fontutils

A collection of useful functions for working with fonts.

add_extremes(font)[source]

Add extreme points to all glyphs in the font, if they are missing.

align_to_grid(font, (sizeX, sizeY))[source]

Align all points of all glyphs in the font to a grid with size (sizeX,sizeY).

auto_contour_direction(font)[source]

Automatically set contour directions for all glyphs in the font.

auto_contour_order(font)[source]

Automatically set contour order for all glyphs in the font.

auto_order_direction(font)[source]

Automatically set contour order and direction for all glyphs in the font, in one go.

auto_point_start(font)
clear_guides(font)[source]
create_guides(font, guides_dict)[source]
decompose(font)[source]

Decompose all composed glyph in the font.

delete_groups(font)[source]

Delete all groups in the font.

font_name(family, style)[source]

Same as full_name(), but family and style names are separated by a hyphen instead of space.

full_name(family, style)[source]

Build the full name of the font from family and style names.

Names are separated by a space. If the style is Regular, use only the family name.

get_full_name(font)[source]

Return the full name of the font, usually family name + style name.

get_glyphs(font)[source]

Return current glyph selection in the font as glyph names or RGlyph objects.

get_spacing_groups(font)[source]

Return a dictionary containing the left and right spacing groups in the font.

mark_composed_glyphs(font, color='Orange', alpha=0.35)[source]

Mark all composed glyphs in the font.

move_glyphs(f, (delta_x, delta_y))[source]

Move all glyphs in the font by the given (x,y) distance.

parse_glyphs_groups(names, groups)[source]

Parse a gstring and a groups dict into a list of glyph names.

print_groups(font, mode=0)[source]

Print all groups and glyphs in the font.

print_guides(font)[source]
print_selected_glyphs(f, mode=0, sort=False)[source]

Print the selected glyphs to the output window.

remove_overlap(font)[source]

Remove overlaps in all glyphs of the font.

rename_glyph(font, old_name, new_name, overwrite=True, mark=True, verbose=True)[source]

Rename a glyph in a given font.

Parameters:
  • font (RFont) – The font which contains the glyph to be renamed.
  • old_name (str) – The old glyph name to be replaced.
  • new_name (str) – The new glyph name to be used in place of the old one.
  • overwrite (bool) – Overwrite existing glyph with the new name.
  • mark (bool) – Mark the glyph after renaming.
  • verbose (bool) – Output informative messages to the console.
rename_glyphs_from_list(font, names_list, overwrite=True, mark=True, verbose=True)[source]
round_to_grid(font, gridsize, glyphs=None)[source]
scale_glyphs(f, (factor_x, factor_y))[source]

Scale all glyphs in the font by the given (x,y) factor.

set_font_names(f, family_name, style_name)[source]

Set font names from family_name and style_name.

set_foundry_info(font, fontInfoDict)[source]

Set foundry info from data in dict.

set_unique_ps_id(font)[source]

Set random unique PostScript ID.

temp_font()[source]

Return a temporary font for importing single .glyfs.

Previous topic

fontinfo

Next topic

ftp

This Page