LibWeb: Use default system fonts for serif, sans-serif, etc.

This commit is contained in:
Andreas Kling 2023-01-06 11:57:59 +01:00
parent b2d3ceaec5
commit 70c0c1c845
Notes: sideshowbarker 2024-07-17 16:23:55 +09:00

View file

@ -12,6 +12,9 @@ namespace Web::Platform {
FontPluginSerenity::FontPluginSerenity()
{
// NOTE: These will eventually get replaced by system defaults.
Gfx::FontDatabase::set_default_font_query("Katica 10 400 0");
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
}
FontPluginSerenity::~FontPluginSerenity() = default;
@ -28,18 +31,16 @@ Gfx::Font& FontPluginSerenity::default_fixed_width_font()
DeprecatedString FontPluginSerenity::generic_font_name(GenericFont generic_font)
{
// FIXME: Replace hard-coded font names with a relevant call to FontDatabase.
// Currently, we cannot request the default font's name, or request it at a specific size and weight.
// So, hard-coded font names it is.
// FIXME: Make these configurable at the browser settings level. Fall back to system defaults.
switch (generic_font) {
case GenericFont::SansSerif:
case GenericFont::UiSansSerif:
case GenericFont::Cursive:
case GenericFont::UiRounded:
return "Katica";
return default_font().family();
case GenericFont::Monospace:
case GenericFont::UiMonospace:
return "Csilla";
return default_fixed_width_font().family();
case GenericFont::Serif:
case GenericFont::UiSerif:
return "Roman";