• Home
Name Date Size #Lines LOC

..--

fonts/sha1sum/03-May-2024-

tests/03-May-2024-198172

texts/in-tree/03-May-2024-32,13131,805

Makefile.amD03-May-20241.9 KiB9680

README.mdD03-May-20241.8 KiB4136

hb-diffD03-May-2024227 116

hb-diff-colorizeD03-May-2024253 84

hb-diff-filter-failuresD03-May-2024166 62

hb-diff-ngramsD03-May-2024110 62

hb-diff-statD03-May-2024108 62

hb-manifest-readD03-May-2024156 62

hb-manifest-updateD03-May-2024128 62

hb-unicode-decodeD03-May-2024130 62

hb-unicode-encodeD03-May-2024134 62

hb-unicode-prettynameD03-May-2024175 73

hb_test_tools.pyD03-May-202413.8 KiB562456

record-test.shD03-May-20242.4 KiB9682

run-tests.shD03-May-20241.1 KiB5344

README.md

1Adding tests
2============
3
4You can test shaping of a unicode sequence against a font like this:
5```sh
6$ ./hb-unicode-encode 41 42 43 627 | ../../util/hb-shape font.ttf
7```
8assuming an in-tree build.  The 41 42 43 627 here is a sequence of
9Unicode codepoints: U+0041,0042,0043,0627.  When you are happy with
10the shape results, you can use the `record-test.sh` script to add
11this to the test suite.  `record-test.sh` requires `pyftsubset` to
12be installed.  You can get `pyftsubset` by installing
13FontTools from <https://github.com/behdad/fonttools>.
14
15To use `record-test.sh`, just put it right before the `hb-shape` invocation:
16```sh
17$ ./hb-unicode-encode 41 42 43 627 | ./record-it.sh ../../util/hb-shape font.ttf
18```
19what this does is:
20  * Subset the font for the sequence of Unicode characters requested,
21  * Compare the `hb-shape` output of the original font versus the subset
22    font for the input sequence,
23  * If the outputs differ, perhaps it is because the font does not have
24    glyph names; it then compares the output of `hb-view` for both fonts.
25  * If the outputs differ, recording fails.  Otherwise, it will move the
26    subset font file into `fonts/sha1sum` and name it after its hash,
27    and prints out the test case input, which you can then redirect to
28    an existing or new test file in `tests`, eg.:
29```sh
30$ ./hb-unicode-encode 41 42 43 627 | ./record-it.sh ../../util/hb-shape font.ttf >> tests/test-name.test
31```
32
33If you created a new test file, add it to `Makefile.am` so it is run.
34Check that `make test` does indeed run it, and that the test passes.
35When everything looks good, `git add` the new font as well as new
36test file if you created any.  You can see what new files are there
37by running `git status tests fonts/sha1sum`.  And commit!
38
39*Note!*  Please only add tests using Open Source fonts, preferably under
40OFL or similar license.
41