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)
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)
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)