fontlabapp.glyphs.identity_tools.glyph_identity.suffix_tool
suffix_tool
Add, remove or replace a glyph-name suffix (.ss01, .sc, .alt) on the selected glyphs.
WHAT: A non-modal panel offers three operations. Add puts a suffix on each selected name. Remove strips one suffix (or the last suffix when the field is empty). Replace swaps one suffix for another. A table previews every new name and a check result. Apply renames all rows that pass.
HOW: The script rescans the font before the write. A row passes only when the new name is valid, does not exist, is not the target of another row, and the glyph is not tied to an auto layer. The write is one Undo step. The rename and the optional Unicode removal use the font-owned FontGate record, never flGlyph.fgGlyph. After clearing Unicode the script reads the list back and compares it with the plan. The scan, the refusal policy and the one-step write come from the shared module fontlabapp.glyphs.names.model. If a write fails part way, every planned glyph is still notified and stamped, and the message asks you to use Edit > Undo.
WHY: Suffixed alternates are normally unencoded, so the panel can clear their Unicode in the same step. FontLab would replace an existing glyph that has the new name, so the script refuses that. FontLab rebuilds auto layers when they are notified, so the script REFUSES glyphs that have auto layers and glyphs that are the base of an auto composite, also through other composites. It never calls UpdateAll (fl#8537) and discloses queued ids and their possible date changes. Before it removes Unicode, the script applies the guards of the App Unicode writer: a regular Font window must be active and no Glyph editor may be open.
USE: Select glyphs in the Font window. Run the script. Choose the operation, type or pick a suffix (a missing leading dot is added), then press Apply.
BENEFIT: Alternate sets (.ss01, .sc, .case) get consistent names in one previewed, undoable step.
Credit: adapted from the author's own archived Apache-2.0 FontLab samples. The edit is recorded as one Undo step.
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
KEY |
attribute | ||
MODES |
attribute | ||
OPERATION |
attribute | (shared captured text) | |
PRESETS |
attribute | ||
RESERVED |
attribute | (shared captured text) | |
TITLE |
attribute | ||
VALID_NAME |
attribute | (shared captured text) | |
apply_suffix |
function | (native: Any, qtcore: Any, package_id: int, names: list[str], mode: str, suffix: str, replacement: str='', cl… |
Rename NAMES by suffix. |
dotted |
function | (suffix: str) -> str |
Return SUFFIX with one leading dot. |
hexes |
function | (codes: list[int]) -> str |
Return codes as "U+0041 U+0042", or an en dash for none. |
main |
function | () -> Any |
Open or replace the Suffix Tool panel. |
plan_renames |
function | (facts: names_edit.Facts, pairs: list[tuple[str, str]]) -> list[tuple[str, str, str]] |
Return (old, new, status) for each pair whose name changes. (shared captured text) |
suffixed |
function | (name: str, mode: str, suffix: str, replacement: str='') -> str |
Return the new name for one glyph, or NAME when the operation does not apply. |
unicode_loss |
function | (facts: names_edit.Facts, plan: list[tuple[str, str, str]]) -> dict[str, list[int]] |
Return {old name: code points} that a Unicode removal would delete (rows "ok"). |
unicode_write_guard |
function | (package_id: int) -> None |
Apply the App Unicode writer guards before any history call. |