diff options
author | 2017-05-04 10:10:05 -0400 | |
---|---|---|
committer | 2017-05-04 16:57:43 +0000 | |
commit | cef018896e5cad8eb46a536b60cdf79ebe2b0191 (patch) | |
tree | 2085d6071e90287f8dcacc31d801eaa99f35c035 /include | |
parent | ba9028440be7cd651759be3ff517809aad189de3 (diff) |
SkTypeface::getAdvancedMetrics(): cleanup
- SkAdvancedTypefaceMetrics is a struct not a class
- SkTypeface::PerGlyphInfo is gone
- s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g
- s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g
- [on]getAdvancedMetrics now return unique_ptr rather than bare ptr.
- [on]getAdvancedMetrics no longer has parameters. (Only caller always
used same arguments.)
- SkAdvancedTypefaceMetrics uses C++11 in-class member initializers.
- SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt
Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582
Reviewed-on: https://skia-review.googlesource.com/15311
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkTypeface.h | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 3e7f447f9f..2d066d90f2 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -20,12 +20,12 @@ class SkDescriptor; class SkFontData; class SkFontDescriptor; class SkScalerContext; -struct SkScalerContextRec; -struct SkScalerContextEffects; class SkStream; class SkStreamAsset; -class SkAdvancedTypefaceMetrics; class SkWStream; +struct SkAdvancedTypefaceMetrics; +struct SkScalerContextEffects; +struct SkScalerContextRec; typedef uint32_t SkFontID; /** Machine endian. */ @@ -327,14 +327,6 @@ public: } protected: - // The type of advance data wanted. - enum PerGlyphInfo { - kNo_PerGlyphInfo = 0x0, // Don't populate any per glyph info. - kGlyphNames_PerGlyphInfo = 0x1, // Populate glyph names (Type 1 only). - kToUnicode_PerGlyphInfo = 0x2 // Populate ToUnicode table, ignored - // for Type 1 fonts - }; - /** uniqueID must be unique and non-zero */ SkTypeface(const SkFontStyle& style, bool isFixedPitch = false); @@ -351,10 +343,7 @@ protected: virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, const SkDescriptor*) const = 0; virtual void onFilterRec(SkScalerContextRec*) const = 0; - virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( - PerGlyphInfo, - const uint32_t* glyphIDs, - uint32_t glyphIDsCount) const = 0; + virtual std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const = 0; virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0; // TODO: make pure virtual. @@ -396,20 +385,8 @@ private: friend class GrPathRendering; friend class GrGLPathRendering; - /** Retrieve detailed typeface metrics. Used by the PDF backend. - @param perGlyphInfo Indicate what glyph specific information (advances, - names, etc.) should be populated. - @param glyphIDs For per-glyph info, specify subset of the font by - giving glyph ids. Each integer represents a glyph - id. Passing NULL means all glyphs in the font. - @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if - glyphIDs is NULL. - @return The returned object has already been referenced. - */ - SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics( - PerGlyphInfo, - const uint32_t* glyphIDs = NULL, - uint32_t glyphIDsCount = 0) const; + /** Retrieve detailed typeface metrics. Used by the PDF backend. */ + std::unique_ptr<SkAdvancedTypefaceMetrics> getAdvancedMetrics() const; private: SkFontID fUniqueID; @@ -423,9 +400,4 @@ private: typedef SkWeakRefCnt INHERITED; }; - -namespace skstd { -template <> struct is_bitmask_enum<SkTypeface::PerGlyphInfo> : std::true_type {}; -} - #endif |