Skip to content

Place From Bounds

Add or move top and bottom anchors from the outline bounds.

What: Puts top, bottom, _top and _bottom anchors on the ink box of each layer. Each anchor sits at the horizontal centre of the box, on the chosen edge, plus an offset. The offset pushes the anchor away from the glyph.

How: top follows the upper edge; bottom follows the lower edge; _top follows the lower edge; _bottom follows the upper edge. A missing anchor is added with its name-derived appearance. An existing anchor moves and keeps its style. Empty layers are left alone. The centre rounds half up.

Why: This gives a quick first anchor set for a new font. Refine it later by hand.

Use: Select glyphs. Run the script. Tick the anchors. Set offsets. Check the table. Press Place.

Benefit: Many glyphs get consistent starter anchors in one Undo step.

Safety: Auto layers are listed and never edited. The script refuses the whole batch, before any history exists, when:

  • an existing anchor would move to 0, 0 (FontLab cannot Redo that);
  • a glyph has an automatic layer, or is the base of an automatic composite, also through other composites (FontLab rebuilds the composite and Undo does not restore it);
  • several anchors on a layer share a name (the edit is ambiguous);

After the write, the script reads every value back. It reports any value that FontLab did not keep, for example under a strong rounding preference. If FontLab fails part-way, the error says that native changes may remain. The edit is recorded as one Undo step. The plan, the safety checks, the one-step write and the panel base are shared with the other anchor scripts (fly.ap.anchors.writer, fly.ap.anchors.panel.model); the planner and the controls belong to this script.

Source: the author's own FontLab sample anchors_place_from_bounds.py, Apache-2.0. Adapted for the current FontLab 9 API.

Run Anchors > Place From Bounds from FontLab's Scripts menu.

Read installation and working with scripts before use.

Source identity

SHA256: 9c9005e716f70ca9cc29511690fa0297bcc4376e137730ab63dca16a64412d04

Python source at f4c16f20ef10