Bug 1185812 - rejigger the ordering of fonts within a family to avoid obscure faces. r=heycam

This commit is contained in:
John Daggett 2015-09-02 12:24:30 +09:00
parent 3950ef30da
commit e61be5512b
2 changed files with 6 additions and 4 deletions

View File

@ -1338,9 +1338,9 @@ gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
uint32_t minDistance = 0xffffffff;
gfxFontEntry* matched = nullptr;
// iterate in reverse order so that the last-defined font is the first one
// in the fontlist used for matching, as per CSS Fonts spec
for (int32_t i = count - 1; i >= 0; i--) {
// iterate in forward order so that faces like 'Bold' are matched before
// matching style distance faces such as 'Bold Outline' (see bug 1185812)
for (uint32_t i = 0; i < count; i++) {
fe = mAvailableFonts[i];
uint32_t distance =
WeightDistance(aFontStyle.weight, fe->Weight()) +

View File

@ -140,7 +140,9 @@ public:
nsRefPtr<gfxFontEntry> fe = aFontEntry;
// remove existing entry, if already present
mAvailableFonts.RemoveElement(aFontEntry);
mAvailableFonts.AppendElement(aFontEntry);
// insert at the beginning so that the last-defined font is the first
// one in the fontlist used for matching, as per CSS Fonts spec
mAvailableFonts.InsertElementAt(0, aFontEntry);
if (aFontEntry->mFamilyName.IsEmpty()) {
aFontEntry->mFamilyName = Name();