diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2023-04-14 08:52:47 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-15 15:24:50 +0200 |
commit | 55423b4ed06b4db1b61f862250d17f3407671117 (patch) | |
tree | 9ebb7bae0360b068af9857100a6d90ee2272eec9 /Userland/Libraries/LibGfx/Font/ScaledFont.cpp | |
parent | c9404c3a63850719d79837a5c888382760b5d620 (diff) | |
download | serenity-55423b4ed06b4db1b61f862250d17f3407671117.zip |
LibGfx+Userland: Add width_rounded_up() helper
Diffstat (limited to 'Userland/Libraries/LibGfx/Font/ScaledFont.cpp')
-rw-r--r-- | Userland/Libraries/LibGfx/Font/ScaledFont.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/Font/ScaledFont.cpp b/Userland/Libraries/LibGfx/Font/ScaledFont.cpp index 6a9891fb01..441639bc97 100644 --- a/Userland/Libraries/LibGfx/Font/ScaledFont.cpp +++ b/Userland/Libraries/LibGfx/Font/ScaledFont.cpp @@ -36,6 +36,11 @@ ScaledFont::ScaledFont(NonnullRefPtr<VectorFont> font, float point_width, float }; } +int ScaledFont::width_rounded_up(StringView view) const +{ + return static_cast<int>(ceilf(width(view))); +} + float ScaledFont::width(StringView view) const { return unicode_view_width(Utf8View(view)); } float ScaledFont::width(Utf8View const& view) const { return unicode_view_width(view); } float ScaledFont::width(Utf32View const& view) const { return unicode_view_width(view); } |