コード例 #1
0
def getControlBounds(drawable: Drawable,
                     layer: GlyphSet | None) -> BoundingBox | None:
    pen = ControlBoundsPen(layer)
    # raise 'KeyError' when a referenced component is missing from glyph set
    pen.skipMissingComponents = False
    drawable.draw(pen)
    return None if pen.bounds is None else BoundingBox(*pen.bounds)
コード例 #2
0
def getControlBounds(drawable: Drawable, layer: Any) -> Optional[BoundingBox]:
    # XXX: layer should behave like a mapping of glyph names to Glyph objects, but
    # cyclic imports...
    pen = ControlBoundsPen(layer)
    # raise 'KeyError' when a referenced component is missing from glyph set
    pen.skipMissingComponents = False
    drawable.draw(pen)
    return None if pen.bounds is None else BoundingBox(*pen.bounds)
コード例 #3
0
ファイル: __init__.py プロジェクト: simoncozens/boulmer
 def getControlBounds(self, layer=None):
     pen = ControlBoundsPen(layer)
     # raise 'KeyError' when a referenced component is missing from glyph set
     pen.skipMissingComponents = False
     self.draw(pen)
     return None if pen.bounds is None else BoundingBox(*pen.bounds)