From ea08338878781f166e166b50c65e26482a3070fc Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Wed, 27 Jul 2016 16:50:57 -0700 Subject: [PATCH] UFO benchmark module --- Lib/cu2qu/benchmark.py | 28 +++-- .../RobotoSubset-Regular.ufo/fontinfo.plist | 8 ++ .../RobotoSubset-Regular.ufo/glyphs/A_.glif | 25 ++++ .../RobotoSubset-Regular.ufo/glyphs/B_.glif | 49 ++++++++ .../RobotoSubset-Regular.ufo/glyphs/C_.glif | 35 ++++++ .../RobotoSubset-Regular.ufo/glyphs/D_.glif | 33 ++++++ .../RobotoSubset-Regular.ufo/glyphs/E_.glif | 29 +++++ .../RobotoSubset-Regular.ufo/glyphs/F_.glif | 23 ++++ .../RobotoSubset-Regular.ufo/glyphs/G_.glif | 39 +++++++ .../RobotoSubset-Regular.ufo/glyphs/H_.glif | 23 ++++ .../RobotoSubset-Regular.ufo/glyphs/I_.glif | 11 ++ .../RobotoSubset-Regular.ufo/glyphs/J_.glif | 23 ++++ .../RobotoSubset-Regular.ufo/glyphs/K_.glif | 25 ++++ .../RobotoSubset-Regular.ufo/glyphs/L_.glif | 17 +++ .../RobotoSubset-Regular.ufo/glyphs/M_.glif | 28 +++++ .../RobotoSubset-Regular.ufo/glyphs/N_.glif | 17 +++ .../RobotoSubset-Regular.ufo/glyphs/O_.glif | 37 ++++++ .../RobotoSubset-Regular.ufo/glyphs/P_.glif | 27 +++++ .../RobotoSubset-Regular.ufo/glyphs/Q_.glif | 43 +++++++ .../RobotoSubset-Regular.ufo/glyphs/R_.glif | 35 ++++++ .../RobotoSubset-Regular.ufo/glyphs/S_.glif | 45 +++++++ .../RobotoSubset-Regular.ufo/glyphs/T_.glif | 17 +++ .../RobotoSubset-Regular.ufo/glyphs/U_.glif | 25 ++++ .../RobotoSubset-Regular.ufo/glyphs/V_.glif | 19 +++ .../RobotoSubset-Regular.ufo/glyphs/W_.glif | 35 ++++++ .../RobotoSubset-Regular.ufo/glyphs/X_.glif | 19 +++ .../RobotoSubset-Regular.ufo/glyphs/Y_.glif | 16 +++ .../RobotoSubset-Regular.ufo/glyphs/Z_.glif | 25 ++++ .../RobotoSubset-Regular.ufo/glyphs/a.glif | 54 +++++++++ .../RobotoSubset-Regular.ufo/glyphs/b.glif | 44 +++++++ .../RobotoSubset-Regular.ufo/glyphs/c.glif | 35 ++++++ .../glyphs/contents.plist | 110 ++++++++++++++++++ .../RobotoSubset-Regular.ufo/glyphs/d.glif | 44 +++++++ .../RobotoSubset-Regular.ufo/glyphs/e.glif | 39 +++++++ .../RobotoSubset-Regular.ufo/glyphs/f.glif | 29 +++++ .../RobotoSubset-Regular.ufo/glyphs/g.glif | 56 +++++++++ .../RobotoSubset-Regular.ufo/glyphs/h.glif | 29 +++++ .../RobotoSubset-Regular.ufo/glyphs/i.glif | 25 ++++ .../RobotoSubset-Regular.ufo/glyphs/j.glif | 37 ++++++ .../RobotoSubset-Regular.ufo/glyphs/k.glif | 25 ++++ .../RobotoSubset-Regular.ufo/glyphs/l.glif | 11 ++ .../RobotoSubset-Regular.ufo/glyphs/m.glif | 48 ++++++++ .../RobotoSubset-Regular.ufo/glyphs/n.glif | 30 +++++ .../RobotoSubset-Regular.ufo/glyphs/o.glif | 37 ++++++ .../RobotoSubset-Regular.ufo/glyphs/p.glif | 44 +++++++ .../RobotoSubset-Regular.ufo/glyphs/q.glif | 44 +++++++ .../RobotoSubset-Regular.ufo/glyphs/r.glif | 28 +++++ .../RobotoSubset-Regular.ufo/glyphs/s.glif | 45 +++++++ .../RobotoSubset-Regular.ufo/glyphs/t.glif | 29 +++++ .../RobotoSubset-Regular.ufo/glyphs/u.glif | 30 +++++ .../RobotoSubset-Regular.ufo/glyphs/v.glif | 19 +++ .../RobotoSubset-Regular.ufo/glyphs/w.glif | 35 ++++++ .../RobotoSubset-Regular.ufo/glyphs/x.glif | 19 +++ .../RobotoSubset-Regular.ufo/glyphs/y.glif | 31 +++++ .../RobotoSubset-Regular.ufo/glyphs/z.glif | 25 ++++ .../data/RobotoSubset-Regular.ufo/lib.plist | 61 ++++++++++ .../RobotoSubset-Regular.ufo/metainfo.plist | 10 ++ Lib/cu2qu/ufo_benchmark.py | 51 ++++++++ 58 files changed, 1870 insertions(+), 10 deletions(-) create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/fontinfo.plist create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/A_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/B_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/C_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/D_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/E_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/F_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/G_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/H_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/I_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/J_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/K_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/L_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/M_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/N_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/O_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/P_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Q_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/R_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/S_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/T_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/U_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/V_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/W_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/X_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Y_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Z_.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/a.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/b.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/c.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/contents.plist create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/d.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/e.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/f.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/g.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/h.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/i.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/j.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/k.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/l.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/m.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/n.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/o.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/p.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/q.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/r.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/s.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/t.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/u.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/v.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/w.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/x.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/y.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/z.glif create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/lib.plist create mode 100644 Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/metainfo.plist create mode 100644 Lib/cu2qu/ufo_benchmark.py diff --git a/Lib/cu2qu/benchmark.py b/Lib/cu2qu/benchmark.py index 41b71f03c..26ea894ed 100644 --- a/Lib/cu2qu/benchmark.py +++ b/Lib/cu2qu/benchmark.py @@ -21,9 +21,9 @@ import timeit MAX_ERR = 5 SETUP_CODE = ''' -from cu2qu import %s -from cu2qu.benchmark import setup_%s -args = setup_%s() +from %(module)s import %(function)s +from %(benchmark_module)s import %(setup_function)s +args = %(setup_function)s() ''' @@ -44,20 +44,28 @@ def setup_curves_to_quadratic(): [MAX_ERR] * num_curves) -def run_test(name): - print('%s:' % name) +def run_benchmark( + benchmark_module, module, function, setup_suffix='', repeat=1000): + setup_func = 'setup_' + function + if setup_suffix: + print('%s with %s:' % (function, setup_suffix)) + setup_func += '_' + setup_suffix + else: + print('%s:' % function) results = timeit.repeat( - '%s(*args)' % name, - setup=(SETUP_CODE % (name, name, name)), - repeat=1000, number=1) + '%s(*args)' % function, + setup=(SETUP_CODE % { + 'benchmark_module': benchmark_module, 'setup_function': setup_func, + 'module': module, 'function': function}), + repeat=repeat, number=1) print('min: %dus' % (min(results) * 1000000.)) print('avg: %dus' % (sum(results) / len(results) * 1000000.)) print() def main(): - run_test('curve_to_quadratic') - run_test('curves_to_quadratic') + run_benchmark('cu2qu.benchmark', 'cu2qu', 'curve_to_quadratic') + run_benchmark('cu2qu.benchmark', 'cu2qu', 'curves_to_quadratic') if __name__ == '__main__': diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/fontinfo.plist b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/fontinfo.plist new file mode 100644 index 000000000..ff3e2e202 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/fontinfo.plist @@ -0,0 +1,8 @@ + + + + + unitsPerEm + 2048 + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/A_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/A_.glif new file mode 100644 index 000000000..5e02be5b0 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/A_.glif @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/B_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/B_.glif new file mode 100644 index 000000000..7888ee1dc --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/B_.glif @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/C_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/C_.glif new file mode 100644 index 000000000..7b3c29f6c --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/C_.glif @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/D_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/D_.glif new file mode 100644 index 000000000..ec4551c56 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/D_.glif @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/E_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/E_.glif new file mode 100644 index 000000000..728252361 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/E_.glif @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/F_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/F_.glif new file mode 100644 index 000000000..5e69c2b88 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/F_.glif @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/G_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/G_.glif new file mode 100644 index 000000000..56da0c4a8 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/G_.glif @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/H_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/H_.glif new file mode 100644 index 000000000..4c1b924d3 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/H_.glif @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/I_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/I_.glif new file mode 100644 index 000000000..e3c2b06f6 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/I_.glif @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/J_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/J_.glif new file mode 100644 index 000000000..38e5f0610 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/J_.glif @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/K_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/K_.glif new file mode 100644 index 000000000..54d25b67d --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/K_.glif @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/L_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/L_.glif new file mode 100644 index 000000000..c20f15c0c --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/L_.glif @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/M_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/M_.glif new file mode 100644 index 000000000..aaaf05457 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/M_.glif @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/N_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/N_.glif new file mode 100644 index 000000000..c69ba5e6e --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/N_.glif @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/O_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/O_.glif new file mode 100644 index 000000000..06990ea92 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/O_.glif @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/P_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/P_.glif new file mode 100644 index 000000000..a1107a746 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/P_.glif @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Q_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Q_.glif new file mode 100644 index 000000000..d183269fa --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Q_.glif @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/R_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/R_.glif new file mode 100644 index 000000000..05f105519 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/R_.glif @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/S_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/S_.glif new file mode 100644 index 000000000..1cabea6ad --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/S_.glif @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/T_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/T_.glif new file mode 100644 index 000000000..64a680fbf --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/T_.glif @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/U_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/U_.glif new file mode 100644 index 000000000..acdf8b071 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/U_.glif @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/V_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/V_.glif new file mode 100644 index 000000000..c451792b7 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/V_.glif @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/W_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/W_.glif new file mode 100644 index 000000000..1b5443f76 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/W_.glif @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/X_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/X_.glif new file mode 100644 index 000000000..f5666c1eb --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/X_.glif @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Y_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Y_.glif new file mode 100644 index 000000000..ff9202e91 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Y_.glif @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Z_.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Z_.glif new file mode 100644 index 000000000..5983127d7 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/Z_.glif @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/a.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/a.glif new file mode 100644 index 000000000..4934a930a --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/a.glif @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/b.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/b.glif new file mode 100644 index 000000000..6077bfed4 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/b.glif @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/c.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/c.glif new file mode 100644 index 000000000..63595f53a --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/c.glif @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/contents.plist b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/contents.plist new file mode 100644 index 000000000..955842960 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/contents.plist @@ -0,0 +1,110 @@ + + + + + A + A_.glif + B + B_.glif + C + C_.glif + D + D_.glif + E + E_.glif + F + F_.glif + G + G_.glif + H + H_.glif + I + I_.glif + J + J_.glif + K + K_.glif + L + L_.glif + M + M_.glif + N + N_.glif + O + O_.glif + P + P_.glif + Q + Q_.glif + R + R_.glif + S + S_.glif + T + T_.glif + U + U_.glif + V + V_.glif + W + W_.glif + X + X_.glif + Y + Y_.glif + Z + Z_.glif + a + a.glif + b + b.glif + c + c.glif + d + d.glif + e + e.glif + f + f.glif + g + g.glif + h + h.glif + i + i.glif + j + j.glif + k + k.glif + l + l.glif + m + m.glif + n + n.glif + o + o.glif + p + p.glif + q + q.glif + r + r.glif + s + s.glif + t + t.glif + u + u.glif + v + v.glif + w + w.glif + x + x.glif + y + y.glif + z + z.glif + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/d.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/d.glif new file mode 100644 index 000000000..7c76bc4da --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/d.glif @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/e.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/e.glif new file mode 100644 index 000000000..36f5d0687 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/e.glif @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/f.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/f.glif new file mode 100644 index 000000000..6cba075db --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/f.glif @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/g.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/g.glif new file mode 100644 index 000000000..cf2fa57c6 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/g.glif @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/h.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/h.glif new file mode 100644 index 000000000..d2e78900e --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/h.glif @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/i.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/i.glif new file mode 100644 index 000000000..baf43704d --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/i.glif @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/j.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/j.glif new file mode 100644 index 000000000..e664718ee --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/j.glif @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/k.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/k.glif new file mode 100644 index 000000000..9feae96f4 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/k.glif @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/l.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/l.glif new file mode 100644 index 000000000..745aa6172 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/l.glif @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/m.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/m.glif new file mode 100644 index 000000000..53521c9b3 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/m.glif @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/n.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/n.glif new file mode 100644 index 000000000..982ae424c --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/n.glif @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/o.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/o.glif new file mode 100644 index 000000000..ee5cc899f --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/o.glif @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/p.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/p.glif new file mode 100644 index 000000000..46688b04d --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/p.glif @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/q.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/q.glif new file mode 100644 index 000000000..e84dab94a --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/q.glif @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/r.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/r.glif new file mode 100644 index 000000000..f0f22ea2a --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/r.glif @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/s.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/s.glif new file mode 100644 index 000000000..c0e2cff0d --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/s.glif @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/t.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/t.glif new file mode 100644 index 000000000..1293be524 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/t.glif @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/u.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/u.glif new file mode 100644 index 000000000..93178e8ba --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/u.glif @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/v.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/v.glif new file mode 100644 index 000000000..d1d4efcf7 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/v.glif @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/w.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/w.glif new file mode 100644 index 000000000..ca63e3bc5 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/w.glif @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/x.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/x.glif new file mode 100644 index 000000000..9445ca8a5 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/x.glif @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/y.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/y.glif new file mode 100644 index 000000000..523291e1b --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/y.glif @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/z.glif b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/z.glif new file mode 100644 index 000000000..918a56148 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/glyphs/z.glif @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/lib.plist b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/lib.plist new file mode 100644 index 000000000..043d19ba2 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/lib.plist @@ -0,0 +1,61 @@ + + + + + public.glyphOrder + + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u + v + w + x + y + z + + + diff --git a/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/metainfo.plist b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/metainfo.plist new file mode 100644 index 000000000..45bacb938 --- /dev/null +++ b/Lib/cu2qu/test/data/RobotoSubset-Regular.ufo/metainfo.plist @@ -0,0 +1,10 @@ + + + + + creator + org.robofab.ufoLib + formatVersion + 2 + + diff --git a/Lib/cu2qu/ufo_benchmark.py b/Lib/cu2qu/ufo_benchmark.py new file mode 100644 index 000000000..d6665dbe5 --- /dev/null +++ b/Lib/cu2qu/ufo_benchmark.py @@ -0,0 +1,51 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import print_function, division, absolute_import + +import os +import random + +from defcon import Font +from robofab.world import OpenFont + +from cu2qu.benchmark import run_benchmark +from cu2qu.test import DATADIR + +MAX_ERR_EM = 0.002 + + +def setup_fonts_to_quadratic_defcon(): + return [[Font(os.path.join(DATADIR, 'RobotoSubset-Regular.ufo'))], + MAX_ERR_EM] + + +def setup_fonts_to_quadratic_robofab(): + return [[OpenFont(os.path.join(DATADIR, 'RobotoSubset-Regular.ufo'))], + MAX_ERR_EM] + + +def main(): + run_benchmark( + 'cu2qu.ufo_benchmark', 'cu2qu.ufo', 'fonts_to_quadratic', + setup_suffix='defcon', repeat=10) + run_benchmark( + 'cu2qu.ufo_benchmark', 'cu2qu.ufo', 'fonts_to_quadratic', + setup_suffix='robofab', repeat=10) + + +if __name__ == '__main__': + random.seed(1) + main()