diff options
author | Hal Canary <halcanary@google.com> | 2018-04-02 15:53:24 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-05 14:48:52 +0000 |
commit | 0ad685a170112b0c775442280d067af36458153e (patch) | |
tree | 7497aae1c32892b04ad4d511f172d8b9a659da7d /src/pdf | |
parent | 8caf85f9f40f6bad38bf66bd02b87dcebe139a5c (diff) |
SkPDF: implement xheight for type3 fonts
Change-Id: Ib8e5424e31003798ea141e958a74aa8110ee52c7
Reviewed-on: https://skia-review.googlesource.com/117860
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/pdf')
-rw-r--r-- | src/pdf/SkPDFFont.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp index ff3b84cf75..c9230f017b 100644 --- a/src/pdf/SkPDFFont.cpp +++ b/src/pdf/SkPDFFont.cpp @@ -629,6 +629,7 @@ static void add_type3_font_info(SkPDFCanon* canon, } int unitsPerEm; auto cache = SkPDFFont::MakeVectorCache(typeface, &unitsPerEm); + SkASSERT(cache); SkScalar emSize = (SkScalar)unitsPerEm; font->insertName("Subtype", "Type3"); // Flip about the x-axis and scale by 1/emSize. @@ -727,8 +728,11 @@ static void add_type3_font_info(SkPDFCanon* canon, // Adobe requests CapHeight, XHeight, and StemV be added // to "greatly help our workflow downstream". if (metrics->fCapHeight != 0) { descriptor->insertInt("CapHeight", metrics->fCapHeight); } - if (metrics->fXHeight != 0) { descriptor->insertInt("XHeight", metrics->fXHeight); } if (metrics->fStemV != 0) { descriptor->insertInt("StemV", metrics->fStemV); } + SkScalar xHeight = cache->getFontMetrics().fXHeight; + if (xHeight != 0) { + descriptor->insertScalar("XHeight", xHeight); + } } descriptor->insertInt("Flags", fontDescriptorFlags); font->insertObjRef("FontDescriptor", std::move(descriptor)); |