From 2e759656de7df6e4f7300eb0453227ceb48e0fa9 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Tue, 3 Oct 2023 15:40:24 -0600 Subject: [PATCH] Ladybird: Load fonts via Core::Resource URIs instead of filesystem paths --- Ladybird/FontPlugin.cpp | 7 ++----- Ladybird/Utilities.cpp | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Ladybird/FontPlugin.cpp b/Ladybird/FontPlugin.cpp index 106f4d679ec..2e8dac841b4 100644 --- a/Ladybird/FontPlugin.cpp +++ b/Ladybird/FontPlugin.cpp @@ -19,12 +19,9 @@ namespace Ladybird { FontPlugin::FontPlugin(bool is_layout_test_mode) : m_is_layout_test_mode(is_layout_test_mode) { - // Load the default SerenityOS fonts... - Gfx::FontDatabase::set_default_fonts_lookup_path(DeprecatedString::formatted("{}/res/fonts", s_serenity_resource_root)); - - // ...and also anything we can find in the system's font directories + // Load anything we can find in the system's font directories for (auto const& path : Core::StandardPaths::font_directories().release_value_but_fixme_should_propagate_errors()) - Gfx::FontDatabase::the().load_all_fonts_from_path(path.to_deprecated_string()); + Gfx::FontDatabase::the().load_all_fonts_from_uri(MUST(String::formatted("file://{}", path))); Gfx::FontDatabase::set_default_font_query("Katica 10 400 0"); Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0"); diff --git a/Ladybird/Utilities.cpp b/Ladybird/Utilities.cpp index 5fb193f8d18..dc65dbdeb83 100644 --- a/Ladybird/Utilities.cpp +++ b/Ladybird/Utilities.cpp @@ -8,6 +8,7 @@ #include "Utilities.h" #include #include +#include #include #include @@ -39,6 +40,8 @@ void platform_init() return LexicalPath(app_dir).parent().append("share"sv).string(); #endif }(); + + Core::ResourceImplementation::install(make(MUST(String::formatted("{}/res", s_serenity_resource_root)))); } ErrorOr> get_paths_for_helper_process(StringView process_name)