[varLib.iup] Compile with Cython when available
Even with no annotations, makes it ~35% faster.
This commit is contained in:
parent
455158f2bf
commit
5d9677038b
@ -1,3 +1,17 @@
|
||||
try:
|
||||
import cython
|
||||
except ImportError:
|
||||
# if cython not installed, use mock module with no-op decorators and types
|
||||
from fontTools.misc import cython
|
||||
|
||||
if cython.compiled:
|
||||
# Yep, I'm compiled.
|
||||
COMPILED = True
|
||||
else:
|
||||
# Just a lowly interpreted script.
|
||||
COMPILED = False
|
||||
|
||||
|
||||
MAX_LOOKBACK = 8
|
||||
|
||||
def iup_segment(coords, rc1, rd1, rc2, rd2):
|
||||
|
3
setup.py
3
setup.py
@ -68,6 +68,9 @@ if with_cython is True or (with_cython is None and has_cython):
|
||||
ext_modules.append(
|
||||
Extension("fontTools.cu2qu.cu2qu", ["Lib/fontTools/cu2qu/cu2qu.py"]),
|
||||
)
|
||||
ext_modules.append(
|
||||
Extension("fontTools.varLib.iup", ["Lib/fontTools/varLib/iup.py"]),
|
||||
)
|
||||
|
||||
extras_require = {
|
||||
# for fontTools.ufoLib: to read/write UFO fonts
|
||||
|
Loading…
x
Reference in New Issue
Block a user