If path is None, use the font’s original location.
The file type must be inferred from the file extension
of the given path. If no file extension is given, the
environment may fall back to the format of its choice.
showProgress indicates if a progress indicator should
be displayed during the operation. Environments may or may
not implement this behavior. formatVersion indicates
the format version that should be used for writing the given
file type. For example, if 2 is given for formatVersion
and the file type being written if UFO, the file is to
be written in UFO 2 format. This value is not limited
to UFO format versions. If no format version is given,
the original format version of the file should be preserved.
If there is no original format version it is implied that
the format version is the latest version for the file
type as supported by the environment.

.. note:

Environments may define their own rules governing when
a file should be saved into its original location and
when it should not. For example, a font opened from a
compiled OpenType font may not be written back into
the original OpenType font.

setColorForLayer(layerName, rgba)

Deprecated: use Font.getLayer(layerName).color=r,g,b,a

setDisplayOption(option, value)

Set a display option for the default layer.

option

must be Fill, Stroke, Points, Coordinates or all

setLayerDisplay(layerName, option, value)

Deprecated: use Font.getLayer(layerName).setDisplayOption(option,value)

showUI()

Deprecated: use openInterface.

templateKeys()

Return the template glyphs names in the font. Template glyphs are not existing glyphs but they are visible in the UI.

testDeinstall()

testInstall()

Test install the font in the local machine.

updateComponentReferences(baseGlyphName)

Update all component references.

addObserver(observer, methodName, notification)

Add an observer object. that will receive notification for the given methodName.

getRepresentation(name, **kwargs)

Get a representation by name.

Optionally arguments could be provided if the representation factory requires arguments.

holdChanges()

Capture changes and bundle them in a single change in a with statement.

performUndo()

Create a undo item and add it the the undo manager.

prepareUndo(undoTitle='')

Save the current state of the object.

releaseHeldChanges()

removeObserver(observer, notification)

Remove an observer object for a notification.

undo(undoTitle='')

Capture the current state of the object and create a undo item in a with statement.

changed()

Tell the environment that something has changed in
the object. The behavior of this method will vary
from environment to environment.
:

position must be a coordinate
indicating the position of the guideline.
angle indicates the angle of
the guideline. name indicates the name
for the guideline. This must be a string
or None. color indicates the color for
the guideline. This must be a color
or None. This will return the newly created
BaseGuidline object.

guideline may be a BaseGuideline object from which
attribute values will be copied. If position, angle, name
or color are specified as arguments, those values will be used
instead of the values in the given guideline object.

autoUnicodes()

Use heuristics to set Unicode values in all glyphs.

>>>font.autoUnicodes()

Environments will define their own heuristics for
automatically determining values.

This applies only to the default layer.

clearGuidelines()

Clear all guidelines.

>>>font.clearGuidelines()

close(save=False)

Close the font.

>>>font.close()

save is a boolean indicating if the font
should be saved prior to closing. If save
is True, the BaseFont.save method
will be called. The default is False.

copyData(source)

Copy data from source into this font.
Refer to BaseFont.copy for a list
of values that will be copied.

duplicateLayer(layerName, newLayerName)

Duplicate the layer with layerName, assign
newLayerName to the new layer and insert the
new layer into the font. :

generate(format, path=None, **environmentOptions)

format defines the file format to output.
Standard format identifiers can be found in BaseFont.generateFormatToExtension:

Environments are not required to support all of these
and environments may define their own format types.
path defines the location where the new file should
be created. If a file already exists at that location,
it will be overwritten by the new file. If path defines
a directory, the file will be output as the current
file name, with the appropriate suffix for the format,
into the given directory. If no path is given, the
file will be output into the same directory as the source
font with the file named with the current file name,
with the appropriate suffix for the format.

Environments may allow unique keyword arguments in this
method. For example, if a tool allows decomposing components
during a generate routine it may allow this:

getFlatKerning()

getLayer(name)

getReverseComponentMapping()

Create a dictionary of unicode -> [glyphname, …] mappings.
All glyphs are loaded. Note that one glyph can have multiple unicode values,
and a unicode value can have multiple glyphs pointing to it.

insertLayer(layer, name=None)

Insert layer into the font. :

>>>layer=font.insertLayer(otherLayer,name="layer 2")

This will not insert the layer directly.
Rather, a new layer will be created and the data from
layer will be copied to to the new layer. name
indicates the name that should be assigned to the layer
after insertion. If name is not given, the layer’s
original name must be used. If the layer does not have
a name, an error must be raised. The data that will be
inserted from layer is the same data as documented
in BaseLayer.copy.

interpolate(factor, minFont, maxFont, round=True, suppressError=True)

The interpolation occurs on a 0 to 1.0 range where minFont
is located at 0 and maxFont is located at 1.0. factor
is the interpolation value. It may be less than 0 and greater
than 1.0. It may be a integer/float or a tuple of
two integer/float. If it is a tuple, the first
number indicates the x factor and the second number indicates
the y factor. round indicates if the result should be
rounded to integers. suppressError indicates if incompatible
data should be ignored or if an error should be raised when
such incompatibilities are found.