/usr/lib/python3/dist-packages/defcon/tools/representations.py is in python3-defcon 0.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | from __future__ import absolute_import
from fontTools.pens.areaPen import AreaPen
from fontTools.pens.boundsPen import ControlBoundsPen, BoundsPen
from fontTools.misc.arrayTools import unionRect
# -----
# Glyph
# -----
def glyphBoundsRepresentationFactory(glyph):
pen = BoundsPen(glyph.layer)
glyph.draw(pen)
return pen.bounds
def glyphControlPointBoundsRepresentationFactory(glyph):
pen = ControlBoundsPen(glyph.layer)
glyph.draw(pen)
return pen.bounds
# -------
# Contour
# -------
# bounds
def contourBoundsRepresentationFactory(obj):
pen = BoundsPen(None)
obj.draw(pen)
return pen.bounds
def contourControlPointBoundsRepresentationFactory(obj):
pen = ControlBoundsPen(None)
obj.draw(pen)
return pen.bounds
# winding direction
def contourClockwiseRepresentationFactory(contour):
pen = AreaPen()
pen.endPath = pen.closePath
contour.draw(pen)
return pen.value < 0
# ---------
# Component
# ---------
# bounds
def componentBoundsRepresentationFactory(obj):
pen = BoundsPen(obj.layer)
obj.draw(pen)
return pen.bounds
def componentPointBoundsRepresentationFactory(obj):
pen = ControlBoundsPen(obj.layer)
obj.draw(pen)
return pen.bounds
|