User Guide
FontLab 4
704
Font
The Font class contains all the data that is related to the font in FontLab
internal data structures. The Font class by itself has no interaction with
the user interface elements. You need to use other classes such as the fl
object of the FontLab class to interact with the font.
The most important members of the Font class are:
classes
Python list with the strings containing FontLab classes
ot_classes String containing OpenType classes (text that appears in the
bottom control of the OpenType panel)
features
List of OpenType features. Each element of the list is an object
of the Feature class
customdata A string that may contain any data you want to attach to a font.
This data is saved in the FontLab font file so you can use this
member to store information that is not editable by FontLab
tools.
truetypetables
List of custom TrueType tables. Each element of the list is an
object of the TrueTypeTable class.
ttinfo
TrueType information (mostly hinting-related tables)
glyphs
Array of glyphs. Each element of the array is an object of the
Glyph class
So, for example, if you want to see the advanced width of the glyph with
index 12 you would write:
print fl.font.glyphs[12].width
Here “fl” is an object of the FontLab class that represents the FontLab user
interface; “font” is the currently active font (object of the Font class);
“glyphs” is a member of the Font class representing an array of glyphs; [12]
directs us to the 12
th
element of the glyphs array; “width” is a member of
the Glyph class representing the glyph’s advance width.
A shorter way to access the glyphs of the font is to access the Font object as
an array:
print len(fl.font)
print fl.font[12].width