Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
229 / 229
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WinAnsiTable
100.00% covered (success)
100.00%
229 / 229
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 getTable
100.00% covered (success)
100.00%
229 / 229
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Encoding;
6
7final class WinAnsiTable
8{
9    /** @return array<int, string> byte value (0-255) to PostScript glyph name */
10    public static function getTable(): array
11    {
12        $notdef = '.notdef';
13        $table = [];
14
15        // 0-31: .notdef
16        for ($i = 0; $i <= 31; $i++) {
17            $table[$i] = $notdef;
18        }
19
20        // 32-126: standard printable ASCII
21        $table[32]  = 'space';
22        $table[33]  = 'exclam';
23        $table[34]  = 'quotedbl';
24        $table[35]  = 'numbersign';
25        $table[36]  = 'dollar';
26        $table[37]  = 'percent';
27        $table[38]  = 'ampersand';
28        $table[39]  = 'quotesingle';
29        $table[40]  = 'parenleft';
30        $table[41]  = 'parenright';
31        $table[42]  = 'asterisk';
32        $table[43]  = 'plus';
33        $table[44]  = 'comma';
34        $table[45]  = 'hyphen';
35        $table[46]  = 'period';
36        $table[47]  = 'slash';
37        $table[48]  = 'zero';
38        $table[49]  = 'one';
39        $table[50]  = 'two';
40        $table[51]  = 'three';
41        $table[52]  = 'four';
42        $table[53]  = 'five';
43        $table[54]  = 'six';
44        $table[55]  = 'seven';
45        $table[56]  = 'eight';
46        $table[57]  = 'nine';
47        $table[58]  = 'colon';
48        $table[59]  = 'semicolon';
49        $table[60]  = 'less';
50        $table[61]  = 'equal';
51        $table[62]  = 'greater';
52        $table[63]  = 'question';
53        $table[64]  = 'at';
54        $table[65]  = 'A';
55        $table[66]  = 'B';
56        $table[67]  = 'C';
57        $table[68]  = 'D';
58        $table[69]  = 'E';
59        $table[70]  = 'F';
60        $table[71]  = 'G';
61        $table[72]  = 'H';
62        $table[73]  = 'I';
63        $table[74]  = 'J';
64        $table[75]  = 'K';
65        $table[76]  = 'L';
66        $table[77]  = 'M';
67        $table[78]  = 'N';
68        $table[79]  = 'O';
69        $table[80]  = 'P';
70        $table[81]  = 'Q';
71        $table[82]  = 'R';
72        $table[83]  = 'S';
73        $table[84]  = 'T';
74        $table[85]  = 'U';
75        $table[86]  = 'V';
76        $table[87]  = 'W';
77        $table[88]  = 'X';
78        $table[89]  = 'Y';
79        $table[90]  = 'Z';
80        $table[91]  = 'bracketleft';
81        $table[92]  = 'backslash';
82        $table[93]  = 'bracketright';
83        $table[94]  = 'asciicircum';
84        $table[95]  = 'underscore';
85        $table[96]  = 'grave';
86        $table[97]  = 'a';
87        $table[98]  = 'b';
88        $table[99]  = 'c';
89        $table[100] = 'd';
90        $table[101] = 'e';
91        $table[102] = 'f';
92        $table[103] = 'g';
93        $table[104] = 'h';
94        $table[105] = 'i';
95        $table[106] = 'j';
96        $table[107] = 'k';
97        $table[108] = 'l';
98        $table[109] = 'm';
99        $table[110] = 'n';
100        $table[111] = 'o';
101        $table[112] = 'p';
102        $table[113] = 'q';
103        $table[114] = 'r';
104        $table[115] = 's';
105        $table[116] = 't';
106        $table[117] = 'u';
107        $table[118] = 'v';
108        $table[119] = 'w';
109        $table[120] = 'x';
110        $table[121] = 'y';
111        $table[122] = 'z';
112        $table[123] = 'braceleft';
113        $table[124] = 'bar';
114        $table[125] = 'braceright';
115        $table[126] = 'asciitilde';
116
117        // 127: .notdef
118        $table[127] = $notdef;
119
120        // 128-159: Windows-specific characters
121        $table[128] = 'Euro';
122        $table[129] = $notdef;
123        $table[130] = 'quotesinglbase';
124        $table[131] = 'florin';
125        $table[132] = 'quotedblbase';
126        $table[133] = 'ellipsis';
127        $table[134] = 'dagger';
128        $table[135] = 'daggerdbl';
129        $table[136] = 'circumflex';
130        $table[137] = 'perthousand';
131        $table[138] = 'Scaron';
132        $table[139] = 'guilsinglleft';
133        $table[140] = 'OE';
134        $table[141] = $notdef;
135        $table[142] = 'Zcaron';
136        $table[143] = $notdef;
137        $table[144] = $notdef;
138        $table[145] = 'quoteleft';
139        $table[146] = 'quoteright';
140        $table[147] = 'quotedblleft';
141        $table[148] = 'quotedblright';
142        $table[149] = 'bullet';
143        $table[150] = 'endash';
144        $table[151] = 'emdash';
145        $table[152] = 'tilde';
146        $table[153] = 'trademark';
147        $table[154] = 'scaron';
148        $table[155] = 'guilsinglright';
149        $table[156] = 'oe';
150        $table[157] = $notdef;
151        $table[158] = 'zcaron';
152        $table[159] = 'Ydieresis';
153
154        // 160-255: ISO Latin-1 supplement
155        $table[160] = 'space';
156        $table[161] = 'exclamdown';
157        $table[162] = 'cent';
158        $table[163] = 'sterling';
159        $table[164] = 'currency';
160        $table[165] = 'yen';
161        $table[166] = 'brokenbar';
162        $table[167] = 'section';
163        $table[168] = 'dieresis';
164        $table[169] = 'copyright';
165        $table[170] = 'ordfeminine';
166        $table[171] = 'guillemotleft';
167        $table[172] = 'logicalnot';
168        $table[173] = 'hyphen';
169        $table[174] = 'registered';
170        $table[175] = 'macron';
171        $table[176] = 'degree';
172        $table[177] = 'plusminus';
173        $table[178] = 'twosuperior';
174        $table[179] = 'threesuperior';
175        $table[180] = 'acute';
176        $table[181] = 'mu';
177        $table[182] = 'paragraph';
178        $table[183] = 'periodcentered';
179        $table[184] = 'cedilla';
180        $table[185] = 'onesuperior';
181        $table[186] = 'ordmasculine';
182        $table[187] = 'guillemotright';
183        $table[188] = 'onequarter';
184        $table[189] = 'onehalf';
185        $table[190] = 'threequarters';
186        $table[191] = 'questiondown';
187        $table[192] = 'Agrave';
188        $table[193] = 'Aacute';
189        $table[194] = 'Acircumflex';
190        $table[195] = 'Atilde';
191        $table[196] = 'Adieresis';
192        $table[197] = 'Aring';
193        $table[198] = 'AE';
194        $table[199] = 'Ccedilla';
195        $table[200] = 'Egrave';
196        $table[201] = 'Eacute';
197        $table[202] = 'Ecircumflex';
198        $table[203] = 'Edieresis';
199        $table[204] = 'Igrave';
200        $table[205] = 'Iacute';
201        $table[206] = 'Icircumflex';
202        $table[207] = 'Idieresis';
203        $table[208] = 'Eth';
204        $table[209] = 'Ntilde';
205        $table[210] = 'Ograve';
206        $table[211] = 'Oacute';
207        $table[212] = 'Ocircumflex';
208        $table[213] = 'Otilde';
209        $table[214] = 'Odieresis';
210        $table[215] = 'multiply';
211        $table[216] = 'Oslash';
212        $table[217] = 'Ugrave';
213        $table[218] = 'Uacute';
214        $table[219] = 'Ucircumflex';
215        $table[220] = 'Udieresis';
216        $table[221] = 'Yacute';
217        $table[222] = 'Thorn';
218        $table[223] = 'germandbls';
219        $table[224] = 'agrave';
220        $table[225] = 'aacute';
221        $table[226] = 'acircumflex';
222        $table[227] = 'atilde';
223        $table[228] = 'adieresis';
224        $table[229] = 'aring';
225        $table[230] = 'ae';
226        $table[231] = 'ccedilla';
227        $table[232] = 'egrave';
228        $table[233] = 'eacute';
229        $table[234] = 'ecircumflex';
230        $table[235] = 'edieresis';
231        $table[236] = 'igrave';
232        $table[237] = 'iacute';
233        $table[238] = 'icircumflex';
234        $table[239] = 'idieresis';
235        $table[240] = 'eth';
236        $table[241] = 'ntilde';
237        $table[242] = 'ograve';
238        $table[243] = 'oacute';
239        $table[244] = 'ocircumflex';
240        $table[245] = 'otilde';
241        $table[246] = 'odieresis';
242        $table[247] = 'divide';
243        $table[248] = 'oslash';
244        $table[249] = 'ugrave';
245        $table[250] = 'uacute';
246        $table[251] = 'ucircumflex';
247        $table[252] = 'udieresis';
248        $table[253] = 'yacute';
249        $table[254] = 'thorn';
250        $table[255] = 'ydieresis';
251
252        return $table;
253    }
254}