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 /tools/fonts/SkTestTypeface.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 'tools/fonts/SkTestTypeface.cpp')
-rw-r--r-- | tools/fonts/SkTestTypeface.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/fonts/SkTestTypeface.cpp b/tools/fonts/SkTestTypeface.cpp index d7caa5a392..bf3a1a3e9e 100644 --- a/tools/fonts/SkTestTypeface.cpp +++ b/tools/fonts/SkTestTypeface.cpp @@ -119,17 +119,16 @@ void SkTestTypeface::onFilterRec(SkScalerContextRec* rec) const { rec->setHinting(SkPaint::kNo_Hinting); } +void SkTestTypeface::getGlyphToUnicodeMap(SkUnichar* glyphToUnicode) const { + unsigned glyphCount = fTestFont->fCharCodesCount; + for (unsigned gid = 0; gid < glyphCount; ++gid) { + glyphToUnicode[gid] = SkTo<SkUnichar>(fTestFont->fCharCodes[gid]); + } +} + std::unique_ptr<SkAdvancedTypefaceMetrics> SkTestTypeface::onGetAdvancedMetrics() const { // pdf only std::unique_ptr<SkAdvancedTypefaceMetrics> info(new SkAdvancedTypefaceMetrics); info->fFontName.set(fTestFont->fName); - int glyphCount = this->onCountGlyphs(); - - 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; } |