Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
229 / 229 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| MacRomanTable | |
100.00% |
229 / 229 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| getTable | |
100.00% |
229 / 229 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Encoding; |
| 6 | |
| 7 | final class MacRomanTable |
| 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: control characters - .notdef |
| 16 | for ($i = 0; $i <= 31; $i++) { |
| 17 | $table[$i] = $notdef; |
| 18 | } |
| 19 | |
| 20 | // 32-126: same as 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-255: Mac OS Roman high bytes |
| 121 | $table[128] = 'Adieresis'; |
| 122 | $table[129] = 'Aring'; |
| 123 | $table[130] = 'Ccedilla'; |
| 124 | $table[131] = 'Eacute'; |
| 125 | $table[132] = 'Ntilde'; |
| 126 | $table[133] = 'Odieresis'; |
| 127 | $table[134] = 'Udieresis'; |
| 128 | $table[135] = 'aacute'; |
| 129 | $table[136] = 'agrave'; |
| 130 | $table[137] = 'acircumflex'; |
| 131 | $table[138] = 'adieresis'; |
| 132 | $table[139] = 'atilde'; |
| 133 | $table[140] = 'aring'; |
| 134 | $table[141] = 'ccedilla'; |
| 135 | $table[142] = 'eacute'; |
| 136 | $table[143] = 'egrave'; |
| 137 | $table[144] = 'ecircumflex'; |
| 138 | $table[145] = 'edieresis'; |
| 139 | $table[146] = 'iacute'; |
| 140 | $table[147] = 'igrave'; |
| 141 | $table[148] = 'icircumflex'; |
| 142 | $table[149] = 'idieresis'; |
| 143 | $table[150] = 'ntilde'; |
| 144 | $table[151] = 'oacute'; |
| 145 | $table[152] = 'ograve'; |
| 146 | $table[153] = 'ocircumflex'; |
| 147 | $table[154] = 'odieresis'; |
| 148 | $table[155] = 'otilde'; |
| 149 | $table[156] = 'uacute'; |
| 150 | $table[157] = 'ugrave'; |
| 151 | $table[158] = 'ucircumflex'; |
| 152 | $table[159] = 'udieresis'; |
| 153 | $table[160] = 'dagger'; |
| 154 | $table[161] = 'degree'; |
| 155 | $table[162] = 'cent'; |
| 156 | $table[163] = 'sterling'; |
| 157 | $table[164] = 'section'; |
| 158 | $table[165] = 'bullet'; |
| 159 | $table[166] = 'paragraph'; |
| 160 | $table[167] = 'germandbls'; |
| 161 | $table[168] = 'registered'; |
| 162 | $table[169] = 'copyright'; |
| 163 | $table[170] = 'trademark'; |
| 164 | $table[171] = 'acute'; |
| 165 | $table[172] = 'dieresis'; |
| 166 | $table[173] = $notdef; |
| 167 | $table[174] = 'AE'; |
| 168 | $table[175] = 'Oslash'; |
| 169 | $table[176] = 'infinity'; |
| 170 | $table[177] = 'plusminus'; |
| 171 | $table[178] = 'lessequal'; |
| 172 | $table[179] = 'greaterequal'; |
| 173 | $table[180] = 'yen'; |
| 174 | $table[181] = 'mu'; |
| 175 | $table[182] = 'partialdiff'; |
| 176 | $table[183] = 'summation'; |
| 177 | $table[184] = 'product'; |
| 178 | $table[185] = 'pi'; |
| 179 | $table[186] = 'integral'; |
| 180 | $table[187] = 'ordfeminine'; |
| 181 | $table[188] = 'ordmasculine'; |
| 182 | $table[189] = 'Omega'; |
| 183 | $table[190] = 'ae'; |
| 184 | $table[191] = 'oslash'; |
| 185 | $table[192] = 'questiondown'; |
| 186 | $table[193] = 'exclamdown'; |
| 187 | $table[194] = 'logicalnot'; |
| 188 | $table[195] = 'radical'; |
| 189 | $table[196] = 'florin'; |
| 190 | $table[197] = 'approxequal'; |
| 191 | $table[198] = 'Delta'; |
| 192 | $table[199] = 'guillemotleft'; |
| 193 | $table[200] = 'guillemotright'; |
| 194 | $table[201] = 'ellipsis'; |
| 195 | $table[202] = 'space'; |
| 196 | $table[203] = 'Agrave'; |
| 197 | $table[204] = 'Atilde'; |
| 198 | $table[205] = 'Otilde'; |
| 199 | $table[206] = 'OE'; |
| 200 | $table[207] = 'oe'; |
| 201 | $table[208] = 'endash'; |
| 202 | $table[209] = 'emdash'; |
| 203 | $table[210] = 'quotedblleft'; |
| 204 | $table[211] = 'quotedblright'; |
| 205 | $table[212] = 'quoteleft'; |
| 206 | $table[213] = 'quoteright'; |
| 207 | $table[214] = 'divide'; |
| 208 | $table[215] = 'lozenge'; |
| 209 | $table[216] = 'ydieresis'; |
| 210 | $table[217] = 'Ydieresis'; |
| 211 | $table[218] = 'fraction'; |
| 212 | $table[219] = 'Euro'; |
| 213 | $table[220] = 'guilsinglleft'; |
| 214 | $table[221] = 'guilsinglright'; |
| 215 | $table[222] = 'fi'; |
| 216 | $table[223] = 'fl'; |
| 217 | $table[224] = 'daggerdbl'; |
| 218 | $table[225] = 'periodcentered'; |
| 219 | $table[226] = 'quotesinglbase'; |
| 220 | $table[227] = 'quotedblbase'; |
| 221 | $table[228] = 'perthousand'; |
| 222 | $table[229] = 'Acircumflex'; |
| 223 | $table[230] = 'Ecircumflex'; |
| 224 | $table[231] = 'Aacute'; |
| 225 | $table[232] = 'Edieresis'; |
| 226 | $table[233] = 'Egrave'; |
| 227 | $table[234] = 'Iacute'; |
| 228 | $table[235] = 'Icircumflex'; |
| 229 | $table[236] = 'Idieresis'; |
| 230 | $table[237] = 'Igrave'; |
| 231 | $table[238] = 'Oacute'; |
| 232 | $table[239] = 'Ocircumflex'; |
| 233 | $table[240] = 'apple'; |
| 234 | $table[241] = 'Ograve'; |
| 235 | $table[242] = 'Uacute'; |
| 236 | $table[243] = 'Ucircumflex'; |
| 237 | $table[244] = 'Ugrave'; |
| 238 | $table[245] = 'dotlessi'; |
| 239 | $table[246] = 'circumflex'; |
| 240 | $table[247] = 'tilde'; |
| 241 | $table[248] = 'macron'; |
| 242 | $table[249] = 'breve'; |
| 243 | $table[250] = 'dotaccent'; |
| 244 | $table[251] = 'ring'; |
| 245 | $table[252] = 'cedilla'; |
| 246 | $table[253] = 'hungarumlaut'; |
| 247 | $table[254] = 'ogonek'; |
| 248 | $table[255] = 'caron'; |
| 249 | |
| 250 | return $table; |
| 251 | } |
| 252 | } |