зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1344990 part.1 gfx and layout should refer "font.name-list.*" when "font.name.*" is empty r=jfkthame
When "font.name.*" is empty, it means "default", i.e., use the first font of "font.name-list.*". In most cases, we don't need to change existing "font.name.*" handlers which refer "font.name-list.*". However, handlers which refer only "font.name.*", we need to add the code to refer "font.name-list.*" too. MozReview-Commit-ID: B37y1Ld9Azg --HG-- extra : rebase_source : f944893ff38d5f2072b5014dccf455045ddafd19
This commit is contained in:
Родитель
5e9f07c697
Коммит
28770793c6
|
@ -1569,6 +1569,7 @@ gfxFcPlatformFontList::GetStandardFamilyName(const nsAString& aFontName,
|
|||
}
|
||||
|
||||
static const char kFontNamePrefix[] = "font.name.";
|
||||
static const char kFontNameListPrefix[] = "font.name-list.";
|
||||
|
||||
void
|
||||
gfxFcPlatformFontList::AddGenericFonts(mozilla::FontFamilyType aGenericType,
|
||||
|
@ -1604,6 +1605,17 @@ gfxFcPlatformFontList::AddGenericFonts(mozilla::FontFamilyType aGenericType,
|
|||
prefFontName.Append('.');
|
||||
prefFontName.Append(langGroupStr);
|
||||
nsAdoptingString fontlistValue = Preferences::GetString(prefFontName.get());
|
||||
if (fontlistValue.IsEmpty()) {
|
||||
nsAutoCString prefFontNameListName(kFontNameListPrefix);
|
||||
prefFontNameListName.Append(generic);
|
||||
prefFontNameListName.Append('.');
|
||||
prefFontNameListName.Append(langGroupStr);
|
||||
// The font name list may have two or more family names as comma
|
||||
// separated list. In such case, not matching with generic font
|
||||
// name is fine because if the list prefers specific font, we
|
||||
// should try to use the pref with complicated path.
|
||||
fontlistValue = Preferences::GetString(prefFontNameListName.get());
|
||||
}
|
||||
if (fontlistValue) {
|
||||
if (!fontlistValue.EqualsLiteral("serif") &&
|
||||
!fontlistValue.EqualsLiteral("sans-serif") &&
|
||||
|
@ -1781,6 +1793,11 @@ gfxFcPlatformFontList::PrefFontListsUseOnlyGenerics()
|
|||
// Ex: font.name.serif.ar ==> "serif" (ok)
|
||||
// Ex: font.name.serif.ar ==> "monospace" (return false)
|
||||
// Ex: font.name.serif.ar ==> "DejaVu Serif" (return false)
|
||||
// Ex: font.name.serif.ar ==> "" and
|
||||
// font.name-list.serif.ar ==> "serif" (ok)
|
||||
// Ex: font.name.serif.ar ==> "" and
|
||||
// font.name-list.serif.ar ==> "Something, serif"
|
||||
// (return false)
|
||||
|
||||
nsDependentCString prefName(names[i] +
|
||||
ArrayLength(kFontNamePrefix) - 1);
|
||||
|
@ -1788,6 +1805,17 @@ gfxFcPlatformFontList::PrefFontListsUseOnlyGenerics()
|
|||
const nsDependentCSubstring& generic = tokenizer.nextToken();
|
||||
const nsDependentCSubstring& langGroup = tokenizer.nextToken();
|
||||
nsAdoptingCString fontPrefValue = Preferences::GetCString(names[i]);
|
||||
if (fontPrefValue.IsEmpty()) {
|
||||
nsAutoCString nameListPrefName(kFontNameListPrefix);
|
||||
nameListPrefName.Append(generic);
|
||||
nameListPrefName.Append('.');
|
||||
nameListPrefName.Append(langGroup);
|
||||
// The font name list may have two or more family names as comma
|
||||
// separated list. In such case, not matching with generic font
|
||||
// name is fine because if the list prefers specific font, this
|
||||
// should return false.
|
||||
fontPrefValue = Preferences::GetCString(nameListPrefName.get());
|
||||
}
|
||||
|
||||
if (!langGroup.EqualsLiteral("x-math") &&
|
||||
!generic.Equals(fontPrefValue)) {
|
||||
|
|
|
@ -849,8 +849,10 @@ void gfxFontUtils::ParseFontList(const nsAString& aFamilyList,
|
|||
fontname = Substring(nameStart, p);
|
||||
fontname.CompressWhitespace(true, true);
|
||||
|
||||
// append it to the list
|
||||
aFontList.AppendElement(fontname);
|
||||
// append it to the list if it's not empty
|
||||
if (!fontname.IsEmpty()) {
|
||||
aFontList.AppendElement(fontname);
|
||||
}
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,6 +191,7 @@ StaticPresData::GetFontPrefsForLangHelper(nsIAtom *aLanguage,
|
|||
// set the default variable font (the other fonts are seen as 'generic' fonts
|
||||
// in GFX and will be queried there when hunting for alternative fonts)
|
||||
if (eType == eDefaultFont_Variable) {
|
||||
// XXX "font.name.variable."? There is no such pref...
|
||||
MAKE_FONT_PREF_KEY(pref, "font.name.variable.", langGroup);
|
||||
|
||||
nsAdoptingString value = Preferences::GetString(pref.get());
|
||||
|
|
Загрузка…
Ссылка в новой задаче