OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkFontDescriptor.h" | |
8 #include "SkFontMgr.h" | 9 #include "SkFontMgr.h" |
9 #include "SkLazyPtr.h" | 10 #include "SkLazyPtr.h" |
10 #include "SkStream.h" | 11 #include "SkStream.h" |
11 #include "SkTypes.h" | 12 #include "SkTypes.h" |
12 | 13 |
13 class SkFontStyle; | 14 class SkFontStyle; |
14 class SkTypeface; | 15 class SkTypeface; |
15 | 16 |
16 class SkEmptyFontStyleSet : public SkFontStyleSet { | 17 class SkEmptyFontStyleSet : public SkFontStyleSet { |
17 public: | 18 public: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 return this->onCreateFromData(data, ttcIndex); | 127 return this->onCreateFromData(data, ttcIndex); |
127 } | 128 } |
128 | 129 |
129 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con st { | 130 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, int ttcIndex) con st { |
130 if (NULL == stream) { | 131 if (NULL == stream) { |
131 return NULL; | 132 return NULL; |
132 } | 133 } |
133 return this->onCreateFromStream(stream, ttcIndex); | 134 return this->onCreateFromStream(stream, ttcIndex); |
134 } | 135 } |
135 | 136 |
137 SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, const SkFontParam eters& params) const { | |
138 if (NULL == stream) { | |
139 return NULL; | |
140 } | |
141 return this->onCreateFromStream(stream, params); | |
142 } | |
143 | |
144 SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const SkFontPar ameters& params) const { | |
bungeman-skia
2015/03/23 21:59:05
These are just the base 'default' shims to keep ex
| |
145 return this->onCreateFromStream(stream, params.fIndex); | |
146 } | |
147 | |
136 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { | 148 SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const { |
137 if (NULL == path) { | 149 if (NULL == path) { |
138 return NULL; | 150 return NULL; |
139 } | 151 } |
140 return this->onCreateFromFile(path, ttcIndex); | 152 return this->onCreateFromFile(path, ttcIndex); |
141 } | 153 } |
142 | 154 |
143 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], | 155 SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], |
144 unsigned styleBits) const { | 156 unsigned styleBits) const { |
145 return this->onLegacyCreateTypeface(familyName, styleBits); | 157 return this->onLegacyCreateTypeface(familyName, styleBits); |
146 } | 158 } |
147 | 159 |
148 // As a template argument this must have external linkage. | 160 // As a template argument this must have external linkage. |
149 SkFontMgr* sk_fontmgr_create_default() { | 161 SkFontMgr* sk_fontmgr_create_default() { |
150 SkFontMgr* fm = SkFontMgr::Factory(); | 162 SkFontMgr* fm = SkFontMgr::Factory(); |
151 return fm ? fm : SkNEW(SkEmptyFontMgr); | 163 return fm ? fm : SkNEW(SkEmptyFontMgr); |
152 } | 164 } |
153 | 165 |
154 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default); | 166 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default); |
155 | 167 |
156 SkFontMgr* SkFontMgr::RefDefault() { | 168 SkFontMgr* SkFontMgr::RefDefault() { |
157 return SkRef(singleton.get()); | 169 return SkRef(singleton.get()); |
158 } | 170 } |
OLD | NEW |