LibGfx: Add Font::pixel_size_rounded_up()

This returns the font's size (distance between ascender and descender)
in pixels, rounded up to the nearest integer.

This is the number we want to use in a lot of UI code, so let's have
a friendly API for it instead of ceil'ing the pixel_size() in a million
random places.
This commit is contained in:
Andreas Kling 2023-03-03 19:30:55 +01:00
commit 93c9344e35
Notes: sideshowbarker 2024-07-17 06:46:15 +09:00
4 changed files with 25 additions and 2 deletions

View file

@ -155,9 +155,14 @@ public:
virtual FontPixelMetrics pixel_metrics() const = 0;
virtual u8 presentation_size() const = 0;
virtual float pixel_size() const = 0;
virtual u8 slope() const = 0;
// Font pixel size (distance between ascender and descender).
virtual float pixel_size() const = 0;
// Font pixel size, rounded up to the nearest integer.
virtual int pixel_size_rounded_up() const = 0;
virtual u16 width() const = 0;
virtual u16 weight() const = 0;