Home

Awesome

Text rendering tests

This is a test suite for text rendering engines. It is not easy to correctly display text, so we founded this project to help implementations to get this right.

$ brew install cmake ninja npm rust
$ git clone --recursive https://github.com/unicode-org/text-rendering-tests.git
$ cd text-rendering-tests
$ for engine in CoreText FreeStack TehreerStack fontkit OpenType.js Allsorts ; do python3 check.py --engine=$engine --output=reports/$engine.html ; done

Supported Platforms

Currently, the test suite supports six OpenType implementations:

It’s trivial to test other implementations; simply write a small wrapper tool. For the Go font library, see here. For the Rust font library, see here.

Test Cases

The test cases are defined in the testcases directory. It contains HTML snippets which describe each test, and define the rendering parameters together with the expected result.

For each test case, the check.py script parses the HTML snippet to extract the rendering parameters. Then, it runs a sub-process (written in C++, Objective C, Rust or JavaScript depending on the tested implementation) that writes the observed rendering in SVG format to Standard Output. Finally, the script checks whether the expected rendering matches the observed result. Currently, “matching” is implemented by iterating over SVG paths, allowing for maximally 1 font design unit of difference.

Copyright & Licenses

Copyright © 2016-2024 Unicode, Inc. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the United States and other countries.

A CLA is required to contribute to this project - please refer to the CONTRIBUTING.md file (or start a Pull Request) for more information.

The contents of this repository are governed by the Unicode Terms of Use and are released under LICENSE.