diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-20 06:35:52 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-20 06:35:52 +0100 |
| commit | 18a3a38a2b7a41ed8577b9e34dc28cc6fc47f4e3 (patch) | |
| tree | 82125b1a05a9929f919145c11fb4bb9e0e308311 | |
| parent | 38cc5c34f481e2e89fc59ae54ff7ee3134b5b849 (diff) | |
fixing space problem
| -rw-r--r-- | src/text.cc | 16 |
1 files changed, 10 insertions, 6 deletions
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); |
