1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:47: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

@ -43,6 +43,7 @@ public:
void set_presentation_size(u8 size) { m_presentation_size = size; }
virtual float pixel_size() const override { return m_glyph_height; }
virtual int pixel_size_rounded_up() const override { return m_glyph_height; }
u16 width() const override { return FontWidth::Normal; }