Index: src/ports/SkFontMgr_android.cpp |
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp |
index 5e93bf8a6208522c600bedca95d02529a3f7f570..adcf0d8ec6d82297fb5bebf76457179b83a0e9fa 100644 |
--- a/src/ports/SkFontMgr_android.cpp |
+++ b/src/ports/SkFontMgr_android.cpp |
@@ -346,8 +346,9 @@ protected: |
virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], |
const SkFontStyle& style, |
- const char bpc47[], |
- uint32_t character) const SK_OVERRIDE |
+ const char** bcp47, |
+ size_t bcpLength, |
+ SkUnichar character) const SK_OVERRIDE |
{ |
// The variant 'elegant' is 'not squashed', 'compact' is 'stays in ascent/descent'. |
// The variant 'default' means 'compact and elegant'. |
@@ -359,7 +360,8 @@ protected: |
// The first time match anything in the mask, second time anything not in the mask. |
for (bool maskMatches = true; maskMatches != false; maskMatches = false) { |
- SkLanguage lang(bpc47); |
+ size_t bcpNext = 1; |
+ SkLanguage lang((bcpLength > 0) ? bcp47[0] : NULL); |
// Match against the language, removing a segment each time. |
// The last time through the loop, the language will be empty. |
// The empty language is special, and matches all languages. |
@@ -387,6 +389,13 @@ protected: |
return face.detach(); |
} |
} |
+ |
+ // move onto the next language tag until we exhaust them and |
+ // only then fall through to the default case (i.e. empty lang). |
+ if (lang.getTag().isEmpty() && bcpNext < bcpLength) { |
+ lang.set(bcp47[bcpNext++]); |
+ } |
+ |
} while (!lang.getTag().isEmpty() && (lang = lang.getParent(), true)); |
} |
return NULL; |