glyphNameToUnicode(name)— Adobe Glyph List name-to-Unicode resolver.
Module encodingAgl | Source packages/front/office/fonts/src/encodings/agl.js | Deps encodingAglTable | Worker-safe yes
Resolve
const { glyphNameToUnicode } = runtime.resolve('encodingAgl');
// Returns: { glyphNameToUnicode }
API
| Method | Signature | Returns |
|---|---|---|
glyphNameToUnicode |
(name: string) => number[] | null |
Unicode code point sequence for a PostScript glyph name, or null when unresolvable. Never throws. |
Examples
const { glyphNameToUnicode } = runtime.resolve('encodingAgl');
glyphNameToUnicode('Agrave'); // [0x00C0] — table lookup
glyphNameToUnicode('ffi'); // [0xFB03] — ligature, single precomposed code point
glyphNameToUnicode('uni0041'); // [0x0041]
glyphNameToUnicode('uni00410042'); // [0x0041, 0x0042] — a 2-codepoint sequence
glyphNameToUnicode('u1F600'); // [0x1F600] — astral-plane single codepoint
glyphNameToUnicode('not-a-glyph'); // null
Resolution algorithm
The AGL Specification's (adobe-type-tools/agl-specification, §3
"Mapping glyph names to Unicode values") heuristic algorithm has three
relevant rules; this module implements all three:
- Table lookup — a verbatim Adobe Glyph List name (e.g.
Agrave→[0x00C0],bullet→[0x2022], ligatures likeffi→[0xFB03]). Backed byencodingAglTable'sAGL_TABLE, generated from the vendoredadobe-type-tools/agl-aglfnglyphlist.txt(BSD-3-Clause, pinned commit4036a9ca, 4281 entries — see../../src/encodings/AGL-PROVENANCE.mdand the re-runnable generator../../tools/gen-agl-table.mjs). uniXXXX[YYYY...]form —"uni"+ a hex-digit sequence whose length is a multiple of 4; each 4-digit group is one Unicode code point (surrogate / out-of-range groups invalidate the whole name).uXXXX/uXXXXX/uXXXXXXform —"u"+ 4 to 6 hex digits, a single Unicode code point (same range/surrogate exclusion).
A name that matches none of the three resolves to null.
Worker Usage
const worker = fw.createWorker([encodingAglTable, encodingAgl]);
Notes
- Hex-digit matching is case-insensitive (a documented, deliberate deviation from the spec's literal "uppercase hexadecimal digits" — real fonts use both cases; this only widens what resolves).
- Consumers should treat a
nullresult as "no Unicode mapping known" rather than "the glyph name is invalid".
See also
- lookup — the byte-to-glyph-name encoding dispatcher this module complements (glyph name → Unicode, vs. byte → glyph name).
../../src/encodings/AGL-PROVENANCE.md— vendoring provenance + regeneration recipe.