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

LibGfx: Add a simple Gfx::FontMetrics and Gfx::Font::metrics(code_point)

This is used to get a handy set of glyph metrics.
This commit is contained in:
Andreas Kling 2021-09-23 13:12:11 +02:00
parent 3d36e4d944
commit d7586aff53
3 changed files with 20 additions and 0 deletions

View file

@ -373,4 +373,14 @@ Font const& Font::bold_variant() const
return *m_bold_variant;
}
FontMetrics Font::metrics(u32 code_point) const
{
return FontMetrics {
.size = (float)presentation_size(),
.x_height = (float)x_height(),
.glyph_width = (float)glyph_width(code_point),
.glyph_spacing = (float)glyph_spacing(),
};
}
}