cairoPen.py 592 B

1234567891011121314151617181920212223242526
  1. """Pen to draw to a Cairo graphics library context."""
  2. from fontTools.pens.basePen import BasePen
  3. __all__ = ["CairoPen"]
  4. class CairoPen(BasePen):
  5. """Pen to draw to a Cairo graphics library context."""
  6. def __init__(self, glyphSet, context):
  7. BasePen.__init__(self, glyphSet)
  8. self.context = context
  9. def _moveTo(self, p):
  10. self.context.move_to(*p)
  11. def _lineTo(self, p):
  12. self.context.line_to(*p)
  13. def _curveToOne(self, p1, p2, p3):
  14. self.context.curve_to(*p1, *p2, *p3)
  15. def _closePath(self):
  16. self.context.close_path()