diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-26 23:54:07 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-27 01:14:56 +0100 |
commit | ee883372f69170312215b0cc8374aac303a02223 (patch) | |
tree | 74a1ed7266897592fa6db00158a6a2bcbe839a7c /Userland/Libraries/LibGfx/FontDatabase.cpp | |
parent | eeeaf410fbe4735a3495f1cec05b22cc25b2a904 (diff) | |
download | serenity-ee883372f69170312215b0cc8374aac303a02223.zip |
LibGfx: Make FontDatabase lookups take font (point) sizes as float
This will allow web content to ask for fractional sizes, which becomes
important when converting between px/pt.
Diffstat (limited to 'Userland/Libraries/LibGfx/FontDatabase.cpp')
-rw-r--r-- | Userland/Libraries/LibGfx/FontDatabase.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp index 30c1afaf33..e761f5d89b 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/FontDatabase.cpp @@ -161,20 +161,20 @@ RefPtr<Gfx::Font> FontDatabase::get_by_name(StringView name) return it->value; } -RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, unsigned size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match) +RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match) { for (auto typeface : m_private->typefaces) { if (typeface->family() == family && typeface->weight() == weight && typeface->slope() == slope) - return typeface->get_font(size, allow_inexact_size_match); + return typeface->get_font(point_size, allow_inexact_size_match); } return nullptr; } -RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, FlyString const& variant, unsigned 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) { for (auto typeface : m_private->typefaces) { if (typeface->family() == family && typeface->variant() == variant) - return typeface->get_font(size, allow_inexact_size_match); + return typeface->get_font(point_size, allow_inexact_size_match); } return nullptr; } |