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

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

Issue 1974783002: Revert of Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 sk_sp<SkTypeface_AndroidSystem> face(family->matchStyle(style)); 374 SkAutoTUnref<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);
tomhudson 2016/05/12 13:29:39 Looks like we accidentally omitted the return stat
390 if (glyphID != 0) {
391 return face.release();
392 }
390 } 393 }
391 return nullptr; 394 return nullptr;
392 } 395 }
393 396
394 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], 397 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
395 const SkFontStyle& style, 398 const SkFontStyle& style,
396 const char* bcp47[], 399 const char* bcp47[],
397 int bcp47Count, 400 int bcp47Count,
398 SkUnichar character) const o verride 401 SkUnichar character) const o verride
399 { 402 {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ; 578 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ;
576 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" , 579 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" ,
577 gSystemFontUseStrings[custom->fSystemFontUse], 580 gSystemFontUseStrings[custom->fSystemFontUse],
578 custom->fBasePath, 581 custom->fBasePath,
579 custom->fFontsXml, 582 custom->fFontsXml,
580 custom->fFallbackFontsXml)); 583 custom->fFallbackFontsXml));
581 } 584 }
582 585
583 return new SkFontMgr_Android(custom); 586 return new SkFontMgr_Android(custom);
584 } 587 }
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