diff options
author | Hal Canary <halcanary@google.com> | 2018-05-09 11:50:34 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-09 18:00:35 +0000 |
commit | 46cc3dabaff7daa6b57e3c33997153d986219579 (patch) | |
tree | 809ca0d62fddcbd3b378d0a4d330692ebd58748d /src/pdf/SkPDFDevice.cpp | |
parent | 06d374694a515d064a26e6c5391bce9a0c5c8aa0 (diff) |
Revert "Revert "SkAdvancedTypefaceMetrics: factor out GlyphToUnicode""
This reverts commit 97c1108607584b6050a6880d6ce22846e4913a92.
Change-Id: Ic3c6addc64ced39766bbee3e10b4d88faf61ba2f
Reviewed-on: https://skia-review.googlesource.com/127021
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 6e36fb3d82..c18219ab0d 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -1052,8 +1052,8 @@ private: }; } // namespace -static SkUnichar map_glyph(const SkTDArray<SkUnichar>& glyphToUnicode, SkGlyphID glyph) { - return SkToInt(glyph) < glyphToUnicode.count() ? glyphToUnicode[SkToInt(glyph)] : -1; +static SkUnichar map_glyph(const std::vector<SkUnichar>& glyphToUnicode, SkGlyphID glyph) { + return glyph < glyphToUnicode.size() ? glyphToUnicode[SkToInt(glyph)] : -1; } static void update_font(SkWStream* wStream, int fontIndex, SkScalar textSize) { @@ -1200,6 +1200,9 @@ void SkPDFDevice::internalDrawText( if (!metrics) { return; } + const std::vector<SkUnichar>& glyphToUnicode = SkPDFFont::GetUnicodeMap( + typeface, fDocument->canon()); + SkClusterator clusterator(sourceText, sourceByteCount, paint, clusters, textByteLength, utf8Text); const SkGlyphID* glyphs = clusterator.glyphs(); @@ -1244,7 +1247,6 @@ void SkPDFDevice::internalDrawText( return; } SkDynamicMemoryWStream* out = content.stream(); - const SkTDArray<SkUnichar>& glyphToUnicode = metrics->fGlyphToUnicode; out->writeText("BT\n"); SK_AT_SCOPE_EXIT(out->writeText("ET\n")); |