From 993871c6dfa19cf4e0bd4a16c9aad26cb0025d70 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 27 Sep 2026 14:54:53 +0100 Subject: Draw the TUI's cells as pixels with the symbols' glyphs vega pixels runs the same scripts as tui --dump and writes each frame as an image: the view's cells (only those on screen are evaluated) become glyphs, each drawn once per size with the exact area of its curves, in its tone's colour on its row's background. No page, no scene in between. A 1920x1350 grid takes 12 ms a frame here, writing the image included. Symbol files carry the font's line now (format 3: ascent and descent where format 2 kept zeros), the cell height and baseline; and the build tool takes fonts in order, later ones filling the codes earlier ones lack: a CJK font alone drew ambiguous-width arrows two cells wide in a one-cell grid, which the new check caught, so a monospace Latin font comes first and Hangul after. --- surfaces/vega.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'surfaces/vega.h') diff --git a/surfaces/vega.h b/surfaces/vega.h index f01667b..b8e0044 100644 --- a/surfaces/vega.h +++ b/surfaces/vega.h @@ -1,6 +1,7 @@ #ifndef VEGA_H #define VEGA_H #include "module.h" +#include "symbols.h" #include /* Vega reads a verified Pure module by convention (docs/design/001-first-component.md): @@ -121,4 +122,17 @@ void vega_grid_free(VegaGrid *); void vega_draw(VegaGrid *, PureApp *, const VegaScreen *, const char *prompt, size_t prompt_length, bool typing); /* The part and item a line of the last drawn grid shows. */ bool vega_hit(const VegaGrid *, unsigned line, unsigned *part, size_t *item); + +/* Pixels: the grid drawn with a font's glyphs (a symbol file, pixels per em). + * A cell is as wide as a digit and as tall as the font's line; each glyph is + * drawn once, the first time a cell shows it. */ +typedef struct { + VegaGlyphs *glyphs; + int cell_width, cell_height, baseline; +} VegaFace; +bool vega_face_open(VegaFace *, const VegaSymbols *, float pixels); +void vega_face_close(VegaFace *); +/* The grid into out: 0xRRGGBB pixels, grid->width * cell_width across and + * grid->height * cell_height down, stride pixels apart. */ +void vega_pixels(const VegaGrid *, VegaFace *, uint32_t *out, size_t stride); #endif -- cgit v1.2.3