fonts#

fonts(add=None, use=False, output='name', dryrun=False, rebuild=False, verbose=False, die=False, **kwargs)[source]#

List available fonts, or add new ones. Alias to Matplotlib’s font manager.

Note: if the font is not available after adding it, set rebuild=True. However, note that this can be very slow.

Parameters:
  • add (str/list) – path of the fonts or folders to add; if none, list available fonts

  • use (bool) – set the last-added font as the default font

  • output (str) – what to display the listed fonts as: options are ‘name’ (list of names, default), ‘path’ (dict of name:path), or ‘font’ (dict of name:font object)

  • dryrun (bool) – list fonts to be added rather than adding them

  • rebuild (bool) – whether to rebuild Matplotlib’s font cache (slow)

  • verbose (bool) – print out information on errors

  • die (bool) – whether to raise an exception if fonts can’t be added

  • kwargs (dict) – passed to matplotlib.font_manager.findSystemFonts()

Examples:

sc.fonts() # List available font names
sc.fonts(fullfont=True) # List available font objects
sc.fonts('myfont.ttf', use=True) # Add this font and immediately set to default
sc.fonts(['/folder1', '/folder2']) # Add all fonts in both folders
sc.fonts(rebuild=True) # Run this if added fonts aren't appearing