fix truncated "l" in some cases on wide fonts

minimum width should not be truncated to 0 during layout!
This commit is contained in:
bunnie 2023-07-06 16:15:49 +08:00
parent ee5168254e
commit dee4871f91

View file

@ -126,7 +126,7 @@ pub fn xor_glyph_large(fb: &mut FrBuf, p: &Point, gs: GlyphSprite, xor: bool, cr
return;
}
let high = gs.high as i16 / 2;
let wide = gs.wide as i16 / 2;
let wide = (gs.wide as i16 / 2).max(1);
if high > SPRITE_PX || wide > SPRITE_PX {
// Fail silently if glyph height or width is out of spec
// TODO: Maybe return an error?
@ -206,7 +206,7 @@ pub fn xor_glyph_2x(fb: &mut FrBuf, p: &Point, gs: GlyphSprite, xor: bool, cr: C
return;
}
let high = gs.high as i16 / 2;
let wide = gs.wide as i16 / 2;
let wide = (gs.wide as i16 / 2).max(1);
if high > SPRITE_PX || wide > SPRITE_PX {
// Fail silently if glyph height or width is out of spec
// TODO: Maybe return an error?