diff --git a/Ladybird/FontPlugin.cpp b/Ladybird/FontPlugin.cpp index e876b96cb68..35dc15d575c 100644 --- a/Ladybird/FontPlugin.cpp +++ b/Ladybird/FontPlugin.cpp @@ -57,7 +57,6 @@ void FontPlugin::update_generic_fonts() { // How we choose which system font to use for each CSS font: // 1. Try a list of known-suitable fonts with their names hard-coded below. - // 2. If that didn't work, fall back to Gfx::FontDatabase::default_font() (or default_fixed_width_font()) // This is rather weird, but it's how things work right now. // We should eventually have a way to query the system for the default font. @@ -79,14 +78,7 @@ void FontPlugin::update_generic_fonts() break; } - if (!gfx_font) { - if (generic_font == Web::Platform::GenericFont::Monospace || generic_font == Web::Platform::GenericFont::UiMonospace) - gfx_font = Gfx::FontDatabase::default_fixed_width_font(); - else - gfx_font = Gfx::FontDatabase::default_font(); - } - - m_generic_font_names[static_cast(generic_font)] = gfx_font->family(); + m_generic_font_names[static_cast(generic_font)] = gfx_font ? gfx_font->family() : String {}; }; // Fallback fonts to look for if Gfx::Font can't load expected font diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 519a03d9064..b06ded7a4f1 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -96,7 +96,7 @@ static DOM::Element const* element_to_inherit_style_from(DOM::Element const*, Op StyleComputer::StyleComputer(DOM::Document& document) : m_document(document) - , m_default_font_metrics(16, Gfx::FontDatabase::default_font().pixel_metrics()) + , m_default_font_metrics(16, Platform::FontPlugin::the().default_font().pixel_metrics()) , m_root_element_font_metrics(m_default_font_metrics) { }