more font fixes

This commit is contained in:
Matthew 2026-01-03 17:46:26 +11:00
parent be8814cda2
commit 337f4eae87

View File

@ -100,7 +100,7 @@ TextSize(f32 s)
} }
FontAtlasBuf FontAtlasBuf
CreateAtlas(Arena* arena, FontFace font, u32 size, UVec2 atlas_dim, bool y_origin_top = true) CreateAtlas(Arena* arena, FontFace font, u32 size, UVec2 atlas_dim)
{ {
FontAtlasBuf abuf = { FontAtlasBuf abuf = {
data: Alloc!(u8)(arena, atlas_dim.x * atlas_dim.y * 4), data: Alloc!(u8)(arena, atlas_dim.x * atlas_dim.y * 4),
@ -236,7 +236,6 @@ CreateAtlas(Arena* arena, FontFace font, u32 size, UVec2 atlas_dim, bool y_origi
foreach(r; 0 .. bmp.rows) foreach(r; 0 .. bmp.rows)
{ {
y = (base - font.glyph.bitmap_top + r) + max_h; y = (base - font.glyph.bitmap_top + r) + max_h;
Logf("y %s %s %s %s", baseline - font.glyph.bitmap_top +r, baseline, font.glyph.bitmap_top, r);
foreach(c; 0 .. bmp.width) foreach(c; 0 .. bmp.width)
{ {
x = max_w + c; x = max_w + c;
@ -258,8 +257,6 @@ CreateAtlas(Arena* arena, FontFace font, u32 size, UVec2 atlas_dim, bool y_origi
f32 top = font.glyph.bitmap_top; f32 top = font.glyph.bitmap_top;
f32 left = font.glyph.bitmap_left; f32 left = font.glyph.bitmap_left;
assert(y_origin_top, "only y_origin_top is currently supported");
g.ch = cast(dchar)char_code; g.ch = cast(dchar)char_code;
g.advance = cast(f32)(glyph.advance.x >> 6); g.advance = cast(f32)(glyph.advance.x >> 6);
g.plane_left = left; g.plane_left = left;