OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkFontMgr_indirect.h" | 8 #include "SkFontMgr_indirect.h" |
9 | 9 |
10 #include "SkDataTable.h" | 10 #include "SkDataTable.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 | 207 |
208 if (entry.fTypeface->weak_expired()) { | 208 if (entry.fTypeface->weak_expired()) { |
209 fDataCache.removeShuffle(i); | 209 fDataCache.removeShuffle(i); |
210 --i; | 210 --i; |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 // No exact match, but did find a data match. | 214 // No exact match, but did find a data match. |
215 if (dataTypeface.get() != NULL) { | 215 if (dataTypeface.get() != NULL) { |
216 SkAutoTDelete<SkStream> stream(dataTypeface->openStream(NULL)); | 216 SkAutoTDelete<SkStreamAsset> stream(dataTypeface->openStream(NULL)); |
217 if (stream.get() != NULL) { | 217 if (stream.get() != NULL) { |
218 return fImpl->createFromStream(stream.detach(), dataTypefaceIndex); | 218 return fImpl->createFromStream(stream.detach(), dataTypefaceIndex); |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 // No data match, request data and add entry. | 222 // No data match, request data and add entry. |
223 SkAutoTDelete<SkStreamAsset> stream(fProxy->getData(id.fDataId)); | 223 SkAutoTDelete<SkStreamAsset> stream(fProxy->getData(id.fDataId)); |
224 if (stream.get() == NULL) { | 224 if (stream.get() == NULL) { |
225 return NULL; | 225 return NULL; |
226 } | 226 } |
(...skipping 28 matching lines...) Expand all Loading... |
255 return this->createTypefaceFromFontId(id); | 255 return this->createTypefaceFromFontId(id); |
256 } | 256 } |
257 | 257 |
258 SkTypeface* SkFontMgr_Indirect::onMatchFaceStyle(const SkTypeface* familyMember, | 258 SkTypeface* SkFontMgr_Indirect::onMatchFaceStyle(const SkTypeface* familyMember, |
259 const SkFontStyle& fontStyle) c
onst { | 259 const SkFontStyle& fontStyle) c
onst { |
260 SkString familyName; | 260 SkString familyName; |
261 familyMember->getFamilyName(&familyName); | 261 familyMember->getFamilyName(&familyName); |
262 return this->matchFamilyStyle(familyName.c_str(), fontStyle); | 262 return this->matchFamilyStyle(familyName.c_str(), fontStyle); |
263 } | 263 } |
264 | 264 |
265 SkTypeface* SkFontMgr_Indirect::onCreateFromStream(SkStream* stream, int ttcInde
x) const { | 265 SkTypeface* SkFontMgr_Indirect::onCreateFromStream(SkStreamAsset* stream, int tt
cIndex) const { |
266 return fImpl->createFromStream(stream, ttcIndex); | 266 return fImpl->createFromStream(stream, ttcIndex); |
267 } | 267 } |
268 | 268 |
269 SkTypeface* SkFontMgr_Indirect::onCreateFromFile(const char path[], int ttcIndex
) const { | 269 SkTypeface* SkFontMgr_Indirect::onCreateFromFile(const char path[], int ttcIndex
) const { |
270 return fImpl->createFromFile(path, ttcIndex); | 270 return fImpl->createFromFile(path, ttcIndex); |
271 } | 271 } |
272 | 272 |
273 SkTypeface* SkFontMgr_Indirect::onCreateFromData(SkData* data, int ttcIndex) con
st { | 273 SkTypeface* SkFontMgr_Indirect::onCreateFromData(SkData* data, int ttcIndex) con
st { |
274 return fImpl->createFromData(data, ttcIndex); | 274 return fImpl->createFromData(data, ttcIndex); |
275 } | 275 } |
(...skipping 14 matching lines...) Expand all Loading... |
290 face.reset(this->matchFamilyStyle(NULL, style)); | 290 face.reset(this->matchFamilyStyle(NULL, style)); |
291 } | 291 } |
292 | 292 |
293 if (NULL == face.get()) { | 293 if (NULL == face.get()) { |
294 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style); | 294 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style); |
295 face.reset(this->createTypefaceFromFontId(fontId)); | 295 face.reset(this->createTypefaceFromFontId(fontId)); |
296 } | 296 } |
297 | 297 |
298 return face.detach(); | 298 return face.detach(); |
299 } | 299 } |
OLD | NEW |