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

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
parent 6c8e9fa1b3
commit 93c9344e35
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;