fontlabapp.glyphs.identity_tools.glyph_identity.unicode_from_names
unicode_from_names
Assign Unicode code points that the glyph names imply. Preview first.
WHAT: A non-modal panel reads glyph names and lists the code point each name implies. It knows uniXXXX and uXXXX[XX] names, a built-in table of Adobe Glyph List names, and accented Latin names (Wacute is LATIN CAPITAL LETTER W WITH ACUTE, found with unicodedata). Names with a suffix (a.ss01), ligature names (f_i) and surrogate code points (U+D800 to U+DFFF) are left alone. Assign writes all rows marked "assign".
HOW: The script scans the font and plans each row: "same" (already right), "encoded differently" (the glyph has another code and Replace is off), "used by X" (another glyph already owns the code, or an earlier row claims it), a refusal reason, or "assign". The write rescans, then sets the code points on the font-owned FontGate record as one Undo step. It reads each 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: A code point must belong to one glyph only. The plan never steals a code from another glyph and never lets two rows claim one code. FontLab rebuilds all auto layers when an auto layer, or the base glyph of an auto composite (also through other composites), is notified, and Undo does not restore them. So the script REFUSES such glyphs. It never reads flGlyph.fgGlyph, never calls UpdateAll (fl#8537), discloses queued ids and their possible date changes. Before it writes, 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, or choose "All glyphs in the font". Run the script. Check the table. Press Assign.
BENEFIT: Fonts built from named outlines get a correct character map 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 |
|---|---|---|---|
ACCENTS |
attribute | ||
AGL |
attribute | ||
AGL_TEXT |
attribute | ||
KEY |
attribute | ||
MAX_CODE |
attribute | ||
OPERATION |
attribute | ||
SURROGATES |
attribute | ||
TITLE |
attribute | ||
U |
attribute | ||
UNI |
attribute | ||
apply_unicodes |
function | (native: Any, qtcore: Any, package_id: int, names: list[str], overwrite: bool, *, disclosure: dict[str, Any] … |
Assign the implied code points to NAMES. |
code_for_name |
function | (name: str) -> tuple[int | None, str] |
Return (code point, source) implied by NAME, or (None, ""). |
hexes |
function | (codes: list[int]) -> str |
Return codes as "U+0041 U+0042", or an en dash for none. (shared captured text) |
main |
function | () -> Any |
Open or replace the Unicode from Names panel. |
plan_unicodes |
function | (facts: names_edit.Facts, names: list[str], overwrite: bool) -> list[tuple[str, list[int], int, str, str]] |
Return (name, current codes, implied code, source, status) for each implying name. |
unicode_write_guard |
function | (package_id: int) -> None |
Apply the App Unicode writer guards before any history call. (shared captured text) |