Commit Graph
147 Commits
Author SHA1 Message Date
Khaled Hosny 6b6f0d9770 [GPOS] Apply mark-attachment cross-direction offsets immediately
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.
2026-07-30 23:27:22 +03:00
Khaled Hosny 6cc6d89e05 [GPOS] Count decomposed pieces as one ligature component
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
2026-07-25 13:35:41 +03:00
Khaled Hosny a49431bcf9 [GPOS] Attach mark to first component of MultipleSubst in MarkLigPos
Do what MarkBasePos already does, so the backward search skips the
leftover pieces of a decomposition instead of giving up on them.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4969
2026-07-25 13:35:28 +03:00
j0j1j2 72dfc30899 [hangul] Apply 'calt' feature to non-Hangul characters in Hangul runs (#6030) 2026-06-16 13:55:17 +02:00
Khaled Hosny 8d24ed6cd6 [arabic-pua] Fix mapping for isolated lam alef maksura ligature (#5985)
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
2026-05-17 15:24:40 -06:00
David Corbett 27f1be922e [indic] Categorize U+1CF5 and U+1CF6 as CS (#5949) 2026-04-18 19:54:27 -06:00
Behdad EsfahbodandClaude Sonnet 4.6 63fb2eec90 Monotone characters fixups (#5752)
* [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>
2026-02-20 11:25:24 -07:00
Khaled Hosny 46bc4e95f9 [kbts] Update to version 2.0 2025-11-28 12:56:36 +02:00
Behdad Esfahbod 33f8ee8efc [test] Add HarfBust tests 2025-11-10 02:55:44 -07:00
Behdad Esfahbod b11c14227f Match backtrack/lookahead per syllable (#5635)
* [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
2025-11-04 13:49:52 -07:00
Khaled Hosny 6105bad187 Fix applying synthetic slight to glyph origins (#5629)
* Fix applying synthetic slight to glyph origins

The hb_font_t::get_glyph_[h/v]_origins() methods were applying all the
transformations to the first glyph in the buffer. This shows up for
vertical text only because h_origin callback is usually unset.

Fixes https://github.com/harfbuzz/harfbuzz/issues/5628

* Don’t apply slant to glyph origin

Per discussion in https://github.com/harfbuzz/harfbuzz/issues/5628#issuecomment-3459345504

* Disable only font functions that fail
2025-10-29 13:59:51 -06:00
Harry Dalton 780b986659 [shape] Test fallback to kern table under different shapers
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.
2025-10-17 16:26:21 -06:00
Khaled Hosny 189358e3d0 [test] Add test for harfrust#278 (#5610)
Add test case for https://github.com/harfbuzz/harfrust/pull/278
2025-10-14 20:06:26 -06:00
David Corbett e189b34ec9 [Unicode 17] Update the emoji table & cluster test 2025-09-10 11:19:14 -04:00
Behdad Esfahbod 2c22a65f0c [test] Add test for would_apply with multiple subtables
From HarfRust issue:
https://github.com/harfbuzz/harfrust/issues/118
2025-08-08 15:14:16 -06:00
Behdad Esfahbod 4f8193ceff [tests/vertical] Add test for previous commit 2025-07-26 13:06:45 -06:00
Khaled Hosny 16fe5422b6 [kbts] Add some tests 2025-07-23 21:39:23 +03:00
Behdad Esfahbod d47a319b82 [rust] Roll deps forward
Adjust tests. See:

https://github.com/harfbuzz/harfbuzz/issues/5388
2025-07-15 12:08:00 -06:00
Behdad Esfahbod 604056056c [test/shape] Move LucidaGrande test to macos.tests 2025-05-09 23:17:35 -06:00
Behdad Esfahbod 8456c33ac3 [test/shape] Respect @face-loaders directive 2025-04-06 14:33:44 -06:00
Behdad Esfahbod 1f1cbb64ee Merge pull request #5260 from harfbuzz/tap
Use TAP protocol for tests
2025-04-06 14:30:07 -06:00
Behdad Esfahbod 03f4230188 [mac] Add tests for --face-loader
https://github.com/harfbuzz/harfbuzz/issues/5142
2025-04-06 13:32:28 -06:00
Behdad Esfahbod 5a46872853 Add test for https://github.com/harfbuzz/harfbuzz/issues/5232 2025-04-06 13:32:28 -06:00
Behdad Esfahbod a530672f04 [meson.build] Don't use str.replace() method
Too recent.
2025-04-06 02:34:48 -06:00
Behdad Esfahbod 91fd40ac7c [shape] Skip hidden / ignorables during fallback mark positioning
Fixes https://github.com/harfbuzz/harfbuzz/issues/5232
2025-04-01 04:03:41 -06:00
Behdad Esfahbod 4954edb2b1 [test/vertical] Add more tests 2025-03-28 19:19:57 -06:00
Behdad Esfahbod 67314b205a [test/vertical] Enable some on fontations 2025-03-28 16:41:41 -06:00
Behdad Esfahbod 18ced8dbb1 [test/vertical] Add more tests 2025-03-28 16:31:46 -06:00
Behdad Esfahbod cb44134cbf [test/vertical] Test more font-funcs 2025-03-28 15:56:13 -06:00
Behdad Esfahbod 7ba0368200 [test] Enable aat-trak on all font funcs now 2025-03-27 17:14:22 -06:00
Behdad Esfahbod e16a985798 [test/shape/aots] Add directive to run with ot shaper only 2025-03-25 15:17:23 -06:00
Behdad Esfahbod 851d3e33b5 [aots] Fix compile error
Also requires https://github.com/adobe-type-tools/aots/pull/5 to
be merged. Or if that repo is inactive, we can switch to my fork.
2025-03-25 15:06:24 -06:00
Behdad Esfahbod eec9108416 [test/shape] Adjust uniscribe test 2025-03-25 13:56:12 -06:00
Khaled Hosny 614013940d [test/shape] Update comment 2025-03-25 19:24:00 +02:00
Khaled Hosny 6cf308c857 [test/shape] Remove @font-funcs-=directwrite from directwrite test
The directwrite font functions support variations now, so this is no
longer needed.
2025-03-25 10:34:43 +02:00
Khaled Hosny 1402ecfecf [test/shape] Use @shapers directive in uniscribe test 2025-03-25 10:33:38 +02:00
Behdad Esfahbod 46a30fe390 [test/shape] Respect @shapers directive 2025-03-24 18:23:34 -06:00
Behdad Esfahbod 74c82b3a29 Blacken 2025-03-23 11:52:45 -06:00
Behdad Esfahbod f0e260ad73 [text-rendering-tests] Run against ot,ft only
See https://github.com/harfbuzz/harfbuzz/pull/5188
2025-03-23 11:51:58 -06:00
Behdad Esfahbod 8ae92d0d83 [text-rendering-tests] Run against all font-funcs
One test is failing with fontations, and a few with directwrite.
2025-03-22 13:22:37 -06:00
Behdad Esfahbod 51a5618c54 [test] Update text-rendering-tests 2025-03-22 13:20:16 -06:00
Khaled Hosny 14c07dcfa7 [test] Make context-matching test pass with coretext font functions
Remove the CBDT/CBLC tables not needed for the test and a glyf/loca
tables with blank glyphs to make Core Text load the font.
2025-03-20 18:05:30 -06:00
Khaled Hosny 686503e2e0 [directwrite] Copy font variations when shaping 2025-03-20 01:59:56 +02:00
Behdad Esfahbod 0349359ce6 [tests] Fix one test 2025-03-18 14:59:26 -06:00
Behdad Esfahbod 696b4a26a8 [coretext] Blocklist one more shape test 2025-03-17 21:05:21 -06:00
Behdad Esfahbod ad9c473759 [test/shape] Make output less verbose 2025-03-17 21:05:21 -06:00
Behdad Esfahbod 630bc9b45d [coretext] Disable variation-selectors test :-( 2025-03-17 21:05:21 -06:00
Behdad Esfahbod 719dafdaad [test/shape] Allow comments in directives
Also adjust tests for directwrite font-funcs.
2025-03-17 21:05:21 -06:00
Behdad Esfahbod ee34711d64 [test/shape] Allow directives to instruct what backends to test 2025-03-17 21:05:21 -06:00
Behdad Esfahbod aacc667e51 [test/shape/run-tests] Streamline testing other backends 2025-03-17 21:05:21 -06:00