Speeds up font compilation by around 200%
Cython is used to compile some hot paths into native Python extensions. These hot paths were identified through running ufocompile with the hotshot profiler and then converting file by file to Cython, starting with the "hottest" paths and continuing until returns were deminishing. This means that only a few Python files were converted to Cython. Closes #23 Closes #20 (really this time)
This commit is contained in:
parent
31ae014e0c
commit
8234b62ab7
108 changed files with 26933 additions and 110 deletions
21
misc/pylib/robofab/pens/quartzPen.py
Normal file
21
misc/pylib/robofab/pens/quartzPen.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from fontTools.pens.basePen import BasePen
|
||||
|
||||
class QuartzPen(BasePen):
|
||||
|
||||
"""Pen to draw onto a Quartz drawing context (Carbon.CG)."""
|
||||
|
||||
def __init__(self, glyphSet, quartzContext):
|
||||
BasePen.__init__(self, glyphSet)
|
||||
self._context = quartzContext
|
||||
|
||||
def _moveTo(self, (x, y)):
|
||||
self._context.CGContextMoveToPoint(x, y)
|
||||
|
||||
def _lineTo(self, (x, y)):
|
||||
self._context.CGContextAddLineToPoint(x, y)
|
||||
|
||||
def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)):
|
||||
self._context.CGContextAddCurveToPoint(x1, y1, x2, y2, x3, y3)
|
||||
|
||||
def _closePath(self):
|
||||
self._context.closePath()
|
||||
Reference in a new issue