OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkFontConfigInterface.h" | 8 #include "SkFontConfigInterface.h" |
9 #include "SkFontHost_FreeType_common.h" | 9 #include "SkFontHost_FreeType_common.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 const SkFontConfigInterface::FontIdentity& getIdentity() const { | 32 const SkFontConfigInterface::FontIdentity& getIdentity() const { |
33 return fIdentity; | 33 return fIdentity; |
34 } | 34 } |
35 | 35 |
36 SkStreamAsset* getLocalStream() const { return fLocalStream.get(); } | 36 SkStreamAsset* getLocalStream() const { return fLocalStream.get(); } |
37 | 37 |
38 bool isFamilyName(const char* name) const { | 38 bool isFamilyName(const char* name) const { |
39 return fFamilyName.equals(name); | 39 return fFamilyName.equals(name); |
40 } | 40 } |
41 | 41 |
42 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE | |
43 static SkTypeface* LegacyCreateTypeface(const char familyName[], SkTypeface:
:Style); | |
44 #else | |
45 static SkTypeface* LegacyCreateTypeface(const char familyName[], SkFontStyle
); | 42 static SkTypeface* LegacyCreateTypeface(const char familyName[], SkFontStyle
); |
46 #endif | |
47 | 43 |
48 protected: | 44 protected: |
49 FontConfigTypeface(const SkFontStyle& style, | 45 FontConfigTypeface(const SkFontStyle& style, |
50 const SkFontConfigInterface::FontIdentity& fi, | 46 const SkFontConfigInterface::FontIdentity& fi, |
51 const SkString& familyName) | 47 const SkString& familyName) |
52 : INHERITED(style, SkTypefaceCache::NewFontID(), false) | 48 : INHERITED(style, SkTypefaceCache::NewFontID(), false) |
53 , fIdentity(fi) | 49 , fIdentity(fi) |
54 , fFamilyName(familyName) | 50 , fFamilyName(familyName) |
55 , fLocalStream(nullptr) {} | 51 , fLocalStream(nullptr) {} |
56 | 52 |
57 FontConfigTypeface(const SkFontStyle& style, bool fixedWidth, SkStreamAsset*
localStream) | 53 FontConfigTypeface(const SkFontStyle& style, bool fixedWidth, SkStreamAsset*
localStream) |
58 : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) | 54 : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) |
59 , fLocalStream(localStream) { | 55 , fLocalStream(localStream) { |
60 // we default to empty fFamilyName and fIdentity | 56 // we default to empty fFamilyName and fIdentity |
61 } | 57 } |
62 | 58 |
63 void onGetFamilyName(SkString* familyName) const override; | 59 void onGetFamilyName(SkString* familyName) const override; |
64 void onGetFontDescriptor(SkFontDescriptor*, bool*) const override; | 60 void onGetFontDescriptor(SkFontDescriptor*, bool*) const override; |
65 SkStreamAsset* onOpenStream(int* ttcIndex) const override; | 61 SkStreamAsset* onOpenStream(int* ttcIndex) const override; |
66 | 62 |
67 private: | 63 private: |
68 typedef SkTypeface_FreeType INHERITED; | 64 typedef SkTypeface_FreeType INHERITED; |
69 }; | 65 }; |
OLD | NEW |