aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-09-13 08:08:38 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-13 08:08:38 -0700
commit5f1d0f61ea182829826d9d76cb85346d3e23305d (patch)
tree69e720980b78a12b26593c6dc0536c21b885486a /src/ports
parent5718b2df4c4fbe61b437ed74a427cbb5e3e17118 (diff)
SkPDF: SkTypeface_FreeType ToUnicode table improvement.
Currently the SkTypeface_FreeType::onGetAdvancedTypefaceMetrics synthesized glyph to Unicode mapping returns the Unicode point of the last character to map to the glyph. In practice it is better to guess the first character to map to the glyph instead. BUG=359065 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2329953003 Review-Url: https://codereview.chromium.org/2329953003
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkFontHost_FreeType.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 6681c9c1ef..84a74af469 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -447,7 +447,10 @@ static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyph
SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
while (glyphIndex) {
SkASSERT(glyphIndex < SkToUInt(numGlyphs));
- (*glyphToUnicode)[glyphIndex] = charCode;
+ // Use the first character that maps to this glyphID. https://crbug.com/359065
+ if (0 == (*glyphToUnicode)[glyphIndex]) {
+ (*glyphToUnicode)[glyphIndex] = charCode;
+ }
charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
}
}