Chromium Code Reviews| Index: src/core/SkAdvancedTypefaceMetrics.h |
| diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h |
| index 1b490e0199300d6671dd428835900172a9f31a6b..55a27487943eb4b489c507b4efe8a107496991a6 100644 |
| --- a/src/core/SkAdvancedTypefaceMetrics.h |
| +++ b/src/core/SkAdvancedTypefaceMetrics.h |
| @@ -5,16 +5,14 @@ |
| * found in the LICENSE file. |
| */ |
| - |
| #ifndef SkAdvancedTypefaceMetrics_DEFINED |
| #define SkAdvancedTypefaceMetrics_DEFINED |
| +#include "SkEnumOperators.h" |
| #include "SkRect.h" |
| #include "SkRefCnt.h" |
| #include "SkString.h" |
| #include "SkTDArray.h" |
| -#include "SkTemplates.h" |
| -#include "SkSinglyLinkedList.h" |
| /** \class SkAdvancedTypefaceMetrics |
| @@ -22,16 +20,15 @@ |
| embed typefaces. This class is created and filled in with information by |
| SkTypeface::getAdvancedTypefaceMetrics. |
| */ |
| - |
| class SkAdvancedTypefaceMetrics : public SkRefCnt { |
| public: |
| SkAdvancedTypefaceMetrics() |
| : fType(SkAdvancedTypefaceMetrics::kOther_Font) |
| - , fFlags(SkAdvancedTypefaceMetrics::kEmpty_FontFlag) |
| + , fFlags((FontFlags)0) |
| , fLastGlyphID(0) |
| , fEmSize(0) |
| - , fStyle(0) |
| + , fStyle((StyleFlags)0) |
| , fItalicAngle(0) |
| , fAscent(0) |
| , fDescent(0) |
| @@ -43,7 +40,7 @@ public: |
| SkString fFontName; |
| - enum FontType { |
| + enum FontType : uint8_t { |
| kType1_Font, |
| kType1CID_Font, |
| kCFF_Font, |
| @@ -55,29 +52,28 @@ public: |
| // information will never be populated. |
| FontType fType; |
| - enum FontFlags { |
| - kEmpty_FontFlag = 0x0, //!<No flags set |
| - kMultiMaster_FontFlag = 0x1, //!<May be true for Type1, CFF, or TrueType fonts. |
| - kNotEmbeddable_FontFlag = 0x2, //!<May not be embedded. |
| - kNotSubsettable_FontFlag = 0x4, //!<May not be subset. |
| + enum FontFlags : uint8_t { |
| + kMultiMaster_FontFlag = 0x01, //!<May be true for Type1, CFF, or TrueType fonts. |
| + kNotEmbeddable_FontFlag = 0x02, //!<May not be embedded. |
| + kNotSubsettable_FontFlag = 0x04, //!<May not be subset. |
| }; |
| - // Global font flags. |
| - FontFlags fFlags; |
| + FontFlags fFlags; // Global font flags. |
| uint16_t fLastGlyphID; // The last valid glyph ID in the font. |
| uint16_t fEmSize; // The size of the em box (defines font units). |
| // These enum values match the values used in the PDF file format. |
| - enum StyleFlags { |
| - kFixedPitch_Style = 0x00001, |
| - kSerif_Style = 0x00002, |
| - kScript_Style = 0x00008, |
| - kItalic_Style = 0x00040, |
| - kAllCaps_Style = 0x10000, |
| - kSmallCaps_Style = 0x20000, |
| - kForceBold_Style = 0x40000 |
| + enum StyleFlags : uint32_t { |
| + kFixedPitch_Style = 0x00000001, |
| + kSerif_Style = 0x00000002, |
| + kScript_Style = 0x00000008, |
| + kItalic_Style = 0x00000040, |
| + kAllCaps_Style = 0x00010000, |
| + kSmallCaps_Style = 0x00020000, |
| + kForceBold_Style = 0x00040000 |
| }; |
| - uint16_t fStyle; // Font style characteristics. |
| + StyleFlags fStyle; // Font style characteristics. |
| + |
| int16_t fItalicAngle; // Counterclockwise degrees from vertical of the |
| // dominant vertical stroke for an Italic face. |
| // The following fields are all in font units. |
| @@ -99,5 +95,11 @@ private: |
| typedef SkRefCnt INHERITED; |
| }; |
| +namespace skstd { |
| +template <> struct is_bitmask_enum<SkAdvancedTypefaceMetrics::FontFlags> : |
| +std::true_type {}; |
|
bungeman-skia
2016/08/15 21:41:36
nit: it shouldn't be necessary to put this on the
hal.canary
2016/08/16 01:27:38
Done.
|
| +template <> struct is_bitmask_enum<SkAdvancedTypefaceMetrics::StyleFlags> : |
| +std::true_type {}; |
| +} |
| #endif |