mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
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:
parent
87a149c9a4
commit
96895cd22c
15 changed files with 39 additions and 25 deletions
|
@ -609,7 +609,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
}
|
||||
auto font = unspanned_font;
|
||||
if (span.attributes.bold) {
|
||||
if (auto bold_font = Gfx::FontDatabase::the().get(font->family(), font->presentation_size(), 700))
|
||||
if (auto bold_font = Gfx::FontDatabase::the().get(font->family(), font->presentation_size(), 700, 0))
|
||||
font = bold_font;
|
||||
}
|
||||
draw_text_helper(span_start, span_end, font, span.attributes);
|
||||
|
|
|
@ -753,25 +753,25 @@ void Widget::set_font(const Gfx::Font* font)
|
|||
|
||||
void Widget::set_font_family(const String& family)
|
||||
{
|
||||
set_font(Gfx::FontDatabase::the().get(family, m_font->presentation_size(), m_font->weight()));
|
||||
set_font(Gfx::FontDatabase::the().get(family, m_font->presentation_size(), m_font->weight(), m_font->slope()));
|
||||
}
|
||||
|
||||
void Widget::set_font_size(unsigned size)
|
||||
{
|
||||
set_font(Gfx::FontDatabase::the().get(m_font->family(), size, m_font->weight()));
|
||||
set_font(Gfx::FontDatabase::the().get(m_font->family(), size, m_font->weight(), m_font->slope()));
|
||||
}
|
||||
|
||||
void Widget::set_font_weight(unsigned weight)
|
||||
{
|
||||
set_font(Gfx::FontDatabase::the().get(m_font->family(), m_font->presentation_size(), weight));
|
||||
set_font(Gfx::FontDatabase::the().get(m_font->family(), m_font->presentation_size(), weight, m_font->slope()));
|
||||
}
|
||||
|
||||
void Widget::set_font_fixed_width(bool fixed_width)
|
||||
{
|
||||
if (fixed_width)
|
||||
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_fixed_width_font().family(), m_font->presentation_size(), m_font->weight()));
|
||||
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_fixed_width_font().family(), m_font->presentation_size(), m_font->weight(), m_font->slope()));
|
||||
else
|
||||
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_font().family(), m_font->presentation_size(), m_font->weight()));
|
||||
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_font().family(), m_font->presentation_size(), m_font->weight(), m_font->slope()));
|
||||
}
|
||||
|
||||
void Widget::set_min_size(const Gfx::IntSize& size)
|
||||
|
|
|
@ -28,7 +28,7 @@ CoverWizardPage::CoverWizardPage()
|
|||
m_content_widget->layout()->set_margins(20);
|
||||
|
||||
m_header_label = m_content_widget->add<Label>();
|
||||
m_header_label->set_font(Gfx::FontDatabase::the().get("Pebbleton", 14, 700));
|
||||
m_header_label->set_font(Gfx::FontDatabase::the().get("Pebbleton", 14, 700, 0));
|
||||
m_header_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
|
||||
m_header_label->set_fixed_height(48);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue