mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1407114 - part 3 - Handle fallback from styled to regular face if necessary when checking the platform's common fallback fonts. r=jrmuizel
This commit is contained in:
parent
6ade77d1f6
commit
3ea98ba522
@ -615,18 +615,34 @@ gfxPlatformFontList::CommonFontFallback(uint32_t aCh, uint32_t aNextCh,
|
||||
|
||||
familyName.AppendASCII(fallbackFamily);
|
||||
gfxFontFamily *fallback = FindFamilyByCanonicalName(familyName);
|
||||
if (!fallback)
|
||||
if (!fallback) {
|
||||
continue;
|
||||
}
|
||||
|
||||
gfxFontEntry *fontEntry;
|
||||
bool needsBold; // ignored in the system fallback case
|
||||
|
||||
// use first font in list that supports a given character
|
||||
fontEntry = fallback->FindFontForStyle(*aMatchStyle, needsBold);
|
||||
if (fontEntry && fontEntry->HasCharacter(aCh)) {
|
||||
if (fontEntry) {
|
||||
if (fontEntry->HasCharacter(aCh)) {
|
||||
*aMatchedFamily = fallback;
|
||||
return fontEntry;
|
||||
}
|
||||
// If we requested a styled font (bold and/or italic), and the char
|
||||
// was not available, check other faces of the family.
|
||||
if (!fontEntry->IsNormalStyle()) {
|
||||
// If style/weight/stretch was not Normal, see if we can
|
||||
// fall back to a next-best face (e.g. Arial Black -> Bold,
|
||||
// or Arial Narrow -> Regular).
|
||||
GlobalFontMatch data(aCh, aMatchStyle);
|
||||
fallback->SearchAllFontsForChar(&data);
|
||||
if (data.mBestMatch) {
|
||||
*aMatchedFamily = fallback;
|
||||
return data.mBestMatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user