aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontHost_mac.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2017-03-02 13:31:16 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-02 20:08:20 +0000
commitc66390560ed845dbaf8656615f6a9524da643fa4 (patch)
treea2591d3a0429a9bd5f03707b27bfcb22c03cc7e4 /src/ports/SkFontHost_mac.cpp
parente646afb49ede5cb4e8c46101ed31ffb8f38395f1 (diff)
Tell PDF on Mac when a font is a variation font.
PDF needs to know when a font is a variation font so that it knows it cannot just embed the typeface. BUG=chromium:697916 Change-Id: I85091e444a235545f0f63fe131729c107bb664a0 Reviewed-on: https://skia-review.googlesource.com/9158 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/ports/SkFontHost_mac.cpp')
-rw-r--r--src/ports/SkFontHost_mac.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index b5022d9af9..21017e114c 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -1488,6 +1488,18 @@ SkAdvancedTypefaceMetrics* SkTypeface_Mac::onGetAdvancedTypefaceMetrics(
}
}
+ // In 10.10 and earlier, CTFontCopyVariationAxes and CTFontCopyVariation do not work when
+ // applied to fonts which started life with CGFontCreateWithDataProvider (they simply always
+ // return nullptr). As a result, we are limited to CGFontCopyVariationAxes and
+ // CGFontCopyVariations here until support for 10.10 and earlier is removed.
+ UniqueCFRef<CGFontRef> cgFont(CTFontCopyGraphicsFont(ctFont.get(), nullptr));
+ if (cgFont) {
+ UniqueCFRef<CFArrayRef> cgAxes(CGFontCopyVariationAxes(cgFont.get()));
+ if (cgAxes && CFArrayGetCount(cgAxes.get()) > 0) {
+ info->fFlags |= SkAdvancedTypefaceMetrics::kMultiMaster_FontFlag;
+ }
+ }
+
CFIndex glyphCount = CTFontGetGlyphCount(ctFont.get());
info->fLastGlyphID = SkToU16(glyphCount - 1);
info->fEmSize = CTFontGetUnitsPerEm(ctFont.get());