1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

Ladybird+LibWeb: Stop using Gfx::FontDatabase default fonts

This closes the window at WebContent process startup where we were
relying on Gfx::FontDatabase having some resolvable value in its default
font query.
This commit is contained in:
Andreas Kling 2024-06-04 15:14:14 +02:00
parent 49d546fe8b
commit fac126bce9
Notes: sideshowbarker 2024-07-17 23:00:03 +09:00
2 changed files with 2 additions and 10 deletions

View file

@ -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<size_t>(generic_font)] = gfx_font->family();
m_generic_font_names[static_cast<size_t>(generic_font)] = gfx_font ? gfx_font->family() : String {};
};
// Fallback fonts to look for if Gfx::Font can't load expected font

View file

@ -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)
{
}