diff options
| author | eunhhu <[email protected]> | 2026-09-28 12:48:45 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 12:48:45 +0100 |
| commit | c38380464d29c4502c98d996236ccf890392fe86 (patch) | |
| tree | 2c510e29207427fd105f5bd87425deb5b01b208e /symbols/symbols.h | |
| parent | 16d84b2530e154795a825fbf2b7e028e2f209b71 (diff) | |
| download | vega-c38380464d29c4502c98d996236ccf890392fe86.tar.gz vega-c38380464d29c4502c98d996236ccf890392fe86.zip | |
Shape text as HarfBuzz does, from a symbol file, checked against HarfBuzz
The build tool compiles a font's shaping plans the way HarfBuzz's planner
does (features, stages, masks, lookups per script and direction) and
carries them with the font's character map, advances and GDEF, GSUB and
GPOS tables in a section of the symbol file (VEGASYM4); glyphs shaping
reaches become symbols of their own. A small engine ports HarfBuzz 10's
default, Arabic and Hebrew shaping step for step and reads the tables in
place, every read bounds-checked. The build refuses a file whose shaping
differs from HarfBuzz's on random runs: DejaVu Sans agrees on 600,000
runs in six scripts both ways, and every installed font the tool accepts
agrees too, at 1.05-1.18 times HarfBuzz's time.
Diffstat (limited to 'symbols/symbols.h')
| -rw-r--r-- | symbols/symbols.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/symbols/symbols.h b/symbols/symbols.h index 32f48d0..f6a6175 100644 --- a/symbols/symbols.h +++ b/symbols/symbols.h @@ -26,7 +26,14 @@ typedef struct { uint16_t units; /* per em */ int16_t ascent, descent; /* a font's line, in units from the baseline, y up (0 and 0 for icons) */ uint32_t symbols, points; + /* A font's shaping (text/shape.h), when the file carries it: after the + * points, a flag in the header saying so (VEGASYM4). */ + const unsigned char *shaping; + size_t shaping_size; } VegaSymbols; +/* The glyphs shaping gives are the shaped font's own: glyph g is the symbol + * VEGA_GLYPH_SYMBOLS + g (past every code point). */ +enum { VEGA_GLYPH_SYMBOLS = 0x110000, VEGA_SYMBOLS_SHAPING = 1 }; /* Verify bytes as a symbol file (kept, not copied); false with why. What * reading needs is checked, per symbol: after this no read leaves the file |
