From 0d9d4c50bbd4a33a309ccb498b6bc55509c1dfed Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 27 Sep 2026 23:12:16 +0100 Subject: Centre a wide character's glyph in its two cells A Hangul or CJK glyph is one em across, less than two cells of a monospace Latin font (1.2 em for DejaVu Sans Mono), and was drawn from the left of its cells, so syllables stood apart unevenly. A cached glyph now keeps its advance in pixels, and a wide character's glyph is drawn centred in its two cells. --- symbols/symbols.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'symbols/symbols.c') diff --git a/symbols/symbols.c b/symbols/symbols.c index f00639a..2ee5d5e 100644 --- a/symbols/symbols.c +++ b/symbols/symbols.c @@ -237,7 +237,7 @@ const VegaBitmap *vega_glyph(VegaGlyphs *glyphs, uint32_t code) { if (pixels) vega_symbol_raster(glyphs->symbols, &symbol, glyphs->scale, place.left / glyphs->scale, place.top / glyphs->scale, place.width, place.height, pixels, (size_t)place.width); - slot->bitmap = (VegaBitmap){place, pixels}; + slot->bitmap = (VegaBitmap){place, pixels, (int)lroundf(symbol.advance * glyphs->scale)}; return &slot->bitmap; } -- cgit v1.2.3