Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
189 / 189
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
MacExpertEncodingTable
100.00% covered (success)
100.00%
189 / 189
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getTable
100.00% covered (success)
100.00%
189 / 189
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Encoding;
6
7/**
8 * MacExpertEncoding — used by expert/small-caps Type 1 fonts on Mac.
9 * Per PDF spec ISO 32000-2:2020, Table D.4.
10 */
11final class MacExpertEncodingTable
12{
13    /** @return array<int, string> byte value (0-255) to PostScript glyph name */
14    public static function getTable(): array
15    {
16        $notdef = '.notdef';
17        $table = array_fill(0, 256, $notdef);
18
19        $table[202] = 'space';
20        // Ligatures and fractions
21        $table[242] = 'fi';
22        $table[243] = 'fl';
23
24        // Small caps and expert glyphs
25        $table[276 - 256] = $notdef; // keep notdef for unmapped
26
27        // Per the PostScript Language Reference / PDF spec Table D.4
28        $table[207] = 'Acircumflexsmall'; // N/A in some implementations; included per spec
29        $table[171] = 'Aacutesmall';
30        $table[198] = 'ACsmall'; // non-standard name; some fonts use this
31
32        // Full mapping per Table D.4
33        $table[202] = 'space';
34        $table[244] = 'exclamsmall';
35        $table[245] = 'Hungarumlautsmall';
36        $table[246] = 'dollaroldstyle';
37        $table[247] = 'dollarsuperior';
38        $table[248] = 'ampersandsmall';
39        $table[249] = 'Acutesmall';
40        $table[250] = 'parenleftsuperior';
41        $table[251] = 'parenrightsuperior';
42        $table[252] = 'twodotenleader';
43        $table[253] = 'onedotenleader';
44        $table[254] = 'comma';
45        $table[255] = 'hyphen';
46        $table[46]  = 'period';
47        $table[47]  = 'fraction';
48        $table[48]  = 'zerooldstyle';
49        $table[49]  = 'oneoldstyle';
50        $table[50]  = 'twooldstyle';
51        $table[51]  = 'threeoldstyle';
52        $table[52]  = 'fouroldstyle';
53        $table[53]  = 'fiveoldstyle';
54        $table[54]  = 'sixoldstyle';
55        $table[55]  = 'sevenoldstyle';
56        $table[56]  = 'eightoldstyle';
57        $table[57]  = 'nineoldstyle';
58        $table[58]  = 'colon';
59        $table[59]  = 'semicolon';
60        $table[60]  = 'commasuperior';
61        $table[61]  = 'threequartersemdash';
62        $table[62]  = 'periodsuperior';
63        $table[63]  = 'questionsmall';
64        $table[65]  = 'asuperior';
65        $table[66]  = 'bsuperior';
66        $table[67]  = 'centsuperior';
67        $table[68]  = 'dsuperior';
68        $table[69]  = 'esuperior';
69        $table[73]  = 'isuperior';
70        $table[76]  = 'lsuperior';
71        $table[77]  = 'msuperior';
72        $table[78]  = 'nsuperior';
73        $table[79]  = 'osuperior';
74        $table[82]  = 'rsuperior';
75        $table[83]  = 'ssuperior';
76        $table[84]  = 'tsuperior';
77        $table[86]  = 'ff';
78        $table[87]  = 'ffi';
79        $table[88]  = 'ffl';
80        $table[89]  = 'parenleftinferior';
81        $table[90]  = 'parenrightinferior';
82        $table[91]  = 'Circumflexsmall';
83        $table[92]  = 'hyphensuperior';
84        $table[93]  = 'Gravesmall';
85        $table[94]  = 'Asmall';
86        $table[95]  = 'Bsmall';
87        $table[96]  = 'Csmall';
88        $table[97]  = 'Dsmall';
89        $table[98]  = 'Esmall';
90        $table[99]  = 'Fsmall';
91        $table[100] = 'Gsmall';
92        $table[101] = 'Hsmall';
93        $table[102] = 'Ismall';
94        $table[103] = 'Jsmall';
95        $table[104] = 'Ksmall';
96        $table[105] = 'Lsmall';
97        $table[106] = 'Msmall';
98        $table[107] = 'Nsmall';
99        $table[108] = 'Osmall';
100        $table[109] = 'Psmall';
101        $table[110] = 'Qsmall';
102        $table[111] = 'Rsmall';
103        $table[112] = 'Ssmall';
104        $table[113] = 'Tsmall';
105        $table[114] = 'Usmall';
106        $table[115] = 'Vsmall';
107        $table[116] = 'Wsmall';
108        $table[117] = 'Xsmall';
109        $table[118] = 'Ysmall';
110        $table[119] = 'Zsmall';
111        $table[120] = 'colonmonetary';
112        $table[121] = 'onefitted';
113        $table[122] = 'rupiah';
114        $table[123] = 'Tildesmall';
115        $table[125] = 'centoldstyle';
116        $table[126] = 'figuredash';
117        $table[128] = 'hypheninferior';
118        $table[129] = 'Ogoneksmall';
119        $table[130] = 'Ringsmall';
120        $table[131] = 'Cedillasmall';
121        $table[133] = 'onequarter';
122        $table[134] = 'onehalf';
123        $table[135] = 'threequarters';
124        $table[136] = 'oneeighth';
125        $table[137] = 'threeeighths';
126        $table[138] = 'fiveeighths';
127        $table[139] = 'seveneighths';
128        $table[140] = 'onethird';
129        $table[141] = 'twothirds';
130        $table[143] = 'zerosuperior';
131        $table[144] = 'onesuperior';
132        $table[145] = 'twosuperior';
133        $table[146] = 'threesuperior';
134        $table[147] = 'foursuperior';
135        $table[148] = 'fivesuperior';
136        $table[149] = 'sixsuperior';
137        $table[150] = 'sevensuperior';
138        $table[151] = 'eightsuperior';
139        $table[152] = 'ninesuperior';
140        $table[153] = 'zeroinferior';
141        $table[154] = 'oneinferior';
142        $table[155] = 'twoinferior';
143        $table[156] = 'threeinferior';
144        $table[157] = 'fourinferior';
145        $table[158] = 'fiveinferior';
146        $table[159] = 'sixinferior';
147        $table[160] = 'seveninferior';
148        $table[161] = 'eightinferior';
149        $table[162] = 'nineinferior';
150        $table[163] = 'centinferior';
151        $table[164] = 'dollarinferior';
152        $table[165] = 'periodinferior';
153        $table[166] = 'commainferior';
154        $table[167] = 'Agravesmall';
155        $table[168] = 'Aacutesmall';
156        $table[169] = 'Acircumflexsmall';
157        $table[170] = 'Atildesmall';
158        $table[171] = 'Adieresissmall';
159        $table[172] = 'Aringsmall';
160        $table[173] = 'AEsmall';
161        $table[174] = 'Ccedillasmall';
162        $table[175] = 'Egravesmall';
163        $table[176] = 'Eacutesmall';
164        $table[177] = 'Ecircumflexsmall';
165        $table[178] = 'Edieresissmall';
166        $table[179] = 'Igravesmall';
167        $table[180] = 'Iacutesmall';
168        $table[181] = 'Icircumflexsmall';
169        $table[182] = 'Idieresissmall';
170        $table[183] = 'Ethsmall';
171        $table[184] = 'Ntildesmall';
172        $table[185] = 'Ogravesmall';
173        $table[186] = 'Oacutesmall';
174        $table[187] = 'Ocircumflexsmall';
175        $table[188] = 'Otildesmall';
176        $table[189] = 'Odieresissmall';
177        $table[190] = 'OEsmall';
178        $table[191] = 'Oslashsmall';
179        $table[192] = 'Ugravesmall';
180        $table[193] = 'Uacutesmall';
181        $table[194] = 'Ucircumflexsmall';
182        $table[195] = 'Udieresissmall';
183        $table[196] = 'Yacutesmall';
184        $table[197] = 'Thornsmall';
185        $table[198] = 'Ydieresissmall';
186        $table[33]  = 'exclamdownsmall';
187        $table[34]  = 'centsmall'; // non-standard; some implementations differ
188        $table[36]  = 'dollarsmall'; // non-standard; some implementations differ
189        $table[199] = 'sixoldstyle'; // duplicate remapped
190        $table[200] = 'sevenoldstyle'; // duplicate remapped
191        $table[201] = 'eightoldstyle'; // duplicate remapped
192        $table[203] = 'exclamsmall'; // duplicate
193        $table[204] = 'Dieresissmall';
194        $table[206] = 'Brevesmall';
195        $table[207] = 'Caronsmall';
196        $table[209] = 'Dotaccentsmall';
197        $table[211] = 'Macronsmall';
198        $table[214] = 'figuredash'; // duplicate
199        $table[218] = 'Scaronsmall';
200        $table[223] = 'Zcaronsmall';
201        $table[224] = 'Dieresissmall'; // duplicate
202        $table[225] = 'Brevesmall'; // duplicate
203        $table[227] = 'Dotaccentsmall'; // duplicate
204        $table[232] = 'Lslashsmall';
205        $table[233] = 'Oslashsmall'; // duplicate
206        $table[234] = 'OEsmall'; // duplicate
207        $table[235] = 'ordmasculine';
208        $table[241] = 'Scaronsmall'; // duplicate
209        $table[242] = 'fi';
210        $table[243] = 'fl';
211        $table[37]  = 'Lslashsmall'; // non-standard position
212
213        return $table;
214    }
215}