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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 style, SkToBool(elegant), | 399 style, SkToBool(elegant), |
400 SkString(), character); | 400 SkString(), character); |
401 if (matchingTypeface) { | 401 if (matchingTypeface) { |
402 return matchingTypeface.release(); | 402 return matchingTypeface.release(); |
403 } | 403 } |
404 } | 404 } |
405 return nullptr; | 405 return nullptr; |
406 } | 406 } |
407 | 407 |
408 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { | 408 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { |
409 return this->createFromStream(new SkMemoryStream(data), ttcIndex); | 409 return this->createFromStream(new SkMemoryStream(sk_ref_sp(data)), ttcIn
dex); |
410 } | 410 } |
411 | 411 |
412 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ | 412 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override
{ |
413 SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path)); | 413 SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path)); |
414 return stream.get() ? this->createFromStream(stream.release(), ttcIndex)
: nullptr; | 414 return stream.get() ? this->createFromStream(stream.release(), ttcIndex)
: nullptr; |
415 } | 415 } |
416 | 416 |
417 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons
t override { | 417 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons
t override { |
418 SkAutoTDelete<SkStreamAsset> stream(bareStream); | 418 SkAutoTDelete<SkStreamAsset> stream(bareStream); |
419 bool isFixedPitch; | 419 bool isFixedPitch; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; | 539 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; |
540 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, | 540 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, |
541 gSystemFontUseStrings[custom->fSystemFontUse], | 541 gSystemFontUseStrings[custom->fSystemFontUse], |
542 custom->fBasePath, | 542 custom->fBasePath, |
543 custom->fFontsXml, | 543 custom->fFontsXml, |
544 custom->fFallbackFontsXml)); | 544 custom->fFallbackFontsXml)); |
545 } | 545 } |
546 | 546 |
547 return new SkFontMgr_Android(custom); | 547 return new SkFontMgr_Android(custom); |
548 } | 548 } |
OLD | NEW |