summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/FontFastPath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/FontFastPath.cpp')
-rw-r--r--WebCore/platform/graphics/FontFastPath.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/WebCore/platform/graphics/FontFastPath.cpp b/WebCore/platform/graphics/FontFastPath.cpp
index deac1b6..b0e39db 100644
--- a/WebCore/platform/graphics/FontFastPath.cpp
+++ b/WebCore/platform/graphics/FontFastPath.cpp
@@ -1,6 +1,7 @@
/**
* Copyright (C) 2003, 2006 Apple Computer, Inc.
* Copyright (C) 2008 Holger Hans Peter Freyther
+ * Copyright (C) 2009 Torch Mobile, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -24,6 +25,7 @@
#include "CharacterNames.h"
#include "FontCache.h"
+#include "FontFallbackList.h"
#include "FloatRect.h"
#include "GlyphBuffer.h"
#include "GlyphPageTreeNode.h"
@@ -57,13 +59,13 @@ GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceSmallCap
unsigned pageNumber = (c / GlyphPage::size);
- GlyphPageTreeNode* node = pageNumber ? m_pages.get(pageNumber) : m_pageZero;
+ GlyphPageTreeNode* node = pageNumber ? m_fontList->m_pages.get(pageNumber) : m_fontList->m_pageZero;
if (!node) {
node = GlyphPageTreeNode::getRootChild(fontDataAt(0), pageNumber);
if (pageNumber)
- m_pages.set(pageNumber, node);
+ m_fontList->m_pages.set(pageNumber, node);
else
- m_pageZero = node;
+ m_fontList->m_pageZero = node;
}
GlyphPage* page;
@@ -82,9 +84,9 @@ GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceSmallCap
// Proceed with the fallback list.
node = node->getChild(fontDataAt(node->level()), pageNumber);
if (pageNumber)
- m_pages.set(pageNumber, node);
+ m_fontList->m_pages.set(pageNumber, node);
else
- m_pageZero = node;
+ m_fontList->m_pageZero = node;
}
} else {
while (true) {
@@ -118,9 +120,9 @@ GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceSmallCap
// Proceed with the fallback list.
node = node->getChild(fontDataAt(node->level()), pageNumber);
if (pageNumber)
- m_pages.set(pageNumber, node);
+ m_fontList->m_pages.set(pageNumber, node);
else
- m_pageZero = node;
+ m_fontList->m_pageZero = node;
}
}
@@ -154,16 +156,33 @@ GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, bool forceSmallCap
GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontData, pageNumber)->page();
GlyphData data = fallbackPage && fallbackPage->fontDataForCharacter(c) ? fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData();
// Cache it so we don't have to do system fallback again next time.
- if (!useSmallCapsFont)
+ if (!useSmallCapsFont) {
+#if PLATFORM(WINCE)
+ // missingGlyphData returns a null character, which is not suitable for GDI to display.
+ // Also, sometimes we cannot map a font for the character on WINCE, but GDI can still
+ // display the character, probably because the font package is not installed correctly.
+ // So we just always set the glyph to be same as the character, and let GDI solve it.
+ page->setGlyphDataForCharacter(c, c, characterFontData);
+ return page->glyphDataForCharacter(c);
+#else
page->setGlyphDataForCharacter(c, data.glyph, data.fontData);
+#endif
+ }
return data;
}
// Even system fallback can fail; use the missing glyph in that case.
// FIXME: It would be nicer to use the missing glyph from the last resort font instead.
GlyphData data = primaryFont()->missingGlyphData();
- if (!useSmallCapsFont)
+ if (!useSmallCapsFont) {
+#if PLATFORM(WINCE)
+ // See comment about WINCE GDI handling near setGlyphDataForCharacter above.
+ page->setGlyphDataForCharacter(c, c, data.fontData);
+ return page->glyphDataForCharacter(c);
+#else
page->setGlyphDataForCharacter(c, data.glyph, data.fontData);
+#endif
+ }
return data;
}