1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:17:35 +00:00

LibGfx: Add Font::AllowInexactSizeMatch parameter to font lookup

This allows bitmap font lookup to return the best matching size instead
of failing completely. The previous behavior (exact matches only)
remains the default.
This commit is contained in:
Andreas Kling 2022-02-25 13:30:08 +01:00
parent 95715f0c8f
commit 4dd9e2df78
5 changed files with 28 additions and 8 deletions

View file

@ -44,8 +44,8 @@ public:
static void set_fixed_width_font_query(String);
static void set_default_fonts_lookup_path(String);
RefPtr<Gfx::Font> get(const String& family, unsigned size, unsigned weight, unsigned slope);
RefPtr<Gfx::Font> get(const String& family, const String& variant, unsigned size);
RefPtr<Gfx::Font> get(const String& family, unsigned size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
RefPtr<Gfx::Font> get(const String& family, const String& variant, unsigned size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
RefPtr<Gfx::Font> get_by_name(StringView);
void for_each_font(Function<void(const Gfx::Font&)>);
void for_each_fixed_width_font(Function<void(const Gfx::Font&)>);