1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:07:35 +00:00

LibGfx: Remove Gfx::FontDatabase::default_bold_font()

Instead use default_font().bold_variant() in cases where we want a bold
variant of the default font. :^)
This commit is contained in:
Andreas Kling 2021-05-20 18:40:48 +02:00
parent 068ddf4513
commit 6a012ad79f
24 changed files with 33 additions and 46 deletions

View file

@ -82,7 +82,7 @@ NotificationWindow::NotificationWindow(i32 client_id, const String& text, const
left_container.set_layout<GUI::VerticalBoxLayout>();
m_title_label = &left_container.add<GUI::Label>(title);
m_title_label->set_font(Gfx::FontDatabase::default_bold_font());
m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant());
m_title_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_text_label = &left_container.add<GUI::Label>(text);
m_text_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);

View file

@ -72,7 +72,7 @@ ShutdownDialog::ShutdownDialog()
auto& label = right_container.add<GUI::Label>("What would you like to do?");
label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
label.set_fixed_height(22);
label.set_font(Gfx::FontDatabase::default_bold_font());
label.set_font(Gfx::FontDatabase::default_font().bold_variant());
for (size_t i = 0; i < options.size(); i++) {
auto action = options[i];

View file

@ -89,7 +89,7 @@ void TaskbarButton::paint_event(GUI::PaintEvent& event)
{
VERIFY(icon());
auto& icon = *this->icon();
auto& font = is_checked() ? Gfx::FontDatabase::default_bold_font() : this->font();
auto& font = is_checked() ? this->font().bold_variant() : this->font();
auto& window = WindowList::the().ensure_window(m_identifier);
GUI::Painter painter(*this);

View file

@ -65,7 +65,7 @@ TaskbarWindow::TaskbarWindow(NonnullRefPtr<GUI::Menu> start_menu)
main_widget.layout()->set_margins({ 3, 3, 3, 1 });
m_start_button = GUI::Button::construct("Serenity");
m_start_button->set_font(Gfx::FontDatabase::default_bold_font());
m_start_button->set_font(Gfx::FontDatabase::default_font().bold_variant());
m_start_button->set_icon_spacing(0);
m_start_button->set_fixed_size(80, 21);
auto app_icon = GUI::Icon::default_icon("ladyball");

View file

@ -94,7 +94,7 @@ int Menu::content_width() const
for (auto& item : m_items) {
if (item.type() != MenuItem::Text)
continue;
auto& use_font = item.is_default() ? Gfx::FontDatabase::default_bold_font() : font();
auto& use_font = item.is_default() ? font().bold_variant() : font();
int text_width = use_font.width(Gfx::parse_ampersand_string(item.text()));
if (!item.shortcut_text().is_empty()) {
int shortcut_width = use_font.width(item.shortcut_text());
@ -245,7 +245,7 @@ void Menu::draw()
}
auto& previous_font = painter.font();
if (item.is_default())
painter.set_font(Gfx::FontDatabase::default_bold_font());
painter.set_font(previous_font.bold_variant());
painter.draw_ui_text(text_rect, item.text(), painter.font(), Gfx::TextAlignment::CenterLeft, text_color);
if (!item.shortcut_text().is_empty()) {
painter.draw_text(item.rect().translated(-right_padding(), 0), item.shortcut_text(), Gfx::TextAlignment::CenterRight, text_color);

View file

@ -99,7 +99,7 @@ const Gfx::Font& WindowManager::font() const
const Gfx::Font& WindowManager::window_title_font() const
{
return Gfx::FontDatabase::default_bold_font();
return Gfx::FontDatabase::default_font().bold_variant();
}
bool WindowManager::set_resolution(int width, int height, int scale)