diff options
author | halcanary <halcanary@google.com> | 2016-08-16 09:36:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-16 09:36:23 -0700 |
commit | 3287588a467ee579c3947fe13c6add5048b14aa9 (patch) | |
tree | ce5c0591a097af58fdcc8c3c0d068b483143f19f /src/ports | |
parent | 883c8efae702462fa28e7ce4f17199bbfa1ce360 (diff) |
SkPDF: SkPDFFont class changes
SkPDFFont:
* inline some one-line methdods.
- SkPDFFont::typeface()
- SkPDFFont::fontInfo()
- SkPDFFont::firstGlyphID()
- SkPDFFont::lastGlyphID()
- SkPDFFont::getFontDescriptor()
* de-virtualize some methods:
- SkPDFFont::getType()
- SkPDFFont::multiByteGlyphs()
* Constructor takes more arguments:
fontType, multiByteGlyphs
* re-order fields (pointers before shorts)
* use sk_sp<T> more, T* less
SkAdvancedTypefaceMetrics:
* SkAdvancedTypefaceMetrics::fFont now a uint8_t
* other enumes are sized.
* SkAdvancedTypefaceMetrics::fStyle now big enough.
* remove use of SkTBitOr, replaced with fancy templates
No public API changes.
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2246903002
Review-Url: https://codereview.chromium.org/2246903002
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 15 | ||||
-rw-r--r-- | src/ports/SkFontHost_win.cpp | 4 |
2 files changed, 6 insertions, 13 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 5c3034162d..6681c9c1ef 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -464,20 +464,15 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics( SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; info->fFontName.set(FT_Get_Postscript_Name(face)); - info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag; + if (FT_HAS_MULTIPLE_MASTERS(face)) { - info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( - info->fFlags, SkAdvancedTypefaceMetrics::kMultiMaster_FontFlag); + info->fFlags |= SkAdvancedTypefaceMetrics::kMultiMaster_FontFlag; } if (!canEmbed(face)) { - info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( - info->fFlags, - SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag); + info->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag; } if (!canSubset(face)) { - info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( - info->fFlags, - SkAdvancedTypefaceMetrics::kNotSubsettable_FontFlag); + info->fFlags |= SkAdvancedTypefaceMetrics::kNotSubsettable_FontFlag; } info->fLastGlyphID = face->num_glyphs - 1; info->fEmSize = 1000; @@ -499,7 +494,7 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics( info->fType = SkAdvancedTypefaceMetrics::kOther_Font; } - info->fStyle = 0; + info->fStyle = (SkAdvancedTypefaceMetrics::StyleFlags)0; if (FT_IS_FIXED_WIDTH(face)) { info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style; } diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index a2d9da7a39..45e76c797d 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -1761,9 +1761,7 @@ SkAdvancedTypefaceMetrics* LogFontTypeface::onGetAdvancedTypefaceMetrics( // 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 = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( - info->fFlags, - SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag); + info->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag; } if (perGlyphInfo & kToUnicode_PerGlyphInfo) { |