LibWeb: Stop aggressively quantizing font-weight values

Before this change, we were quantizing to either 400, 700 or 900.
This caused us to treat 100/200/300 weighted fonts as if they were
interchangeable.
This commit is contained in:
Andreas Kling 2023-05-24 19:59:49 +02:00
parent 4fc5e06837
commit 82ddc813d5
Notes: sideshowbarker 2024-07-17 01:10:58 +09:00

View file

@ -389,12 +389,7 @@ int StyleValue::to_font_weight() const
} }
} }
if (has_integer()) { if (has_integer()) {
int font_weight_integer = to_integer(); return to_integer();
if (font_weight_integer <= Gfx::FontWeight::Regular)
return Gfx::FontWeight::Regular;
if (font_weight_integer <= Gfx::FontWeight::Bold)
return Gfx::FontWeight::Bold;
return Gfx::FontWeight::Black;
} }
if (is_calculated()) { if (is_calculated()) {
auto maybe_weight = const_cast<CalculatedStyleValue&>(as_calculated()).resolve_integer(); auto maybe_weight = const_cast<CalculatedStyleValue&>(as_calculated()).resolve_integer();