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

Return a list of all open fonts. Optinally sort options can be provided. see FontList


Return the front most open font.


Return the front current glyph.

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

Open a new font. Optionally a familyName and styleName can be provided. Optionally showInterface can be toggle on/off.

OpenFont(path=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()

list() -> new empty list list(iterable) -> new list initialized from iterable’s items

sortBy(sortOptions, reverse=False)

Sort fonts with the ordering preferences defined by sortBy. sortBy must be one of the following:

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

Sort Description Strings

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

+——————–+————————————–+ | "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 :class: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.


>>> fonts.sortBy("xHeight")

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)

>>> fonts.sortBy(glyphCountSortValue)

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"


>>> fonts.sortBy("magic")
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 08/12/2018