Index: Source/platform/fonts/skia/SimpleFontDataSkia.cpp |
diff --git a/Source/platform/fonts/skia/SimpleFontDataSkia.cpp b/Source/platform/fonts/skia/SimpleFontDataSkia.cpp |
index e312531f4b8e091857fc5851d74779f086d8e51c..f5a9f95e9832cea118e4a4b9e4965c7bf56a36aa 100644 |
--- a/Source/platform/fonts/skia/SimpleFontDataSkia.cpp |
+++ b/Source/platform/fonts/skia/SimpleFontDataSkia.cpp |
@@ -36,7 +36,9 @@ |
#include "SkPath.h" |
#include "SkTypeface.h" |
#include "SkTypes.h" |
+#include "SkUtils.h" |
#include "platform/fonts/FontDescription.h" |
+#include "platform/fonts/GlyphPage.h" |
#include "platform/fonts/VDMXParser.h" |
#include "platform/geometry/FloatRect.h" |
#include "wtf/unicode/Unicode.h" |
@@ -278,4 +280,26 @@ bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters |
} |
#endif |
+bool SimpleFontData::fillGlyphPage(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength) const |
+{ |
+ if (SkUTF16_IsHighSurrogate(buffer[bufferLength-1])) { |
+ SkDebugf("%s last char is high-surrogate", __FUNCTION__); |
+ return false; |
+ } |
+ |
+ SkAutoSTMalloc<GlyphPage::size, uint16_t> glyphStorage(length); |
+ |
+ uint16_t* glyphs = glyphStorage.get(); |
+ SkTypeface* typeface = platformData().typeface(); |
+ typeface->charsToGlyphs(buffer, SkTypeface::kUTF16_Encoding, glyphs, length); |
+ |
+ unsigned allGlyphs = 0; // track if any of the glyphIDs are non-zero |
+ for (unsigned i = 0; i < length; i++) { |
+ pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], glyphs[i] ? this : 0); |
+ allGlyphs |= glyphs[i]; |
+ } |
+ |
+ return allGlyphs; |
+} |
+ |
} // namespace WebCore |