Bug 1165179 - use all style matched faces within a font family. r=heycam

This commit is contained in:
John Daggett 2015-07-02 10:44:14 +09:00
Родитель 8b1e64ec34
Коммит 28d91fc221
1 изменённых файлов: 16 добавлений и 19 удалений

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

@ -1708,7 +1708,6 @@ gfxFontGroup::FindPlatformFont(const nsAString& aName,
{
bool needsBold;
gfxFontFamily *family = nullptr;
gfxFontEntry *fe = nullptr;
if (aUseFontSet) {
// First, look up in the user font set...
@ -1719,18 +1718,6 @@ gfxFontGroup::FindPlatformFont(const nsAString& aName,
// Add userfonts to the fontlist whether already loaded
// or not. Loading is initiated during font matching.
family = mUserFontSet->LookupFamily(aName);
if (family) {
nsAutoTArray<gfxFontEntry*,4> userfonts;
family->FindAllFontsForStyle(mStyle, userfonts, needsBold);
// add these to the fontlist
uint32_t count = userfonts.Length();
for (uint32_t i = 0; i < count; i++) {
fe = userfonts[i];
FamilyFace ff(family, fe, needsBold);
ff.CheckState(mSkipDrawing);
mFonts.AppendElement(ff);
}
}
}
}
@ -1738,14 +1725,24 @@ gfxFontGroup::FindPlatformFont(const nsAString& aName,
if (!family) {
gfxPlatformFontList *fontList = gfxPlatformFontList::PlatformFontList();
family = fontList->FindFamily(aName, mStyle.language, mStyle.systemFont);
if (family) {
fe = family->FindFontForStyle(mStyle, needsBold);
}
}
// add to the font group, unless it's already there
if (fe && !HasFont(fe)) {
mFonts.AppendElement(FamilyFace(family, fe, needsBold));
// if family found, do style matching and add all font entries to mFonts
if (family) {
nsAutoTArray<gfxFontEntry*,4> fontEntryList;
family->FindAllFontsForStyle(mStyle, fontEntryList, needsBold);
// add these to the fontlist
uint32_t n = fontEntryList.Length();
for (uint32_t i = 0; i < n; i++) {
gfxFontEntry* fe = fontEntryList[i];
if (!HasFont(fe)) {
FamilyFace ff(family, fe, needsBold);
if (fe->mIsUserFontContainer) {
ff.CheckState(mSkipDrawing);
}
mFonts.AppendElement(ff);
}
}
}
}