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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 SkTypeface::Style getStyle() { return fStyle; } | 23 SkTypeface::Style getStyle() { return fStyle; } |
24 void setStyle(SkTypeface::Style style) { fStyle = style; } | 24 void setStyle(SkTypeface::Style style) { fStyle = style; } |
25 | 25 |
26 const char* getFamilyName() const { return fFamilyName.c_str(); } | 26 const char* getFamilyName() const { return fFamilyName.c_str(); } |
27 const char* getFullName() const { return fFullName.c_str(); } | 27 const char* getFullName() const { return fFullName.c_str(); } |
28 const char* getPostscriptName() const { return fPostscriptName.c_str(); } | 28 const char* getPostscriptName() const { return fPostscriptName.c_str(); } |
29 const char* getFontFileName() const { return fFontFileName.c_str(); } | 29 const char* getFontFileName() const { return fFontFileName.c_str(); } |
30 bool hasFontData() const { return fFontData.get() != NULL; } | 30 bool hasFontData() const { return fFontData.get() != NULL; } |
31 // Transfers ownership to the caller. | 31 // Transfers ownership to the caller. |
32 SkStream* transferFontData() { return fFontData.detach(); } | 32 SkStreamAsset* transferFontData() { return fFontData.detach(); } |
33 int getFontIndex() const { return fFontIndex; } | 33 int getFontIndex() const { return fFontIndex; } |
34 | 34 |
35 void setFamilyName(const char* name) { fFamilyName.set(name); } | 35 void setFamilyName(const char* name) { fFamilyName.set(name); } |
36 void setFullName(const char* name) { fFullName.set(name); } | 36 void setFullName(const char* name) { fFullName.set(name); } |
37 void setPostscriptName(const char* name) { fPostscriptName.set(name); } | 37 void setPostscriptName(const char* name) { fPostscriptName.set(name); } |
38 void setFontFileName(const char* name) { fFontFileName.set(name); } | 38 void setFontFileName(const char* name) { fFontFileName.set(name); } |
39 /** Set the font data only if it is necessary for serialization. | 39 /** Set the font data only if it is necessary for serialization. |
40 * This method takes ownership of the stream (both reference and cursor). | 40 * This method takes ownership of the stream (both reference and cursor). |
41 */ | 41 */ |
42 void setFontData(SkStream* stream) { fFontData.reset(stream); } | 42 void setFontData(SkStreamAsset* stream) { fFontData.reset(stream); } |
43 void setFontIndex(int index) { fFontIndex = index; } | 43 void setFontIndex(int index) { fFontIndex = index; } |
44 | 44 |
45 private: | 45 private: |
46 SkString fFamilyName; | 46 SkString fFamilyName; |
47 SkString fFullName; | 47 SkString fFullName; |
48 SkString fPostscriptName; | 48 SkString fPostscriptName; |
49 SkString fFontFileName; | 49 SkString fFontFileName; |
50 SkAutoTDelete<SkStream> fFontData; | 50 SkAutoTDelete<SkStreamAsset> fFontData; |
51 int fFontIndex; | 51 int fFontIndex; |
52 | 52 |
53 SkTypeface::Style fStyle; | 53 SkTypeface::Style fStyle; |
54 }; | 54 }; |
55 | 55 |
56 #endif // SkFontDescriptor_DEFINED | 56 #endif // SkFontDescriptor_DEFINED |
OLD | NEW |