Extract BBox Width data from Glyphs?

Hi everyone,

It is possible to extract data from a glyph in to a spreadsheet or a text file ?

I’m working on Condensed and Extended version of a font and I would like to extract from the Normal version the BBox Width (width of a glyph without right and left sidebearing) of all glyphs into a spreadsheet to apply them a multiplication.


You can access it through the bounds property of a layer:

from __future__ import print_function
for g in Font.glyphs:
	copystring = g.name
	for m in Font.masters:
		l = g.layers[m.id]
		copystring += "\t%.1f" % l.bounds.size.width

This will output a tab-separated listing of all bounding box widths. You should be able to paste that in a spreadsheet app.

Perfect ! Thanks a lot

It is possible to indicate a name of a master in the code ?

Feel free to edit the snippet to your liking.

1 Like