def getBounds(drawable: Drawable, layer: GlyphSet | None) -> BoundingBox | None: pen = BoundsPen(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 getBounds(drawable: Drawable, layer: Any) -> Optional[BoundingBox]: # XXX: layer should behave like a mapping of glyph names to Glyph objects, but # cyclic imports... pen = BoundsPen(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 getBounds(self, layer=None): pen = BoundsPen(layer) pen.skipMissingComponents = False self.draw(pen) return None if pen.bounds is None else BoundingBox(*pen.bounds)