From 482c0db8b2c9ab6b14ff4d8bcb4a85bd9a9f4549 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 20 Aug 2025 03:37:12 +1000 Subject: [PATCH] set font atlas to set width for ascii only --- fonts.d | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/fonts.d b/fonts.d index 53d229a..bf7d96a 100644 --- a/fonts.d +++ b/fonts.d @@ -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; }