Files
harfbuzz/test/shape
Behdad Esfahbod 0e6a9c81f0 [indic] Fix Unicode 18 shaping and Rust table generation (#6544)
* [indic] Include Unicode 18 Devanagari and Bengali additions

The block filter discarded U+11B0A even though the Unicode 18 data
classifies it as a consonant. Following marks therefore formed broken
syllables and received unwanted dotted circles. The same omission
excluded Bengali Supplement's U+11DF0 and U+11DF1.

Include both blocks and regenerate the Indic table. These three code
points are the only effective classification changes. Add nine shaping
cases using the existing Adobe Blank font, including a valid-syllable
control and an isolated anusvara that needs a dotted circle.

Eight new cases fail before the fix. All 275 Meson tests pass after it,
including the full shaping suite.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6452
Assisted-by: OpenAI Codex

* [gen] Preserve current Rust vowel-constraint buffer access

The shared generator still emitted direct field access through
buffer.cur(), which now returns Option in HarfRust. Regenerating the
file also lost its checked access to output glyph information.

Emit the cur_glyph helper and guarded output lookup already used by
the checked-in Rust implementation. The regenerated Rust functions
match HarfRust after its import adaptations, and the C++ output is
byte-for-byte unchanged.

All 275 Meson tests pass. HarfRust's default and all-feature workspace
tests pass with the regenerated functions.

Assisted-by: OpenAI Codex

* [test] Keep Unicode 18 Indic cases in a dedicated shaping file

Group the new cases in indic-unicode18.tests so HarfRust can import
these generated tests without replacing existing Indic regressions.
Register the file in the in-house shaping suite.

All 275 Meson tests pass.

Assisted-by: OpenAI Codex

* [gen] Emit HarfRust names directly from the shared generators

Generate the Rust module paths, type names, and table symbol prefixes
used by HarfRust at their source. This removes the need for text
rewrites in HarfRust's Unicode-table makefile.

All eight Rust outputs are byte-for-byte identical to the previous
postprocessed outputs. All seven C/C++ generator outputs are
byte-for-byte unchanged, and all 275 Meson tests pass.

Assisted-by: OpenAI Codex
2026-11-01 19:14:23 -07:00
..
2021-08-11 18:49:59 -06:00
2021-08-11 18:49:59 -06:00
2025-06-14 11:02:37 -06:00

Adding tests

You can test shaping of a unicode sequence against a font like this:

$ ./hb-unicode-encode 41 42 43 627 | ../../util/hb-shape font.ttf

assuming an in-tree build. The 41 42 43 627 here is a sequence of Unicode codepoints: U+0041,0042,0043,0627. When you are happy with the shape results, you can use the record-test.sh script to add this to the test suite. record-test.sh requires pyftsubset to be installed. You can get pyftsubset by installing FontTools from https://github.com/behdad/fonttools.

To use record-test.sh, just put it right before the hb-shape invocation:

$ ./hb-unicode-encode 41 42 43 627 | ./record-test.sh ../../util/hb-shape font.ttf

hb-subset and hb-view are resolved as sibling executables next to the provided hb-shape binary.

what this does is:

  • Subset the font for the sequence of Unicode characters requested,
  • Compare the hb-shape output of the original font versus the subset font for the input sequence,
  • If the outputs differ, perhaps it is because the font does not have glyph names; it then compares the output of hb-view for both fonts.
  • If the outputs differ, recording fails. Otherwise, it will move the subset font file into data/in-house/fonts and name it after its hash, and print out the test case input, which you can then redirect to an existing or new test file in data/in-house/tests using -o, e.g.:
$ ./hb-unicode-encode 41 42 43 627 | ./record-test.sh -o data/in-house/tests/test-name.tests ../../util/hb-shape font.ttf

If you created a new test file, add it to data/in-house/meson.build so it is run. Check that make check does indeed run it, and that the test passes. When everything looks good, git add the new font as well as the new test file if you created any. You can see what new files are there by running git status data/in-house. And commit!

Note! Please only add tests using Open Source fonts, preferably under OFL or similar license.