Bug 1458158 - Correct the weight-difference factor in CalcStyleMatch to favor closer weights, not further ones. r=jwatt

This commit is contained in:
Jonathan Kew 2018-05-01 15:56:04 +01:00
parent e94e29bb2e
commit 007b53464f
2 changed files with 3 additions and 3 deletions

View File

@ -1662,9 +1662,9 @@ CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle)
// measure of closeness of weight to the desired value
if (aFontEntry->Weight().Min() > aStyle->weight) {
rank += aFontEntry->Weight().Min() - aStyle->weight;
rank += 1000.0f - (aFontEntry->Weight().Min() - aStyle->weight);
} else if (aFontEntry->Weight().Max() < aStyle->weight) {
rank += aStyle->weight - aFontEntry->Weight().Max();
rank += 1000.0f - (aStyle->weight - aFontEntry->Weight().Max());
} else {
rank += 2000.0f; // the font supports the exact weight wanted
}

View File

@ -19,7 +19,7 @@ pref(font.default.zh-CN,"sans-serif") pref(font.default.zh-TW,"sans-serif") pref
# Test for bug 1458158: Arabic text in Arial weight 900 should fall back to Bold rather than Regular.
# Limited to Windows because this is specific to the fonts shipped on Windows by default.
skip-if(!winWidget) fails-if(winWidget) == 1458158-1.html 1458158-1-ref.html
skip-if(!winWidget) == 1458158-1.html 1458158-1-ref.html
# basic tests for bug 538730
!= synthetic-bold-1.html synthetic-bold-1-ref.html