From 70c0c1c845229ec8544fe3184ebfbed5503c2726 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 6 Jan 2023 11:57:59 +0100 Subject: [PATCH] LibWeb: Use default system fonts for `serif`, `sans-serif`, etc. --- .../Libraries/LibWeb/Platform/FontPluginSerenity.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp b/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp index 9aa29b8eaa..c860977dff 100644 --- a/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp +++ b/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp @@ -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";