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)
| 297 | |
| 298 | |
| 299 | def _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 | |
| 324 | def _generate_charstrings(font): |
no test coverage detected
searching dependent graphs…