Index: src/fonts/SkTestScalerContext.cpp |
diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp |
index fcb65a83c129761940de99b448bc39a818f9046d..09b20ba71b01b7b96e9518d283eb7080e01a71c4 100644 |
--- a/src/fonts/SkTestScalerContext.cpp |
+++ b/src/fonts/SkTestScalerContext.cpp |
@@ -150,7 +150,15 @@ SkAdvancedTypefaceMetrics* SkTestTypeface::onGetAdvancedTypefaceMetrics( |
// pdf only |
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; |
info->fFontName.set(fTestFont->fName); |
- info->fLastGlyphID = SkToU16(onCountGlyphs() - 1); |
+ int glyphCount = this->onCountGlyphs(); |
+ info->fLastGlyphID = SkToU16(glyphCount - 1); |
+ |
+ SkTDArray<SkUnichar>& toUnicode = info->fGlyphToUnicode; |
+ toUnicode.setCount(glyphCount); |
+ SkASSERT(glyphCount == SkToInt(fTestFont->fCharCodesCount)); |
+ for (int gid = 0; gid < glyphCount; ++gid) { |
+ toUnicode[gid] = SkToS32(fTestFont->fCharCodes[gid]); |
+ } |
return info; |
} |