Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: src/ports/SkFontMgr_android.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/svg/SkSVGDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 return nullptr; 364 return nullptr;
365 } 365 }
366 366
367 static SkTypeface_AndroidSystem* find_family_style_character( 367 static SkTypeface_AndroidSystem* find_family_style_character(
368 const SkTDArray<NameToFamily>& fallbackNameToFamilyMap, 368 const SkTDArray<NameToFamily>& fallbackNameToFamilyMap,
369 const SkFontStyle& style, bool elegant, 369 const SkFontStyle& style, bool elegant,
370 const SkString& langTag, SkUnichar character) 370 const SkString& langTag, SkUnichar character)
371 { 371 {
372 for (int i = 0; i < fallbackNameToFamilyMap.count(); ++i) { 372 for (int i = 0; i < fallbackNameToFamilyMap.count(); ++i) {
373 SkFontStyleSet_Android* family = fallbackNameToFamilyMap[i].styleSet ; 373 SkFontStyleSet_Android* family = fallbackNameToFamilyMap[i].styleSet ;
374 SkAutoTUnref<SkTypeface_AndroidSystem> face(family->matchStyle(style )); 374 sk_sp<SkTypeface_AndroidSystem> face(family->matchStyle(style));
375 375
376 if (!langTag.isEmpty() && !face->fLang.getTag().startsWith(langTag.c _str())) { 376 if (!langTag.isEmpty() && !face->fLang.getTag().startsWith(langTag.c _str())) {
377 continue; 377 continue;
378 } 378 }
379 379
380 if (SkToBool(face->fVariantStyle & kElegant_FontVariant) != elegant) { 380 if (SkToBool(face->fVariantStyle & kElegant_FontVariant) != elegant) {
381 continue; 381 continue;
382 } 382 }
383 383
384 SkPaint paint; 384 SkPaint paint;
385 paint.setTypeface(face); 385 paint.setTypeface(face);
386 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); 386 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);
387 387
388 uint16_t glyphID; 388 uint16_t glyphID;
389 paint.textToGlyphs(&character, sizeof(character), &glyphID); 389 paint.textToGlyphs(&character, sizeof(character), &glyphID);
390 if (glyphID != 0) {
bungeman-skia 2016/05/12 16:47:41 How did this sneak in here? Without this test this
391 return face.release();
392 }
393 } 390 }
394 return nullptr; 391 return nullptr;
395 } 392 }
396 393
397 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], 394 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
398 const SkFontStyle& style, 395 const SkFontStyle& style,
399 const char* bcp47[], 396 const char* bcp47[],
400 int bcp47Count, 397 int bcp47Count,
401 SkUnichar character) const o verride 398 SkUnichar character) const o verride
402 { 399 {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ; 575 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ;
579 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" , 576 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" ,
580 gSystemFontUseStrings[custom->fSystemFontUse], 577 gSystemFontUseStrings[custom->fSystemFontUse],
581 custom->fBasePath, 578 custom->fBasePath,
582 custom->fFontsXml, 579 custom->fFontsXml,
583 custom->fFallbackFontsXml)); 580 custom->fFallbackFontsXml));
584 } 581 }
585 582
586 return new SkFontMgr_Android(custom); 583 return new SkFontMgr_Android(custom);
587 } 584 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/svg/SkSVGDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698