From bafb710f0047751e26b87897eaf2a05609708536 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 28 Sep 2026 15:20:08 +0100 Subject: Shape Syriac, stretch with stch, and fall back for fonts without Arabic forms The rest of HarfBuzz 10.2's Arabic shaper. Joining types now come from HarfBuzz's own table (Unicode 16, with Syriac's Alaph and Dalath-Rish groups the state machine's last two columns use), the general category deciding where it has none, so Syriac shapes with fin2, fin3 and med2. What stch multiplies is recorded and, after positioning, stretched under the word before it, repeating pieces copied as often as fit. A font with presentation forms but no Arabic features gets HarfBuzz's fallback lookups, which the build tool writes as OpenType and the runtime applies at their pause like any GSUB lookup. The generator now reads HarfBuzz's generated tables through their lookup functions' ranges and offsets: rows whose range starts mid-row have blank cells in front, which the row comments alone miscounted (Arabic Supplement); the Indic table, read again this way, did not change. Noto Sans Syriac, FreeSans's Syriac, Unifont's Arabic and Noto Sans Arabic shape as HarfBuzz does at 3,000 runs a plan; no installed font is refused any more (213 fonts, 1,822 plans). --- text/syllabic.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'text/syllabic.h') diff --git a/text/syllabic.h b/text/syllabic.h index d03116b..767fada 100644 --- a/text/syllabic.h +++ b/text/syllabic.h @@ -51,4 +51,17 @@ typedef struct { unsigned broken; /* the broken cluster's type, plus one */ } VegaMachine; extern const VegaMachine vega_indic_machine, vega_khmer_machine, vega_myanmar_machine, vega_use_machine; + +/* Arabic's joining type (hb-ot-shaper-arabic-table.hh): U 0, L 1, R 2, D and + * C 3, Syriac's Alaph 4 and Dalath-Rish 5, T 7, and 8 where the general + * category decides (T for Mn, Me and Cf, else U). */ +uint8_t vega_arabic_joining(uint32_t u); +/* For fallback shaping: the presentation forms (init, medi, fina, isol) of + * U+0621..06D3, and the ligatures of presentation forms, in HarfBuzz's + * order: those of three components, of two, of marks. */ +enum { VEGA_ARABIC_FORMS_FIRST = 0x0621, VEGA_ARABIC_FORMS_LAST = 0x06D3 }; +extern const uint16_t vega_arabic_forms[VEGA_ARABIC_FORMS_LAST - VEGA_ARABIC_FORMS_FIRST + 1][4]; +typedef struct { uint16_t first, ligature, components[2]; } VegaArabicLigature; +typedef struct { const VegaArabicLigature *ligatures; unsigned count, length; } VegaArabicLigatures; +extern const VegaArabicLigatures vega_arabic_ligatures[3]; #endif -- cgit v1.2.3