# test files
This directory contains files used for testing.
## ttc
The `ttc` directory contains ttc files, see it's readme for provenance.
## ttx
The `ttx` directory contains ttx files describing test cases. These are compiled
and stored in the `ttf` directory; the `ttf` files are the actual test inputs.
## fea
The `fea` directory contains fea files describing test cases, as this is a
very good format for describing layout tables. Similarly to ttx,
these are compiled to ttf and stored in the `ttf` directory. Each test case is
comprised of a FEA file and a corresponding glyph list.
## extracted data
The extracted directory contains text files holding data computed by FreeType
for each font. This data is used for comparisons with the results of our
metadata reading and outline loading implementations.
### glyphs
Extracted glyph outlines are generated by `extract_glyphs.py` and stored in
`extracted\<font-file-name>-glyphs.txt`. Each glyph is represented by the pattern:
```
glyph <glyph-id> <font-size> <hint-mode>
points <points>
contours <contours>
tags <tags>
m <points>
l <points>
q <points>
c <points>
-
```
With the following values:
* `glyph-id`: the glyph identifier
* `font-size`: size in pixels per em. A size of 0 means unscaled
* `hint-mode`: one of `none`, `full`, `light`, or `light-subpixel`
* `points`: space separated list of points in `x, y` format
* `contours` and `tags`: space separated list of integers representing contour end point
indices and tag bits, respectively
* `m`, `l`, `q`, `c`: path commands for `move to`, `line to`, `quad to` and `cubic to`,
respectively
The pattern ends with a single `-`.
## test font sources
Describes the provenance, usage and generation procedures for font data used for testing.
* _notoseriftc_autohint_metrics_
* font: Noto Serif Traditional Chinese Regular
* source: https://fonts.google.com/noto/specimen/Noto+Serif+TC
* license: [Open Font License][OFL]
* usage: testing CJK specific routines in the skrifa autohinter
* subset: characters used for alignment zones and standard widths
```shell
pyftsubset NotoSerifTC-Regular.ttf --text=他你們和对就我時来能說这齊军已既是民现理置軍配開露顾个人以你個到大對我時来要说主因想理當着者著过进過還面些你們和她將年情样理說这通即吧呢响师收斷眼间陈除随隨事學將想政新樣沒然现球經起例别动吗增明期物种调费都间田囗
```
* _notoserif_autohint_shaping_
* font: Noto Serif Regular
* source: https://fonts.google.com/noto/specimen/Noto+Serif
* license: [Open Font License][OFL]
* usage: testing autohinting shaper capture of OpenType features
* subset: fi ligatures and c2sc support
```shell
pyftsubset notoserif-regular.ttf --layout-features+=c2sc --no-hinting --text=Hfix
```
* _material_icons_subset_
* font: Google Material Icons Regular
* source: https://fonts.googleapis.com/icon?family=Material+Icons
* license: [Apache 2][Apache2]
* usage: testing empty Private DICT and scaling with upem=512, ppem=8
* subset: just a single glyph to check scaling
```shell
pyftsubset material_icons.otf --gids=2
```
* _material_icons_subset_matrix_
* font: Google Material Icons Regular
* source: https://fonts.googleapis.com/icon?family=Material+Icons
* license: [Apache 2][Apache2]
* usage: testing nested font matrix
* subset: just a single glyph to check scaling
```shell
pyftsubset material_icons.otf --gids=2
```
* additional hacks: hand modified TTX to add some font matrices
* _avar2checker_
* font: avar2 checker
* source: https://github.com/Lorp/fencer/tree/main/src/fonts
* license: [Apache 2][Apache2]
* usage: testing avar2 userspace to normalized coordinate mapping
* _tinos_subset_
* font: Tinos Regular
* source: https://fonts.google.com/specimen/Tinos
* license: [Apache 2][Apache2]
* usage: testing hdmx advance widths
* subset: a few characters to test hdmx advances
```shell
pyftsubset tinos-regular.ttf --text=aAbB --gids=3,5
```
* _TestMORX*_
* source: https://github.com/unicode-org/text-rendering-tests/tree/main/fonts
* license: [UNICODE LICENSE V3](Unicode3)
* usage: testing morx table parsing
* _cousine_hint_subset_
* font: Cousine Regular
* source: https://fonts.google.com/specimen/Cousine
* license: [Apache 2][Apache2]
* usage: testing rounding for mppem instruction at fractional font sizes
* subset: a single character that uses mppem
```shell
pyftsubset cousine-regular.ttf --gids=85
```
* _cmap6_
* font: Hand rolled cmap 6 subtable
* usage: testing cmap format 6 mapping and iteration
* _cmap10_
* font: Hand rolled cmap 10 subtable
* usage: testing cmap format 10 mapping and iteration
## rebuilding
To update the binaries and extracted data, run script located at `resources/test_fonts/rebuild.sh`
This script will install the correct version of fonttools and FreeType, and then regenerate
all of the inputs.
```shell
# from the repo root
somewhere/fontations $ ./font-test-data/test_data/rebuild.sh
```
[OFL]: https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL
[Apache2]: https://www.apache.org/licenses/LICENSE-2.0
[Unicode3]: https://github.com/unicode-org/text-rendering-tests/blob/main/LICENSE