GlyphNames
in package
Pdf extract glyph names class
Resolves a PostScript glyph name (as used in a font's /Differences array) to a Unicode codepoint. Tries the algorithmic "uniXXXX"/"uXXXX" naming convention first (covers most subsetted/custom fonts with no lookup table needed), then a curated table of common named glyphs - not the full ~4,300-entry Adobe Glyph List. An unmapped name returns null and is skipped by the caller rather than guessed at.
Tags
Table of Contents
Constants
- TABLE = [ // ASCII printable range - official Adobe glyph names. 'space' => 0x20, 'exclam' => 0x21, 'quotedbl' => 0x22, 'numbersign' => 0x23, 'dollar' => 0x24, 'percent' => 0x25, 'ampersand' => 0x26, 'quotesingle' => 0x27, 'parenleft' => 0x28, 'parenright' => 0x29, 'asterisk' => 0x2a, 'plus' => 0x2b, 'comma' => 0x2c, 'hyphen' => 0x2d, 'period' => 0x2e, 'slash' => 0x2f, 'zero' => 0x30, 'one' => 0x31, 'two' => 0x32, 'three' => 0x33, 'four' => 0x34, 'five' => 0x35, 'six' => 0x36, 'seven' => 0x37, 'eight' => 0x38, 'nine' => 0x39, 'colon' => 0x3a, 'semicolon' => 0x3b, 'less' => 0x3c, 'equal' => 0x3d, 'greater' => 0x3e, 'question' => 0x3f, 'at' => 0x40, 'A' => 0x41, 'B' => 0x42, 'C' => 0x43, 'D' => 0x44, 'E' => 0x45, 'F' => 0x46, 'G' => 0x47, 'H' => 0x48, 'I' => 0x49, 'J' => 0x4a, 'K' => 0x4b, 'L' => 0x4c, 'M' => 0x4d, 'N' => 0x4e, 'O' => 0x4f, 'P' => 0x50, 'Q' => 0x51, 'R' => 0x52, 'S' => 0x53, 'T' => 0x54, 'U' => 0x55, 'V' => 0x56, 'W' => 0x57, 'X' => 0x58, 'Y' => 0x59, 'Z' => 0x5a, 'bracketleft' => 0x5b, 'backslash' => 0x5c, 'bracketright' => 0x5d, 'asciicircum' => 0x5e, 'underscore' => 0x5f, 'grave' => 0x60, 'a' => 0x61, 'b' => 0x62, 'c' => 0x63, 'd' => 0x64, 'e' => 0x65, 'f' => 0x66, 'g' => 0x67, 'h' => 0x68, 'i' => 0x69, 'j' => 0x6a, 'k' => 0x6b, 'l' => 0x6c, 'm' => 0x6d, 'n' => 0x6e, 'o' => 0x6f, 'p' => 0x70, 'q' => 0x71, 'r' => 0x72, 's' => 0x73, 't' => 0x74, 'u' => 0x75, 'v' => 0x76, 'w' => 0x77, 'x' => 0x78, 'y' => 0x79, 'z' => 0x7a, 'braceleft' => 0x7b, 'bar' => 0x7c, 'braceright' => 0x7d, 'asciitilde' => 0x7e, // Common typographic punctuation. 'quoteleft' => 0x2018, 'quoteright' => 0x2019, 'quotedblleft' => 0x201c, 'quotedblright' => 0x201d, 'quotesinglbase' => 0x201a, 'quotedblbase' => 0x201e, 'endash' => 0x2013, 'emdash' => 0x2014, 'bullet' => 0x2022, 'ellipsis' => 0x2026, 'dagger' => 0x2020, 'daggerdbl' => 0x2021, 'trademark' => 0x2122, 'copyright' => 0xa9, 'registered' => 0xae, 'degree' => 0xb0, 'plusminus' => 0xb1, 'section' => 0xa7, 'paragraph' => 0xb6, 'periodcentered' => 0xb7, 'fi' => 0xfb01, 'fl' => 0xfb02, // Common accented Latin letters (Latin-1 Supplement block). 'Agrave' => 0xc0, 'Aacute' => 0xc1, 'Acircumflex' => 0xc2, 'Atilde' => 0xc3, 'Adieresis' => 0xc4, 'Aring' => 0xc5, 'AE' => 0xc6, 'Ccedilla' => 0xc7, 'Egrave' => 0xc8, 'Eacute' => 0xc9, 'Ecircumflex' => 0xca, 'Edieresis' => 0xcb, 'Igrave' => 0xcc, 'Iacute' => 0xcd, 'Icircumflex' => 0xce, 'Idieresis' => 0xcf, 'Ntilde' => 0xd1, 'Ograve' => 0xd2, 'Oacute' => 0xd3, 'Ocircumflex' => 0xd4, 'Otilde' => 0xd5, 'Odieresis' => 0xd6, 'Oslash' => 0xd8, 'Ugrave' => 0xd9, 'Uacute' => 0xda, 'Ucircumflex' => 0xdb, 'Udieresis' => 0xdc, 'Yacute' => 0xdd, 'agrave' => 0xe0, 'aacute' => 0xe1, 'acircumflex' => 0xe2, 'atilde' => 0xe3, 'adieresis' => 0xe4, 'aring' => 0xe5, 'ae' => 0xe6, 'ccedilla' => 0xe7, 'egrave' => 0xe8, 'eacute' => 0xe9, 'ecircumflex' => 0xea, 'edieresis' => 0xeb, 'igrave' => 0xec, 'iacute' => 0xed, 'icircumflex' => 0xee, 'idieresis' => 0xef, 'ntilde' => 0xf1, 'ograve' => 0xf2, 'oacute' => 0xf3, 'ocircumflex' => 0xf4, 'otilde' => 0xf5, 'odieresis' => 0xf6, 'oslash' => 0xf8, 'ugrave' => 0xf9, 'uacute' => 0xfa, 'ucircumflex' => 0xfb, 'udieresis' => 0xfc, 'yacute' => 0xfd, 'ydieresis' => 0xff, 'germandbls' => 0xdf, 'dotlessi' => 0x131, ]
- Curated PostScript glyph name to Unicode codepoint table
Methods
- resolve() : int|null
- Resolve a PostScript glyph name to a Unicode codepoint
Constants
TABLE
Curated PostScript glyph name to Unicode codepoint table
protected
mixed
TABLE
= [
// ASCII printable range - official Adobe glyph names.
'space' => 0x20,
'exclam' => 0x21,
'quotedbl' => 0x22,
'numbersign' => 0x23,
'dollar' => 0x24,
'percent' => 0x25,
'ampersand' => 0x26,
'quotesingle' => 0x27,
'parenleft' => 0x28,
'parenright' => 0x29,
'asterisk' => 0x2a,
'plus' => 0x2b,
'comma' => 0x2c,
'hyphen' => 0x2d,
'period' => 0x2e,
'slash' => 0x2f,
'zero' => 0x30,
'one' => 0x31,
'two' => 0x32,
'three' => 0x33,
'four' => 0x34,
'five' => 0x35,
'six' => 0x36,
'seven' => 0x37,
'eight' => 0x38,
'nine' => 0x39,
'colon' => 0x3a,
'semicolon' => 0x3b,
'less' => 0x3c,
'equal' => 0x3d,
'greater' => 0x3e,
'question' => 0x3f,
'at' => 0x40,
'A' => 0x41,
'B' => 0x42,
'C' => 0x43,
'D' => 0x44,
'E' => 0x45,
'F' => 0x46,
'G' => 0x47,
'H' => 0x48,
'I' => 0x49,
'J' => 0x4a,
'K' => 0x4b,
'L' => 0x4c,
'M' => 0x4d,
'N' => 0x4e,
'O' => 0x4f,
'P' => 0x50,
'Q' => 0x51,
'R' => 0x52,
'S' => 0x53,
'T' => 0x54,
'U' => 0x55,
'V' => 0x56,
'W' => 0x57,
'X' => 0x58,
'Y' => 0x59,
'Z' => 0x5a,
'bracketleft' => 0x5b,
'backslash' => 0x5c,
'bracketright' => 0x5d,
'asciicircum' => 0x5e,
'underscore' => 0x5f,
'grave' => 0x60,
'a' => 0x61,
'b' => 0x62,
'c' => 0x63,
'd' => 0x64,
'e' => 0x65,
'f' => 0x66,
'g' => 0x67,
'h' => 0x68,
'i' => 0x69,
'j' => 0x6a,
'k' => 0x6b,
'l' => 0x6c,
'm' => 0x6d,
'n' => 0x6e,
'o' => 0x6f,
'p' => 0x70,
'q' => 0x71,
'r' => 0x72,
's' => 0x73,
't' => 0x74,
'u' => 0x75,
'v' => 0x76,
'w' => 0x77,
'x' => 0x78,
'y' => 0x79,
'z' => 0x7a,
'braceleft' => 0x7b,
'bar' => 0x7c,
'braceright' => 0x7d,
'asciitilde' => 0x7e,
// Common typographic punctuation.
'quoteleft' => 0x2018,
'quoteright' => 0x2019,
'quotedblleft' => 0x201c,
'quotedblright' => 0x201d,
'quotesinglbase' => 0x201a,
'quotedblbase' => 0x201e,
'endash' => 0x2013,
'emdash' => 0x2014,
'bullet' => 0x2022,
'ellipsis' => 0x2026,
'dagger' => 0x2020,
'daggerdbl' => 0x2021,
'trademark' => 0x2122,
'copyright' => 0xa9,
'registered' => 0xae,
'degree' => 0xb0,
'plusminus' => 0xb1,
'section' => 0xa7,
'paragraph' => 0xb6,
'periodcentered' => 0xb7,
'fi' => 0xfb01,
'fl' => 0xfb02,
// Common accented Latin letters (Latin-1 Supplement block).
'Agrave' => 0xc0,
'Aacute' => 0xc1,
'Acircumflex' => 0xc2,
'Atilde' => 0xc3,
'Adieresis' => 0xc4,
'Aring' => 0xc5,
'AE' => 0xc6,
'Ccedilla' => 0xc7,
'Egrave' => 0xc8,
'Eacute' => 0xc9,
'Ecircumflex' => 0xca,
'Edieresis' => 0xcb,
'Igrave' => 0xcc,
'Iacute' => 0xcd,
'Icircumflex' => 0xce,
'Idieresis' => 0xcf,
'Ntilde' => 0xd1,
'Ograve' => 0xd2,
'Oacute' => 0xd3,
'Ocircumflex' => 0xd4,
'Otilde' => 0xd5,
'Odieresis' => 0xd6,
'Oslash' => 0xd8,
'Ugrave' => 0xd9,
'Uacute' => 0xda,
'Ucircumflex' => 0xdb,
'Udieresis' => 0xdc,
'Yacute' => 0xdd,
'agrave' => 0xe0,
'aacute' => 0xe1,
'acircumflex' => 0xe2,
'atilde' => 0xe3,
'adieresis' => 0xe4,
'aring' => 0xe5,
'ae' => 0xe6,
'ccedilla' => 0xe7,
'egrave' => 0xe8,
'eacute' => 0xe9,
'ecircumflex' => 0xea,
'edieresis' => 0xeb,
'igrave' => 0xec,
'iacute' => 0xed,
'icircumflex' => 0xee,
'idieresis' => 0xef,
'ntilde' => 0xf1,
'ograve' => 0xf2,
'oacute' => 0xf3,
'ocircumflex' => 0xf4,
'otilde' => 0xf5,
'odieresis' => 0xf6,
'oslash' => 0xf8,
'ugrave' => 0xf9,
'uacute' => 0xfa,
'ucircumflex' => 0xfb,
'udieresis' => 0xfc,
'yacute' => 0xfd,
'ydieresis' => 0xff,
'germandbls' => 0xdf,
'dotlessi' => 0x131,
]
Methods
resolve()
Resolve a PostScript glyph name to a Unicode codepoint
public
static resolve(string $glyphName) : int|null
Parameters
- $glyphName : string