aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/SkAdvancedTypefaceMetrics.h1
-rw-r--r--src/pdf/SkPDFFont.cpp6
2 files changed, 5 insertions, 2 deletions
diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h
index 891677e6ba..ea25340580 100644
--- a/src/core/SkAdvancedTypefaceMetrics.h
+++ b/src/core/SkAdvancedTypefaceMetrics.h
@@ -68,7 +68,6 @@ struct SkAdvancedTypefaceMetrics {
int16_t fDescent = 0; // Max depth below baseline (negative).
int16_t fStemV = 0; // Thickness of dominant vertical stem.
int16_t fCapHeight = 0; // Height (from baseline) of top of flat capitals.
- int16_t fXHeight = 0; // Height (from baseline) of the top of lowercase letter x.
SkIRect fBBox = {0, 0, 0, 0}; // The bounding box of all glyphs (in font units).
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));