Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Aug 15, 2024
1 parent 5736bb8 commit 64917ae
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
You need to have `fonttools 4.50` installed on your system and in your PATH. Note that you need to have that
exact version, otherwise the tests will fail.

In addition to that, you need Java installed on your system, install the [CFF dump utility](https://github.com/janpe2/CFFDump/releases/tag/v1.3.0) and point the `CFF_DUMP_BIN` environment variable to it.

## Generating tests
In order to create new fonttools tests, you can edit `data/fonttools.tests`. For subset tests, you can edit
`data/subsets.tests`
In order to create new fonttools tests, you can edit `data/fonttools.tests`.
For CFF tests, you can edit `data/cff.tests`. For subset tests, you can edit `data/subsets.tests`

In order to generate the tests, run `scripts/gen-tests.py`.

## Description
Testing is very important, as having errors in the subsetting logic could have fatal consequences.
Because of this, we have three different testing approaches that cover 4 different
Because of this, we have four different testing approaches that cover 4 different
font readers and 7 different PDF readers in total.

### Subset tests
Expand All @@ -32,6 +34,12 @@ dump small subsets of fonts and compare the output to how fonttools would subset
to identify other kinds of potential issues in the implementation. And it conveniently also allows us to
have a fourth implementation to test against.

### CFF tests
A problem with CFF tests is that fonttools abstracts away the exact structure of the CFF table,
and stuff like the order of operators in DICTs as well as missing entries are not preserved. Because of
this, we use the above-mentioned CFF dump utility, which provides a much more detailed insight into the
structure of the CFF table, and allows us to detect regressions in CFF subsetting more easily.

### Fuzzing tests
In `examples`, we have a binary that takes an environment variable `FONT_DIR` and recursively iterates over all fonts
in that directory and basically performs the same test as in #1, but on a randomly selected sets of glyphs. We currently
Expand Down

0 comments on commit 64917ae

Please sign in to comment.