AllFonts(*deprecatedSortOptions, sortOptions=None, reverse=False)

Return a list of all open fonts.

Optional sorting options can be provided. see FontsList


Return the front most open font.


Return the front current glyph.

NewFont(familyName=None, styleName=None, showInterface=True, showUI=None)

Open a new font. Optional familyName and styleName can be provided. Use showInterface (bool) to indicate if the font should be opened in the UI.

OpenFont(pathOrObject=None, showInterface=True, showUI=None)

Open a font with a given path. If no path is given a get file dialog will pop up. Optionally showInterface can be toggle on/off.

OpenWindow(controller, *args, **kwargs)

Open window and control if that window is not openend twice.

Return True when the window is already opened. False if a new instance of the window is opened.

CreateCursor(pathOrImage, hotSpot=(4, 4))

Create a cursor from a path or an NSImage. Optional a hotSpot x, y tuple can be provided.


class FontsList()

A list object to sort fonts according to different options.

sortBy(sortOptions, reverse=False)

Sort the list of fonts with the ordering preferences defined by sortOptions.

sortBy must be one of the following:

  • sort description string
  • BaseInfo attribute name
  • sort value function
  • list/tuple containing sort description strings, BaseInfo attribute names and/or sort value functions
  • magic

Sort Description Strings

The sort description strings, and how they modify the sort, are:

string sorting
familyName Family names by alphabetical order.
styleName Style names by alphabetical order.
isItalic Italics before romans.
isRoman Romans before italics.
widthValue Width values by numerical order.
weightValue Weight values by numerical order.
monospace Monospaced before proportional.
proportional Proportional before monospaced.
fonts.sortBy("familyName", "styleName")

Font Info Attribute Names

Any BaseFont attribute name may be included as a sort option. For example, to sort by x-height value, you’d use the xHeight attribute name:


Sort Value Function

A sort value function must be a function that accepts one argument, font. This function must return a sortable value for the given font. For example:

def glyphCountSortValue(font):
    return len(font)


A list of sort description strings and/or sort functions may also be provided. This should be in order of most to least important. For example, to sort by family name and then style name, do this:


If “magic” is given for sortBy, the fonts will be sorted based on this sort description sequence:

  • familyName
  • isProportional
  • widthValue
  • weightValue
  • styleName
  • isRoman
Inherits from subclass:












Get a list of fonts that match familyName. This will return an instance of :class:BaseFontList.

getFontsByFamilyNameStyleName(familyName, styleName)

Get a list of fonts that match familyName and styleName. This will return an instance of :class:BaseFontList.


Get a list of fonts that match the (attribute, value) combinations in attributeValuePairs.


>>> subFonts = fonts.getFontsByFontInfoAttribute(("xHeight", 20))
>>> subFonts = fonts.getFontsByFontInfoAttribute(("xHeight", 20), ("descender", -150))

This will return an instance of :class:BaseFontList.


Get a list of fonts that match styleName. This will return an instance of :class:BaseFontList.

Last edited on 12/05/2021