bug 668813 pt 1 - check character coverage of other styles in the selected font family before falling back to other families. r=jdaggett

This commit is contained in:
Jonathan Kew 2011-08-09 09:00:52 +01:00
Родитель b549d28077
Коммит c7b249e538
1 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -3365,6 +3365,25 @@ gfxFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
*aMatchType = gfxTextRange::kFontGroup;
return font.forget();
}
// check other faces of the family
// XXX optimization point: give the family a charmap that is the union
// of the char maps of all its faces, so we can quickly test whether
// it's worth doing this search
gfxFontFamily *family = font->GetFontEntry()->Family();
if (family) {
FontSearch matchData(aCh, font);
family->FindFontForChar(&matchData);
gfxFontEntry *fe = matchData.mBestMatch;
if (fe) {
bool needsBold =
font->GetStyle()->weight >= 600 && !fe->IsBold();
selectedFont =
fe->FindOrMakeFont(font->GetStyle(), needsBold);
if (selectedFont) {
return selectedFont.forget();
}
}
}
}
// if character is in Private Use Area, don't do matching against pref or system fonts