forked from firka/flutter
Fine-tune fake-bolding condition
The old logic for fake bolding results in no fake bolding for a bold span on a light weight (300) because the target weight (600 in this case) didn't meet the condition. This patch fine-tunes the threshold to enable fake bolding for this. Bug: 17587185 Change-Id: I04abd00a74240cbed79c417f81486aa2158b2806
This commit is contained in:
@@ -141,11 +141,11 @@ static int computeMatch(FontStyle style1, FontStyle style2) {
|
||||
}
|
||||
|
||||
static FontFakery computeFakery(FontStyle wanted, FontStyle actual) {
|
||||
// If desired weight is bold or darker, and 2 or more grades higher
|
||||
// than actual (for example, medium 500 -> bold 700), then select
|
||||
// fake bold.
|
||||
// If desired weight is semibold or darker, and 2 or more grades
|
||||
// higher than actual (for example, medium 500 -> bold 700), then
|
||||
// select fake bold.
|
||||
int wantedWeight = wanted.getWeight();
|
||||
bool isFakeBold = wantedWeight >= 7 && (wantedWeight - actual.getWeight()) >= 2;
|
||||
bool isFakeBold = wantedWeight >= 6 && (wantedWeight - actual.getWeight()) >= 2;
|
||||
bool isFakeItalic = wanted.getItalic() && !actual.getItalic();
|
||||
return FontFakery(isFakeBold, isFakeItalic);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user