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

Unified Diff: src/ports/SkFontConfigInterface_android.cpp

Issue 23819067: Add new entry point that supports fallback font selection based on language. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« include/ports/SkTypeface_android.h ('K') | « include/ports/SkTypeface_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontConfigInterface_android.cpp
diff --git a/src/ports/SkFontConfigInterface_android.cpp b/src/ports/SkFontConfigInterface_android.cpp
index 9a38261e80262789788e545dd9d86cbb5d1d9825..dbebd330574391a232a5cfa3e33e3dccc2ac3d90 100644
--- a/src/ports/SkFontConfigInterface_android.cpp
+++ b/src/ports/SkFontConfigInterface_android.cpp
@@ -95,7 +95,7 @@ public:
* Get the family name of the font in the default fallback font list that
* contains the specified chararacter. if no font is found, returns false.
*/
- bool getFallbackFamilyNameForChar(SkUnichar uni, SkString* name);
+ bool getFallbackFamilyNameForChar(SkUnichar uni, const SkString& lang, SkString* name);
/**
*
*/
@@ -246,10 +246,10 @@ SkFontConfigInterfaceAndroid::SkFontConfigInterfaceAndroid(SkTDArray<FontFamily*
if (fontRec.fIsValid) {
DEBUG_FONT(("---- SystemFonts[%d][%d] fallback=%d file=%s",
- i, fFonts.count() - 1, fontRec.fIsFallbackFont, filename.c_str()));
+ i, fFonts.count() - 1, family->fIsFallbackFont, filename.c_str()));
} else {
DEBUG_FONT(("---- SystemFonts[%d][%d] fallback=%d file=%s (INVALID)",
- i, fFonts.count() - 1, fontRec.fIsFallbackFont, filename.c_str()));
+ i, fFonts.count() - 1, family->fIsFallbackFont, filename.c_str()));
continue;
}
@@ -504,8 +504,10 @@ SkTypeface* SkFontConfigInterfaceAndroid::getTypefaceForFontRec(FontRecID fontRe
return face;
}
-bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni, SkString* name) {
- FallbackFontList* fallbackFontList = this->getCurrentLocaleFallbackFontList();
+bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni,
+ const SkString& lang,
+ SkString* name) {
+ FallbackFontList* fallbackFontList = this->findFallbackFontList(lang);
for (int i = 0; i < fallbackFontList->count(); i++) {
FamilyRecID familyRecID = fallbackFontList->getAt(i);
FontRecID fontRecID = find_best_style(fFontFamilies[familyRecID], SkTypeface::kNormal);
@@ -662,8 +664,14 @@ SkTypeface* SkFontConfigInterfaceAndroid::nextLogicalTypeface(SkFontID currFontI
///////////////////////////////////////////////////////////////////////////////
bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name) {
+ SkString locale = SkFontConfigParser::GetLocale();
+ SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface();
+ return fontConfig->getFallbackFamilyNameForChar(uni, locale, name);
+}
+
+bool SkGetFallbackFamilyNameForChar(SkUnichar uni, const SkString& lang, SkString* name) {
SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface();
- return fontConfig->getFallbackFamilyNameForChar(uni, name);
+ return fontConfig->getFallbackFamilyNameForChar(uni, lang, name);
}
void SkUseTestFontConfigFile(const char* mainconf, const char* fallbackconf,
« include/ports/SkTypeface_android.h ('K') | « include/ports/SkTypeface_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698