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
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 6681c9c..84a74af 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -447,7 +447,10 @@
     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);
     }
 }