mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 728518 - improve the handling of weight in FindFontForChar. r=jdaggett
This commit is contained in:
parent
64dd783613
commit
a5d915dbc1
@ -743,25 +743,16 @@ gfxFontFamily::FindFontForChar(FontSearch *aMatchData)
|
||||
|
||||
if (aMatchData->mFontToMatch) {
|
||||
const gfxFontStyle *style = aMatchData->mFontToMatch->GetStyle();
|
||||
|
||||
// italics
|
||||
|
||||
// matching italics takes precedence over weight
|
||||
bool wantItalic =
|
||||
((style->style & (FONT_STYLE_ITALIC | FONT_STYLE_OBLIQUE)) != 0);
|
||||
if (fe->IsItalic() == wantItalic) {
|
||||
rank += 5;
|
||||
rank += 10;
|
||||
}
|
||||
|
||||
// weight
|
||||
PRInt32 targetWeight = style->ComputeWeight() * 100;
|
||||
|
||||
PRInt32 entryWeight = fe->Weight();
|
||||
if (entryWeight == targetWeight) {
|
||||
rank += 5;
|
||||
} else {
|
||||
PRUint32 diffWeight = abs(entryWeight - targetWeight);
|
||||
if (diffWeight <= 100) // favor faces close in weight
|
||||
rank += 2;
|
||||
}
|
||||
// measure of closeness of weight to the desired value
|
||||
rank += 9 - abs(fe->Weight() / 100 - style->ComputeWeight());
|
||||
} else {
|
||||
// if no font to match, prefer non-bold, non-italic fonts
|
||||
if (!fe->IsItalic()) {
|
||||
|
Loading…
Reference in New Issue
Block a user