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

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

Issue 26325003: Fix ambiguity in API if no matching system language is found (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « include/ports/SkTypeface_android.h ('k') | 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 /* 2 /*
3 * Copyright 2013 The Android Open Source Project 3 * Copyright 2013 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkFontConfigInterface.h" 9 #include "SkFontConfigInterface.h"
10 #include "SkTypeface_android.h" 10 #include "SkTypeface_android.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // store the result for subsequent lookups 506 // store the result for subsequent lookups
507 fontRec.fTypeface = face; 507 fontRec.fTypeface = face;
508 } 508 }
509 SkASSERT(face); 509 SkASSERT(face);
510 return face; 510 return face;
511 } 511 }
512 512
513 bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni, 513 bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni,
514 const char* lang , 514 const char* lang ,
515 SkString* name) { 515 SkString* name) {
516 FallbackFontList* fallbackFontList = this->findFallbackFontList(lang); 516 FallbackFontList* fallbackFontList = NULL;
517 const SkString langTag(lang);
518 if (langTag.isEmpty()) {
519 fallbackFontList = this->getCurrentLocaleFallbackFontList();
520 } else {
521 fallbackFontList = this->findFallbackFontList(langTag);
522 }
523
517 for (int i = 0; i < fallbackFontList->count(); i++) { 524 for (int i = 0; i < fallbackFontList->count(); i++) {
518 FamilyRecID familyRecID = fallbackFontList->getAt(i); 525 FamilyRecID familyRecID = fallbackFontList->getAt(i);
519 526
520 // if it is not one of the accepted variants then move to the next famil y 527 // if it is not one of the accepted variants then move to the next famil y
521 int32_t acceptedVariants = SkPaintOptionsAndroid::kDefault_Variant | 528 int32_t acceptedVariants = SkPaintOptionsAndroid::kDefault_Variant |
522 SkPaintOptionsAndroid::kElegant_Variant; 529 SkPaintOptionsAndroid::kElegant_Variant;
523 if (!(fFontFamilies[familyRecID].fPaintOptions.getFontVariant() & accept edVariants)) { 530 if (!(fFontFamilies[familyRecID].fPaintOptions.getFontVariant() & accept edVariants)) {
524 continue; 531 continue;
525 } 532 }
526 533
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 if (uBounds) { 733 if (uBounds) {
727 *uBounds = upperBounds; 734 *uBounds = upperBounds;
728 } 735 }
729 } 736 }
730 return currentTypeface; 737 return currentTypeface;
731 } 738 }
732 739
733 /////////////////////////////////////////////////////////////////////////////// 740 ///////////////////////////////////////////////////////////////////////////////
734 741
735 bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name) { 742 bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name) {
736 SkString locale = SkFontConfigParser::GetLocale();
737 SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface(); 743 SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface();
738 return fontConfig->getFallbackFamilyNameForChar(uni, locale.c_str(), name); 744 return fontConfig->getFallbackFamilyNameForChar(uni, NULL, name);
739 } 745 }
740 746
741 bool SkGetFallbackFamilyNameForChar(SkUnichar uni, const char* lang, SkString* n ame) { 747 bool SkGetFallbackFamilyNameForChar(SkUnichar uni, const char* lang, SkString* n ame) {
742 SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface(); 748 SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface();
743 return fontConfig->getFallbackFamilyNameForChar(uni, lang, name); 749 return fontConfig->getFallbackFamilyNameForChar(uni, lang, name);
744 } 750 }
745 751
746 void SkUseTestFontConfigFile(const char* mainconf, const char* fallbackconf, 752 void SkUseTestFontConfigFile(const char* mainconf, const char* fallbackconf,
747 const char* fontsdir) { 753 const char* fontsdir) {
748 gTestMainConfigFile = mainconf; 754 gTestMainConfigFile = mainconf;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style , fontVariant); 925 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style , fontVariant);
920 } 926 }
921 927
922 #endif 928 #endif
923 929
924 /////////////////////////////////////////////////////////////////////////////// 930 ///////////////////////////////////////////////////////////////////////////////
925 931
926 SkFontMgr* SkFontMgr::Factory() { 932 SkFontMgr* SkFontMgr::Factory() {
927 return NULL; 933 return NULL;
928 } 934 }
OLDNEW
« no previous file with comments | « include/ports/SkTypeface_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698