mapping.pl (38395B)
1 #! /usr/bin/perl 2 3 # Adapted from the MathJax-dev repository file /fonts/OTF/TeX/makeFF under the 4 # Apache 2 license 5 6 # We use this file to recover the mapping from TeX fonts to KaTeX fonts, to 7 # accurately extract the metrics from the corresponding .tfm (TeX font metric) 8 # files 9 10 use JSON; 11 12 $map{cmr10} = { 13 "Main-Regular" => [ 14 [0,1] => 0x393, # \Gamma, \Delta 15 2 => 0x398, # \Theta 16 3 => 0x39B, # \Lambda 17 4 => 0x39E, # \Xi 18 5 => 0x3A0, # \Pi 19 6 => 0x3A3, # \Sigma 20 [7,8] => 0x3A5, # \Upsilon, \Phi 21 [9,0xA] => 0x3A8, # \Psi, \Omega 22 23 0x10 => 0x131, # \imath (roman) 24 0x11 => 0x237, # \jmath (roman) 25 0x12 => 0x60, # \grave 26 0x12 => 0x2CB, # \grave 27 0x12 => [0x300,-500,0], # \grave (combining) 28 0x13 => 0xB4, # \acute 29 0x13 => 0x2CA, # \acute 30 0x13 => [0x301,-500,0], # \acute (combining) 31 0x14 => 0x2C7, # \check 32 0x14 => [0x30C,-500,0], # \check (combining) 33 0x15 => 0x2D8, # \breve 34 0x15 => [0x306,-500,0], # \breve (combining) 35 0x16 => 0xAF, # \bar 36 0x16 => 0x2C9, # \bar 37 0x16 => [0x304,-500,0], # \bar (combining) 38 0x17 => [0xB0,-125,0], # ring above 39 0x17 => [0x2DA,-125,0], # ring above 40 0x17 => [0x30A,-625,0], # ring above (combining) 41 42 [0x21,0x2F] => 0x21, # !, ", #, $, %, &, ', (, ), *, +, comma, -, ., / 43 0x22 => 0x201D, # " 44 0x27 => 0x2019, # ' 45 [0x30,0x39] => 0x30, # 0-9 46 [0x3A,0x3B] => 0x3A, # :, ; 47 0x3D => 0x3D, # = 48 [0x3F,0x40] => 0x3F, # ?, @ 49 [0x41,0x5A] => 0x41, # A-Z 50 0x5B => 0x5B, # [ 51 0x5C => 0x201C, # `` 52 [0x5D,0x5E] => 0x5D, # ], ^ 53 0x5E => 0x2C6, # \hat 54 0x5E => [0x302,-500,0], # \hat (combining) 55 0x5F => [0x2D9,111,0], # \dot 56 0x5F => [0x307,-389,0], # \dot (combining) 57 0x60 => 0x2018, # ` 58 [0x61,0x7A] => 0x61, # a-z 59 [0x7B,0x7C] => 0x2013, # \endash, \emdash 60 0x7B => [0x5F,0,-310], # underline 61 0x7D => [0x30B,-500,0], # double acute (combining) 62 0x7E => [0x7E,0,-350], # ~ 63 0x7E => 0x2DC, # \tilde 64 0x7E => [0x303,-500,0], # \tilde (combining) 65 0x7F => 0xA8, # \ddot 66 0x7F => [0x308,-500,0], # \ddot (combining) 67 ], 68 }; 69 70 $map{cmmi10} = { 71 "Math-Regular" => [ 72 [0,1] => 0x393, # \Gamma, \Delta 73 2 => 0x398, # \Theta 74 3 => 0x39B, # \Lambda 75 4 => 0x39E, # \Xi 76 5 => 0x3A0, # \Pi 77 6 => 0x3A3, # \Sigma 78 [7,8] => 0x3A5, # \Upsilon, \Phi 79 [9,0xA] => 0x3A8, # \Psi, \Omega 80 81 [0xB,0xE] => 0x3B1, # \alpha, \beta, \gamma, \delta 82 0xF => 0x3F5, # \elpsilon 83 [0x10,0x18] => 0x3B6, # \zeta, \eta, \theta, \iota, \kappa, \lambda, \mu, \nu, \xi 84 [0x19,0x1A] => 0x3C0, # \pi, \rho 85 [0x1B,0x1D] => 0x3C3, # \sigma, \tau, \upsilon 86 0x1E => 0x3D5, # \phi 87 [0x1F,0x21] => 0x3C7, # \chi, \psi, \omega 88 0x22 => 0x3B5, # \varepsilon 89 0x23 => 0x3D1, # \vartheta 90 0x24 => 0x3D6, # \varpi 91 0x25 => 0x3F1, # \varrho 92 0x26 => 0x3C2, # \varsigma 93 0x27 => 0x3C6, # \varphi 94 95 [0x41,0x5A] => 0x41, # A-Z 96 [0x61,0x7A] => 0x61, # a - z 97 0x6F => 0x3BF, # omicron 98 ], 99 100 "Math-Italic" => [ 101 [0,1] => 0x393, # \Gamma, \Delta 102 2 => 0x398, # \Theta 103 3 => 0x39B, # \Lambda 104 4 => 0x39E, # \Xi 105 5 => 0x3A0, # \Pi 106 6 => 0x3A3, # \Sigma 107 [7,8] => 0x3A5, # \Upsilon, \Phi 108 [9,0xA] => 0x3A8, # \Psi, \Omega 109 110 [0xB,0xE] => 0x3B1, # \alpha, \beta, \gamma, \delta 111 0xF => 0x3F5, # \elpsilon 112 [0x10,0x18] => 0x3B6, # \zeta, \eta, \theta, \iota, \kappa, \lambda, \mu, \nu, \xi 113 [0x19,0x1A] => 0x3C0, # \pi, \rho 114 [0x1B,0x1D] => 0x3C3, # \sigma, \tau, \upsilon 115 0x1E => 0x3D5, # \phi 116 [0x1F,0x21] => 0x3C7, # \chi, \psi, \omega 117 0x22 => 0x3B5, # \varepsilon 118 0x23 => 0x3D1, # \vartheta 119 0x24 => 0x3D6, # \varpi 120 0x25 => 0x3F1, # \varrho 121 0x26 => 0x3C2, # \varsigma 122 0x27 => 0x3C6, # \varphi 123 124 [0x41,0x5A] => 0x41, # A-Z 125 [0x61,0x7A] => 0x61, # a - z 126 0x6F => 0x3BF, # omicron 127 ], 128 129 "Main-Regular" => [ 130 0x28 => 0x21BC, # \leftharpoonup 131 0x29 => 0x21BD, # \leftharpoondown 132 0x2A => 0x21C0, # \rightharpoonup 133 0x2B => 0x21C1, # \rightharpoondown 134 135 0x2E => 0x25B9, # \triangleright 136 0x2F => 0x25C3, # \triangleleft 137 138 0x3C => 0x3C, # < 139 0x3D => 0x2215, # / 140 0x3E => 0x3E, # > 141 0x3F => 0x22C6, # \star 142 0x40 => 0x2202, # \partial 143 144 [0x5B,0x5D] => 0x266D, # \flat, \natural, \sharp 145 0x5E => 0x2323, # \smile 146 0x5F => 0x2322, # \frown 147 0x60 => 0x2113, # \ell 148 149 0x7D => 0x2118, # \wp 150 0x7E => [0x20D7,-653,0],# \vec 151 ], 152 153 "Main-Italic" => [ 154 0x7B => 0x131, # \imath 155 0x7C => 0x237, # \jmath 156 ], 157 158 "Caligraphic-Regular" => [ 159 [0x30,0x39] => 0x30, # Oldstyle 0-9 160 ], 161 }; 162 163 $map{cmsy10} = { 164 "Main-Regular" => [ 165 0 => 0x2212, # - 166 1 => 0x22C5, # \cdot 167 2 => 0xD7, # \times 168 3 => 0x2217, # \ast 169 4 => 0xF7, # \div 170 5 => 0x22C4, # \diamond 171 6 => 0xB1, # \pm 172 7 => 0x2213, # \mp 173 [8,0xC] => 0x2295, # \oplus, \ominus, \otimes, \oslash, \odot 174 0xD => 0x25EF, # \bigcirc 175 [0xE,0xF] => 0x2218, # \circ, \bullet 176 177 0x10 => 0x224D, # \asymp 178 0x11 => 0x2261, # \equiv 179 [0x12,0x13] => 0x2286, # \subseteq, \supseteq 180 [0x14,0x15] => 0x2264, # \leq, \geq 181 [0x16,0x17] => 0x2AAF, # \preceq, \succeq 182 0x18 => 0x223C, # \sim 183 0x19 => 0x2248, # \approx 184 [0x1A,0x1B] => 0x2282, # \subset, \supset 185 [0x1C,0x1D] => 0x226A, # \ll, \gg 186 [0x1E,0x1F] => 0x227A, # \prec, \succ 187 188 0x20 => 0x2190, # \leftarrow 189 0x21 => 0x2192, # \rightarrow 190 0x22 => 0x2191, # \uparrow 191 0x23 => 0x2193, # \downarrow 192 0x24 => 0x2194, # \leftrightarrow 193 0x25 => 0x2197, # \nearrow 194 0x26 => 0x2198, # \searrow 195 0x27 => 0x2243, # \simeq 196 197 0x28 => 0x21D0, # \Leftarrow 198 0x29 => 0x21D2, # \Rightarrow 199 0x2A => 0x21D1, # \Uparrow 200 0x2B => 0x21D3, # \Downarrow 201 0x2C => 0x21D4, # \Leftrightarrow 202 0x2D => 0x2196, # \nwarrow 203 0x2E => 0x2199, # \swarrow 204 0x2F => 0x221D, # \propto 205 206 0x30 => 0x2032, # \prime 207 0x31 => 0x221E, # \infty 208 0x32 => 0x2208, # \in 209 0x33 => 0x220B, # \ni 210 0x34 => 0x25B3, # \bigtriangleup and \triangle 211 0x35 => 0x25BD, # \bigtriangledown 212 0x36 => [0x338,-778,0], # \not (combining) 213 214 0x38 => 0x2200, # \forall 215 0x39 => 0x2203, # \exists 216 0x3A => 0xAC, # \neg 217 0x3B => 0x2205, # \emptyset 218 0x3C => 0x211C, # \Re 219 0x3D => 0x2111, # \Im 220 0x3E => 0x22A4, # \top 221 0x3F => 0x22A5, # \bot 222 223 0x40 => 0x2135, # \aleph 224 225 0x5B => 0x222A, # \cup 226 0x5C => 0x2229, # \cap 227 0x5D => 0x228E, # \uplus 228 [0x5E,0x5F] => 0x2227, # \wedge, \vee 229 230 [0x60,0x61] => 0x22A2, # \vdash, \dashv 231 [0x62,0x63] => 0x230A, # \lfloor, \rfloor 232 [0x64,0x65] => 0x2308, # \lceil, \rceil 233 0x66 => 0x7B, # { 234 0x67 => 0x7D, # } 235 [0x68,0x69] => 0x27E8, # \langle, \rangle 236 0x6A => 0x7C, # | 237 0x6A => 0x2223, # \vert 238 0x6B => 0x2225, # \Vert 239 0x6C => 0x2195, # \updownarrow 240 0x6D => 0x21D5, # \Updownarrow 241 0x6E => 0x5C, # \backslash 242 0x6E => 0x2216, # \setminus 243 0x6F => 0x2240, # \wr 244 245 0x70 => [0x221A,0,760], # \surd ### adjust position so font doesn't have a large depth 246 0x71 => 0x2A3F, # \amalg 247 0x72 => 0x2207, # \nabla 248 0x73 => 0x222B, # \int 249 0x74 => 0x2294, # \sqcup 250 0x75 => 0x2293, # \sqcap 251 [0x76,0x77] => 0x2291, # \sqsubseteq, \sqsupseteq 252 253 [0x79,0x7A] => 0x2020, # \dagger, \ddagger 254 255 0x7C => 0x2663, # \clubsuit 256 0x7D => 0x2662, # \diamondsuit 257 0x7E => 0x2661, # \heartsuit 258 0x7F => 0x2660, # \spadesuit 259 ], 260 261 "Math-Italic" => [ 262 0x36 => 0x2F # \not 263 ], 264 265 "Caligraphic-Regular" => [ 266 [0x41,0x5A] => 0x41, # A-Z 267 ], 268 }; 269 270 $map{cmex10} = { 271 "Size1" => [ 272 0 => [0x28,0,810], # ( 273 1 => [0x29,0,810], # ) 274 2 => [0x5B,0,810], # [ 275 3 => [0x5D,0,810], # ] 276 4 => [0x230A,0,810], # \lfloor 277 5 => [0x230B,0,810], # \rfloor 278 6 => [0x2308,0,810], # \lceil 279 7 => [0x2309,0,810], # \rceil 280 8 => [0x7B,0,810], # { 281 9 => [0x7D,0,810], # } 282 0xA => [0x27E8,0,810], # \langle 283 0xB => [0x27E9,0,810], # \rangle 284 0xC => [0x2223,0,606], # \vert 285 0xD => [0x2225,0,606], # \Vert 286 0xE => [0x2F,0,810], # / 287 0xF => [0x5C,0,810], # \ 288 289 0x46 => [0x2A06,0,750], # \bigsqcup 290 0x48 => [0x222E,0,805], # \oint 291 0x4A => [0x2A00,0,750], # \bigodot 292 0x4C => [0x2A01,0,750], # \bigoplus 293 0x4E => [0x2A02,0,750], # \bigotimes 294 295 0x50 => [0x2211,0,750], # \sum 296 0x51 => [0x220F,0,750], # \prod 297 0x52 => [0x222B,0,805], # \int 298 0x53 => [0x22C3,0,750], # \bigcup 299 0x54 => [0x22C2,0,750], # \bigcap 300 0x55 => [0x2A04,0,750], # \biguplus 301 0x56 => [0x22C0,0,750], # \bigwedge 302 0x57 => [0x22C1,0,750], # \bigvee 303 304 0x60 => [0x2210,0,750], # \coprod 305 0x62 => 0x2C6, # \widehat 306 0x62 => [0x302,-556,0], # \widehat (combining) 307 0x65 => 0x2DC, # \widetilde 308 0x65 => [0x303,-556,0], # \widetilde (combining) 309 310 0x70 => [0x221A,0,810], # surd 311 0x3F => [0x23D0,0,601], # arrow extension 312 0x77 => [0x2016,0,601], # Arrow extension (non-standard) 313 0x78 => [0x2191,0,600], # uparrow top 314 0x79 => [0x2193,0,600], # downarrow bottom 315 0x7E => [0x21D1,0,600], # Uparrow top 316 0x7F => [0x21D3,0,600], # Downarrow bottom 317 ], 318 319 "Size2" => [ 320 0x10 => [0x28,0,1110], # ( 321 0x11 => [0x29,0,1110], # ) 322 0x2E => [0x2F,0,1110], # / 323 0x2F => [0x5C,0,1110], # \ 324 0x44 => [0x27E8,0,1110],# \langle 325 0x45 => [0x27E9,0,1110],# \rangle 326 327 0x47 => [0x2A06,0,950], # \bigsqcup 328 0x49 => [0x222E,0,1360],# \oint 329 0x4B => [0x2A00,0,950], # \bigodot 330 0x4D => [0x2A01,0,950], # \bigoplus 331 0x4F => [0x2A02,0,950], # \bigotimes 332 333 0x58 => [0x2211,0,950], # \sum 334 0x59 => [0x220F,0,950], # \prod 335 0x5A => [0x222B,0,1360],# \int 336 0x5B => [0x22C3,0,950], # \bigcup 337 0x5C => [0x22C2,0,950], # \bigcap 338 0x5D => [0x2A04,0,950], # \biguplus 339 0x5E => [0x22C0,0,950], # \bigwedge 340 0x5F => [0x22C1,0,950], # \bigvee 341 0x61 => [0x2210,0,950], # \coprod 342 343 0x63 => 0x2C6, # \widehat 344 0x63 => [0x302,-1000,0],# \widehat (combining) 345 0x66 => 0x2DC, # \widetilde 346 0x66 => [0x303,-1000,0],# \widetilde (combining) 347 348 0x68 => [0x5B,0,1110], # [ 349 0x69 => [0x5D,0,1110], # ] 350 0x6A => [0x230A,0,1110],# \lfloor 351 0x6B => [0x230B,0,1110],# \rfloor 352 0x6C => [0x2308,0,1110],# \lceil 353 0x6D => [0x2309,0,1110],# \rceil 354 0x6E => [0x7B,0,1110], # { 355 0x6F => [0x7D,0,1110], # } 356 0x71 => [0x221A,0,1110],# surd 357 ], 358 359 "Size3" => [ 360 0x12 => [0x28,0,1410], # ( 361 0x13 => [0x29,0,1410], # ) 362 0x14 => [0x5B,0,1410], # [ 363 0x15 => [0x5D,0,1410], # ] 364 0x16 => [0x230A,0,1410],# \lfloor 365 0x17 => [0x230B,0,1410],# \rfloor 366 0x18 => [0x2308,0,1410],# \lceil 367 0x19 => [0x2309,0,1410],# \rceil 368 0x1A => [0x7B,0,1410], # { 369 0x1B => [0x7D,0,1410], # } 370 0x1C => [0x27E8,0,1410],# \langle 371 0x1D => [0x27E9,0,1410],# \rangle 372 0x1E => [0x2F,0,1410], # / 373 0x1F => [0x5C,0,1410], # \ 374 0x64 => 0x2C6, # \widehat 375 0x64 => [0x302,-1444,0],# \widehat (combining) 376 0x67 => 0x2DC, # \widetilde 377 0x67 => [0x303,-1444,0],# \widetilde (combining) 378 0x72 => [0x221A,0,1410],# surd 379 ], 380 381 "Size4" => [ 382 0x20 => [0x28,0,1710], # ( 383 0x21 => [0x29,0,1710], # ) 384 0x22 => [0x5B,0,1710], # [ 385 0x23 => [0x5D,0,1710], # ] 386 0x24 => [0x230A,0,1710],# \lfloor 387 0x25 => [0x230B,0,1710],# \rfloor 388 0x26 => [0x2308,0,1710],# \lceil 389 0x27 => [0x2309,0,1710],# \rceil 390 0x28 => [0x7B,0,1710], # { 391 0x29 => [0x7D,0,1710], # } 392 0x2A => [0x27E8,0,1710],# \langle 393 0x2B => [0x27E9,0,1710],# \rangle 394 0x2C => [0x2F,0,1710], # / 395 0x2D => [0x5C,0,1710], # \ 396 0x73 => [0x221A,0,1710],# surd 397 398 0x30 => [0x239B,0,1115],# left paren upper hook 399 0x31 => [0x239E,0,1115],# right paren upper hook 400 0x32 => [0x23A1,0,1115],# left square bracket upper corner 401 0x33 => [0x23A4,0,1115],# right square bracket upper corner 402 0x34 => [0x23A3,0,1115],# left square bracket lower corner 403 0x35 => [0x23A6,0,1115],# right square bracket lower hook 404 0x36 => [0x23A2,0,601], # left square bracket extension 405 0x37 => [0x23A5,0,601], # right square bracket extension 406 0x38 => [0x23A7,0,900], # left curly brace upper hook 407 0x39 => [0x23AB,0,900], # right curly brace upper hook 408 0x3A => 0x23A9, # left curly brace lower hook 409 0x3B => 0x23AD, # right curly brace lower hook 410 0x3C => [0x23A8,0,1150],# left curly brace middle 411 0x3D => [0x23AC,0,1150],# right curly brace middle 412 0x3E => [0x23AA,0,300], # curly brace extension 413 414 0x40 => [0x239D,0,1115],# left paren lower hook 415 0x41 => [0x23A0,0,1115],# right paren lower hook 416 0x42 => [0x239C,0,600], # left paren extension 417 0x43 => [0x239F,0,600], # right paren extension 418 419 0x74 => [0x23B7,0,915], # radical bottom 420 0x75 => [0xE000,0,605], # radical extension (PUA) 421 0x76 => [0xE001,0,565], # radical top (PUA) 422 [0x7A,0x7D] => 0xE150, # \braceld, \bracerd, \bracelu, \braceru (PUA) 423 ], 424 }; 425 426 $map{cmti10} = { 427 "Main-Italic" => [ 428 [0,1] => 0x393, # \Gamma, \Delta 429 2 => 0x398, # \Theta 430 3 => 0x39B, # \Lambda 431 4 => 0x39E, # \Xi 432 5 => 0x3A0, # \Pi 433 6 => 0x3A3, # \Sigma 434 [7,8] => 0x3A5, # \Upsilon, \Phi 435 [9,0xA] => 0x3A8, # \Psi, \Omega 436 437 0x12 => [0x300,-511,0], # \grave (combining) 438 0x13 => [0x301,-511,0], # \acute (combining) 439 0x14 => [0x30C,-511,0], # \check (combining) 440 0x15 => [0x306,-511,0], # \breve (combining) 441 0x16 => [0x304,-511,0], # \bar (combining) 442 0x17 => [0x30A,-671,0], # ring above (combining) 443 444 [0x21,0x23] => 0x21, # !, ", #, 445 0x22 => 0x201D, # " 446 0x24 => 0xA3, # pound sign 447 [0x25,0x2F] => 0x25, # %, &, ', (, ), *, +, comma, -, ., / 448 0x27 => 0x2019, # ' 449 [0x30,0x39] => 0x30, # 0-9 450 [0x3A,0x3B] => 0x3A, # :, ; 451 0x3D => 0x3D, # = 452 [0x3F,0x40] => 0x3F, # ?, @ 453 [0x41,0x5A] => 0x41, # A-Z 454 0x5B => 0x5B, # [ 455 0x5C => 0x201C, # `` 456 [0x5D,0x5E] => 0x5D, # ], ^ 457 0x5E => [0x302,-511,0], # \hat (combining) 458 0x5F => [0x307,-409,0], # \dot (combining) 459 0x60 => 0x2018, # ` 460 [0x61,0x7A] => 0x61, # a-z 461 [0x7B,0x7C] => 0x2013, # \endash, \emdash 462 0x7B => [0x5F,0,-310], # underline 463 0x7D => [0x30B,-511,0], # double acute (combining) 464 0x7E => [0x7E,0,-350], # ~ 465 0x7E => [0x303,-511,0], # \tilde (combining) 466 0x7F => [0x308,-511,0], # \ddot (combining) 467 ], 468 }; 469 470 $map{cmbx10} = { 471 "Main-Bold" => [ 472 [0,1] => 0x393, # \Gamma, \Delta 473 2 => 0x398, # \Theta 474 3 => 0x39B, # \Lambda 475 4 => 0x39E, # \Xi 476 5 => 0x3A0, # \Pi 477 6 => 0x3A3, # \Sigma 478 [7,8] => 0x3A5, # \Upsilon, \Phi 479 [9,0xA] => 0x3A8, # \Psi, \Omega 480 481 0x10 => 0x131, # \imath (roman bold) 482 0x11 => 0x237, # \jmath (roman bold) 483 0x12 => 0x60, # \grave 484 0x12 => 0x2CB, # \grave 485 0x12 => [0x300,-575,0], # \grave (combining) 486 0x13 => 0xB4, # \acute 487 0x13 => 0x2CA, # \acute 488 0x13 => [0x301,-575,0], # \acute (combining) 489 0x14 => 0x2C7, # \check 490 0x14 => [0x30C,-575,0], # \check (combining) 491 0x15 => 0x2D8, # \breve 492 0x15 => [0x306,-575,0], # \breve (combining) 493 0x16 => 0xAF, # \bar 494 0x16 => 0x2C9, # \bar 495 0x16 => [0x304,-575,0], # \bar (combining) 496 0x17 => [0xB0,-147,0], # ring above 497 0x17 => [0x2DA,-147,0], # ring above 498 0x17 => [0x30A,-722,0], # ring above (combining) 499 500 [0x21,0x2F] => 0x21, # !, ", #, $, %, &, ', (, ), *, +, comma, -, ., / 501 0x22 => 0x201D, # " 502 0x27 => 0x2019, # ' 503 [0x30,0x39] => 0x30, # 0-9 504 [0x3A,0x3B] => 0x3A, # :, ; 505 0x3D => 0x3D, # = 506 [0x3F,0x40] => 0x3F, # ?, @ 507 [0x41,0x5A] => 0x41, # A-Z 508 0x5B => 0x5B, # [ 509 0x5C => 0x201C, # `` 510 [0x5D,0x5E] => 0x5D, # ], ^ 511 0x5E => 0x2C6, # \hat 512 0x5E => [0x302,-575,0], # \hat (combining) 513 0x5F => [0x2D9,128,0], # \dot 514 0x5F => [0x307,-447,0], # \dot (combining) 515 0x60 => 0x2018, # ` 516 [0x61,0x7A] => 0x61, # a-z 517 [0x7B,0x7C] => 0x2013, # \endash, \emdash 518 0x7B => [0x5F,0,-310], # underline 519 0x7D => [0x30B,-575,0], # double acute (combining) 520 0x7E => [0x7E,0,-350], # ~ 521 0x7E => 0x2DC, # \tilde 522 0x7E => [0x303,-575,0], # \tilde (combining) 523 0x7F => 0xA8, # \ddot 524 0x7F => [0x308,-575,0], # \ddot (combining) 525 ], 526 }; 527 528 $map{cmmib10} = { 529 "Math-BoldItalic" => [ 530 [0,1] => 0x393, # \Gamma, \Delta 531 2 => 0x398, # \Theta 532 3 => 0x39B, # \Lambda 533 4 => 0x39E, # \Xi 534 5 => 0x3A0, # \Pi 535 6 => 0x3A3, # \Sigma 536 [7,8] => 0x3A5, # \Upsilon, \Phi 537 [9,0xA] => 0x3A8, # \Psi, \Omega 538 539 [0xB,0xE] => 0x3B1, # \alpha, \beta, \gamma, \delta 540 0xF => 0x3F5, # \elpsilon 541 [0x10,0x18] => 0x3B6, # \zeta, \eta, \theta, \iota, \kappa, \lambda, \mu, \nu, \xi 542 [0x19,0x1A] => 0x3C0, # \pi, \rho 543 [0x1B,0x1D] => 0x3C3, # \sigma, \tau, \upsilon 544 0x1E => 0x3D5, # \phi 545 [0x1F,0x21] => 0x3C7, # \chi, \psi, \omega 546 0x22 => 0x3B5, # \varepsilon 547 0x23 => 0x3D1, # \vartheta 548 0x24 => 0x3D6, # \varpi 549 0x25 => 0x3F1, # \varrho 550 0x26 => 0x3C2, # \varsigma 551 0x27 => 0x3C6, # \varphi 552 553 [0x41,0x5A] => 0x41, # A-Z 554 [0x61,0x7A] => 0x61, # a - z 555 0x6F => 0x3BF, # omicron 556 ], 557 558 "Main-Bold" => [ 559 0x28 => 0x21BC, # \leftharpoonup 560 0x29 => 0x21BD, # \leftharpoondown 561 0x2A => 0x21C0, # \rightharpoonup 562 0x2B => 0x21C1, # \rightharpoondown 563 564 0x2E => 0x25B9, # \triangleright 565 0x2F => 0x25C3, # \triangleleft 566 567 0x3C => 0x3C, # < 568 0x3D => 0x2215, # / 569 0x3E => 0x3E, # > 570 0x3F => 0x22C6, # \star 571 0x40 => 0x2202, # \partial 572 573 [0x5B,0x5D] => 0x266D, # \flat, \natural, \sharp 574 0x5E => 0x2323, # \smile 575 0x5F => 0x2322, # \frown 576 0x60 => 0x2113, # \ell 577 0x68 => 0x210F, # \hbar (bar added below) 578 579 0x7D => 0x2118, # \wp 580 0x7E => [0x20D7,-729,0],# \vec 581 ], 582 }; 583 584 $map{cmbsy10} = { 585 "Main-Bold" => [ 586 0 => 0x2212, # - 587 1 => 0x22C5, # \cdot 588 2 => 0xD7, # \times 589 3 => 0x2217, # \ast 590 4 => 0xF7, # \div 591 5 => 0x22C4, # \diamond 592 6 => 0xB1, # \pm 593 7 => 0x2213, # \mp 594 [8,0xC] => 0x2295, # \oplus, \ominus, \otimes, \oslash, \odot 595 0xD => 0x25EF, # \bigcirc 596 [0xE,0xF] => 0x2218, # \circ, \bullet 597 598 0x10 => 0x224D, # \asymp 599 0x11 => 0x2261, # \equiv 600 [0x12,0x13] => 0x2286, # \subseteq, \supseteq 601 [0x14,0x15] => 0x2264, # \leq, \geq 602 [0x16,0x17] => 0x2AAF, # \preceq, \succeq 603 0x18 => 0x223C, # \sim 604 0x19 => 0x2248, # \approx 605 [0x1A,0x1B] => 0x2282, # \subset, \supset 606 [0x1C,0x1D] => 0x226A, # \ll, \gg 607 [0x1E,0x1F] => 0x227A, # \prec, \succ 608 609 0x20 => 0x2190, # \leftarrow 610 0x21 => 0x2192, # \rightarrow 611 0x22 => 0x2191, # \uparrow 612 0x23 => 0x2193, # \downarrow 613 0x24 => 0x2194, # \leftrightarrow 614 0x25 => 0x2197, # \nearrow 615 0x26 => 0x2198, # \searrow 616 0x27 => 0x2243, # \simeq 617 618 0x28 => 0x21D0, # \Leftarrow 619 0x29 => 0x21D2, # \Rightarrow 620 0x2A => 0x21D1, # \Uparrow 621 0x2B => 0x21D3, # \Downarrow 622 0x2C => 0x21D4, # \Leftrightarrow 623 0x2D => 0x2196, # \nwarrow 624 0x2E => 0x2199, # \swarrow 625 0x2F => 0x221D, # \propto 626 627 0x30 => 0x2032, # \prime 628 0x31 => 0x221E, # \infty 629 0x32 => 0x2208, # \in 630 0x33 => 0x220B, # \ni 631 0x34 => 0x25B3, # \bigtriangleup and \triangle 632 0x35 => 0x25BD, # \bigtriangledown 633 0x36 => [0x338,-894,0], # \not (combining) 634 635 0x38 => 0x2200, # \forall 636 0x39 => 0x2203, # \exists 637 0x3A => 0xAC, # \neg 638 0x3B => 0x2205, # \emptyset 639 0x3C => 0x211C, # \Re 640 0x3D => 0x2111, # \Im 641 0x3E => 0x22A4, # \top 642 0x3F => 0x22A5, # \bot 643 644 0x40 => 0x2135, # \aleph 645 646 0x5B => 0x222A, # \cup 647 0x5C => 0x2229, # \cap 648 0x5D => 0x228E, # \uplus 649 [0x5E,0x5F] => 0x2227, # \wedge, \vee 650 651 [0x60,0x61] => 0x22A2, # \vdash, \dashv 652 [0x62,0x63] => 0x230A, # \lfloor, \rfloor 653 [0x64,0x65] => 0x2308, # \lceil, \rceil 654 0x66 => 0x7B, # { 655 0x67 => 0x7D, # } 656 [0x68,0x69] => 0x27E8, # \langle, \rangle 657 0x6A => 0x7C, # | 658 0x6A => 0x2223, # \vert 659 0x6B => 0x2225, # \Vert 660 0x6C => 0x2195, # \updownarrow 661 0x6D => 0x21D5, # \Updownarrow 662 0x6E => 0x5C, # \backslash 663 0x6E => 0x2216, # \setminus 664 0x6F => 0x2240, # \wr 665 666 0x70 => [0x221A,0,760], # \surd ### adjust position so font doesn't have a large depth 667 0x71 => 0x2A3F, # \amalg 668 0x72 => 0x2207, # \nabla 669 0x73 => 0x222B, # \int 670 0x74 => 0x2294, # \sqcup 671 0x75 => 0x2293, # \sqcap 672 [0x76,0x77] => 0x2291, # \sqsubseteq, \sqsupseteq 673 674 [0x79,0x7A] => 0x2020, # \dagger, \ddagger 675 676 0x7C => 0x2663, # \clubsuit 677 0x7D => 0x2662, # \diamondsuit 678 0x7E => 0x2661, # \heartsuit 679 0x7F => 0x2660, # \spadesuit 680 ], 681 682 "Math-BoldItalic" => [ 683 0x36 => 0x2F # \not 684 ], 685 }; 686 687 $map{msam10} = { 688 "Main-Regular" => [ 689 0x5C => 0x2220, # \angle 690 ], 691 692 "Main-Bold" => [ 693 0x5C => 0x2220, # \angle (emboldened below) 694 ], 695 696 "AMS" => [ 697 0x00 => 0x22A1, # \boxdot 698 0x01 => 0x229E, # \boxplus 699 0x02 => 0x22A0, # \boxtimes 700 0x03 => 0x25A1, # \square 701 0x04 => 0x25A0, # \blacksquare 702 0x05 => 0x22C5, # \centerdot 703 0x06 => 0x25CA, # \lozenge 704 0x07 => 0x29EB, # \blacklozenge 705 0x08 => 0x21BB, # \circlearrowright 706 0x09 => 0x21BA, # \circlearrowleft 707 0x0A => 0x21CC, # \rightleftharpoons 708 0x0B => 0x21CB, # \leftrightharpoons 709 0x0C => 0x229F, # \boxminus 710 0x0D => 0x22A9, # \Vdash 711 0x0E => 0x22AA, # \Vvdash 712 0x0F => 0x22A8, # \vDash 713 0x10 => 0x21A0, # \twoheadrightarrow 714 0x11 => 0x219E, # \twoheadleftarrow 715 0x12 => 0x21C7, # \leftleftarrows 716 0x13 => 0x21C9, # \rightrightarrows 717 0x14 => 0x21C8, # \upuparrows 718 0x15 => 0x21CA, # \downdownarrows 719 0x16 => 0x21BE, # \upharpoonright 720 0x17 => 0x21C2, # \downharpoonright 721 0x18 => 0x21BF, # \upharpoonleft 722 0x19 => 0x21C3, # \downharpoonleft 723 0x1A => 0x21A3, # \rightarrowtail 724 0x1B => 0x21A2, # \leftarrowtail 725 0x1C => 0x21C6, # \leftrightarrows 726 0x1D => 0x21C4, # \rightleftarrows 727 0x1E => 0x21B0, # \Lsh 728 0x1F => 0x21B1, # \Rsh 729 0x20 => 0x21DD, # \rightsquigarrow 730 0x21 => 0x21AD, # \leftrightsquigarrow 731 0x22 => 0x21AB, # \looparrowleft 732 0x23 => 0x21AC, # \looparrowright 733 0x24 => 0x2257, # \circeq 734 0x25 => 0x227F, # \succsim 735 0x26 => 0x2273, # \gtrsim 736 0x27 => 0x2A86, # \gtrapprox 737 0x28 => 0x22B8, # \multimap 738 0x29 => 0x2234, # \therefore 739 0x2A => 0x2235, # \because 740 0x2B => 0x2251, # \doteqdot 741 0x2C => 0x225C, # \triangleq 742 0x2D => 0x227E, # \precsim 743 0x2E => 0x2272, # \lesssim 744 0x2F => 0x2A85, # \lessapprox 745 0x30 => 0x2A95, # \eqslantless 746 0x31 => 0x2A96, # \eqslantgtr 747 0x32 => 0x22DE, # \curlyeqprec 748 0x33 => 0x22DF, # \curlyeqsucc 749 0x34 => 0x227C, # \preccurlyeq 750 0x35 => 0x2266, # \leqq 751 0x36 => 0x2A7D, # \leqslant 752 0x37 => 0x2276, # \lessgtr 753 0x38 => 0x2035, # \backprime 754 0x39 => 0x2212, # dahsed arrow extension 755 0x3A => 0x2253, # \risingdotseq 756 0x3B => 0x2252, # \fallingdotseq 757 0x3C => 0x227D, # \succcurlyeq 758 0x3D => 0x2267, # \geqq 759 0x3E => 0x2A7E, # \geqslant 760 0x3F => 0x2277, # \gtrless 761 0x40 => 0x228F, # \sqsubset 762 0x41 => 0x2290, # \sqsupset 763 0x42 => 0x22B3, # \vartriangleright 764 0x43 => 0x22B2, # \vartriangleleft 765 0x44 => 0x22B5, # \trianglerighteq 766 0x45 => 0x22B4, # \trianglelefteq 767 0x46 => 0x2605, # \bigstar 768 0x47 => 0x226C, # \between 769 0x48 => 0x25BC, # \blacktriangledown 770 0x49 => 0x25B6, # \blacktriangleright 771 0x4A => 0x25C0, # \blacktriangleleft 772 0x4B => 0x2192, # rightarrow 773 0x4C => 0x2190, # leftarrow 774 0x4D => 0x25B3, # \vartriangle 775 0x4E => 0x25B2, # \blacktriangle 776 0x4F => 0x25BD, # \triangledown 777 0x50 => 0x2256, # \eqcirc 778 0x51 => 0x22DA, # \lesseqgtr 779 0x52 => 0x22DB, # \gtreqless 780 0x53 => 0x2A8B, # \lesseqqgtr 781 0x54 => 0x2A8C, # \gtreqqless 782 0x55 => 0x00A5, # yen 783 0x56 => 0x21DB, # \Rrightarrow 784 0x57 => 0x21DA, # \Lleftarrow 785 0x58 => 0x2713, # checkmark 786 0x59 => 0x22BB, # \veebar 787 0x5A => 0x22BC, # \barwedge 788 0x5B => 0x2A5E, # \doublebarwedge 789 0x5C => 0x2220, # \angle 790 0x5D => 0x2221, # \measuredangle 791 0x5E => 0x2222, # \sphericalangle 792 0x5F => 0x221D, # \varpropto 793 0x60 => 0x2323, # \smallsmile 794 0x61 => 0x2322, # \smallfrown 795 0x62 => 0x22D0, # \Subset 796 0x63 => 0x22D1, # \Supset 797 0x64 => 0x22D3, # \Cup 798 0x65 => 0x22D2, # \Cap 799 0x66 => 0x22CF, # \curlywedge 800 0x67 => 0x22CE, # \curlyvee 801 0x68 => 0x22CB, # \leftthreetimes 802 0x69 => 0x22CC, # \rightthreetimes 803 0x6A => 0x2AC5, # \subseteqq 804 0x6B => 0x2AC6, # \supseteqq 805 0x6C => 0x224F, # \bumpeq 806 0x6D => 0x224E, # \Bumpeq 807 0x6E => 0x22D8, # \lll 808 0x6F => 0x22D9, # \ggg 809 0x70 => 0x250C, # \ulcorner 810 0x71 => 0x2510, # \urcorner 811 0x72 => 0x00AE, # registered sign 812 0x73 => 0x24C8, # \circledS 813 0x74 => 0x22D4, # \pitchfork 814 0x75 => 0x2214, # \dotplus 815 0x76 => 0x223D, # \backsim 816 0x77 => 0x22CD, # \backsimeq 817 0x78 => 0x2514, # \llcorner 818 0x79 => 0x2518, # \lrcorner 819 0x7A => 0x2720, # maltese cross 820 0x7B => 0x2201, # \complement 821 0x7C => 0x22BA, # \intercal 822 0x7D => 0x229A, # \circledcirc 823 0x7E => 0x229B, # \circledast 824 0x7F => 0x229D, # \circleddash 825 ], 826 }; 827 828 $map{msbm10} = { 829 "Size4" => [ 830 0x5B => 0x2C6, # \widehat 831 0x5B => [0x302,-1889,0],# \widehat (combining) 832 0x5D => 0x2DC, # \widetilde 833 0x5D => [0x303,-1889,0],# \widetilde (combining) 834 ], 835 836 "Main-Regular" => [ 837 0x7E => 0x210F, # \hbar 838 ], 839 840 "Main-Italic" => [ 841 0x7D => 0x210F, # \hbar (with slant) 842 ], 843 844 "AMS" => [ 845 0x00 => 0xE00C, # \lvertneqq 846 0x01 => 0xE00D, # \gvertneqq 847 0x02 => 0x2270, # \nleq 848 0x03 => 0x2271, # \ngeq 849 0x04 => 0x226E, # \nless 850 0x05 => 0x226F, # \ngtr 851 0x06 => 0x2280, # \nprec 852 0x07 => 0x2281, # \nsucc 853 0x08 => 0x2268, # \lneqq 854 0x09 => 0x2269, # \gneqq 855 0x0A => 0xE010, # \nleqslant 856 0x0B => 0xE00F, # \ngeqslant 857 0x0C => 0x2A87, # \lneq 858 0x0D => 0x2A88, # \gneq 859 0x0E => 0x22E0, # \npreceq 860 0x0F => 0x22E1, # \nsucceq 861 0x10 => 0x22E8, # \precnsim 862 0x11 => 0x22E9, # \succnsim 863 0x12 => 0x22E6, # \lnsim 864 0x13 => 0x22E7, # \gnsim 865 0x14 => 0xE011, # \nleqq 866 0x15 => 0xE00E, # \ngeqq 867 0x16 => 0x2AB5, # \precneqq 868 0x17 => 0x2AB6, # \succneqq 869 0x18 => 0x2AB9, # \precnapprox 870 0x19 => 0x2ABA, # \succnapprox 871 0x1A => 0x2A89, # \lnapprox 872 0x1B => 0x2A8A, # \gnapprox 873 0x1C => 0x2241, # \nsim 874 0x1D => 0x2246, # \ncong 875 0x1E => 0x2571, # \diagup 876 0x1F => 0x2572, # \diagdown 877 0x20 => 0xE01A, # \varsubsetneq 878 0x21 => 0xE01B, # \varsupsetneq 879 0x22 => 0xE016, # \nsubseteqq 880 0x23 => 0xE018, # \nsupseteqq 881 0x24 => 0x2ACB, # \subsetneqq 882 0x25 => 0x2ACC, # \supsetneqq 883 0x26 => 0xE017, # \varsubsetneqq 884 0x27 => 0xE019, # \varsupsetneqq 885 0x28 => 0x228A, # \subsetneq 886 0x29 => 0x228B, # \supsetneq 887 0x2A => 0x2288, # \nsubseteq 888 0x2B => 0x2289, # \nsupseteq 889 0x2C => 0x2226, # \nparallel 890 0x2D => 0x2224, # \nmid 891 0x2E => 0xE006, # \nshortmid 892 0x2F => 0xE007, # \nshortparallel 893 0x30 => 0x22AC, # \nvdash 894 0x31 => 0x22AE, # \nVdash 895 0x32 => 0x22AD, # \nvDash 896 0x33 => 0x22AF, # \nVDash 897 0x34 => 0x22ED, # \ntrianglerighteq 898 0x35 => 0x22EC, # \ntrianglelefteq 899 0x36 => 0x22EA, # \ntriangleleft 900 0x37 => 0x22EB, # \ntriangleright 901 0x38 => 0x219A, # \nleftarrow 902 0x39 => 0x219B, # \nrightarrow 903 0x3A => 0x21CD, # \nLeftarrow 904 0x3B => 0x21CF, # \nRightarrow 905 0x3C => 0x21CE, # \nLeftrightarrow 906 0x3D => 0x21AE, # \nleftrightarrow 907 0x3E => 0x22C7, # \divideontimes 908 0x3F => 0x2205, # \varnothing 909 0x40 => 0x2204, # \nexists 910 911 [0x41,0x5A] => 0x41, # A-Z 912 0x5C => 0x2C6, # \widehat 913 0x5C => [0x302,-2333,0],# \widehat (combining) 914 0x5E => 0x2DC, # \widetilde 915 0x5E => [0x303,-2333,0],# \widetilde (combining) 916 917 0x60 => 0x2132, # \Finv 918 0x61 => 0x2141, # \Game 919 0x66 => 0x2127, # \mho 920 0x67 => 0x00F0, # \eth 921 0x68 => 0x2242, # minus-tilde 922 0x69 => 0x2136, # \beth 923 0x6A => 0x2137, # \gimel 924 0x6B => 0x2138, # \daleth 925 0x6C => 0x22D6, # \lessdot 926 0x6D => 0x22D7, # \gtrdot 927 0x6E => 0x22C9, # \ltimes 928 0x6F => 0x22CA, # \rtimes 929 0x70 => 0x2223, # \shortmid 930 0x71 => 0x2225, # \shortparallel 931 0x72 => 0x2216, # \smallsetminus 932 0x73 => 0x223C, # \thicksim 933 0x74 => 0x2248, # \thickapprox 934 0x75 => 0x224A, # \approxeq 935 0x76 => 0x2AB8, # \succapprox 936 0x77 => 0x2AB7, # \precapprox 937 0x78 => 0x21B6, # \curvearrowleft 938 0x79 => 0x21B7, # \curvearrowright 939 0x7A => 0x03DD, # \digamma 940 0x7B => 0x03F0, # \varkappa 941 0x7A => 0xE008, # \digamma (non-standard, for IE) 942 0x7B => 0xE009, # \varkappa (non-standard, for IE) 943 0x7C => 0x006B, # \Bbbk 944 0x7D => 0x210F, # \hslash 945 0x7E => 0x0127, # \hbar 946 0x7F => 0x220D, # \backepsilon 947 ], 948 }; 949 950 $map{eufm10} = { 951 "Fraktur-Regular" => [ 952 [0,7] => 0xE300, # variants 953 0x12 => 0x2018, # left quote 954 0x13 => 0x2019, # right quote 955 0x21 => 0x21, # ! 956 [0x26,0x2F] => 0x26, # &, ', (, ), *, +, comma, -, ., / 957 [0x30,0x39] => 0x30, # 0-9 958 [0x3A,0x3B] => 0x3A, # :, ; 959 0x3D => 0x3D, # = 960 0x3F => 0x3F, # ? 961 [0x41,0x5A] => 0x41, # A-Z 962 0x5B => 0x5B, # [ 963 [0x5D,0x5E] => 0x5D, # ], ^ 964 [0x61,0x7A] => 0x61, # a-z 965 0x7D => 0x22, # " 966 ], 967 }; 968 969 $map{cmtt10} = { 970 "Typewriter-Regular" => [ 971 [0,1] => 0x393, # \Gamma, \Delta 972 2 => 0x398, # \Theta 973 3 => 0x39B, # \Lambda 974 4 => 0x39E, # \Xi 975 5 => 0x3A0, # \Pi 976 6 => 0x3A3, # \Sigma 977 [7,8] => 0x3A5, # \Upsilon, \Phi 978 [9,0xA] => 0x3A8, # \Psi, \Omega 979 0xD => 0x2032, # ' 980 981 0x10 => 0x131, # \imath (roman) 982 0x11 => 0x237, # \jmath (roman) 983 0x12 => [0x300,-525,0], # \grave (combining) 984 0x13 => [0x301,-525,0], # \acute (combining) 985 0x14 => [0x30C,-525,0], # \check (combining) 986 0x15 => [0x306,-525,0], # \breve (combining) 987 0x16 => [0x304,-525,0], # \bar (combining) 988 0x17 => [0x30A,-525,0], # ring above (combining) 989 990 [0x21,0x7F] => 0x21, 991 992 0x27 => 2018, # left quote 993 0x60 => 2019, # right quote 994 0x5E => [0x302,-525,0], # \hat (combining) 995 0x7E => [0x303,-525,0], # \tilde (combining) 996 0x7F => [0x308,-525,0], # \ddot (combining) 997 ], 998 }; 999 1000 $map{rsfs10} = { 1001 "Script-Regular" => [ 1002 [0x41,0x5A] => 0x41, # A-Z 1003 ], 1004 }; 1005 1006 $map{cmss10} = { 1007 "SansSerif-Regular" => [ 1008 [0,1] => 0x393, # \Gamma, \Delta 1009 2 => 0x398, # \Theta 1010 3 => 0x39B, # \Lambda 1011 4 => 0x39E, # \Xi 1012 5 => 0x3A0, # \Pi 1013 6 => 0x3A3, # \Sigma 1014 [7,8] => 0x3A5, # \Upsilon, \Phi 1015 [9,0xA] => 0x3A8, # \Psi, \Omega 1016 1017 0x10 => 0x131, # \imath (roman) 1018 0x11 => 0x237, # \jmath (roman) 1019 0x12 => [0x300,-500,0], # \grave (combining) 1020 0x13 => [0x301,-500,0], # \acute (combining) 1021 0x14 => [0x30C,-500,0], # \check (combining) 1022 0x15 => [0x306,-500,0], # \breve (combining) 1023 0x16 => [0x304,-500,0], # \bar (combining) 1024 0x17 => [0x30A,-542,0], # ring above (combining) 1025 1026 [0x21,0x2F] => 0x21, # !, ", #, $, %, &, ', (, ), *, +, comma, -, ., / 1027 0x22 => 0x201D, # " 1028 0x27 => 0x2019, # ' 1029 [0x30,0x39] => 0x30, # 0-9 1030 [0x3A,0x3B] => 0x3A, # :, ; 1031 0x3D => 0x3D, # = 1032 [0x3F,0x40] => 0x3F, # ?, @ 1033 [0x41,0x5A] => 0x41, # A-Z 1034 0x5B => 0x5B, # [ 1035 0x5C => 0x201C, # `` 1036 [0x5D,0x5E] => 0x5D, # ], ^ 1037 0x5E => [0x302,-500,0], # \hat (combining) 1038 0x5F => [0x307,-389,0], # \dot (combining) 1039 0x60 => 0x2018, # ` 1040 [0x61,0x7A] => 0x61, # a-z 1041 [0x7B,0x7C] => 0x2013, # \endash, \emdash 1042 0x7B => [0x5F,0,-350], # underline 1043 0x7D => [0x30B,-500,0], # double acute (combining) 1044 0x7E => [0x7E,0,-350], # ~ 1045 0x7E => [0x303,-500,0], # \tilde (combining) 1046 0x7F => [0x308,-500,0], # \ddot (combining) 1047 ], 1048 }; 1049 1050 foreach $cmfont (keys %map) { 1051 foreach $mjfont (keys %{$map{$cmfont}}) { 1052 $style = $mjfont; $style =~ s/.*?(-|$)//; $style = "Regular" unless $style; 1053 $family = $mjfont; $family =~ s/-.*//; 1054 $fontname = "$family-$style"; 1055 @{$reverse{$fontname}{$cmfont}} = @{$map{$cmfont}{$mjfont}}; 1056 } 1057 } 1058 1059 my %output; 1060 1061 sub add_to_output { 1062 my ($mjfont,$cmfont,$from,$to) = @_; 1063 1064 my $xshift = 0, $yshift = 0; 1065 1066 if (ref($to) eq "ARRAY") { 1067 $xshift = $to->[1]; 1068 $yshift = $to->[2]; 1069 $to = $to->[0]; 1070 } 1071 1072 $data = { 1073 "font" => $cmfont, 1074 "char" => $from, 1075 "xshift" => $xshift, 1076 "yshift" => $yshift 1077 }; 1078 1079 if (defined($output{$mjfont}{$to})) { 1080 print STDERR "Duplicate mapping $to for $mjfont: " . 1081 $output{$mjfont}{$to}{font} . ":" . 1082 $output{$mjfont}{$to}{char} . " vs. $cmfont:$from\n"; 1083 die "Duplicate mapping!"; # disable this line to see all of them 1084 } 1085 $output{$mjfont}{$to} = $data; 1086 } 1087 1088 foreach $mjfont (keys %reverse) { 1089 foreach $cmfont (keys %{$reverse{$mjfont}}) { 1090 @remap = @{$reverse{$mjfont}{$cmfont}}; 1091 while (defined($item = shift(@remap))) { 1092 $remap = shift(@remap); 1093 1094 if (ref($item) eq "ARRAY") { 1095 foreach $from ($item->[0]...$item->[1]) { 1096 $to = $from - $item->[0] + $remap; 1097 add_to_output($mjfont, $cmfont, $from, $to); 1098 } 1099 } else { 1100 add_to_output($mjfont, $cmfont, $item, $remap); 1101 } 1102 } 1103 } 1104 } 1105 1106 print(encode_json(\%output));