MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _bounds

Function _bounds

lib/matplotlib/backends/backend_ps.py:299–321  ·  view source on GitHub ↗

Compute the font bounding box, as if all glyphs were written at the same start position. Helper function for _font_to_ps_type42. Parameters ---------- font : fontTools.ttLib.ttFont.TTFont The font Returns ------- tuple (xMin, yMin, xMax, yMax)

(font)

Source from the content-addressed store, hash-verified

297
298
299def _bounds(font):
300 """
301 Compute the font bounding box, as if all glyphs were written
302 at the same start position.
303
304 Helper function for _font_to_ps_type42.
305
306 Parameters
307 ----------
308 font : fontTools.ttLib.ttFont.TTFont
309 The font
310
311 Returns
312 -------
313 tuple
314 (xMin, yMin, xMax, yMax) of the combined bounding box
315 of all the glyphs in the font
316 """
317 gs = font.getGlyphSet(False)
318 pen = fontTools.pens.boundsPen.BoundsPen(gs)
319 for name in gs.keys():
320 gs[name].draw(pen)
321 return pen.bounds or (0, 0, 0, 0)
322
323
324def _generate_charstrings(font):

Callers 1

_serialize_type42Function · 0.85

Calls 1

drawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…