mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 23:11:34 +03:00
Ladybird: Use standard font paths in FontPluginQt
This makes vector fonts load on macOS, where /usr/share/fonts doesn't exist and Ladybird would only load the bitmap fonts from ./res/fonts in the SerenityOS resource root directory. Additionally, fonts in {/usr/share/local,~/.local}/fonts are now loaded on Linux.
This commit is contained in:
parent
c5cadca542
commit
f49a65cb28
Notes:
sideshowbarker
2024-07-17 17:06:59 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/f49a65cb28 Pull-request: https://github.com/SerenityOS/serenity/pull/16962 Reviewed-by: https://github.com/awesomekling ✅
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2023, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
@ -8,6 +9,8 @@
|
|||||||
|
|
||||||
#include "FontPluginQt.h"
|
#include "FontPluginQt.h"
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
|
#include <AK/String.h>
|
||||||
|
#include <LibCore/StandardPaths.h>
|
||||||
#include <LibGfx/Font/FontDatabase.h>
|
#include <LibGfx/Font/FontDatabase.h>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontInfo>
|
#include <QFontInfo>
|
||||||
@ -21,8 +24,9 @@ FontPluginQt::FontPluginQt()
|
|||||||
// Load the default SerenityOS fonts...
|
// Load the default SerenityOS fonts...
|
||||||
Gfx::FontDatabase::set_default_fonts_lookup_path(DeprecatedString::formatted("{}/res/fonts", s_serenity_resource_root));
|
Gfx::FontDatabase::set_default_fonts_lookup_path(DeprecatedString::formatted("{}/res/fonts", s_serenity_resource_root));
|
||||||
|
|
||||||
// ...and also anything we can find in /usr/share/fonts
|
// ...and also anything we can find in the system's font directories
|
||||||
Gfx::FontDatabase::the().load_all_fonts_from_path("/usr/share/fonts");
|
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::set_default_font_query("Katica 10 400 0");
|
Gfx::FontDatabase::set_default_font_query("Katica 10 400 0");
|
||||||
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
|
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
|
||||||
|
Loading…
Reference in New Issue
Block a user