Skip to content

Commit 9d2123d

Browse files
wezmbrawer
authored andcommitted
Add Allsorts engine
1 parent fb3764c commit 9d2123d

3 files changed

Lines changed: 7551 additions & 4 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ display text, so we founded this project to help implementations to
77
get this right.
88

99
```bash
10-
$ brew install cmake ninja npm
10+
$ brew install cmake ninja npm rust
1111
$ git clone --recursive https://github.com/unicode-org/text-rendering-tests.git
1212
$ cd text-rendering-tests
13-
$ for engine in CoreText FreeStack TehreerStack fontkit OpenType.js ; do python check.py --engine=$engine --output=reports/$engine.html ; done
13+
$ for engine in CoreText FreeStack TehreerStack fontkit OpenType.js Allsorts ; do python check.py --engine=$engine --output=reports/$engine.html ; done
1414
```
1515

1616

@@ -43,6 +43,10 @@ text rendering stack consisting of [FreeType](https://www.freetype.org/),
4343
* With `--engine=OpenType.js`, the tests are run using [OpenType.js](https://github.com/nodebox/opentype.js), another JavaScript font engine.
4444
[Test report for OpenType.js](https://rawgit.com/unicode-org/text-rendering-tests/master/reports/OpenType.js.html).
4545

46+
* With `--engine=Allsorts`, the tests are run using [Allsorts](https://github.com/yeslogic/allsorts),
47+
a parsing and shaping engine implemented in [Rust](https://www.rust-lang.org/).
48+
[Test report for Allsorts](https://rawgit.com/unicode-org/text-rendering-tests/master/reports/Allsorts.html).
49+
4650
It’s trivial to test other implementations; simply write a small
4751
wrapper tool. For the [Go font
4852
library](https://godoc.org/golang.org/x/image/font/sfnt), see

check.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def __init__(self, engine):
3636
self.command = 'node_modules/opentype.js/bin/test-render'
3737
elif self.engine == 'fontkit':
3838
self.command = 'src/third_party/fontkit/render'
39+
elif self.engine == 'Allsorts':
40+
self.command = 'src/third_party/allsorts/allsorts-tools/target/release/allsorts'
3941
else:
4042
self.command = 'build/fonttest/fonttest'
4143
self.datestr = self.make_datestr()
@@ -44,7 +46,7 @@ def __init__(self, engine):
4446
self.observed = {} # testcase --> SVG ElementTree
4547

4648
def get_version(self):
47-
if self.engine in {'CoreText', 'FreeStack', 'TehreerStack'}:
49+
if self.engine in {'CoreText', 'FreeStack', 'TehreerStack', 'Allsorts'}:
4850
return subprocess.check_output([self.command, '--version',
4951
'--engine=' + self.engine])
5052
if self.engine in ('OpenType.js', 'fontkit'):
@@ -206,6 +208,8 @@ def run_command(cmd, timeout_sec):
206208
def build(engine):
207209
if engine == 'OpenType.js' or engine == 'fontkit':
208210
subprocess.check_call(['npm', 'install'])
211+
elif engine == 'Allsorts':
212+
subprocess.check_call(['cargo', 'build', '--release', '--manifest-path', 'src/third_party/allsorts/allsorts-tools/Cargo.toml'])
209213
else:
210214
if not os.path.exists('build'): os.mkdir('build')
211215
subprocess.check_call(['cmake', '-GNinja', '../src'], cwd='build')
@@ -217,7 +221,7 @@ def main():
217221
etree.register_namespace('xlink', 'http://www.w3.org/1999/xlink')
218222
parser = argparse.ArgumentParser()
219223
parser.add_argument('--engine',
220-
choices=['FreeStack', 'TehreerStack', 'CoreText', 'DirectWrite', 'OpenType.js', 'fontkit'],
224+
choices=['FreeStack', 'TehreerStack', 'CoreText', 'DirectWrite', 'OpenType.js', 'fontkit', 'Allsorts'],
221225
default='FreeStack')
222226
parser.add_argument('--output', help='path to report file being written')
223227
args = parser.parse_args()

0 commit comments

Comments
 (0)