mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 14:31:10 +01:00
When the requested direction differs from the script's horizontal direction, the Graphite2 shaper reverses the buffer before segmenting. Input cluster values then decrease along the buffer, so assigning each Graphite group the cluster of its base character can leave earlier characters outside the resulting cluster map. Preserve the source span of every Graphite glyph while constructing the output. At monotone cluster levels, seed each glyph from the minimum endpoint of that span and use merge_clusters() over each Graphite output range. Keep the historical base-character behavior at non-monotone levels. HarfBuzz cluster values are opaque client labels and can be repeated or gapped. Merging them can therefore coalesce multiple Graphite layout groups. Preserve the Graphite group index separately for positioning so every group's advance is emitted even when its HarfBuzz cluster was merged. Validate Graphite slot source bounds before indexing the input. Add shape regressions using a subset of Awami Nastaliq and an API test with repeated input clusters. The latter used to merge the output clusters correctly but drop an entire layout-group advance, reducing the total from 3200 to 1269. Tested with: meson test -C build test-graphite2 meson test -C build --suite shape meson test -C build Assisted-by: Codex <codex@openai.com> Co-authored-by: Michael Brown <michael.brown@rubicotech.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>