| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 SkAutoTDelete<SkStreamAsset> fStream; | 44 SkAutoTDelete<SkStreamAsset> fStream; |
| 45 int fIndex; | 45 int fIndex; |
| 46 int fAxisCount; | 46 int fAxisCount; |
| 47 SkAutoSTMalloc<4, SkFixed> fAxis; | 47 SkAutoSTMalloc<4, SkFixed> fAxis; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class SkFontDescriptor : SkNoncopyable { | 50 class SkFontDescriptor : SkNoncopyable { |
| 51 public: | 51 public: |
| 52 SkFontDescriptor(SkTypeface::Style = SkTypeface::kNormal); | 52 SkFontDescriptor(SkTypeface::Style = SkTypeface::kNormal); |
| 53 // Does not affect ownership of SkStream. | 53 // Does not affect ownership of SkStream. |
| 54 SkFontDescriptor(SkStream*); | 54 static bool Deserialize(SkStream*, SkFontDescriptor* result); |
| 55 | 55 |
| 56 void serialize(SkWStream*); | 56 void serialize(SkWStream*); |
| 57 | 57 |
| 58 SkTypeface::Style getStyle() { return fStyle; } | 58 SkTypeface::Style getStyle() { return fStyle; } |
| 59 void setStyle(SkTypeface::Style style) { fStyle = style; } | 59 void setStyle(SkTypeface::Style style) { fStyle = style; } |
| 60 | 60 |
| 61 const char* getFamilyName() const { return fFamilyName.c_str(); } | 61 const char* getFamilyName() const { return fFamilyName.c_str(); } |
| 62 const char* getFullName() const { return fFullName.c_str(); } | 62 const char* getFullName() const { return fFullName.c_str(); } |
| 63 const char* getPostscriptName() const { return fPostscriptName.c_str(); } | 63 const char* getPostscriptName() const { return fPostscriptName.c_str(); } |
| 64 bool hasFontData() const { return fFontData.get() != nullptr; } | 64 bool hasFontData() const { return fFontData.get() != nullptr; } |
| 65 SkFontData* detachFontData() { return fFontData.detach(); } | 65 SkFontData* detachFontData() { return fFontData.detach(); } |
| 66 | 66 |
| 67 void setFamilyName(const char* name) { fFamilyName.set(name); } | 67 void setFamilyName(const char* name) { fFamilyName.set(name); } |
| 68 void setFullName(const char* name) { fFullName.set(name); } | 68 void setFullName(const char* name) { fFullName.set(name); } |
| 69 void setPostscriptName(const char* name) { fPostscriptName.set(name); } | 69 void setPostscriptName(const char* name) { fPostscriptName.set(name); } |
| 70 /** Set the font data only if it is necessary for serialization. | 70 /** Set the font data only if it is necessary for serialization. |
| 71 * This method takes ownership of the font data. */ | 71 * This method takes ownership of the font data. */ |
| 72 void setFontData(SkFontData* data) { fFontData.reset(data); } | 72 void setFontData(SkFontData* data) { fFontData.reset(data); } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 SkString fFamilyName; | 75 SkString fFamilyName; |
| 76 SkString fFullName; | 76 SkString fFullName; |
| 77 SkString fPostscriptName; | 77 SkString fPostscriptName; |
| 78 SkAutoTDelete<SkFontData> fFontData; | 78 SkAutoTDelete<SkFontData> fFontData; |
| 79 | 79 |
| 80 SkTypeface::Style fStyle; | 80 SkTypeface::Style fStyle; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 #endif // SkFontDescriptor_DEFINED | 83 #endif // SkFontDescriptor_DEFINED |
| OLD | NEW |