LibGfx: Convert FontDatabase APIs to use FlyString

This commit is contained in:
Andreas Kling 2023-09-05 20:19:33 +02:00 committed by Tim Flynn
parent e4d14e1afc
commit 13db3c5ce0
Notes: sideshowbarker 2024-07-17 07:16:27 +09:00
15 changed files with 66 additions and 62 deletions

View file

@ -34,11 +34,11 @@ FontPlugin::FontPlugin(bool is_layout_test_mode)
update_generic_fonts();
auto default_font_name = generic_font_name(Web::Platform::GenericFont::UiSansSerif);
m_default_font = Gfx::FontDatabase::the().get(default_font_name, 12.0, 400, Gfx::FontWidth::Normal, 0);
m_default_font = Gfx::FontDatabase::the().get(MUST(String::from_deprecated_string(default_font_name)), 12.0, 400, Gfx::FontWidth::Normal, 0);
VERIFY(m_default_font);
auto default_fixed_width_font_name = generic_font_name(Web::Platform::GenericFont::UiMonospace);
m_default_fixed_width_font = Gfx::FontDatabase::the().get(default_fixed_width_font_name, 12.0, 400, Gfx::FontWidth::Normal, 0);
m_default_fixed_width_font = Gfx::FontDatabase::the().get(MUST(String::from_deprecated_string(default_fixed_width_font_name)), 12.0, 400, Gfx::FontWidth::Normal, 0);
VERIFY(m_default_fixed_width_font);
}
@ -75,7 +75,7 @@ void FontPlugin::update_generic_fonts()
RefPtr<Gfx::Font const> gfx_font;
for (auto& fallback : fallbacks) {
gfx_font = Gfx::FontDatabase::the().get(fallback, 16, 400, Gfx::FontWidth::Normal, 0, Gfx::Font::AllowInexactSizeMatch::Yes);
gfx_font = Gfx::FontDatabase::the().get(MUST(String::from_deprecated_string(fallback)), 16, 400, Gfx::FontWidth::Normal, 0, Gfx::Font::AllowInexactSizeMatch::Yes);
if (gfx_font)
break;
}

View file

@ -32,7 +32,7 @@ TEST_CASE(test_fontdatabase_get)
{
Gfx::FontDatabase::set_default_fonts_lookup_path(TEST_INPUT(""));
auto& font_database = Gfx::FontDatabase::the();
EXPECT(!font_database.get("Family", 12, 400, Gfx::FontWidth::Normal, 0)->name().is_empty());
EXPECT(!font_database.get("Family"_fly_string, 12, 400, Gfx::FontWidth::Normal, 0)->name().is_empty());
}
TEST_CASE(test_fontdatabase_for_each_font)

View file

