Everywhere: Fully qualify font names by including their slope

Fixes typefaces of the same weight but different slopes being
incorrectly returned for each other by FontDatabase.
This commit is contained in:
thankyouverycool 2022-01-31 20:18:15 -05:00 committed by Andreas Kling
commit 96895cd22c
Notes: sideshowbarker 2024-07-17 19:53:40 +09:00
15 changed files with 39 additions and 25 deletions

View file

@ -793,13 +793,14 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
FontSelector font_selector;
bool monospace = false;
// FIXME: Implement font slope style. All found fonts are currently hard-coded as regular.
auto find_font = [&](String const& family) -> RefPtr<Gfx::Font> {
font_selector = { family, size, weight };
font_selector = { family, size, weight, 0 };
if (auto found_font = FontCache::the().get(font_selector))
return found_font;
if (auto found_font = Gfx::FontDatabase::the().get(family, size, weight))
if (auto found_font = Gfx::FontDatabase::the().get(family, size, weight, 0))
return found_font;
return {};