""" font data tables for truetype and afm computer modern fonts """ from __future__ import annotations from typing import overload, Union latex_to_bakoma = { '\\__sqrt__' : ('cmex10', 0x70), '\\bigcap' : ('cmex10', 0x5c), '\\bigcup' : ('cmex10', 0x5b), '\\bigodot' : ('cmex10', 0x4b), '\\bigoplus' : ('cmex10', 0x4d), '\\bigotimes' : ('cmex10', 0x4f), '\\biguplus' : ('cmex10', 0x5d), '\\bigvee' : ('cmex10', 0x5f), '\\bigwedge' : ('cmex10', 0x5e), '\\coprod' : ('cmex10', 0x61), '\\int' : ('cmex10', 0x5a), '\\langle' : ('cmex10', 0xad), '\\leftangle' : ('cmex10', 0xad), '\\leftbrace' : ('cmex10', 0xa9), '\\oint' : ('cmex10', 0x49), '\\prod' : ('cmex10', 0x59), '\\rangle' : ('cmex10', 0xae), '\\rightangle' : ('cmex10', 0xae), '\\rightbrace' : ('cmex10', 0xaa), '\\sum' : ('cmex10', 0x58), '\\widehat' : ('cmex10', 0x62), '\\widetilde' : ('cmex10', 0x65), '\\{' : ('cmex10', 0xa9), '\\}' : ('cmex10', 0xaa), '{' : ('cmex10', 0xa9), '}' : ('cmex10', 0xaa), ',' : ('cmmi10', 0x3b), '.' : ('cmmi10', 0x3a), '/' : ('cmmi10', 0x3d), '<' : ('cmmi10', 0x3c), '>' : ('cmmi10', 0x3e), '\\alpha' : ('cmmi10', 0xae), '\\beta' : ('cmmi10', 0xaf), '\\chi' : ('cmmi10', 0xc2), '\\combiningrightarrowabove' : ('cmmi10', 0x7e), '\\delta' : ('cmmi10', 0xb1), '\\ell' : ('cmmi10', 0x60), '\\epsilon' : ('cmmi10', 0xb2), '\\eta' : ('cmmi10', 0xb4), '\\flat' : ('cmmi10', 0x5b), '\\frown' : ('cmmi10', 0x5f), '\\gamma' : ('cmmi10', 0xb0), '\\imath' : ('cmmi10', 0x7b), '\\iota' : ('cmmi10', 0xb6), '\\jmath' : ('cmmi10', 0x7c), '\\kappa' : ('cmmi10', 0x2219), '\\lambda' : ('cmmi10', 0xb8), '\\leftharpoondown' : ('cmmi10', 0x29), '\\leftharpoonup' : ('cmmi10', 0x28), '\\mu' : ('cmmi10', 0xb9), '\\natural' : ('cmmi10', 0x5c), '\\nu' : ('cmmi10', 0xba), '\\omega' : ('cmmi10', 0x21), '\\phi' : ('cmmi10', 0xc1), '\\pi' : ('cmmi10', 0xbc), '\\psi' : ('cmmi10', 0xc3), '\\rho' : ('cmmi10', 0xbd), '\\rightharpoondown' : ('cmmi10', 0x2b), '\\rightharpoonup' : ('cmmi10', 0x2a), '\\sharp' : ('cmmi10', 0x5d), '\\sigma' : ('cmmi10', 0xbe), '\\smile' : ('cmmi10', 0x5e), '\\tau' : ('cmmi10', 0xbf), '\\theta' : ('cmmi10', 0xb5), '\\triangleleft' : ('cmmi10', 0x2f), '\\triangleright' : ('cmmi10', 0x2e), '\\upsilon' : ('cmmi10', 0xc0), '\\varepsilon' : ('cmmi10', 0x22), '\\varphi' : ('cmmi10', 0x27), '\\varrho' : ('cmmi10', 0x25), '\\varsigma' : ('cmmi10', 0x26), '\\vartheta' : ('cmmi10', 0x23), '\\wp' : ('cmmi10', 0x7d), '\\xi' : ('cmmi10', 0xbb), '\\zeta' : ('cmmi10', 0xb3), '!' : ('cmr10', 0x21), '%' : ('cmr10', 0x25), '&' : ('cmr10', 0x26), '(' : ('cmr10', 0x28), ')' : ('cmr10', 0x29), '+' : ('cmr10', 0x2b), '0' : ('cmr10', 0x30), '1' : ('cmr10', 0x31), '2' : ('cmr10', 0x32), '3' : ('cmr10', 0x33), '4' : ('cmr10', 0x34), '5' : ('cmr10', 0x35), '6' : ('cmr10', 0x36), '7' : ('cmr10', 0x37), '8' : ('cmr10', 0x38), '9' : ('cmr10', 0x39), ':' : ('cmr10', 0x3a), ';' : ('cmr10', 0x3b), '=' : ('cmr10', 0x3d), '?' : ('cmr10', 0x3f), '@' : ('cmr10', 0x40), '[' : ('cmr10', 0x5b), '\\#' : ('cmr10', 0x23), '\\$' : ('cmr10', 0x24), '\\%' : ('cmr10', 0x25), '\\Delta' : ('cmr10', 0xa2), '\\Gamma' : ('cmr10', 0xa1), '\\Lambda' : ('cmr10', 0xa4), '\\Omega' : ('cmr10', 0xad), '\\Phi' : ('cmr10', 0xa9), '\\Pi' : ('cmr10', 0xa6), '\\Psi' : ('cmr10', 0xaa), '\\Sigma' : ('cmr10', 0xa7), '\\Theta' : ('cmr10', 0xa3), '\\Upsilon' : ('cmr10', 0xa8), '\\Xi' : ('cmr10', 0xa5), '\\circumflexaccent' : ('cmr10', 0x5e), '\\combiningacuteaccent' : ('cmr10', 0xb6), '\\combiningbreve' : ('cmr10', 0xb8), '\\combiningdiaeresis' : ('cmr10', 0xc4), '\\combiningdotabove' : ('cmr10', 0x5f), '\\combininggraveaccent' : ('cmr10', 0xb5), '\\combiningoverline' : ('cmr10', 0xb9), '\\combiningtilde' : ('cmr10', 0x7e), '\\leftbracket' : ('cmr10', 0x5b), '\\leftparen' : ('cmr10', 0x28), '\\rightbracket' : ('cmr10', 0x5d), '\\rightparen' : ('cmr10', 0x29), '\\widebar' : ('cmr10', 0xb9), ']' : ('cmr10', 0x5d), '*' : ('cmsy10', 0xa4), '\N{MINUS SIGN}' : ('cmsy10', 0xa1), '\\Downarrow' : ('cmsy10', 0x2b), '\\Im' : ('cmsy10', 0x3d), '\\Leftarrow' : ('cmsy10', 0x28), '\\Leftrightarrow' : ('cmsy10', 0x2c), '\\P' : ('cmsy10', 0x7b), '\\Re' : ('cmsy10', 0x3c), '\\Rightarrow' : ('cmsy10', 0x29), '\\S' : ('cmsy10', 0x78), '\\Uparrow' : ('cmsy10', 0x2a), '\\Updownarrow' : ('cmsy10', 0x6d), '\\Vert' : ('cmsy10', 0x6b), '\\aleph' : ('cmsy10', 0x40), '\\approx' : ('cmsy10', 0xbc), '\\ast' : ('cmsy10', 0xa4), '\\asymp' : ('cmsy10', 0xb3), '\\backslash' : ('cmsy10', 0x6e), '\\bigcirc' : ('cmsy10', 0xb0), '\\bigtriangledown' : ('cmsy10', 0x35), '\\bigtriangleup' : ('cmsy10', 0x34), '\\bot' : ('cmsy10', 0x3f), '\\bullet' : ('cmsy10', 0xb2), '\\cap' : ('cmsy10', 0x5c), '\\cdot' : ('cmsy10', 0xa2), '\\circ' : ('cmsy10', 0xb1), '\\clubsuit' : ('cmsy10', 0x7c), '\\cup' : ('cmsy10', 0x5b), '\\dag' : ('cmsy10', 0x79), '\\dashv' : ('cmsy10', 0x61), '\\ddag' : ('cmsy10', 0x7a), '\\diamond' : ('cmsy10', 0xa6), '\\diamondsuit' : ('cmsy10', 0x7d), '\\div' : ('cmsy10', 0xa5), '\\downarrow' : ('cmsy10', 0x23), '\\emptyset' : ('cmsy10', 0x3b), '\\equiv' : ('cmsy10', 0xb4), '\\exists' : ('cmsy10', 0x39), '\\forall' : ('cmsy10', 0x38), '\\geq' : ('cmsy10', 0xb8), '\\gg' : ('cmsy10', 0xc0), '\\heartsuit' : ('cmsy10', 0x7e), '\\in' : ('cmsy10', 0x32), '\\infty' : ('cmsy10', 0x31), '\\lbrace' : ('cmsy10', 0x66), '\\lceil' : ('cmsy10', 0x64), '\\leftarrow' : ('cmsy10', 0xc3), '\\leftrightarrow' : ('cmsy10', 0x24), '\\leq' : ('cmsy10', 0x2219), '\\lfloor' : ('cmsy10', 0x62), '\\ll' : ('cmsy10', 0xbf), '\\mid' : ('cmsy10', 0x6a), '\\mp' : ('cmsy10', 0xa8), '\\nabla' : ('cmsy10', 0x72), '\\nearrow' : ('cmsy10', 0x25), '\\neg' : ('cmsy10', 0x3a), '\\ni' : ('cmsy10', 0x33), '\\nwarrow' : ('cmsy10', 0x2d), '\\odot' : ('cmsy10', 0xaf), '\\ominus' : ('cmsy10', 0xaa), '\\oplus' : ('cmsy10', 0xa9), '\\oslash' : ('cmsy10', 0xae), '\\otimes' : ('cmsy10', 0xad), '\\pm' : ('cmsy10', 0xa7), '\\prec' : ('cmsy10', 0xc1), '\\preceq' : ('cmsy10', 0xb9), '\\prime' : ('cmsy10', 0x30), '\\propto' : ('cmsy10', 0x2f), '\\rbrace' : ('cmsy10', 0x67), '\\rceil' : ('cmsy10', 0x65), '\\rfloor' : ('cmsy10', 0x63), '\\rightarrow' : ('cmsy10', 0x21), '\\searrow' : ('cmsy10', 0x26), '\\sim' : ('cmsy10', 0xbb), '\\simeq' : ('cmsy10', 0x27), '\\slash' : ('cmsy10', 0x36), '\\spadesuit' : ('cmsy10', 0xc4), '\\sqcap' : ('cmsy10', 0x75), '\\sqcup' : ('cmsy10', 0x74), '\\sqsubseteq' : ('cmsy10', 0x76), '\\sqsupseteq' : ('cmsy10', 0x77), '\\subset' : ('cmsy10', 0xbd), '\\subseteq' : ('cmsy10', 0xb5), '\\succ' : ('cmsy10', 0xc2), '\\succeq' : ('cmsy10', 0xba), '\\supset' : ('cmsy10', 0xbe), '\\supseteq' : ('cmsy10', 0xb6), '\\swarrow' : ('cmsy10', 0x2e), '\\times' : ('cmsy10', 0xa3), '\\to' : ('cmsy10', 0x21), '\\top' : ('cmsy10', 0x3e), '\\uparrow' : ('cmsy10', 0x22), '\\updownarrow' : ('cmsy10', 0x6c), '\\uplus' : ('cmsy10', 0x5d), '\\vdash' : ('cmsy10', 0x60), '\\vee' : ('cmsy10', 0x5f), '\\vert' : ('cmsy10', 0x6a), '\\wedge' : ('cmsy10', 0x5e), '\\wr' : ('cmsy10', 0x6f), '\\|' : ('cmsy10', 0x6b), '|' : ('cmsy10', 0x6a), '\\_' : ('cmtt10', 0x5f) } # Automatically generated. type12uni = { 'aring' : 229, 'quotedblright' : 8221, 'V' : 86, 'dollar' : 36, 'four' : 52, 'Yacute' : 221, 'P' : 80, 'underscore' : 95, 'p' : 112, 'Otilde' : 213, 'perthousand' : 8240, 'zero' : 48, 'dotlessi' : 305, 'Scaron' : 352, 'zcaron' : 382, 'egrave' : 232, 'section' : 167, 'Icircumflex' : 206, 'ntilde' : 241, 'ampersand' : 38, 'dotaccent' : 729, 'degree' : 176, 'K' : 75, 'acircumflex' : 226, 'Aring' : 197, 'k' : 107, 'smalltilde' : 732, 'Agrave' : 192, 'divide' : 247, 'ocircumflex' : 244, 'asciitilde' : 126, 'two' : 50, 'E' : 69, 'scaron' : 353, 'F' : 70, 'bracketleft' : 91, 'asciicircum' : 94, 'f' : 102, 'ordmasculine' : 186, 'mu' : 181, 'paragraph' : 182, 'nine' : 57, 'v' : 118, 'guilsinglleft' : 8249, 'backslash' : 92, 'six' : 54, 'A' : 65, 'icircumflex' : 238, 'a' : 97, 'ogonek' : 731, 'q' : 113, 'oacute' : 243, 'ograve' : 242, 'edieresis' : 235, 'comma' : 44, 'otilde' : 245, 'guillemotright' : 187, 'ecircumflex' : 234, 'greater' : 62, 'uacute' : 250, 'L' : 76, 'bullet' : 8226, 'cedilla' : 184, 'ydieresis' : 255, 'l' : 108, 'logicalnot' : 172, 'exclamdown' : 161, 'endash' : 8211, 'agrave' : 224, 'Adieresis' : 196, 'germandbls' : 223, 'Odieresis' : 214, 'space' : 32, 'quoteright' : 8217, 'ucircumflex' : 251, 'G' : 71, 'quoteleft' : 8216, 'W' : 87, 'Q' : 81, 'g' : 103, 'w' : 119, 'question' : 63, 'one' : 49, 'ring' : 730, 'figuredash' : 8210, 'B' : 66, 'iacute' : 237, 'Ydieresis' : 376, 'R' : 82, 'b' : 98, 'r' : 114, 'Ccedilla' : 199, 'minus' : 8722, 'Lslash' : 321, 'Uacute' : 218, 'yacute' : 253, 'Ucircumflex' : 219, 'quotedbl' : 34, 'onehalf' : 189, 'Thorn' : 222, 'M' : 77, 'eight' : 56, 'multiply' : 215, 'grave' : 96, 'Ocircumflex' : 212, 'm' : 109, 'Ugrave' : 217, 'guilsinglright' : 8250, 'Ntilde' : 209, 'questiondown' : 191, 'Atilde' : 195, 'ccedilla' : 231, 'Z' : 90, 'copyright' : 169, 'yen' : 165, 'Eacute' : 201, 'H' : 72, 'X' : 88, 'Idieresis' : 207, 'bar' : 124, 'h' : 104, 'x' : 120, 'udieresis' : 252, 'ordfeminine' : 170, 'braceleft' : 123, 'macron' : 175, 'atilde' : 227, 'Acircumflex' : 194, 'Oslash' : 216, 'C' : 67, 'quotedblleft' : 8220, 'S' : 83, 'exclam' : 33, 'Zcaron' : 381, 'equal' : 61, 's' : 115, 'eth' : 240, 'Egrave' : 200, 'hyphen' : 45, 'period' : 46, 'igrave' : 236, 'colon' : 58, 'Ecircumflex' : 202, 'trademark' : 8482, 'Aacute' : 193, 'cent' : 162, 'lslash' : 322, 'c' : 99, 'N' : 78, 'breve' : 728, 'Oacute' : 211, 'guillemotleft' : 171, 'n' : 110, 'idieresis' : 239, 'braceright' : 125, 'seven' : 55, 'brokenbar' : 166, 'ugrave' : 249, 'periodcentered' : 183, 'sterling' : 163, 'I' : 73, 'Y' : 89, 'Eth' : 208, 'emdash' : 8212, 'i' : 105, 'daggerdbl' : 8225, 'y' : 121, 'plusminus' : 177, 'less' : 60, 'Udieresis' : 220, 'D' : 68, 'five' : 53, 'T' : 84, 'oslash' : 248, 'acute' : 180, 'd' : 100, 'OE' : 338, 'Igrave' : 204, 't' : 116, 'parenright' : 41, 'adieresis' : 228, 'quotesingle' : 39, 'twodotenleader' : 8229, 'slash' : 47, 'ellipsis' : 8230, 'numbersign' : 35, 'odieresis' : 246, 'O' : 79, 'oe' : 339, 'o' : 111, 'Edieresis' : 203, 'plus' : 43, 'dagger' : 8224, 'three' : 51, 'hungarumlaut' : 733, 'parenleft' : 40, 'fraction' : 8260, 'registered' : 174, 'J' : 74, 'dieresis' : 168, 'Ograve' : 210, 'j' : 106, 'z' : 122, 'ae' : 230, 'semicolon' : 59, 'at' : 64, 'Iacute' : 205, 'percent' : 37, 'bracketright' : 93, 'AE' : 198, 'asterisk' : 42, 'aacute' : 225, 'U' : 85, 'eacute' : 233, 'e' : 101, 'thorn' : 254, 'u' : 117, } uni2type1 = {v: k for k, v in type12uni.items()} # The script below is to sort and format the tex2uni dict ## For decimal values: int(hex(v), 16) # newtex = {k: hex(v) for k, v in tex2uni.items()} # sd = dict(sorted(newtex.items(), key=lambda item: item[0])) # ## For formatting the sorted dictionary with proper spacing ## the value '24' comes from finding the longest string in ## the newtex keys with len(max(newtex, key=len)) # for key in sd: # print("{0:24} : {1: _EntryTypeOut: ... @overload def _normalize_stix_fontcodes(d: list[_EntryTypeIn]) -> list[_EntryTypeOut]: ... @overload def _normalize_stix_fontcodes(d: dict[str, list[_EntryTypeIn] | dict[str, list[_EntryTypeIn]]] ) -> dict[str, list[_EntryTypeOut] | dict[str, list[_EntryTypeOut]]]: ... def _normalize_stix_fontcodes(d): if isinstance(d, tuple): return tuple(ord(x) if isinstance(x, str) and len(x) == 1 else x for x in d) elif isinstance(d, list): return [_normalize_stix_fontcodes(x) for x in d] elif isinstance(d, dict): return {k: _normalize_stix_fontcodes(v) for k, v in d.items()} stix_virtual_fonts: dict[str, Union[dict[str, list[_EntryTypeOut]], list[_EntryTypeOut]]] stix_virtual_fonts = _normalize_stix_fontcodes(_stix_virtual_fonts) # Free redundant list now that it has been normalized del _stix_virtual_fonts # Fix some incorrect glyphs. stix_glyph_fixes = { # Cap and Cup glyphs are swapped. 0x22d2: 0x22d3, 0x22d3: 0x22d2, }