@ -321,14 +321,14 @@ static ErrorOr<FontInfo> load_font(StringView path, StringView mime_type, Nonnul
{
if (path.ends_with(".font"sv)) {
auto font = TRY(Gfx::BitmapFont::try_load_from_mapped_file(mapped_file));
auto typeface = TRY(try_make_ref_counted<Gfx::Typeface>(font->family().to_deprecated_string(), font->variant().to_deprecated_string()));
auto typeface = TRY(try_make_ref_counted<Gfx::Typeface>(font->family(), font->variant()));
typeface->add_bitmap_font(move(font));
return FontInfo { FontInfo::Format::BitmapFont, move(typeface) };
}
if (mime_type == "font/otf" || mime_type == "font/ttf") {
auto font = TRY(OpenType::Font::try_load_from_externally_owned_memory(mapped_file->bytes()));
auto typeface = TRY(try_make_ref_counted<Gfx::Typeface>(font->family().to_deprecated_string(), font->variant().to_deprecated_string()));
auto typeface = TRY(try_make_ref_counted<Gfx::Typeface>(font->family(), font->variant()));
typeface->set_vector_font(move(font));
return FontInfo {
mime_type == "font/otf" ? FontInfo::Format::OpenType : FontInfo::Format::TrueType,
@ -338,7 +338,7 @@ static ErrorOr<FontInfo> load_font(StringView path, StringView mime_type, Nonnul
if (mime_type == "font/woff" || mime_type == "font/woff2") {
auto font = TRY(WOFF::Font::try_load_from_externally_owned_memory(mapped_file->bytes()));
auto typeface = TRY(try_make_ref_counted<Gfx::Typeface>(font->family().to_deprecated_string(), font->variant().to_deprecated_string()));
auto typeface = TRY(try_make_ref_counted<Gfx::Typeface>(font->family(), font->variant()));
typeface->set_vector_font(move(font));
return FontInfo {
mime_type == "font/woff" ? FontInfo::Format::WOFF : FontInfo::Format::WOFF2,
@ -381,7 +381,7 @@ ErrorOr<void> PropertiesWindow::create_font_tab(GUI::TabWidget& tab_widget, Nonn
break;
}
tab->find_descendant_of_type_named<GUI::Label>("font_format")->set_text(format_name);
tab->find_descendant_of_type_named<GUI::Label>("font_family")->set_text(TRY(String::from_deprecated_string(typeface->family())));
tab->find_descendant_of_type_named<GUI::Label>("font_family")->set_text(typeface->family().to_string());
tab->find_descendant_of_type_named<GUI::Label>("font_fixed_width")->set_text(typeface->is_fixed_width() ? "Yes"_string : "No"_string);
tab->find_descendant_of_type_named<GUI::Label>("font_width")->set_text(TRY(String::from_utf8(Gfx::width_to_name(static_cast<Gfx::FontWidth>(typeface->width())))));

View file

@ -403,7 +403,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto adjust_font_size = [&](float adjustment) {
auto& font = terminal->font();
auto new_size = max(5, font.presentation_size() + adjustment);
if (auto new_font = Gfx::FontDatabase::the().get(font.family().to_deprecated_string(), new_size, font.weight(), font.width(), font.slope())) {
if (auto new_font = Gfx::FontDatabase::the().get(font.family(), new_size, font.weight(), font.width(), font.slope())) {
terminal->set_font_and_resize_to_fit(*new_font);
terminal->apply_size_increments_to_window(*window);
window->resize(terminal->size());

View file

@ -1856,7 +1856,7 @@ RefPtr<Gfx::Font const> HackStudioWidget::read_editor_font_from_config()
auto font_variant = Config::read_string("HackStudio"sv, "EditorFont"sv, "Variant"sv);
auto font_size = Config::read_i32("HackStudio"sv, "EditorFont"sv, "Size"sv);
auto font = Gfx::FontDatabase::the().get(font_family, font_variant, font_size);
auto font = Gfx::FontDatabase::the().get(MUST(FlyString::from_deprecated_fly_string(font_family)), FlyString::from_deprecated_fly_string(font_variant).release_value_but_fixme_should_propagate_errors(), font_size);
if (font.is_null())
return Gfx::FontDatabase::the().default_fixed_width_font();

View file

@ -30,11 +30,11 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
widget->load_from_gml(font_picker_dialog_gml).release_value_but_fixme_should_propagate_errors();
m_family_list_view = *widget->find_descendant_of_type_named<ListView>("family_list_view");
m_family_list_view->set_model(ItemListModel<DeprecatedString>::create(m_families));
m_family_list_view->set_model(ItemListModel<FlyString>::create(m_families));
m_family_list_view->horizontal_scrollbar().set_visible(false);
m_variant_list_view = *widget->find_descendant_of_type_named<ListView>("variant_list_view");
m_variant_list_view->set_model(ItemListModel<DeprecatedString>::create(m_variants));
m_variant_list_view->set_model(ItemListModel<FlyString>::create(m_variants));
m_variant_list_view->horizontal_scrollbar().set_visible(false);
m_size_spin_box = *widget->find_descendant_of_type_named<SpinBox>("size_spin_box");
@ -57,7 +57,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
m_family_list_view->on_selection_change = [this] {
const auto& index = m_family_list_view->selection().first();
m_family = index.data().to_deprecated_string();
m_family = MUST(String::from_deprecated_string(index.data().to_deprecated_string()));
m_variants.clear();
Gfx::FontDatabase::the().for_each_typeface([&](auto& typeface) {
if (m_fixed_width_only && !typeface.is_fixed_width())
@ -78,7 +78,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
m_variant_list_view->on_selection_change = [this] {
const auto& index = m_variant_list_view->selection().first();
bool font_is_fixed_size = false;
m_variant = index.data().to_deprecated_string();
m_variant = MUST(String::from_deprecated_string(index.data().to_deprecated_string()));
m_sizes.clear();
Gfx::FontDatabase::the().for_each_typeface([&](auto& typeface) {
if (m_fixed_width_only && !typeface.is_fixed_width())
@ -190,15 +190,15 @@ void FontPicker::set_font(Gfx::Font const* font)
return;
}
m_family = font->family().to_deprecated_string();
m_variant = font->variant().to_deprecated_string();
m_family = font->family();
m_variant = font->variant();
m_size = font->presentation_size();
auto family_index = m_families.find_first_index(m_font->family().to_deprecated_string());
auto family_index = m_families.find_first_index(m_font->family());
if (family_index.has_value())
m_family_list_view->set_cursor(m_family_list_view->model()->index(family_index.value()), GUI::AbstractView::SelectionUpdate::Set);
auto variant_index = m_variants.find_first_index(m_font->variant().to_deprecated_string());
auto variant_index = m_variants.find_first_index(m_font->variant());
if (variant_index.has_value())
m_variant_list_view->set_cursor(m_variant_list_view->model()->index(variant_index.value()), GUI::AbstractView::SelectionUpdate::Set);

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/FlyString.h>
#include <LibGUI/Dialog.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Forward.h>
@ -37,12 +38,12 @@ private:
RefPtr<SpinBox> m_size_spin_box;
RefPtr<Label> m_sample_text_label;
Vector<DeprecatedString> m_families;
Vector<DeprecatedString> m_variants;
Vector<FlyString> m_families;
Vector<FlyString> m_variants;
Vector<int> m_sizes;
Optional<DeprecatedString> m_family;
Optional<DeprecatedString> m_variant;
Optional<FlyString> m_family;
Optional<FlyString> m_variant;
Optional<int> m_size;
};

View file

@ -821,25 +821,25 @@ void Widget::set_font(Gfx::Font const* font)
void Widget::set_font_family(String const& family)
{
set_font(Gfx::FontDatabase::the().get(family.to_deprecated_string(), m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
set_font(Gfx::FontDatabase::the().get(family, m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
}
void Widget::set_font_size(unsigned size)
{
set_font(Gfx::FontDatabase::the().get(m_font->family().to_deprecated_string(), size, m_font->weight(), m_font->width(), m_font->slope()));
set_font(Gfx::FontDatabase::the().get(m_font->family(), size, m_font->weight(), m_font->width(), m_font->slope()));
}
void Widget::set_font_weight(unsigned weight)
{
set_font(Gfx::FontDatabase::the().get(m_font->family().to_deprecated_string(), m_font->presentation_size(), weight, m_font->width(), m_font->slope()));
set_font(Gfx::FontDatabase::the().get(m_font->family(), m_font->presentation_size(), weight, m_font->width(), m_font->slope()));
}
void Widget::set_font_fixed_width(bool fixed_width)
{
if (fixed_width)
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_fixed_width_font().family().to_deprecated_string(), m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_fixed_width_font().family(), m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
else
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_font().family().to_deprecated_string(), m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
set_font(Gfx::FontDatabase::the().get(Gfx::FontDatabase::the().default_font().family(), m_font->presentation_size(), m_font->weight(), m_font->width(), m_font->slope()));
}
bool Widget::is_font_fixed_width()

View file

@ -33,7 +33,7 @@ ErrorOr<void> CoverWizardPage::build(String title, String subtitle)
m_content_widget->set_layout<VerticalBoxLayout>(20);
m_header_label = TRY(m_content_widget->try_add<Label>(move(title)));
m_header_label->set_font(Gfx::FontDatabase::the().get("Pebbleton", 14, 700, Gfx::FontWidth::Normal, 0));
m_header_label->set_font(Gfx::FontDatabase::the().get("Pebbleton"_fly_string, 14, 700, Gfx::FontWidth::Normal, 0));
m_header_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
m_header_label->set_fixed_height(48);

View file

@ -409,14 +409,14 @@ String BitmapFont::variant() const
RefPtr<Font> BitmapFont::with_size(float point_size) const
{
return Gfx::FontDatabase::the().get(family().to_deprecated_string(), point_size, weight(), width(), slope());
return Gfx::FontDatabase::the().get(family(), point_size, weight(), width(), slope());
}
Font const& Font::bold_variant() const
{
if (m_bold_variant)
return *m_bold_variant;
m_bold_variant = Gfx::FontDatabase::the().get(family().to_deprecated_string(), presentation_size(), 700, Gfx::FontWidth::Normal, 0);
m_bold_variant = Gfx::FontDatabase::the().get(family(), presentation_size(), 700, Gfx::FontWidth::Normal, 0);
if (!m_bold_variant)
m_bold_variant = this;
return *m_bold_variant;

View file

@ -5,6 +5,7 @@
*/
#include <AK/DeprecatedFlyString.h>
#include <AK/FlyString.h>
#include <AK/Queue.h>
#include <AK/QuickSort.h>
#include <LibCore/DirIterator.h>
@ -117,7 +118,7 @@ Font& FontDatabase::default_fixed_width_font()
struct FontDatabase::Private {
HashMap<DeprecatedString, NonnullRefPtr<Gfx::Font>, CaseInsensitiveStringTraits> full_name_to_font_map;
HashMap<DeprecatedFlyString, Vector<NonnullRefPtr<Typeface>>, CaseInsensitiveStringTraits> typefaces;
HashMap<FlyString, Vector<NonnullRefPtr<Typeface>>, AK::ASCIICaseInsensitiveFlyStringTraits> typefaces;
};
void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root)
@ -144,20 +145,20 @@ void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root)
if (auto font_or_error = Gfx::BitmapFont::try_load_from_file(path); !font_or_error.is_error()) {
auto font = font_or_error.release_value();
m_private->full_name_to_font_map.set(font->qualified_name().to_deprecated_string(), *font);
auto typeface = get_or_create_typeface(font->family().to_deprecated_string(), font->variant().to_deprecated_string());
auto typeface = get_or_create_typeface(font->family(), font->variant());
typeface->add_bitmap_font(font);
}
} else if (path.ends_with(".ttf"sv)) {
// FIXME: What about .otf
if (auto font_or_error = OpenType::Font::try_load_from_file(path); !font_or_error.is_error()) {
auto font = font_or_error.release_value();
auto typeface = get_or_create_typeface(font->family().to_deprecated_string(), font->variant().to_deprecated_string());
auto typeface = get_or_create_typeface(font->family(), font->variant());
typeface->set_vector_font(move(font));
}
} else if (path.ends_with(".woff"sv)) {
if (auto font_or_error = WOFF::Font::try_load_from_file(path); !font_or_error.is_error()) {
auto font = font_or_error.release_value();
auto typeface = get_or_create_typeface(font->family().to_deprecated_string(), font->variant().to_deprecated_string());
auto typeface = get_or_create_typeface(font->family(), font->variant());
typeface->set_vector_font(move(font));
}
}
@ -204,7 +205,7 @@ RefPtr<Gfx::Font> FontDatabase::get_by_name(StringView name)
auto slope = parts.take_last().to_int().value_or(0);
auto weight = parts.take_last().to_int().value_or(0);
auto size = parts.take_last().to_int().value_or(0);
auto family = DeprecatedString::join(' ', parts);
auto family = MUST(String::join(' ', parts));
return get(family, size, weight, Gfx::FontWidth::Normal, slope);
}
dbgln("Font lookup failed: '{}'", name);
@ -213,7 +214,7 @@ RefPtr<Gfx::Font> FontDatabase::get_by_name(StringView name)
return it->value;
}
RefPtr<Gfx::Font> FontDatabase::get(DeprecatedFlyString const& family, float point_size, unsigned weight, unsigned width, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match)
RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, float point_size, unsigned weight, unsigned width, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match)
{
auto it = m_private->typefaces.find(family);
if (it == m_private->typefaces.end())
@ -225,7 +226,7 @@ RefPtr<Gfx::Font> FontDatabase::get(DeprecatedFlyString const& family, float poi
return nullptr;
}
RefPtr<Gfx::Font> FontDatabase::get(DeprecatedFlyString const& family, DeprecatedFlyString const& variant, float point_size, Font::AllowInexactSizeMatch allow_inexact_size_match)
RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch allow_inexact_size_match)
{
auto it = m_private->typefaces.find(family);
if (it == m_private->typefaces.end())
@ -237,7 +238,7 @@ RefPtr<Gfx::Font> FontDatabase::get(DeprecatedFlyString const& family, Deprecate
return nullptr;
}
RefPtr<Typeface> FontDatabase::get_or_create_typeface(DeprecatedString const& family, DeprecatedString const& variant)
RefPtr<Typeface> FontDatabase::get_or_create_typeface(FlyString const& family, FlyString const& variant)
{
auto it = m_private->typefaces.find(family);
if (it != m_private->typefaces.end()) {
@ -260,9 +261,9 @@ void FontDatabase::for_each_typeface(Function<void(Typeface const&)> callback)
}
}
void FontDatabase::for_each_typeface_with_family_name(String const& family_name, Function<void(Typeface const&)> callback)
void FontDatabase::for_each_typeface_with_family_name(FlyString const& family_name, Function<void(Typeface const&)> callback)
{
auto it = m_private->typefaces.find(family_name.bytes_as_string_view());
auto it = m_private->typefaces.find(family_name);
if (it == m_private->typefaces.end())
return;
for (auto const& typeface : it->value)

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
@ -48,14 +49,14 @@ public:
static void set_fixed_width_font_query(DeprecatedString);
static void set_default_fonts_lookup_path(DeprecatedString);
RefPtr<Gfx::Font> get(DeprecatedFlyString const& family, float point_size, unsigned weight, unsigned width, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
RefPtr<Gfx::Font> get(DeprecatedFlyString const& family, DeprecatedFlyString const& variant, float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
RefPtr<Gfx::Font> get(FlyString const& family, float point_size, unsigned weight, unsigned width, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
RefPtr<Gfx::Font> get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
RefPtr<Gfx::Font> get_by_name(StringView);
void for_each_font(Function<void(Gfx::Font const&)>);
void for_each_fixed_width_font(Function<void(Gfx::Font const&)>);
void for_each_typeface(Function<void(Typeface const&)>);
void for_each_typeface_with_family_name(String const& family_name, Function<void(Typeface const&)>);
void for_each_typeface_with_family_name(FlyString const& family_name, Function<void(Typeface const&)>);
void load_all_fonts_from_path(DeprecatedString const&);
@ -63,7 +64,7 @@ private:
FontDatabase();
~FontDatabase() = default;
RefPtr<Typeface> get_or_create_typeface(DeprecatedString const& family, DeprecatedString const& variant);
RefPtr<Typeface> get_or_create_typeface(FlyString const& family, FlyString const& variant);
struct Private;
OwnPtr<Private> m_private;

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/RefCounted.h>
#include <AK/Vector.h>
@ -18,14 +19,14 @@ namespace Gfx {
class Typeface : public RefCounted<Typeface> {
public:
Typeface(DeprecatedString const& family, DeprecatedString const& variant)
: m_family(family)
, m_variant(variant)
Typeface(FlyString family, FlyString variant)
: m_family(move(family))
, m_variant(move(variant))
{
}
DeprecatedFlyString const& family() const { return m_family; }
DeprecatedFlyString const& variant() const { return m_variant; }
FlyString const& family() const { return m_family; }
FlyString const& variant() const { return m_variant; }
unsigned weight() const;
unsigned width() const;
u8 slope() const;
@ -40,8 +41,8 @@ public:
RefPtr<Font> get_font(float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No) const;
private:
DeprecatedFlyString m_family;
DeprecatedFlyString m_variant;
FlyString m_family;
FlyString m_variant;
Vector<RefPtr<BitmapFont>> m_bitmap_fonts;
RefPtr<VectorFont> m_vector_font;

View file

@ -61,25 +61,25 @@ PDFErrorOr<NonnullRefPtr<Gfx::Font>> PDFFont::replacement_for(StringView name, f
bool is_bold = name.contains("bold"sv, CaseSensitivity::CaseInsensitive);
bool is_italic = name.contains("italic"sv, CaseSensitivity::CaseInsensitive);
DeprecatedString font_family;
FlyString font_family;
if (name.contains("times"sv, CaseSensitivity::CaseInsensitive)) {
font_family = "Liberation Serif";
font_family = "Liberation Serif"_fly_string;
} else if (name.contains("courier"sv, CaseSensitivity::CaseInsensitive)) {
font_family = "Liberation Mono";
font_family = "Liberation Mono"_fly_string;
} else {
font_family = "Liberation Sans";
font_family = "Liberation Sans"_fly_string;
}
DeprecatedString font_variant;
FlyString font_variant;
if (is_bold && is_italic) {
font_variant = "BoldItalic";
font_variant = "BoldItalic"_fly_string;
} else if (is_bold) {
font_variant = "Bold";
font_variant = "Bold"_fly_string;
} else if (is_italic) {
font_variant = "Italic";
font_variant = "Italic"_fly_string;
} else {
font_variant = "Regular";
font_variant = "Regular"_fly_string;
}
float point_size = (font_size * POINTS_PER_INCH) / DEFAULT_DPI;

View file

@ -1848,7 +1848,7 @@ RefPtr<Gfx::Font const> StyleComputer::font_matching_algorithm(FontFaceKey const
Gfx::FontDatabase::the().for_each_typeface_with_family_name(key.family_name.to_string(), [&](Gfx::Typeface const& typeface) {
matching_family_fonts.empend(
FontFaceKey {
.family_name = MUST(FlyString::from_deprecated_fly_string(typeface.family())),
.family_name = typeface.family(),
.weight = static_cast<int>(typeface.weight()),
.slope = typeface.slope(),
},
@ -2022,7 +2022,7 @@ RefPtr<Gfx::Font const> StyleComputer::compute_font_for_style_values(DOM::Elemen
if (auto found_font = font_matching_algorithm(key, font_size_in_pt))
return found_font;
if (auto found_font = Gfx::FontDatabase::the().get(family.to_deprecated_string(), font_size_in_pt, weight, width, slope, Gfx::Font::AllowInexactSizeMatch::Yes))
if (auto found_font = Gfx::FontDatabase::the().get(family, font_size_in_pt, weight, width, slope, Gfx::Font::AllowInexactSizeMatch::Yes))
return found_font;
return {};