Skip to content

fontlabapp.vfjo._edit · declarations 001

Back to fontlabapp.vfjo._edit

fontlabapp.vfjo.add_suffix

add_suffix(obj: Objects, suffix: str, *, drop_unicodes: bool = True) -> Objects

Append suffix to every glyph name and return obj.

By default the Unicode values (unicode, unicodes) are removed too, so pasted copies do not clash with the originals; pass drop_unicodes=False to keep them.

fontlabapp.vfjo.anchors

anchors(obj: Any) -> Iterator[_Data]

Yield the anchor boxes of all layers.

fontlabapp.vfjo.contours

contours(obj: Any) -> Iterator[_Data]

Yield the contour boxes (coordinates before element transforms).

fontlabapp.vfjo.edit_nodes

edit_nodes(obj: Any, fn: Callable[[Node], Node | None]) -> Any

Replace each node by fn(node) (None keeps it); return obj.

Raises ValueError when a contour's point count changes.

fontlabapp.vfjo.elements

elements(obj: Any) -> Iterator[_Data]

Yield the element boxes, nested elementData.elements included.

fontlabapp.vfjo.layers

layers(obj: Any) -> Iterator[_Data]

Yield the layer boxes of all glyph items and layer items.

fontlabapp.vfjo.move

move(obj: Any, dx: Number, dy: Number, *, anchors: bool = True) -> Any

Move outlines, components, anchors, guidelines and hints by (dx, dy); return obj.

fontlabapp.vfjo.paste

paste(objs: Objects, font: Any = None, *, on_conflict: str = 'rename', **kw: Any) -> json_data.Pasted

Paste objs into font (default: the current font), with Undo.

Glyph data goes to json_data.paste_glyphs (new glyphs; on_conflict is "rename" or "skip" and applies to glyph data only). FontLab may order the new glyph's layers differently from the JSON. Layer, element or contour data (one kind at a time) goes to json_data.paste_shapes on the current glyph's active layer, which must belong to font: shape data with a font other than the current font raises ValueError. Glyph paste records one Undo step per new glyph plus one for the outlines (json_data.GLYPHS_UNDO_TEXT); shape paste records one. Empty data, glyphs mixed with shapes or more than one shape kind raise ValueError; no font or no current glyph raises RuntimeError.

fontlabapp.vfjo.rename

rename(obj: Objects, rename: Mapping[str, str] | Callable[[str], str]) -> Objects

Rename glyph items from a mapping (missing names stay) or a function; return obj.

Unicode values stay; paste drops values that clash in the font.

fontlabapp.vfjo.scale

scale(obj: Any, sx: Number, sy: Number | None = None, *, origin: tuple[Number, Number] = (0, 0), anchors: bool = True, widths: bool = False) -> Any

Scale by sx (and sy, default sx) around origin; widths scales advanceWidth.

Hint thickness scales except for ghost hints (thickness -20 or 21), which keep their value; a real stem hint of exactly -20 or 21 units stays too.

fontlabapp.vfjo.set_width

set_width(obj: Any, width: Number | Callable[[Number], Number]) -> Any

Set every layer's advanceWidth to a number or width(old_width); return obj.