| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkFontDescriptor_DEFINED | 8 #ifndef SkFontDescriptor_DEFINED |
| 9 #define SkFontDescriptor_DEFINED | 9 #define SkFontDescriptor_DEFINED |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 SkAutoTDelete<SkStreamAsset> fStream; | 45 SkAutoTDelete<SkStreamAsset> fStream; |
| 46 int fIndex; | 46 int fIndex; |
| 47 int fAxisCount; | 47 int fAxisCount; |
| 48 SkAutoSTMalloc<4, SkFixed> fAxis; | 48 SkAutoSTMalloc<4, SkFixed> fAxis; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class SkFontDescriptor : SkNoncopyable { | 51 class SkFontDescriptor : SkNoncopyable { |
| 52 public: | 52 public: |
| 53 SkFontDescriptor(); | 53 SkFontDescriptor(SkTypeface::Style = SkTypeface::kNormal); |
| 54 // Does not affect ownership of SkStream. | 54 // Does not affect ownership of SkStream. |
| 55 static bool Deserialize(SkStream*, SkFontDescriptor* result); | 55 static bool Deserialize(SkStream*, SkFontDescriptor* result); |
| 56 | 56 |
| 57 void serialize(SkWStream*); | 57 void serialize(SkWStream*); |
| 58 | 58 |
| 59 SkFontStyle getStyle() { return fStyle; } | 59 SkTypeface::Style getStyle() { return fStyle; } |
| 60 void setStyle(SkFontStyle style) { fStyle = style; } | 60 void setStyle(SkTypeface::Style style) { fStyle = style; } |
| 61 | 61 |
| 62 const char* getFamilyName() const { return fFamilyName.c_str(); } | 62 const char* getFamilyName() const { return fFamilyName.c_str(); } |
| 63 const char* getFullName() const { return fFullName.c_str(); } | 63 const char* getFullName() const { return fFullName.c_str(); } |
| 64 const char* getPostscriptName() const { return fPostscriptName.c_str(); } | 64 const char* getPostscriptName() const { return fPostscriptName.c_str(); } |
| 65 bool hasFontData() const { return fFontData.get() != nullptr; } | 65 bool hasFontData() const { return fFontData.get() != nullptr; } |
| 66 SkFontData* detachFontData() { return fFontData.release(); } | 66 SkFontData* detachFontData() { return fFontData.release(); } |
| 67 | 67 |
| 68 void setFamilyName(const char* name) { fFamilyName.set(name); } | 68 void setFamilyName(const char* name) { fFamilyName.set(name); } |
| 69 void setFullName(const char* name) { fFullName.set(name); } | 69 void setFullName(const char* name) { fFullName.set(name); } |
| 70 void setPostscriptName(const char* name) { fPostscriptName.set(name); } | 70 void setPostscriptName(const char* name) { fPostscriptName.set(name); } |
| 71 /** Set the font data only if it is necessary for serialization. | 71 /** Set the font data only if it is necessary for serialization. |
| 72 * This method takes ownership of the font data. */ | 72 * This method takes ownership of the font data. */ |
| 73 void setFontData(SkFontData* data) { fFontData.reset(data); } | 73 void setFontData(SkFontData* data) { fFontData.reset(data); } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 SkString fFamilyName; | 76 SkString fFamilyName; |
| 77 SkString fFullName; | 77 SkString fFullName; |
| 78 SkString fPostscriptName; | 78 SkString fPostscriptName; |
| 79 SkAutoTDelete<SkFontData> fFontData; | 79 SkAutoTDelete<SkFontData> fFontData; |
| 80 | 80 |
| 81 SkFontStyle fStyle; | 81 SkTypeface::Style fStyle; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 #endif // SkFontDescriptor_DEFINED | 84 #endif // SkFontDescriptor_DEFINED |
| OLD | NEW |