1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 10:57:36 +00:00

LibWeb: Make FontPlugin::generic_font_name() return FlyString

This commit is contained in:
Andreas Kling 2023-09-06 07:45:47 +02:00 committed by Tim Flynn
parent 13db3c5ce0
commit 4da1f4e836
6 changed files with 23 additions and 23 deletions

View file

@ -2001,7 +2001,7 @@ RefPtr<Gfx::Font const> StyleComputer::compute_font_for_style_values(DOM::Elemen
float const font_size_in_pt = font_size_in_px * 0.75f;
auto find_font = [&](String const& family) -> RefPtr<Gfx::Font const> {
auto find_font = [&](FlyString const& family) -> RefPtr<Gfx::Font const> {
font_selector = { family, font_size_in_pt, weight, width, slope };
FontFaceKey key {
@ -2060,7 +2060,7 @@ RefPtr<Gfx::Font const> StyleComputer::compute_font_for_style_values(DOM::Elemen
default:
return {};
}
return find_font(String::from_deprecated_string(Platform::FontPlugin::the().generic_font_name(generic_font)).release_value_but_fixme_should_propagate_errors());
return find_font(Platform::FontPlugin::the().generic_font_name(generic_font));
};
RefPtr<Gfx::Font const> found_font;

View file

@ -34,7 +34,7 @@ public:
virtual Gfx::Font& default_font() = 0;
virtual Gfx::Font& default_fixed_width_font() = 0;
virtual DeprecatedString generic_font_name(GenericFont) = 0;
virtual FlyString generic_font_name(GenericFont) = 0;
};
}

View file

@ -29,7 +29,7 @@ Gfx::Font& FontPluginSerenity::default_fixed_width_font()
return Gfx::FontDatabase::default_fixed_width_font();
}
DeprecatedString FontPluginSerenity::generic_font_name(GenericFont generic_font)
FlyString FontPluginSerenity::generic_font_name(GenericFont generic_font)
{
// FIXME: Make these configurable at the browser settings level. Fall back to system defaults.
switch (generic_font) {
@ -37,15 +37,15 @@ DeprecatedString FontPluginSerenity::generic_font_name(GenericFont generic_font)
case GenericFont::UiSansSerif:
case GenericFont::Cursive:
case GenericFont::UiRounded:
return default_font().family().to_deprecated_string();
return default_font().family();
case GenericFont::Monospace:
case GenericFont::UiMonospace:
return default_fixed_width_font().family().to_deprecated_string();
return default_fixed_width_font().family();
case GenericFont::Serif:
case GenericFont::UiSerif:
return "Roman";
return "Roman"_fly_string;
case GenericFont::Fantasy:
return "Comic Book";
return "Comic Book"_fly_string;
case GenericFont::__Count:
VERIFY_NOT_REACHED();
}

View file

@ -18,7 +18,7 @@ public:
virtual Gfx::Font& default_font() override;
virtual Gfx::Font& default_fixed_width_font() override;
virtual DeprecatedString generic_font_name(GenericFont) override;
virtual FlyString generic_font_name(GenericFont) override;
};
}