diff options
author | 2017-11-09 16:16:09 -0500 | |
---|---|---|
committer | 2017-11-10 14:21:17 +0000 | |
commit | a865d25519b0805697c5809288dd2fb3f642c17d (patch) | |
tree | 6e603d755fb3a0dcf26ffe305373645f118170aa /src/ports | |
parent | 193de5d7ea81ad4a3cf5bd9e0bf7f50069368d27 (diff) |
Windows GDI Typeface: set NotEmbeddable_FontFlag same as other backends.
Also fix a typo.
Change-Id: I1a94cd961887ef7f55a9bfd27def6b1675ec4952
Reviewed-on: https://skia-review.googlesource.com/69700
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontHost_mac.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontHost_win.cpp | 20 | ||||
-rw-r--r-- | src/ports/SkTypeface_win_dw.cpp | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 5e753aebcf..ae46664ff6 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -1521,7 +1521,7 @@ std::unique_ptr<SkAdvancedTypefaceMetrics> SkTypeface_Mac::onGetAdvancedMetrics( offsetof(SkOTTableOS2_V4, fsType), sizeof(fsType), &fsType)) { - SkOTUtils::SetAdvanvedTypefaceFlags(fsType, info.get()); + SkOTUtils::SetAdvancedTypefaceFlags(fsType, info.get()); } // If it's not a truetype font, mark it as 'other'. Assume that TrueType diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 3cf42fd39e..9094d7e2a4 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -20,6 +20,7 @@ #include "SkMaskGamma.h" #include "SkMatrix22.h" #include "SkOnce.h" +#include "SkOTTable_OS_2.h" #include "SkOTTable_maxp.h" #include "SkOTTable_name.h" #include "SkOTUtils.h" @@ -1733,11 +1734,20 @@ std::unique_ptr<SkAdvancedTypefaceMetrics> LogFontTypeface::onGetAdvancedMetrics info.reset(new SkAdvancedTypefaceMetrics); tchar_to_skstring(lf.lfFaceName, &info->fFontName); - // If bit 1 is set, the font may not be embedded in a document. - // If bit 1 is clear, the font can be embedded. - // If bit 2 is set, the embedding is read-only. - if (otm.otmfsType & 0x1) { - info->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag; + + SkOTTableOS2_V4::Type fsType; + if (sizeof(fsType) == this->getTableData(SkTEndian_SwapBE32(SkOTTableOS2::TAG), + offsetof(SkOTTableOS2_V4, fsType), + sizeof(fsType), + &fsType)) { + SkOTUtils::SetAdvancedTypefaceFlags(fsType, info.get()); + } else { + // If bit 1 is set, the font may not be embedded in a document. + // If bit 1 is clear, the font can be embedded. + // If bit 2 is set, the embedding is read-only. + if (otm.otmfsType & 0x1) { + info->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag; + } } populate_glyph_to_unicode(hdc, glyphCount, &(info->fGlyphToUnicode)); diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp index 3dcaa921c2..bec151ee3f 100644 --- a/src/ports/SkTypeface_win_dw.cpp +++ b/src/ports/SkTypeface_win_dw.cpp @@ -372,7 +372,7 @@ std::unique_ptr<SkAdvancedTypefaceMetrics> DWriteFontTypeface::onGetAdvancedMetr return info; } - SkOTUtils::SetAdvanvedTypefaceFlags(os2Table->version.v4.fsType, info.get()); + SkOTUtils::SetAdvancedTypefaceFlags(os2Table->version.v4.fsType, info.get()); // There are versions of DirectWrite which support named instances for system variation fonts, // but no means to indicate that such a typeface is a variation. |