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

Unified Diff: Source/platform/exported/linux/WebFontInfo.cpp

Issue 381893002: Do not specify language for font fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Passing rebaseline job to bots Created 6 years, 5 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/exported/linux/WebFontInfo.cpp
diff --git a/Source/platform/exported/linux/WebFontInfo.cpp b/Source/platform/exported/linux/WebFontInfo.cpp
index e011ef66e32eb5d14f8a9c4c74c30967265e1720..10b2467cf31ee590531118c6c4662d04446a4ed0 100644
--- a/Source/platform/exported/linux/WebFontInfo.cpp
+++ b/Source/platform/exported/linux/WebFontInfo.cpp
@@ -61,7 +61,7 @@ void WebFontInfo::fallbackFontForChar(WebUChar32 c, const char* preferredLocale,
fcvalue.u.b = FcTrue;
FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse);
- if (preferredLocale) {
+ if (preferredLocale && strlen(preferredLocale)) {
FcLangSet* langset = FcLangSetCreate();
FcLangSetAdd(langset, reinterpret_cast<const FcChar8 *>(preferredLocale));
FcPatternAddLangSet(pattern, FC_LANG, langset);
@@ -71,6 +71,11 @@ void WebFontInfo::fallbackFontForChar(WebUChar32 c, const char* preferredLocale,
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
+ // Default substitution reintroduces an FC_LANG entry,
+ // which causes sorting order to change.
+ if (!preferredLocale || !strlen(preferredLocale))
+ FcPatternDel(pattern, FC_LANG);
+
FcResult result;
FcFontSet* fontSet = FcFontSort(0, pattern, 0, 0, &result);
FcPatternDestroy(pattern);
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698