gems/vfs_font: improve glyph bb sanity check

Issue #5374
This commit is contained in:
Norman Feske 2024-11-15 11:15:14 +01:00 committed by Christian Helmuth
parent 052dd903a4
commit 0eefe2d872

View File

@ -68,10 +68,10 @@ class Genode::Vfs_font : public Text_painter::Font
void with_glyph(Text_painter::Area const bb, auto const &fn) const
{
/* consider glyph bounds exceeding the font's bounding box */
uint8_t const clipped_h = uint8_t(_width ? (bb.count() / _width) : 0u);
unsigned const clipped_h = _width ? unsigned(bb.count() / _width) : 0u;
fn(Glyph { .width = _width,
.height = min(_height, clipped_h),
.height = min(unsigned(_height), clipped_h),
.vpos = _vpos,
.advance = _advance(),
.values = _values });