Esempio n. 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)
Esempio n. 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)
Esempio n. 3
0
 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)