Fixes https://github.com/harfbuzz/harfbuzz/issues/4596
See the issue for more details.
Instead of deferring mark positioning to the end of GPOS application, we
now apply cross-direction offsets (y-direction in horizontal text)
immediately and keep applying main-direction (x-direction in horizontal
text) as before.
This is still not 100% compatible with DirectWrite or Core Text (they
apply both directions immediately), but enough to fix the reported
issue.
Based on Behdad’s patch below, but fixes the Noto Nastaliq regression by
resolving the base offset through the whole cursive attachment chain
since cursive offsets are relative the previous glyph and get finalized
only at end of GPOS:
https://github.com/harfbuzz/harfbuzz/issues/4596#issuecomment-2276300688
The remaining failure is not a regression, the new expectation now match
DirectWrite and Core Text.
The tests include a subsetted bug font, as well as two constructed fonts
where curs lookup come before mark ones, once with kern before mark and
with kern after mark, to show that lookup order affects y but not
x-direction.
Non-first pieces of a MultipleSubst now add no extra component, so a
decomposed glyph absorbed into a ligature counts as the single component
it started as, and its marks attach where MarkBasePos would.
Part of https://github.com/harfbuzz/harfbuzz/issues/4969
Correct the ArabicPUATraditional.txt entry for 0xF295 which should be
isolated not final form. Also enable 0xFC43 ligature so the ligature is
actually used.
Fixes https://github.com/harfbuzz/harfbuzz/issues/5984
* [buffer] Fix a typo and doc string
* [buffer] Add merge_grapheme_clusters / merge_out_grapheme_clusters
Cluster merges serve two distinct purposes that require different level
gates:
- Grapheme grouping: combining marks merged into their base cluster.
Correct gate: IS_GRAPHEMES (levels 0 and 3).
New functions: merge_grapheme_clusters / merge_out_grapheme_clusters.
- Monotonicity maintenance: clusters merged to prevent non-monotone
output after ligature formation, reordering, etc.
Correct gate: IS_MONOTONE (levels 0 and 1).
Existing functions: merge_clusters / merge_out_clusters.
Previously both paths shared merge_clusters_impl's single IS_MONOTONE
gate, so GRAPHEMES (level 3) was incorrectly blocked from merging
grapheme clusters. This also caused a regression in the Thai and
Hangul shapers for MONOTONE_CHARACTERS (level 1): when their explicit
== MONOTONE_GRAPHEMES call-site guards were removed in #5069, the
impls' IS_MONOTONE gate no longer protected them.
Gates are now in the inline wrappers in hb-buffer.hh; the _impl
functions are gate-free. hb_form_clusters, CoreText grapheme
detection, and the Thai/Hangul shapers are updated to call the
grapheme-semantic variants. Fixes#5750.
Fixes https://github.com/harfbuzz/harfbuzz/issues/5751
Fixes https://github.com/harfbuzz/harfbuzz/issues/5750
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [thai] Adjust grapheme merging logic
* [hangul] Tweak grapheme merging
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* [match-backtrack] Fix syllable-setting logic
If accidentally backtrack_len() was equal idx, we were setting
syllable, even though we want to match backtrack, which shouldn't
match syllable.
I'm surprised how this was not exposed before.
Fixes https://github.com/harfbuzz/harfbuzz/issues/5597
* Always match backtrack per syllable
* Always match lookahead per syllable as well
* Add Indic test for per-syllable backtrack/lookahead matching
More specifically, this asserts that the `kern` table is avoided for
certain shapers, and that we avoid double-spacing in the presence of
`dist` for the same.