From 18a3a38a2b7a41ed8577b9e34dc28cc6fc47f4e3 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Fri, 20 Feb 2026 06:35:52 +0100 Subject: fixing space problem --- src/text.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/text.cc') diff --git a/src/text.cc b/src/text.cc index b76bab2..51ddc9b 100644 --- a/src/text.cc +++ b/src/text.cc @@ -198,16 +198,20 @@ enum font_error_e wayc_font_raster(struct font_s* font, codepoint_t codepoint, FT_GlyphSlot slot = font->face->glyph; FT_Bitmap bitmap = slot->bitmap; - // Pack glyph bitmap into atlas texture and get UV coordinates - vec2 uv0, uv1; - enum atlas_error_e aterr = wayc_atlas_insert( - &font->atlas, bitmap.width, bitmap.rows, bitmap.buffer, &uv0, &uv1); - if (aterr) return FONT_ERROR_ATLAS_FAILED; - vec2 bearing = {(f32)slot->bitmap_left, (f32)slot->bitmap_top}; vec2 size = {(f32)bitmap.width, (f32)bitmap.rows}; f32 advance = (f32)slot->advance.x / WAYC_SCALE; + // Pack glyph bitmap into atlas texture and get UV coordinates + vec2 uv0 = {0.0f, 0.0f}; + vec2 uv1 = {0.0f, 0.0f}; + + if (bitmap.buffer != nullptr) { + enum atlas_error_e aterr = wayc_atlas_insert( + &font->atlas, bitmap.width, bitmap.rows, bitmap.buffer, &uv0, &uv1); + if (aterr) return FONT_ERROR_ATLAS_FAILED; + } + glm_vec2_copy(uv0, got.uv0); glm_vec2_copy(uv1, got.uv1); glm_vec2_copy(size, got.size); -- cgit v1.2.3