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.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'symbols/symbols.h') diff --git a/symbols/symbols.h b/symbols/symbols.h index 0af3412..32f48d0 100644 --- a/symbols/symbols.h +++ b/symbols/symbols.h @@ -62,7 +62,8 @@ void vega_symbol_raster(const VegaSymbols *, const VegaSymbol *, double scale, d /* Symbols drawn once at one scale and kept, for surfaces that compose them * on the CPU: each the first time it is asked for. */ -typedef struct { VegaPlace place; const unsigned char *pixels; } VegaBitmap; /* pixels: place.width per row */ +/* pixels: place.width per row; advance: how far the pen moves after it, in whole pixels */ +typedef struct { VegaPlace place; const unsigned char *pixels; int advance; } VegaBitmap; typedef struct VegaGlyphs VegaGlyphs; VegaGlyphs *vega_glyphs_open(const VegaSymbols *, float scale); /* The bitmap of code, or NULL when the file has no such symbol. */ -- cgit v1.2.3