Cosimo Lupo
855166c518
cu2qu/ufo: must use PointToSegmentPen with outputImpliedClosingLine=True
...
When collecting a glyph's segments, we can't simply call the glyphs' draw
method with the GetSegmentsPen, but we must initialize the
PointToSegmentPen explicitly with outputImpliedClosingLine=True.
By default PointToSegmentPen does not outputImpliedClosingLine -- unless
last and first point on closed contour are duplicated.
Because we are converting multiple glyphs at the same time, we want to
make sure the _get_segments function returns the same number of segments,
whether or not the last and first point overlap.
Fixes https://github.com/googlefonts/fontmake/issues/572
Also see: https://github.com/fonttools/fonttools/pull/1720
2019-09-13 13:14:03 +02:00
Cosimo Lupo
1166e02876
tox: use --no-build-isolation as we install requirements.txt ourselves
2019-04-12 14:54:01 +01:00
Cosimo Lupo
cd6e79b187
pyproject.toml: always install cython as PEP518 build dependency
...
else pip >= 19 doesn't see cython even if it's installed outside the isolated build environment.
One can use --no-build-isolation to prevent that.
https://github.com/pypa/pip/issues/6144
2019-04-12 14:51:33 +01:00
Cosimo Lupo
e8e8ddebb4
mention cu2qu script in README
2019-04-12 09:49:06 +01:00
Cosimo Lupo
3543e4f24e
change imports from ufoLib to fontTools.ufoLib
2018-11-01 16:41:08 +00:00
Cosimo Lupo
c7991047ba
require fonttools[ufo]; drop ufoLib
2018-11-01 16:40:38 +00:00
Cosimo Lupo
104f887682
README: typo
2018-10-18 10:17:23 +01:00
Cosimo Lupo
dd185de804
setup.cfg: 'wheel' entry in setup.cfg is deprecated; should use 'bdist_wheel'
2018-10-18 10:16:08 +01:00
Cosimo Lupo
931b9b3a39
setup.py: fix installation issue when bdist_wheel command is not available
...
Fixes https://github.com/googlei18n/cu2qu/issues/157
https://gitlab.gnome.org/GNOME/cantarell-fonts/-/jobs/126444
2018-10-18 10:15:41 +01:00
Cosimo Lupo
201b4926c1
pens: skip the 'None' point for special quadratic contours without oncurves
...
Fixes https://github.com/trufont/trufont/issues/595
2018-10-11 22:26:10 +01:00
Cosimo Lupo
f77981327e
cli: must create output directory if it doesn't exist already
2018-10-11 18:38:21 +01:00
Cosimo Lupo
e755f58515
pens: add workaround for BasePointToSegmentPen bug
...
Fixes https://github.com/trufont/trufont/issues/595
We shall remove this workaround once ufoLib is fixed upstream
2018-10-11 18:37:54 +01:00
Cosimo Lupo
041f42466b
pens_test: add test for special quadratic contour with no on-curves
2018-10-11 18:36:52 +01:00
Behdad Esfahbod
a340ea1fb3
Revert cdivision
...
Bot not happy. Not happy bot not good.
This reverts commit 7e130ea438875b3a32564fe02adfd60286b3eed0.
This reverts commit 3486a3635f35044fe94d722cee788ba5d3a5698a.
2018-10-09 09:57:15 -04:00
Behdad Esfahbod
7e130ea438
[cython] Revert one of the cdivisions
...
Seeing if makes bot happy.
2018-10-09 09:46:30 -04:00
Behdad Esfahbod
3486a3635f
[cython] Sprinkle some cdivision
...
https://github.com/googlei18n/cu2qu/issues/155#issuecomment-427986961
The primary purpose is to disable div-by-zero check since we know it
can't happen in those functions.
2018-10-09 09:40:35 -04:00
Cosimo Lupo
ad5471c517
pyproject.toml: cython is only optional build requirement
2018-10-09 11:53:18 +01:00
Cosimo Lupo
4adb33a809
add PEP517/518 pyproject.toml
2018-10-09 11:46:58 +01:00
Cosimo Lupo
4247b30dde
revert to using division instead of multiplication, fixes 1-unit diffs after v1.6
...
Fixes #155
2018-10-09 11:32:53 +01:00
Behdad Esfahbod
6be1737965
[cython] Minor add inline
2018-10-06 21:07:13 +02:00
Cosimo Lupo
bc288169a2
typo
2018-09-26 21:27:55 +01:00
Cosimo Lupo
67d1a1d884
README.rst: add installation instructions for cython module
2018-09-26 21:25:49 +01:00
Cosimo Lupo
8baa24fee4
tox: only build sdist for upload on PyPI
2018-09-26 21:25:46 +01:00
Cosimo Lupo
4ee6f7c15a
Merge pull request #153 from googlei18n/cython-setup
...
set up optional cython extension module
2018-09-26 20:22:12 +01:00
Cosimo Lupo
06a981383b
travis: update pypi password, use twine (via tox) to upload to PyPI
2018-09-26 20:19:20 +01:00
Cosimo Lupo
b2410d9fe0
tox: add envs to build sdist, pure/native wheels, and upload to pypi
2018-09-26 20:18:21 +01:00
Cosimo Lupo
c0a9b3689c
travis: run tests both with and without cython
2018-09-26 19:10:18 +01:00
Cosimo Lupo
040c8536e2
tox: run tests with and without cython
2018-09-26 19:06:21 +01:00
Cosimo Lupo
d23308884b
.coveragerc: exclude vendored cython.py
2018-09-26 19:06:21 +01:00
Cosimo Lupo
31ad0eb841
setup.py: make building of extension module optional
...
One can now use either the $CU2QU_WITH_CYTHON environment variable
or the --with/without-cython command line options to setup.py.
The --without-cython is for when one wants to get a pure, universal
wheel despite having both cython and a C compiler installed.
By default (when no env var nor command line options are used),
building from source will attempt to compile the extension module
using the pre-generated *.c source files that are always included
in the sdist package that we (will) upload to PyPI.
If the compilation fails (e.g. the user doesn't have a C compiler),
then an error message will be printed but installation will proceed
without the optional native extension.
When cloning a fresh repo, the *.c sources will not be present, so
to build the extension from local checkout one always needs Cython
installed.
When $CU2QU_WITH_CYTHON is true (1, or yes), then cython is required
and installation will abort if any error occurs during building.
2018-09-26 19:06:20 +01:00
Cosimo Lupo
0f80ff7b2c
cu2qu: add a COMPILED flag to check if cu2qu is running in compiled/interpreted mode
2018-09-26 19:02:02 +01:00
Cosimo Lupo
73d3ce4bc1
cu2qu: add language_level=3 and define_macros to enable coverage
2018-09-26 19:02:02 +01:00
Cosimo Lupo
c13ce2faee
cu2qu: return float('NaN') instead of None so return val matches signature
...
Otherwise I get 'TypeError: must be real number, not NoneType' when running tests with
the compiled cu2qu extension module
2018-09-26 19:02:02 +01:00
Cosimo Lupo
6719b3e1a5
update .gitignore
2018-09-26 19:00:59 +01:00
Cosimo Lupo
337c302488
cli: add missing __future__ import absolute_import
2018-09-26 19:00:59 +01:00
Cosimo Lupo
672b446c89
move cu2qu/__init__py to cu2qu/cu2qu.py so we can make an optional Extension module
2018-09-26 19:00:59 +01:00
Cosimo Lupo
d37bbef646
use setuptools_scm for getting package version from git tags
2018-09-26 18:59:03 +01:00
Cosimo Lupo
ddeece03c7
add script to download updated Cython/Shadow.py module
2018-09-26 18:59:03 +01:00
Cosimo Lupo
1d2b159911
Add copy of Cython.Shadow as cu2qu.cython
2018-09-26 18:59:03 +01:00
Behdad Esfahbod
f85240f005
[cython] Remove a couple intermediates
2018-09-26 11:08:25 -04:00
Cosimo Lupo
add13842f9
Merge pull request #152 from googlei18n/cython
...
Cython
2018-09-26 12:41:55 +01:00
Cosimo Lupo
db3b73713c
Merge pull request #151 from googlei18n/pyup-scheduled-update-2018-09-24
...
Scheduled weekly dependency update for week 38
2018-09-26 12:16:47 +01:00
Cosimo Lupo
a807ab2b93
tests: use math.isclose to compare float coordinates
...
using the default tolerance which is 1e-9, i.e. assures that two floats are the same
within about 9 decimal digits
https://docs.python.org/3/library/math.html#math.isclose
2018-09-26 12:13:39 +01:00
Behdad Esfahbod
36d1b69d7e
[cython] More
2018-09-25 18:04:27 -04:00
Behdad Esfahbod
0c361f5cc4
[cython] Some more
2018-09-25 18:01:48 -04:00
Behdad Esfahbod
3efd0839a1
[cython] Add a few @cython.cfunc
2018-09-25 17:52:16 -04:00
Behdad Esfahbod
1f9c4a9e6b
[cython] Some more annotations
2018-09-25 17:29:08 -04:00
Behdad Esfahbod
ffdeb86420
Add cython shim
2018-09-25 17:21:54 -04:00
Behdad Esfahbod
f07bf0c266
[cython] Add some cython annotations
...
Compare:
Python:
behdad:cu2qu 0$ python __init__.py
curve_to_quadratic: 62.7us
curves_to_quadratic: 163.2us
Cython:
behdad:cu2qu 0$ cython --embed -a __init__.py && gcc __init__.c `python-config --cflags --libs` -O3 && ./a.out
curve_to_quadratic: 30.4us
curves_to_quadratic: 77.8us
Cython without this commit:
behdad:cu2qu 0$ cython --embed -a __init__.py && gcc __init__.c `python-config --cflags --libs` -O3 && ./a.out
curve_to_quadratic: 43.9us
curves_to_quadratic: 113.3us
So, 2x speedup compared to Python. 1.5x speedup compared to Cython without annotations.
More to be done.
2018-09-25 17:18:15 -04:00
Behdad Esfahbod
ed9da8db80
Add benchmarking to __init__
...
I haven't removed tools/benchmark.py. Probably should.
Also, improved the timeit parameters over benchmark.py.
2018-09-25 16:05:40 -04:00