diff options
| author | eunhhu <[email protected]> | 2026-09-28 15:07:51 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 15:07:51 +0100 |
| commit | 218298bb16ef6c147aa6dafc3ea88f62c6fa6ef6 (patch) | |
| tree | 851fa75c1a649fce5b8010c97f1ab36d5a60a035 /text/shape.h | |
| parent | 5788d7e5bd6a26421346d69ae517502527940a0b (diff) | |
| download | vega-218298bb16ef6c147aa6dafc3ea88f62c6fa6ef6.tar.gz vega-218298bb16ef6c147aa6dafc3ea88f62c6fa6ef6.zip | |
Shape Thai and Lao as HarfBuzz does
The Thai shaper, from HarfBuzz 10.2's source: SARA AM comes apart into
NIKHAHIT and SARA AA, the NIKHAHIT moving back over the above-base marks
(and counting as a mark when advances are zeroed). A font with no Thai
script of its own (only DFLT or latn in GSUB) gets its marks shifted to
its private-use glyphs, Windows' before the Mac's, as the stacking
around the base asks; the planner records, as HarfBuzz's does, whether
the font had the script under its own tag.
Noto Sans Thai and Lao, TLWG Loma, FreeSerif's Thai, DejaVu Sans's Lao
and Unifont shape as HarfBuzz does at 3,000 runs a plan, and Loma with
its thai script taken out (so the private-use path runs) at 5,000.
Diffstat (limited to 'text/shape.h')
| -rw-r--r-- | text/shape.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/text/shape.h b/text/shape.h index bd38d96..6e56819 100644 --- a/text/shape.h +++ b/text/shape.h @@ -6,8 +6,8 @@ /* Shaping (docs/design/004-text.md): a run of characters (one script, one * direction) to glyphs and their positions, as HarfBuzz 10 shapes it with - * its default, Arabic, Hebrew, Hangul, Indic, Khmer, Myanmar and Universal - * (USE) shapers, glyph for glyph and unit for unit. + * its default, Arabic, Hebrew, Hangul, Indic, Khmer, Myanmar, Universal + * (USE) and Thai shapers, glyph for glyph and unit for unit. * * What a font's shaping needs travels in a symbol file (its shaping * section), written by the build tool: @@ -48,7 +48,7 @@ enum { VEGA_SHAPING_HEADER = 80, VEGA_PLAN_BYTES = 144, VEGA_STEP_BYTES = 8, VEG VEGA_PLAN_STAGES = 5 }; enum { VEGA_SHAPE_LTR = 1, VEGA_SHAPE_RTL = 2 }; enum { VEGA_SHAPER_DEFAULT, VEGA_SHAPER_ARABIC, VEGA_SHAPER_HEBREW, VEGA_SHAPER_HANGUL, VEGA_SHAPER_INDIC, - VEGA_SHAPER_KHMER, VEGA_SHAPER_MYANMAR, VEGA_SHAPER_USE }; + VEGA_SHAPER_KHMER, VEGA_SHAPER_MYANMAR, VEGA_SHAPER_USE, VEGA_SHAPER_THAI }; /* Plan flags: GPOS runs; mark advances are zeroed after it (by GDEF); glyph * classes come from Unicode (the font has none); the font positions marks * (a 'mark' feature); automatic fractions; the kern table kerns; marks are @@ -71,8 +71,9 @@ enum { VEGA_MASK_USE_RPHF = VEGA_MASK_INIT + 1 }; /* USE: that, and Arab * position by whether they would substitute it. */ enum { VEGA_STAGE_RPHF, VEGA_STAGE_PREF, VEGA_STAGE_BLWF, VEGA_STAGE_PSTF, VEGA_STAGE_VATU }; /* Shaper flags: Indic's font follows the old specification (deva, not - * dev2). */ -enum { VEGA_INDIC_OLD_SPEC = 1 }; + * dev2); Thai's font has no Thai script of its own, so its marks take the + * font's private-use glyphs where it has them. */ +enum { VEGA_INDIC_OLD_SPEC = 1, VEGA_THAI_PUA = 2 }; /* Step flags; pauses, which the shaper tells apart. */ enum { VEGA_STEP_AUTO_ZWNJ = 1, VEGA_STEP_AUTO_ZWJ = 2, VEGA_STEP_RANDOM = 4, VEGA_STEP_PER_SYLLABLE = 8 }; enum { VEGA_STEP_PAUSE = 0xFFFF }; |
