set font atlas to set width for ascii only

This commit is contained in:
Matthew 2025-08-20 03:37:12 +10:00
parent c0d9de9c4e
commit 482c0db8b2

View File

@ -28,7 +28,7 @@ struct FontAtlas
f32 descender;
f32 underline_y;
f32 underline_thickness;
Glyph[] glyphs;
Glyph[128] glyphs;
}
struct Glyph
@ -137,8 +137,6 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
count += 1;
}
atlas.atlas.glyphs = AllocArray!(Glyph)(arena, count);
max_w = 0;
max_h = 0;
current_h = 0;
@ -182,7 +180,7 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
}
}
Glyph* g = atlas.atlas.glyphs.ptr + count;
Glyph* g = atlas.atlas.glyphs.ptr + char_count;
g.ch = cast(dchar)char_code;
g.advance = cast(f32)(glyph.advance.x >> 6);
@ -201,11 +199,8 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
count += 1;
}
}
return atlas;
}