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

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

Issue 681823003: Match language tags by prefix on Android. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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 "SkFontConfigParser_android.h" 8 #include "SkFontConfigParser_android.h"
9 #include "SkFontDescriptor.h" 9 #include "SkFontDescriptor.h"
10 #include "SkFontHost_FreeType_common.h" 10 #include "SkFontHost_FreeType_common.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 346
347 static SkTypeface_AndroidSystem* find_family_style_character( 347 static SkTypeface_AndroidSystem* find_family_style_character(
348 const SkTDArray<NameToFamily>& fallbackNameToFamilyMap, 348 const SkTDArray<NameToFamily>& fallbackNameToFamilyMap,
349 const SkFontStyle& style, bool elegant, 349 const SkFontStyle& style, bool elegant,
350 const SkString& langTag, SkUnichar character) 350 const SkString& langTag, SkUnichar character)
351 { 351 {
352 for (int i = 0; i < fallbackNameToFamilyMap.count(); ++i) { 352 for (int i = 0; i < fallbackNameToFamilyMap.count(); ++i) {
353 SkFontStyleSet_Android* family = fallbackNameToFamilyMap[i].styleSet; 353 SkFontStyleSet_Android* family = fallbackNameToFamilyMap[i].styleSet;
354 SkAutoTUnref<SkTypeface_AndroidSystem> face(family->matchStyle(style)); 354 SkAutoTUnref<SkTypeface_AndroidSystem> face(family->matchStyle(style));
355 355
356 if (!langTag.isEmpty() && langTag != face->fLang.getTag()) { 356 if (!langTag.isEmpty() && !face->fLang.getTag().startsWith(langTag.c_str ())) {
357 continue; 357 continue;
358 } 358 }
359 359
360 if (SkToBool(face->fVariantStyle & kElegant_FontVariant) != elegant) { 360 if (SkToBool(face->fVariantStyle & kElegant_FontVariant) != elegant) {
361 continue; 361 continue;
362 } 362 }
363 363
364 SkPaint paint; 364 SkPaint paint;
365 paint.setTypeface(face); 365 paint.setTypeface(face);
366 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); 366 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 SkDEBUGF(("Use Test Config File Main %s, Fallback %s, Font Dir %s", 552 SkDEBUGF(("Use Test Config File Main %s, Fallback %s, Font Dir %s",
553 gTestMainConfigFile, gTestFallbackConfigFile, gTestFontFilePrefix) ); 553 gTestMainConfigFile, gTestFallbackConfigFile, gTestFontFilePrefix) );
554 } 554 }
555 555
556 void SkGetTestFontConfiguration(const char** mainconf, const char** fallbackconf , 556 void SkGetTestFontConfiguration(const char** mainconf, const char** fallbackconf ,
557 const char** fontsdir) { 557 const char** fontsdir) {
558 *mainconf = gTestMainConfigFile; 558 *mainconf = gTestMainConfigFile;
559 *fallbackconf = gTestFallbackConfigFile; 559 *fallbackconf = gTestFallbackConfigFile;
560 *fontsdir = gTestFontFilePrefix; 560 *fontsdir = gTestFontFilePrefix;
561 } 561 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698