Ladybird: Use Core::Resource to locate the emoji lookup path

The path we were using is no longer correct, and we've been silently
dropping this error. Use Core::Resource instead, which we use for most
other Ladybird resources. This would have made it much more obvious that
emoji were not installed with the application.
This commit is contained in:
Timothy Flynn 2024-03-19 13:54:38 -04:00 committed by Tim Flynn
parent 7463b31754
commit 8af140fd7b
Notes: sideshowbarker 2024-07-17 06:51:40 +09:00

View File

@ -8,12 +8,11 @@
#include "FontPlugin.h"
#include <AK/ByteString.h>
#include <AK/String.h>
#include <LibCore/Resource.h>
#include <LibCore/StandardPaths.h>
#include <LibGfx/Font/Emoji.h>
#include <LibGfx/Font/FontDatabase.h>
extern ByteString s_serenity_resource_root;
namespace Ladybird {
FontPlugin::FontPlugin(bool is_layout_test_mode)
@ -26,7 +25,10 @@ FontPlugin::FontPlugin(bool is_layout_test_mode)
Gfx::FontDatabase::set_default_font_query("Katica 10 400 0");
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
Gfx::Emoji::set_emoji_lookup_path(String::formatted("{}/res/emoji", s_serenity_resource_root).release_value_but_fixme_should_propagate_errors());
auto emoji_path = MUST(Core::Resource::load_from_uri("resource://emoji"sv));
VERIFY(emoji_path->is_directory());
Gfx::Emoji::set_emoji_lookup_path(emoji_path->filesystem_path());
update_generic_fonts();