1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:55:08 +00:00

LibGfx: Add Gfx::Font::bold_variant() that does a proper font lookup

We previously had a cached bold variant font in Gfx::Font that was very
haphazardly located by filename pattern. This patches replaces that
mechanism with a proper Gfx::FontDatabase lookup for the same font but
with bold weight (700).
This commit is contained in:
Andreas Kling 2020-12-31 01:49:05 +01:00
parent 0f66589007
commit 412a91d58f
4 changed files with 16 additions and 25 deletions

View file

@ -427,7 +427,7 @@ void TextEditor::paint_event(PaintEvent& event)
painter.draw_text(
ruler_line_rect.shrunken(2, 0).translated(0, m_line_spacing / 2),
String::number(i + 1),
is_current_line && font().has_boldface() ? font().bold_family_font() : font(),
is_current_line ? font().bold_variant() : font(),
Gfx::TextAlignment::TopRight,
is_current_line ? palette().ruler_active_text() : palette().ruler_inactive_text());
}