anchors

Tools to create, move, delete and transfer anchors.

clear_anchors(font, glyph_names=None)[source]

Delete all anchors in the font.

Parameters:glyph_names (list) – A list of glyphs to restrict selection.
create_anchors(glyph, top=True, bottom=True, accent=False, top_delta=20, bottom_delta=20)[source]

Create anchors in glyph.

Parameters:
  • top (bool) – Create or not top anchors.
  • bottom (bool) – Create or not bottom anchors.
  • accent (bool) – Create ot not accent anchors with underscore prefix.
  • top_delta (int) – Distance from top anchors to the font’s x-height.
  • bottom_delta (int) – Distance from bottom anchors to the font’s baseline.
find_lost_anchors(font)[source]

Find anchors which are lost outside of the bounding box.

get_anchors(font, glyph_names=None)[source]

Get anchors from a font as a dictionary.

Parameters:glyph_names (list) – A list of glyphs to restrict selection.
Returns:A dictionary with anchor names and positions for each glyph.
get_anchors_dict(accents_dict)[source]

Get an anchors dict from a dict of glyph building recipes.

Returns:A dictionary with anchor names and positions for each glyph.
move_anchors(glyph, anchor_names, (delta_x, delta_y))[source]

Move named anchors in the given glyph.

Parameters:
  • anchor_names (list) – A list of anchor names to move.
  • delta_x (int) – The horizontal move distance.
  • delta_y (int) – The vertical move distance.
remove_duplicate_anchors(font)[source]

Delete duplicate anchors with same name and position.

rename_anchor(glyph, old_name, new_name)[source]

Rename named anchor in the given glyph.

Parameters:
  • old_name (str) – Old anchor name to be replace.
  • new_name (str) – New anchor name.
Returns:

A boolean indicating if the glyph has any anchor with the given old_name.

transfer_anchors(source_glyph, dest_glyph)[source]

Transfer all anchors from one glyph to another.

Parameters:
  • source_glyph (RGlyph) – The source glyph for the anchors.
  • dest_glyph (RGlyph) – The destination glyph.
Returns:

A boolean indicating if the source glyph has any anchor.

Previous topic

Modules

Next topic

color

This Page