Index: _mathtext_data.py
===================================================================
--- _mathtext_data.py	(revision 2528)
+++ _mathtext_data.py	(working copy)
@@ -754,3 +754,2303 @@
     r'\sum'             : ('psyr', 229),
 
 }
+
+type12uni = {'uni24C8': 9416,
+'aring': 229,
+'uni22A0': 8864,
+'uni2292': 8850,
+'quotedblright': 8221,
+'uni03D2': 978,
+'uni2215': 8725,
+'uni03D0': 976,
+'V': 86,
+'dollar': 36,
+'uni301E': 12318,
+'uni03D5': 981,
+'four': 52,
+'uni25A0': 9632,
+'uni013C': 316,
+'uni013B': 315,
+'uni013E': 318,
+'Yacute': 221,
+'uni25DE': 9694,
+'uni013F': 319,
+'uni255A': 9562,
+'uni2606': 9734,
+'uni0180': 384,
+'uni22B7': 8887,
+'uni044F': 1103,
+'uni22B5': 8885,
+'uni22B4': 8884,
+'uni22AE': 8878,
+'uni22B2': 8882,
+'uni22B1': 8881,
+'uni22B0': 8880,
+'uni25CD': 9677,
+'uni03CE': 974,
+'uni03CD': 973,
+'uni03CC': 972,
+'uni03CB': 971,
+'uni03CA': 970,
+'uni22B8': 8888,
+'uni22C9': 8905,
+'uni0449': 1097,
+'uni20DD': 8413,
+'uni20DC': 8412,
+'uni20DB': 8411,
+'uni2231': 8753,
+'uni25CF': 9679,
+'uni306E': 12398,
+'uni03D1': 977,
+'uni01A1': 417,
+'uni20D7': 8407,
+'uni03D6': 982,
+'uni2233': 8755,
+'uni20D2': 8402,
+'uni20D1': 8401,
+'uni20D0': 8400,
+'P': 80,
+'uni22BE': 8894,
+'uni22BD': 8893,
+'uni22BC': 8892,
+'uni22BB': 8891,
+'underscore': 95,
+'uni03C8': 968,
+'uni03C7': 967,
+'uni0328': 808,
+'uni03C5': 965,
+'uni03C4': 964,
+'uni03C3': 963,
+'uni03C2': 962,
+'uni03C1': 961,
+'uni03C0': 960,
+'uni2010': 8208,
+'uni0130': 304,
+'uni0133': 307,
+'uni0132': 306,
+'uni0135': 309,
+'uni0134': 308,
+'uni0137': 311,
+'uni0136': 310,
+'uni0139': 313,
+'uni0138': 312,
+'uni2244': 8772,
+'uni229A': 8858,
+'uni2571': 9585,
+'uni0278': 632,
+'uni2239': 8761,
+'p': 112,
+'uni3019': 12313,
+'uni25CB': 9675,
+'uni03DB': 987,
+'uni03DC': 988,
+'uni03DA': 986,
+'uni03DF': 991,
+'uni03DD': 989,
+'uni013D': 317,
+'uni220A': 8714,
+'uni220C': 8716,
+'uni220B': 8715,
+'uni220E': 8718,
+'uni220D': 8717,
+'uni220F': 8719,
+'uni22CC': 8908,
+'Otilde': 213,
+'uni25E5': 9701,
+'uni2736': 10038,
+'perthousand': 8240,
+'zero': 48,
+'uni279B': 10139,
+'dotlessi': 305,
+'uni2279': 8825,
+'Scaron': 352,
+'zcaron': 382,
+'uni21D8': 8664,
+'egrave': 232,
+'uni0271': 625,
+'uni01AA': 426,
+'uni2332': 9010,
+'section': 167,
+'uni25E4': 9700,
+'Icircumflex': 206,
+'ntilde': 241,
+'uni041E': 1054,
+'ampersand': 38,
+'uni041C': 1052,
+'uni041A': 1050,
+'uni22AB': 8875,
+'uni21DB': 8667,
+'dotaccent': 729,
+'uni0416': 1046,
+'uni0417': 1047,
+'uni0414': 1044,
+'uni0415': 1045,
+'uni0412': 1042,
+'uni0413': 1043,
+'degree': 176,
+'uni0411': 1041,
+'K': 75,
+'uni25EB': 9707,
+'uni25EF': 9711,
+'uni0418': 1048,
+'uni0419': 1049,
+'uni2263': 8803,
+'uni226E': 8814,
+'uni2251': 8785,
+'uni02C8': 712,
+'uni2262': 8802,
+'acircumflex': 226,
+'uni22B3': 8883,
+'uni2261': 8801,
+'uni2394': 9108,
+'Aring': 197,
+'uni2260': 8800,
+'uni2254': 8788,
+'uni0436': 1078,
+'uni2267': 8807,
+'k': 107,
+'uni22C8': 8904,
+'uni226A': 8810,
+'uni231F': 8991,
+'smalltilde': 732,
+'uni2201': 8705,
+'uni2200': 8704,
+'uni2203': 8707,
+'uni02BD': 701,
+'uni2205': 8709,
+'uni2204': 8708,
+'Agrave': 192,
+'uni2206': 8710,
+'uni2209': 8713,
+'uni2208': 8712,
+'uni226D': 8813,
+'uni2264': 8804,
+'uni263D': 9789,
+'uni2258': 8792,
+'uni02D3': 723,
+'uni02D2': 722,
+'uni02D1': 721,
+'uni02D0': 720,
+'uni25E1': 9697,
+'divide': 247,
+'uni02D5': 725,
+'uni02D4': 724,
+'ocircumflex': 244,
+'uni2524': 9508,
+'uni043A': 1082,
+'uni24CC': 9420,
+'asciitilde': 126,
+'uni22B9': 8889,
+'uni24D2': 9426,
+'uni211E': 8478,
+'uni211D': 8477,
+'uni24DD': 9437,
+'uni211A': 8474,
+'uni211C': 8476,
+'uni211B': 8475,
+'uni25C6': 9670,
+'uni017F': 383,
+'uni017A': 378,
+'uni017C': 380,
+'uni017B': 379,
+'uni0346': 838,
+'uni22F1': 8945,
+'uni22F0': 8944,
+'two': 50,
+'uni2298': 8856,
+'uni24D1': 9425,
+'E': 69,
+'uni025D': 605,
+'scaron': 353,
+'uni2322': 8994,
+'uni25E3': 9699,
+'uni22BF': 8895,
+'F': 70,
+'uni0440': 1088,
+'uni255E': 9566,
+'uni22BA': 8890,
+'uni0175': 373,
+'uni0174': 372,
+'uni0177': 375,
+'uni0176': 374,
+'bracketleft': 91,
+'uni0170': 368,
+'uni0173': 371,
+'uni0172': 370,
+'asciicircum': 94,
+'uni0179': 377,
+'uni2590': 9616,
+'uni25E2': 9698,
+'uni2119': 8473,
+'uni2118': 8472,
+'uni25CC': 9676,
+'f': 102,
+'ordmasculine': 186,
+'uni229B': 8859,
+'uni22A1': 8865,
+'uni2111': 8465,
+'uni2110': 8464,
+'uni2113': 8467,
+'uni2112': 8466,
+'mu': 181,
+'uni2281': 8833,
+'paragraph': 182,
+'nine': 57,
+'uni25EC': 9708,
+'v': 118,
+'uni040C': 1036,
+'uni0113': 275,
+'uni22D0': 8912,
+'uni21CC': 8652,
+'uni21CB': 8651,
+'uni21CA': 8650,
+'uni22A5': 8869,
+'uni21CF': 8655,
+'uni21CE': 8654,
+'uni21CD': 8653,
+'guilsinglleft': 8249,
+'backslash': 92,
+'uni2284': 8836,
+'uni224E': 8782,
+'uni224D': 8781,
+'uni224F': 8783,
+'uni224A': 8778,
+'uni2287': 8839,
+'uni224C': 8780,
+'uni224B': 8779,
+'uni21BD': 8637,
+'uni2286': 8838,
+'uni030F': 783,
+'uni030D': 781,
+'uni030E': 782,
+'uni030B': 779,
+'uni030C': 780,
+'uni030A': 778,
+'uni026E': 622,
+'uni026D': 621,
+'six': 54,
+'uni026A': 618,
+'uni026C': 620,
+'uni25C1': 9665,
+'uni20D6': 8406,
+'uni045B': 1115,
+'uni045C': 1116,
+'uni256B': 9579,
+'uni045A': 1114,
+'uni045F': 1119,
+'uni045E': 1118,
+'A': 65,
+'uni2569': 9577,
+'uni0458': 1112,
+'uni0459': 1113,
+'uni0452': 1106,
+'uni0453': 1107,
+'uni2562': 9570,
+'uni0451': 1105,
+'uni0456': 1110,
+'uni0457': 1111,
+'uni0454': 1108,
+'uni0455': 1109,
+'icircumflex': 238,
+'uni0307': 775,
+'uni0304': 772,
+'uni0305': 773,
+'uni0269': 617,
+'uni0268': 616,
+'uni0300': 768,
+'uni0301': 769,
+'uni0265': 613,
+'uni0264': 612,
+'uni0267': 615,
+'uni0266': 614,
+'uni0261': 609,
+'uni0260': 608,
+'uni0263': 611,
+'uni0262': 610,
+'a': 97,
+'uni2207': 8711,
+'uni2247': 8775,
+'uni2246': 8774,
+'uni2241': 8769,
+'uni2240': 8768,
+'uni2243': 8771,
+'uni2242': 8770,
+'uni2312': 8978,
+'ogonek': 731,
+'uni2249': 8777,
+'uni2248': 8776,
+'uni3030': 12336,
+'q': 113,
+'uni21C2': 8642,
+'uni21C1': 8641,
+'uni21C0': 8640,
+'uni21C7': 8647,
+'uni21C6': 8646,
+'uni21C5': 8645,
+'uni21C4': 8644,
+'uni225F': 8799,
+'uni212C': 8492,
+'uni21C8': 8648,
+'uni2467': 9319,
+'oacute': 243,
+'uni028F': 655,
+'uni028E': 654,
+'uni026F': 623,
+'uni028C': 652,
+'uni028B': 651,
+'uni028A': 650,
+'uni2510': 9488,
+'ograve': 242,
+'edieresis': 235,
+'uni22CE': 8910,
+'uni22CF': 8911,
+'uni219F': 8607,
+'comma': 44,
+'uni22CA': 8906,
+'uni0429': 1065,
+'uni03C6': 966,
+'uni0427': 1063,
+'uni0426': 1062,
+'uni0425': 1061,
+'uni0424': 1060,
+'uni0423': 1059,
+'uni0422': 1058,
+'uni0421': 1057,
+'uni0420': 1056,
+'uni2465': 9317,
+'uni24D0': 9424,
+'uni2464': 9316,
+'uni0430': 1072,
+'otilde': 245,
+'uni2661': 9825,
+'uni24D6': 9430,
+'uni2466': 9318,
+'uni24D5': 9429,
+'uni219A': 8602,
+'uni2518': 9496,
+'uni22B6': 8886,
+'uni2461': 9313,
+'uni24D4': 9428,
+'uni2460': 9312,
+'uni24EA': 9450,
+'guillemotright': 187,
+'ecircumflex': 234,
+'greater': 62,
+'uni2011': 8209,
+'uacute': 250,
+'uni2462': 9314,
+'L': 76,
+'bullet': 8226,
+'uni02A4': 676,
+'uni02A7': 679,
+'cedilla': 184,
+'uni02A2': 674,
+'uni2015': 8213,
+'uni22C4': 8900,
+'uni22C5': 8901,
+'uni22AD': 8877,
+'uni22C7': 8903,
+'uni22C0': 8896,
+'uni2016': 8214,
+'uni22C2': 8898,
+'uni22C3': 8899,
+'uni24CF': 9423,
+'uni042F': 1071,
+'uni042E': 1070,
+'uni042D': 1069,
+'ydieresis': 255,
+'l': 108,
+'logicalnot': 172,
+'uni24CA': 9418,
+'uni0287': 647,
+'uni0286': 646,
+'uni0285': 645,
+'uni0284': 644,
+'uni0283': 643,
+'uni0282': 642,
+'uni0281': 641,
+'uni027C': 636,
+'uni2664': 9828,
+'exclamdown': 161,
+'uni25C4': 9668,
+'uni0289': 649,
+'uni0288': 648,
+'uni039A': 922,
+'endash': 8211,
+'uni2640': 9792,
+'uni20E4': 8420,
+'uni0473': 1139,
+'uni20E1': 8417,
+'uni2642': 9794,
+'uni03B8': 952,
+'uni03B9': 953,
+'agrave': 224,
+'uni03B4': 948,
+'uni03B5': 949,
+'uni03B6': 950,
+'uni03B7': 951,
+'uni03B0': 944,
+'uni03B1': 945,
+'uni03B2': 946,
+'uni03B3': 947,
+'uni2555': 9557,
+'Adieresis': 196,
+'germandbls': 223,
+'Odieresis': 214,
+'space': 32,
+'uni0126': 294,
+'uni0127': 295,
+'uni0124': 292,
+'uni0125': 293,
+'uni0122': 290,
+'uni0123': 291,
+'uni0120': 288,
+'uni0121': 289,
+'quoteright': 8217,
+'uni2560': 9568,
+'uni2556': 9558,
+'ucircumflex': 251,
+'uni2561': 9569,
+'uni2551': 9553,
+'uni25B2': 9650,
+'uni2550': 9552,
+'uni2563': 9571,
+'uni2553': 9555,
+'G': 71,
+'uni2564': 9572,
+'uni2552': 9554,
+'quoteleft': 8216,
+'uni2565': 9573,
+'uni2572': 9586,
+'uni2568': 9576,
+'uni2566': 9574,
+'W': 87,
+'uni214A': 8522,
+'uni012F': 303,
+'uni012D': 301,
+'uni012E': 302,
+'uni012B': 299,
+'uni012C': 300,
+'uni255C': 9564,
+'uni012A': 298,
+'uni2289': 8841,
+'Q': 81,
+'uni2320': 8992,
+'uni2321': 8993,
+'g': 103,
+'uni03BD': 957,
+'uni03BE': 958,
+'uni03BF': 959,
+'uni2282': 8834,
+'uni2285': 8837,
+'uni03BA': 954,
+'uni03BB': 955,
+'uni03BC': 956,
+'uni2128': 8488,
+'uni25B7': 9655,
+'w': 119,
+'uni0302': 770,
+'uni03DE': 990,
+'uni25DA': 9690,
+'uni0303': 771,
+'uni0463': 1123,
+'uni0462': 1122,
+'uni3018': 12312,
+'uni2514': 9492,
+'question': 63,
+'uni25B3': 9651,
+'uni24E1': 9441,
+'one': 49,
+'uni200A': 8202,
+'uni2278': 8824,
+'ring': 730,
+'uni0195': 405,
+'figuredash': 8210,
+'uni22EC': 8940,
+'uni0339': 825,
+'uni0338': 824,
+'uni0337': 823,
+'uni0336': 822,
+'uni0335': 821,
+'uni0333': 819,
+'uni0332': 818,
+'uni0331': 817,
+'uni0330': 816,
+'uni01C1': 449,
+'uni01C0': 448,
+'uni01C3': 451,
+'uni01C2': 450,
+'uni2353': 9043,
+'uni0308': 776,
+'uni2218': 8728,
+'uni2219': 8729,
+'uni2216': 8726,
+'uni2217': 8727,
+'uni2214': 8724,
+'uni0309': 777,
+'uni2609': 9737,
+'uni2213': 8723,
+'uni2210': 8720,
+'uni2211': 8721,
+'uni2245': 8773,
+'B': 66,
+'uni25D6': 9686,
+'iacute': 237,
+'uni02E6': 742,
+'uni02E7': 743,
+'uni02E8': 744,
+'uni02E9': 745,
+'uni221D': 8733,
+'uni221E': 8734,
+'Ydieresis': 376,
+'uni221C': 8732,
+'uni22D7': 8919,
+'uni221A': 8730,
+'R': 82,
+'uni24DC': 9436,
+'uni033F': 831,
+'uni033E': 830,
+'uni033C': 828,
+'uni033B': 827,
+'uni033A': 826,
+'b': 98,
+'uni228A': 8842,
+'uni22DB': 8923,
+'uni2554': 9556,
+'uni046B': 1131,
+'uni046A': 1130,
+'r': 114,
+'uni24DB': 9435,
+'Ccedilla': 199,
+'minus': 8722,
+'uni24DA': 9434,
+'uni03F0': 1008,
+'uni03F1': 1009,
+'uni20AC': 8364,
+'uni2276': 8822,
+'uni24C0': 9408,
+'uni0162': 354,
+'uni0163': 355,
+'uni011E': 286,
+'uni011D': 285,
+'uni011C': 284,
+'uni011B': 283,
+'uni0164': 356,
+'uni0165': 357,
+'Lslash': 321,
+'uni0168': 360,
+'uni0169': 361,
+'uni25C9': 9673,
+'uni02E5': 741,
+'uni21C3': 8643,
+'uni24C4': 9412,
+'uni24E2': 9442,
+'uni2277': 8823,
+'uni013A': 314,
+'uni2102': 8450,
+'Uacute': 218,
+'uni2317': 8983,
+'uni2107': 8455,
+'uni221F': 8735,
+'yacute': 253,
+'uni3012': 12306,
+'Ucircumflex': 219,
+'uni015D': 349,
+'quotedbl': 34,
+'uni25D9': 9689,
+'uni2280': 8832,
+'uni22AF': 8879,
+'onehalf': 189,
+'uni221B': 8731,
+'Thorn': 222,
+'uni2226': 8742,
+'M': 77,
+'uni25BA': 9658,
+'uni2463': 9315,
+'uni2336': 9014,
+'eight': 56,
+'uni2236': 8758,
+'multiply': 215,
+'uni210C': 8460,
+'uni210A': 8458,
+'uni21C9': 8649,
+'grave': 96,
+'uni210E': 8462,
+'uni0117': 279,
+'uni016C': 364,
+'uni0115': 277,
+'uni016A': 362,
+'uni016F': 367,
+'uni0112': 274,
+'uni016D': 365,
+'uni016E': 366,
+'Ocircumflex': 212,
+'uni2305': 8965,
+'m': 109,
+'uni24DF': 9439,
+'uni0119': 281,
+'uni0118': 280,
+'uni20A3': 8355,
+'uni20A4': 8356,
+'uni20A7': 8359,
+'uni2288': 8840,
+'uni24C3': 9411,
+'uni251C': 9500,
+'uni228D': 8845,
+'uni222F': 8751,
+'uni222E': 8750,
+'uni222D': 8749,
+'uni222C': 8748,
+'uni222B': 8747,
+'uni222A': 8746,
+'uni255B': 9563,
+'Ugrave': 217,
+'uni24DE': 9438,
+'guilsinglright': 8250,
+'uni250A': 9482,
+'Ntilde': 209,
+'uni0279': 633,
+'questiondown': 191,
+'uni256C': 9580,
+'Atilde': 195,
+'uni0272': 626,
+'uni0273': 627,
+'uni0270': 624,
+'ccedilla': 231,
+'uni0276': 630,
+'uni0277': 631,
+'uni0274': 628,
+'uni0275': 629,
+'uni2252': 8786,
+'uni041F': 1055,
+'uni2250': 8784,
+'Z': 90,
+'uni2256': 8790,
+'uni2257': 8791,
+'copyright': 169,
+'uni2255': 8789,
+'uni043D': 1085,
+'uni043E': 1086,
+'uni043F': 1087,
+'yen': 165,
+'uni041D': 1053,
+'uni043B': 1083,
+'uni043C': 1084,
+'uni21B0': 8624,
+'uni21B1': 8625,
+'uni21B2': 8626,
+'uni21B3': 8627,
+'uni21B4': 8628,
+'uni21B5': 8629,
+'uni21B6': 8630,
+'uni21B7': 8631,
+'uni21B8': 8632,
+'Eacute': 201,
+'uni2311': 8977,
+'uni2310': 8976,
+'uni228F': 8847,
+'uni25DB': 9691,
+'uni21BA': 8634,
+'uni21BB': 8635,
+'uni21BC': 8636,
+'uni2017': 8215,
+'uni21BE': 8638,
+'uni21BF': 8639,
+'uni231C': 8988,
+'H': 72,
+'uni0293': 659,
+'uni2202': 8706,
+'uni22A4': 8868,
+'uni231E': 8990,
+'uni2232': 8754,
+'uni225B': 8795,
+'uni225C': 8796,
+'uni24D9': 9433,
+'uni225A': 8794,
+'uni0438': 1080,
+'uni0439': 1081,
+'uni225D': 8797,
+'uni225E': 8798,
+'uni0434': 1076,
+'X': 88,
+'uni007F': 127,
+'uni0437': 1079,
+'Idieresis': 207,
+'uni0431': 1073,
+'uni0432': 1074,
+'uni0433': 1075,
+'uni22AC': 8876,
+'uni22CD': 8909,
+'uni25A3': 9635,
+'bar': 124,
+'uni24BB': 9403,
+'uni037E': 894,
+'uni027B': 635,
+'h': 104,
+'uni027A': 634,
+'uni027F': 639,
+'uni027D': 637,
+'uni027E': 638,
+'uni2227': 8743,
+'uni2004': 8196,
+'uni2225': 8741,
+'uni2224': 8740,
+'uni2223': 8739,
+'uni2222': 8738,
+'uni2221': 8737,
+'uni2220': 8736,
+'x': 120,
+'uni2323': 8995,
+'uni2559': 9561,
+'uni2558': 9560,
+'uni2229': 8745,
+'uni2228': 8744,
+'udieresis': 252,
+'uni029D': 669,
+'ordfeminine': 170,
+'uni22CB': 8907,
+'uni233D': 9021,
+'uni0428': 1064,
+'uni24C6': 9414,
+'uni22DD': 8925,
+'uni24C7': 9415,
+'uni015C': 348,
+'uni015B': 347,
+'uni015A': 346,
+'uni22AA': 8874,
+'uni015F': 351,
+'uni015E': 350,
+'braceleft': 123,
+'uni24C5': 9413,
+'uni0410': 1040,
+'uni03AA': 938,
+'uni24C2': 9410,
+'uni03AC': 940,
+'uni03AB': 939,
+'macron': 175,
+'uni03AD': 941,
+'uni03AF': 943,
+'uni0294': 660,
+'uni0295': 661,
+'uni0296': 662,
+'uni0297': 663,
+'uni0290': 656,
+'uni0291': 657,
+'uni0292': 658,
+'atilde': 227,
+'Acircumflex': 194,
+'uni2370': 9072,
+'uni24C1': 9409,
+'uni0298': 664,
+'uni0299': 665,
+'Oslash': 216,
+'uni029E': 670,
+'C': 67,
+'quotedblleft': 8220,
+'uni029B': 667,
+'uni029C': 668,
+'uni03A9': 937,
+'uni03A8': 936,
+'S': 83,
+'uni24C9': 9417,
+'uni03A1': 929,
+'uni03A0': 928,
+'exclam': 33,
+'uni03A5': 933,
+'uni03A4': 932,
+'uni03A7': 935,
+'Zcaron': 381,
+'uni2133': 8499,
+'uni2132': 8498,
+'uni0159': 345,
+'uni0158': 344,
+'uni2137': 8503,
+'uni2005': 8197,
+'uni2135': 8501,
+'uni2134': 8500,
+'uni02BA': 698,
+'uni2033': 8243,
+'uni0151': 337,
+'uni0150': 336,
+'uni0157': 343,
+'equal': 61,
+'uni0155': 341,
+'uni0154': 340,
+'s': 115,
+'uni233F': 9023,
+'eth': 240,
+'uni24BE': 9406,
+'uni21E9': 8681,
+'uni2060': 8288,
+'Egrave': 200,
+'uni255D': 9565,
+'uni24CD': 9421,
+'uni21E1': 8673,
+'uni21B9': 8633,
+'hyphen': 45,
+'uni01BE': 446,
+'uni01BB': 443,
+'period': 46,
+'igrave': 236,
+'uni01BA': 442,
+'uni2296': 8854,
+'uni2297': 8855,
+'uni2294': 8852,
+'uni2295': 8853,
+'colon': 58,
+'uni2293': 8851,
+'uni2290': 8848,
+'uni2291': 8849,
+'uni032D': 813,
+'uni032E': 814,
+'uni032F': 815,
+'uni032A': 810,
+'uni032B': 811,
+'uni032C': 812,
+'uni231D': 8989,
+'Ecircumflex': 202,
+'uni24D7': 9431,
+'uni25DD': 9693,
+'trademark': 8482,
+'Aacute': 193,
+'cent': 162,
+'uni0445': 1093,
+'uni266E': 9838,
+'uni266D': 9837,
+'uni266B': 9835,
+'uni03C9': 969,
+'uni2003': 8195,
+'uni2047': 8263,
+'lslash': 322,
+'uni03A6': 934,
+'uni2043': 8259,
+'uni250C': 9484,
+'uni2040': 8256,
+'uni255F': 9567,
+'uni24CB': 9419,
+'uni0472': 1138,
+'uni0446': 1094,
+'uni0474': 1140,
+'uni0475': 1141,
+'uni2508': 9480,
+'uni2660': 9824,
+'uni2506': 9478,
+'uni2502': 9474,
+'c': 99,
+'uni2500': 9472,
+'N': 78,
+'uni22A6': 8870,
+'uni21E7': 8679,
+'uni2130': 8496,
+'uni2002': 8194,
+'breve': 728,
+'uni0442': 1090,
+'Oacute': 211,
+'uni229F': 8863,
+'uni25C7': 9671,
+'uni229D': 8861,
+'uni229E': 8862,
+'guillemotleft': 171,
+'uni0329': 809,
+'uni24E5': 9445,
+'uni011F': 287,
+'uni0324': 804,
+'uni0325': 805,
+'uni0326': 806,
+'uni0327': 807,
+'uni0321': 801,
+'uni0322': 802,
+'n': 110,
+'uni2032': 8242,
+'uni2269': 8809,
+'uni2268': 8808,
+'uni0306': 774,
+'uni226B': 8811,
+'uni21EA': 8682,
+'uni0166': 358,
+'uni203B': 8251,
+'uni01B5': 437,
+'idieresis': 239,
+'uni02BC': 700,
+'uni01B0': 432,
+'braceright': 125,
+'seven': 55,
+'uni02BB': 699,
+'uni011A': 282,
+'uni29FB': 10747,
+'brokenbar': 166,
+'uni2036': 8246,
+'uni25C0': 9664,
+'uni0156': 342,
+'uni22D5': 8917,
+'uni0258': 600,
+'ugrave': 249,
+'uni22D6': 8918,
+'uni22D1': 8913,
+'uni2034': 8244,
+'uni22D3': 8915,
+'uni22D2': 8914,
+'uni203C': 8252,
+'uni223E': 8766,
+'uni02BF': 703,
+'uni22D9': 8921,
+'uni22D8': 8920,
+'uni25BD': 9661,
+'uni25BE': 9662,
+'uni25BF': 9663,
+'uni041B': 1051,
+'periodcentered': 183,
+'uni25BC': 9660,
+'uni019E': 414,
+'uni019B': 411,
+'uni019A': 410,
+'uni2007': 8199,
+'uni0391': 913,
+'uni0390': 912,
+'uni0393': 915,
+'uni0392': 914,
+'uni0395': 917,
+'uni0394': 916,
+'uni0397': 919,
+'uni0396': 918,
+'uni0399': 921,
+'uni0398': 920,
+'uni25C8': 9672,
+'uni2468': 9320,
+'sterling': 163,
+'uni22EB': 8939,
+'uni039C': 924,
+'uni039B': 923,
+'uni039E': 926,
+'uni039D': 925,
+'uni039F': 927,
+'I': 73,
+'uni03E1': 993,
+'uni03E0': 992,
+'uni2319': 8985,
+'uni228B': 8843,
+'uni25B5': 9653,
+'uni25B6': 9654,
+'uni22EA': 8938,
+'uni24B9': 9401,
+'uni044E': 1102,
+'uni0199': 409,
+'uni2266': 8806,
+'Y': 89,
+'uni22A2': 8866,
+'Eth': 208,
+'uni266F': 9839,
+'emdash': 8212,
+'uni263B': 9787,
+'uni24BD': 9405,
+'uni22DE': 8926,
+'uni0360': 864,
+'uni2557': 9559,
+'uni22DF': 8927,
+'uni22DA': 8922,
+'uni22DC': 8924,
+'uni0361': 865,
+'i': 105,
+'uni24BF': 9407,
+'uni0362': 866,
+'uni263E': 9790,
+'uni028D': 653,
+'uni2259': 8793,
+'uni0323': 803,
+'uni2265': 8805,
+'daggerdbl': 8225,
+'y': 121,
+'uni010A': 266,
+'plusminus': 177,
+'less': 60,
+'uni21AE': 8622,
+'uni0315': 789,
+'uni230B': 8971,
+'uni21AF': 8623,
+'uni21AA': 8618,
+'uni21AC': 8620,
+'uni21AB': 8619,
+'uni01FB': 507,
+'uni01FC': 508,
+'uni223A': 8762,
+'uni01FA': 506,
+'uni01FF': 511,
+'uni01FD': 509,
+'uni01FE': 510,
+'uni2567': 9575,
+'uni25E0': 9696,
+'uni0104': 260,
+'uni0105': 261,
+'uni0106': 262,
+'uni0107': 263,
+'uni0100': 256,
+'uni0101': 257,
+'uni0102': 258,
+'uni0103': 259,
+'uni2038': 8248,
+'uni2009': 8201,
+'uni2008': 8200,
+'uni0108': 264,
+'uni0109': 265,
+'uni02A1': 673,
+'uni223B': 8763,
+'uni226C': 8812,
+'uni25AC': 9644,
+'uni24D3': 9427,
+'uni21E0': 8672,
+'uni21E3': 8675,
+'Udieresis': 220,
+'uni21E2': 8674,
+'D': 68,
+'uni21E5': 8677,
+'uni2621': 9761,
+'uni21D1': 8657,
+'uni203E': 8254,
+'uni22C6': 8902,
+'uni21E4': 8676,
+'uni010D': 269,
+'uni010E': 270,
+'uni010F': 271,
+'five': 53,
+'T': 84,
+'uni010B': 267,
+'uni010C': 268,
+'uni2605': 9733,
+'uni2663': 9827,
+'uni21E6': 8678,
+'uni24B6': 9398,
+'uni22C1': 8897,
+'oslash': 248,
+'acute': 180,
+'uni01F0': 496,
+'d': 100,
+'OE': 338,
+'uni22E3': 8931,
+'Igrave': 204,
+'uni2308': 8968,
+'uni2309': 8969,
+'uni21A9': 8617,
+'t': 116,
+'uni2313': 8979,
+'uni03A3': 931,
+'uni21A4': 8612,
+'uni21A7': 8615,
+'uni21A6': 8614,
+'uni21A1': 8609,
+'uni21A0': 8608,
+'uni21A3': 8611,
+'uni21A2': 8610,
+'parenright': 41,
+'uni256A': 9578,
+'uni25DC': 9692,
+'uni24CE': 9422,
+'uni042C': 1068,
+'uni24E0': 9440,
+'uni042B': 1067,
+'uni0409': 1033,
+'uni0408': 1032,
+'uni24E7': 9447,
+'uni25B4': 9652,
+'uni042A': 1066,
+'uni228E': 8846,
+'uni0401': 1025,
+'adieresis': 228,
+'uni0403': 1027,
+'quotesingle': 39,
+'uni0405': 1029,
+'uni0404': 1028,
+'uni0407': 1031,
+'uni0406': 1030,
+'uni229C': 8860,
+'uni2306': 8966,
+'uni2253': 8787,
+'twodotenleader': 8229,
+'uni2131': 8497,
+'uni21DA': 8666,
+'uni2234': 8756,
+'uni2235': 8757,
+'uni01A5': 421,
+'uni2237': 8759,
+'uni2230': 8752,
+'uni02CC': 716,
+'slash': 47,
+'uni01A0': 416,
+'ellipsis': 8230,
+'uni2299': 8857,
+'uni2238': 8760,
+'numbersign': 35,
+'uni21A8': 8616,
+'uni223D': 8765,
+'uni01AF': 431,
+'uni223F': 8767,
+'uni01AD': 429,
+'uni01AB': 427,
+'odieresis': 246,
+'uni223C': 8764,
+'uni227D': 8829,
+'uni0280': 640,
+'O': 79,
+'uni227E': 8830,
+'uni21A5': 8613,
+'uni22D4': 8916,
+'uni25D4': 9684,
+'uni227F': 8831,
+'uni0435': 1077,
+'uni2302': 8962,
+'uni2669': 9833,
+'uni24E3': 9443,
+'uni2720': 10016,
+'uni22A8': 8872,
+'uni22A9': 8873,
+'uni040A': 1034,
+'uni22A7': 8871,
+'oe': 339,
+'uni040B': 1035,
+'uni040E': 1038,
+'uni22A3': 8867,
+'o': 111,
+'uni040F': 1039,
+'Edieresis': 203,
+'uni25D5': 9685,
+'plus': 43,
+'uni044D': 1101,
+'uni263C': 9788,
+'uni22E6': 8934,
+'uni2283': 8835,
+'uni258C': 9612,
+'uni219E': 8606,
+'uni24E4': 9444,
+'uni2136': 8502,
+'dagger': 8224,
+'uni24B7': 9399,
+'uni219B': 8603,
+'uni22E5': 8933,
+'three': 51,
+'uni210B': 8459,
+'uni2534': 9524,
+'uni24B8': 9400,
+'uni230A': 8970,
+'hungarumlaut': 733,
+'parenleft': 40,
+'uni0148': 328,
+'uni0149': 329,
+'uni2124': 8484,
+'uni2125': 8485,
+'uni2126': 8486,
+'uni2127': 8487,
+'uni0140': 320,
+'uni2129': 8489,
+'uni25C5': 9669,
+'uni0143': 323,
+'uni0144': 324,
+'uni0145': 325,
+'uni0146': 326,
+'uni0147': 327,
+'uni210D': 8461,
+'fraction': 8260,
+'uni2031': 8241,
+'uni2196': 8598,
+'uni2035': 8245,
+'uni24E6': 9446,
+'uni016B': 363,
+'uni24BA': 9402,
+'uni266A': 9834,
+'uni0116': 278,
+'uni2115': 8469,
+'registered': 174,
+'J': 74,
+'uni25DF': 9695,
+'uni25CE': 9678,
+'uni273D': 10045,
+'dieresis': 168,
+'uni212B': 8491,
+'uni0114': 276,
+'uni212D': 8493,
+'uni212E': 8494,
+'uni212F': 8495,
+'uni014A': 330,
+'uni014B': 331,
+'uni014C': 332,
+'uni014D': 333,
+'uni014E': 334,
+'uni014F': 335,
+'uni025E': 606,
+'uni24E8': 9448,
+'uni0111': 273,
+'uni24E9': 9449,
+'Ograve': 210,
+'j': 106,
+'uni2195': 8597,
+'uni2194': 8596,
+'uni2197': 8599,
+'uni2037': 8247,
+'uni2191': 8593,
+'uni2190': 8592,
+'uni2193': 8595,
+'uni2192': 8594,
+'uni29FA': 10746,
+'uni2713': 10003,
+'z': 122,
+'uni2199': 8601,
+'uni2198': 8600,
+'uni2667': 9831,
+'ae': 230,
+'uni0448': 1096,
+'semicolon': 59,
+'uni2666': 9830,
+'uni038F': 911,
+'uni0444': 1092,
+'uni0447': 1095,
+'uni038E': 910,
+'uni0441': 1089,
+'uni038C': 908,
+'uni0443': 1091,
+'uni038A': 906,
+'uni0250': 592,
+'uni0251': 593,
+'uni0252': 594,
+'uni0253': 595,
+'uni0254': 596,
+'at': 64,
+'uni0256': 598,
+'uni0257': 599,
+'uni0167': 359,
+'uni0259': 601,
+'uni228C': 8844,
+'uni2662': 9826,
+'uni0319': 793,
+'uni0318': 792,
+'uni24BC': 9404,
+'uni0402': 1026,
+'uni22EF': 8943,
+'Iacute': 205,
+'uni22ED': 8941,
+'uni22EE': 8942,
+'uni0311': 785,
+'uni0310': 784,
+'uni21E8': 8680,
+'uni0312': 786,
+'percent': 37,
+'uni0317': 791,
+'uni0316': 790,
+'uni21D6': 8662,
+'uni21D7': 8663,
+'uni21D4': 8660,
+'uni21D5': 8661,
+'uni21D2': 8658,
+'uni21D3': 8659,
+'uni21D0': 8656,
+'uni2138': 8504,
+'uni2270': 8816,
+'uni2271': 8817,
+'uni2272': 8818,
+'uni2273': 8819,
+'uni2274': 8820,
+'uni2275': 8821,
+'bracketright': 93,
+'uni21D9': 8665,
+'uni21DF': 8671,
+'uni21DD': 8669,
+'uni21DE': 8670,
+'AE': 198,
+'uni03AE': 942,
+'uni227A': 8826,
+'uni227B': 8827,
+'uni227C': 8828,
+'asterisk': 42,
+'aacute': 225,
+'uni226F': 8815,
+'uni22E2': 8930,
+'uni0386': 902,
+'uni22E0': 8928,
+'uni22E1': 8929,
+'U': 85,
+'uni22E7': 8935,
+'uni22E4': 8932,
+'uni0387': 903,
+'uni031A': 794,
+'eacute': 233,
+'uni22E8': 8936,
+'uni22E9': 8937,
+'uni24D8': 9432,
+'uni025A': 602,
+'uni025B': 603,
+'uni025C': 604,
+'e': 101,
+'uni0128': 296,
+'uni025F': 607,
+'uni2665': 9829,
+'thorn': 254,
+'uni0129': 297,
+'uni253C': 9532,
+'uni25D7': 9687,
+'u': 117,
+'uni0388': 904,
+'uni0389': 905,
+'uni0255': 597,
+'uni0171': 369,
+'uni0384': 900,
+'uni0385': 901,
+'uni044A': 1098,
+'uni252C': 9516,
+'uni044C': 1100,
+'uni044B': 1099}
+
+uni2type1 = dict([(v,k) for k,v in type12uni.items()])
+
+tex2uni = {'\\maltese': 10016,
+'\\textexclamdown': 161,
+'\\leq': 8804,
+'\\Uparrow': 8657,
+'\\supset': 8835,
+'\\divideontimes': 8903,
+'\\succnsim': 8937,
+'\\Doteq': 8785,
+'\\Re': 8476,
+'\\nearrow': 8599,
+'\\hspace': 8202,
+'\\vert': 124,
+'\\clubsuit': 9827,
+'\\measuredangle': 8737,
+'\\eqdef': 8797,
+'\\danger': 9761,
+'\\asymp': 8781,
+'\\oe': 339,
+'\\Sigma': 931,
+'\\tilde': 771,
+'\\Cup': 8915,
+'\\nsucc': 8833,
+'\\solbar': 9023,
+'\\doublebarwedge ?': 8966,
+'\\BbbC': 8450,
+'\\sqsupset': 8848,
+'\\BbbN': 8469,
+'\\origof': 8886,
+'\\Psi': 936,
+'\\BbbR': 8477,
+'\\BbbQ': 8474,
+'\\BbbP': 8473,
+'\\BbbZ': 8484,
+'\\Omega': 937,
+'\\oiiint': 8752,
+'\\nabla': 8711,
+'\\succsim': 8831,
+'\\coprod': 8720,
+'\\blacktriangle': 9652,
+'\\rq': 8217,
+'\\colon': 58,
+'\\models': 8871,
+'\\twoheaddownarrow': 8609,
+'\\Swarrow': 8665,
+'\\leftarrow': 8592,
+'\\prec': 8826,
+'\\otimes': 8855,
+'\\napprox': 8777,
+'\\invnot': 8976,
+'\\aleph': 8501,
+'\\degree': 176,
+'\\cdots': 8943,
+'\\cdotp': 183,
+'\\gtrdot': 8919,
+'\\gnsim': 8935,
+'\\blacktriangledown': 9662,
+'\\questeq': 8799,
+'\\swarrow': 8601,
+'\\cong': 8773,
+'\\spadesuitopen': 9828,
+'\\equiv': 8801,
+'\\neg': 172,
+'\\preccurlyeq': 8828,
+'\\lessgtr': 8822,
+'\\ll': 8810,
+'\\Ldsh': 8626,
+'\\lneqq': 8808,
+'\\updownarrows': 8645,
+'\\star': 8902,
+'\\Nearrow': 8663,
+'\\nparallel': 8742,
+'\\lq': 8216,
+'\\alpha': 945,
+'\\clubsuitopen': 9831,
+'\\rightrightarrows': 8649,
+'\\mapsdown': 8615,
+'\\risingdotseq': 8787,
+'\\geqq': 8807,
+'\\stareq': 8795,
+'\\ltimes': 8905,
+'\\leftthreetimes': 8907,
+'\\ntriangleleft': 8938,
+'\\carriagereturn': 8629,
+'\\twoheadrightarrow': 8608,
+'\\Lsh': 8624,
+'\\Rrightarrow': 8667,
+'\\Finv': 8498,
+'\\uplus': 8846,
+'\\arceq': 8792,
+'\\ddots': 8945,
+'\\kappa': 954,
+'\\sigma': 963,
+'\\Rightarrow': 8658,
+'\\cup': 8746,
+'\\leftrightharpoons': 8651,
+'\\lambda': 955,
+'\\circledcirc': 8858,
+'\\Theta': 920,
+'\\wr': 8768,
+'\\wp': 8472,
+'\\Vdash': 8873,
+'\\varrho': 1009,
+'\\Vert': 8214,
+'\\coloneq': 8788,
+'\\gtrless': 8823,
+'\\sqcap': 8851,
+'\\leqq': 8806,
+'\\backsim': 8765,
+'\\nequiv': 8802,
+'\\varnothing': 8709,
+'\\vartriangleright': 8883,
+'\\beta': 946,
+'\\nsubseteq': 8840,
+'\\ngeq': 8817,
+'\\leftrightarrows': 8646,
+'\\nexists': 8708,
+'\\Bumpeq': 8782,
+'\\eqgtr': 8925,
+'\\dashv': 8867,
+'\\nRightarrow': 8655,
+'\\dotplus': 8724,
+'\\frakZ': 8488,
+'\\approxeq': 8778,
+'\\obar': 9021,
+'\\geq': 8805,
+'\\ncong': 8775,
+'\\eqcolon': 8789,
+'\\blacktriangleleft': 9664,
+'\\searrow': 8600,
+'\\sqsupseteq': 8850,
+'\\bigcirc': 9675,
+'\\vDash': 8872,
+'\\varkappa': 1008,
+'\\spadesuit': 9824,
+'\\nleftrightarrow': 8622,
+'\\nvdash': 8876,
+'\\llcorner': 8990,
+'\\imageof': 8887,
+'\\mho': 8487,
+'\\upuparrows': 8648,
+'\\vdash': 8866,
+'\\AE': 198,
+'\\AA': 8491,
+'\\prod': 8719,
+'\\approxident': 8779,
+'\\ss': 223,
+'\\lbrace': 123,
+'\\lbrack': 91,
+'\\nsim': 8769,
+'\\bot': 8869,
+'\\underbar': 817,
+'\\lessdot': 8918,
+'\\theta': 952,
+'\\leftrightarrow': 8596,
+'\\psi': 968,
+'\\curlyvee': 8910,
+'\\not': 824,
+'\\rightharpoonup': 8640,
+'\\nsupseteq': 8841,
+'\\Rsh': 8625,
+'\\bullet': 8729,
+'\\beth': 8502,
+'\\varphi': 966,
+'\\varsigma': 962,
+'\\boxplus': 8862,
+'\\greater': 62,
+'\\breve': 774,
+'\\ae': 230,
+'\\ac': 8766,
+'\\Delta': 916,
+'\\curvearrowleft': 8630,
+'\\odot': 8857,
+'\\dot': 775,
+'\\kernelcontraction': 8763,
+'\\Nwarrow': 8662,
+'\\vartriangle': 9653,
+'\\upharpoonright': 8638,
+'\\circ': 8728,
+'\\dddot': 8411,
+'\\rightarrowbar': 8677,
+'\\gtreqless': 8923,
+'\\frakC': 8493,
+'\\chi': 967,
+'\\doteq': 8784,
+'\\sterling': 163,
+'\\iiint': 8749,
+'\\flat': 9837,
+'\\upsilon': 965,
+'\\rtimes': 8906,
+'\\enspace': 8194,
+'\\Phi': 934,
+'\\wedgeq': 8793,
+'\\mapsup': 8613,
+'\\varpi': 982,
+'\\bigcap': 8898,
+'\\rightleftarrows': 8644,
+'\\Pi': 928,
+'\\gtrsim': 8819,
+'\\ast': 8727,
+'\\mapsto': 8614,
+'\\candra': 784,
+'\\thinspace': 8201,
+'\\oint': 8750,
+'\\oplus': 8853,
+'\\diamond': 8900,
+'\\looparrowright': 8620,
+'\\thickspace': 8197,
+'\\ell': 8467,
+'\\bigstar': 9733,
+'\\mp': 8723,
+'\\circeq': 8791,
+'\\ddagger': 8225,
+'\\simeq': 8771,
+'\\nsime': 8772,
+'\\ddot': 776,
+'\\downdownarrows': 8650,
+'\\nprec': 8832,
+'\\backcong': 8780,
+'\\nVDash': 8879,
+'\\textasciicircum': 94,
+'\\bigtriangledown': 9661,
+'\\copyright': 169,
+'\\oslash': 8856,
+'\\ggg': 8921,
+'\\between': 8812,
+'\\iint': 8748,
+'\\nsubset': 8836,
+'\\cdot': 8901,
+'\\Im': 8465,
+'\\lfloor': 8970,
+'\\bar': 772,
+'\\leftharpoonaccent': 8400,
+'\\pm': 177,
+'\\pi': 960,
+'\\supseteq': 8839,
+'\\nrightarrow': 8603,
+'\\updownarrowbar': 8616,
+'\\scurel': 8881,
+'\\gimel': 8503,
+'\\Subset': 8912,
+'\\Gamma': 915,
+'\\Vvdash': 8874,
+'\\lll': 8920,
+'\\blacktriangleright': 9654,
+'\\circledS': 9416,
+'\\circledR': 174,
+'\\hat': 770,
+'\\tau': 964,
+'\\lnsim': 8934,
+'\\overleftrightarrow': 8417,
+'\\bumpeq': 8783,
+'\\Updownarrow': 8661,
+'\\propto': 8733,
+'\\triangleleft': 9665,
+'\\Cap': 8914,
+'\\ntrianglelefteq': 8940,
+'\\sqcup': 8852,
+'\\bigcup': 8899,
+'\\Colon': 8759,
+'\\supsetneq': 8843,
+'\\triangleright': 9655,
+'\\curvearrowright': 8631,
+'\\pitchfork': 8916,
+'\\leftarrowtail': 8610,
+'\\bigwedge': 8896,
+'\\omega': 969,
+'\\hookrightarrow': 8618,
+'\\rightthreetimes': 8908,
+'\\sharp': 9839,
+'\\digamma': 989,
+'\\slash': 8725,
+'\\uparrow': 8593,
+'\\veeeq': 8794,
+'\\curlywedge': 8911,
+'\\in': 8712,
+'\\prurel': 8880,
+'\\overleftarrow': 8406,
+'\\succcurlyeq': 8829,
+'\\eqsim': 8770,
+'\\varepsilon': 949,
+'\\nmid': 8740,
+'\\cwopencirclearrow': 8635,
+'\\zeta': 950,
+'\\eta': 951,
+'\\oiint': 8751,
+'\\eth': 240,
+'\\forall': 8704,
+'\\urcorner': 8989,
+'\\times': 215,
+'\\barleftarrow': 8676,
+'\\lrcorner': 8991,
+'\\upharpoonleft': 8639,
+'\\dots': 8230,
+'\\nwarrow': 8598,
+'\\less': 60,
+'\\measeq': 8798,
+'\\because': 8757,
+'\\ddddot': 8412,
+'\\boxminus': 8863,
+'\\wedge': 8743,
+'\\nVdash': 8878,
+'\\Rdsh': 8627,
+'\\textquestiondown': 191,
+'\\trianglerighteq': 8885,
+'\\rho': 961,
+'\\Supset': 8913,
+'\\therefore': 8756,
+'\\diamondsuit': 9826,
+'\\ni': 8715,
+'\\acute': 769,
+'\\ne': 8800,
+'\\rightarrow': 8594,
+'\\Xi': 926,
+'\\iota': 953,
+'\\nu': 957,
+'\\div': 247,
+'\\triangleq': 8796,
+'\\leftleftarrows': 8647,
+'\\rbrace': 125,
+'\\phi': 981,
+'\\trianglelefteq': 8884,
+'\\ntriangleright': 8939,
+'\\twoheadleftarrow': 8606,
+'\\backslash': 92,
+'\\eqless': 8924,
+'\\rbrack': 93,
+'\\downzigzagarrow': 8623,
+'\\backprime': 8245,
+'\\barwedge': 8892,
+'\\check': 780,
+'\\notin': 8713,
+'\\ominus': 8854,
+'\\precsim': 8830,
+'\\Equiv': 8803,
+'\\rfloor': 8971,
+'\\turnednot': 8985,
+'\\curlyeqsucc': 8927,
+'\\blacksquare': 9632,
+'\\angle': 8736,
+'\\textquotedblright': 8221,
+'\\sqrt': 8730,
+'\\textasciigrave': 96,
+'\\succ': 8827,
+'\\subsetneq': 8842,
+'\\nsupset': 8837,
+'\\fallingdotseq': 8786,
+'\\curlyeqprec': 8926,
+'\\eqcirc': 8790,
+'\\infty': 8734,
+'\\rasp': 700,
+'\\xi': 958,
+'\\heartsuit': 9825,
+'\\rightzigzagarrow': 8669,
+'\\nless': 8814,
+'\\S': 167,
+'\\P': 182,
+'\\veebar': 8891,
+'\\Leftarrow': 8656,
+'\\vartriangleleft': 8882,
+'\\O': 216,
+'\\L': 321,
+'\\daleth': 8504,
+'\\H': 779,
+'\\acwopencirclearrow': 8634,
+'\\t': 865,
+'\\nleftarrow': 8602,
+'\\ocirc': 778,
+'\\emdash': 8212,
+'\\sqsubset': 8847,
+'\\vec': 8407,
+'\\vee': 8744,
+'\\d': 803,
+'\\sqsubseteq': 8849,
+'\\c': 807,
+'\\checkmark': 10003,
+'\\o': 248,
+'\\l': 322,
+'\\adots': 8944,
+'\\k': 808,
+'\\i': 305,
+'\\gamma': 947,
+'\\rceil': 8969,
+'\\lceil': 8968,
+'\\rightarrowtail': 8611,
+'\\textasciiacute': 180,
+'\\minus': 8722,
+'\\subseteq': 8838,
+'\\rightleftharpoons': 8652,
+'\\Upsilon': 978,
+'\\looparrowleft': 8619,
+'\\updownarrow': 8597,
+'\\grave': 768,
+'\\intercal': 8890,
+'\\cap': 8745,
+'\\int': 8747,
+'\\sim': 8764,
+'\\prime': 8242,
+'\\complement': 8705,
+'\\smile': 8995,
+'\\lesseqgtr': 8922,
+'\\downharpoonright': 8642,
+'\\cupdot': 8845,
+'\\overarc': 785,
+'\\boxbar': 9707,
+'\\hookleftarrow': 8617,
+'\\circleddash': 8861,
+'\\downarrow': 8595,
+'\\Lambda': 923,
+'\\gg': 8811,
+'\\ulcorner': 8988,
+'\\lambdabar': 411,
+'\\bigvee': 8897,
+'\\smallsetminus': 8726,
+'\\ntrianglerighteq': 8941,
+'\\precnsim': 8936,
+'\\lasp': 701,
+'\\vdots': 8942,
+'\\rightharpoonaccent': 8401,
+'\\top': 8868,
+'\\downharpoonleft': 8643,
+'\\delta': 948,
+'\\gneqq': 8809,
+'\\leftharpoonup': 8636,
+'\\mu': 956,
+'\\parallel': 8741,
+'\\exists': 8707,
+'\\yen': 165,
+'\\frown': 8994,
+'\\approx': 8776,
+'\\boxtimes': 8864,
+'\\textquotedblleft': 8220,
+'\\twoheaduparrow': 8607,
+'\\dotminus': 8760,
+'\\lesssim': 8818,
+'\\rightharpoondown': 8641,
+'\\dagger': 8224,
+'\\backsimeq': 8909,
+'\\partial': 8706,
+'\\mapsfrom': 8612,
+'\\multimap': 8888,
+'\\OE': 338,
+'\\circledast': 8859,
+'\\Leftrightarrow': 8660,
+'\\nvDash': 8877,
+'\\mid': 8739,
+'\\quad': 8195,
+'\\nleq': 8816,
+'\\sphericalangle': 8738,
+'\\triangledown': 9663,
+'\\ngtr': 8815,
+'\\textasciitilde': 126,
+'\\leftharpoondown': 8637,
+'\\boxdot': 8865,
+'\\scrR': 8475,
+'\\Downarrow': 8659,
+'\\bowtie': 8904,
+'\\natural': 9838,
+'\\scrE': 8496,
+'\\scrF': 8497,
+'\\nLeftrightarrow': 8654,
+'\\scrB': 8492,
+'\\scrM': 8499,
+'\\scrL': 8466,
+'\\nLeftarrow': 8653,
+'\\scrI': 8464,
+'\\scrH': 8459,
+'\\endash': 8211,
+'\\bigtriangleup': 9651,
+'\\sum': 8721,
+'\\Searrow': 8664,
+'\\Lleftarrow': 8666,
+'\\scre': 8495,
+'\\scrg': 8458,
+'\\scro': 8500,
+'\\subset': 8834}
+
+uni2tex = dict([(v,k) for k,v in tex2uni.items()])
+
+tex2type1 = {'\\maltese': 'uni2720',
+'\\textexclamdown': 'exclamdown',
+'\\leq': 'uni2264',
+'\\Uparrow': 'uni21D1',
+'\\supset': 'uni2283',
+'\\divideontimes': 'uni22C7',
+'\\succnsim': 'uni22E9',
+'\\Doteq': 'uni2251',
+'\\Re': 'uni211C',
+'\\nearrow': 'uni2197',
+'\\hspace': 'uni200A',
+'\\vert': 'bar',
+'\\clubsuit': 'uni2663',
+'\\measuredangle': 'uni2221',
+'\\eqdef': 'uni225D',
+'\\danger': 'uni2621',
+'\\asymp': 'uni224D',
+'\\oe': 'oe',
+'\\Sigma': 'uni03A3',
+'\\tilde': 'uni0303',
+'\\Cup': 'uni22D3',
+'\\nsucc': 'uni2281',
+'\\solbar': 'uni233F',
+'\\doublebarwedge ?': 'uni2306',
+'\\BbbC': 'uni2102',
+'\\sqsupset': 'uni2290',
+'\\BbbN': 'uni2115',
+'\\origof': 'uni22B6',
+'\\Psi': 'uni03A8',
+'\\BbbR': 'uni211D',
+'\\BbbQ': 'uni211A',
+'\\BbbP': 'uni2119',
+'\\BbbZ': 'uni2124',
+'\\Omega': 'uni03A9',
+'\\oiiint': 'uni2230',
+'\\nabla': 'uni2207',
+'\\succsim': 'uni227F',
+'\\coprod': 'uni2210',
+'\\blacktriangle': 'uni25B4',
+'\\rq': 'quoteright',
+'\\colon': 'colon',
+'\\models': 'uni22A7',
+'\\twoheaddownarrow': 'uni21A1',
+'\\Swarrow': 'uni21D9',
+'\\leftarrow': 'uni2190',
+'\\prec': 'uni227A',
+'\\otimes': 'uni2297',
+'\\napprox': 'uni2249',
+'\\invnot': 'uni2310',
+'\\aleph': 'uni2135',
+'\\degree': 'degree',
+'\\cdots': 'uni22EF',
+'\\cdotp': 'periodcentered',
+'\\gtrdot': 'uni22D7',
+'\\gnsim': 'uni22E7',
+'\\blacktriangledown': 'uni25BE',
+'\\questeq': 'uni225F',
+'\\swarrow': 'uni2199',
+'\\cong': 'uni2245',
+'\\spadesuitopen': 'uni2664',
+'\\equiv': 'uni2261',
+'\\neg': 'logicalnot',
+'\\preccurlyeq': 'uni227C',
+'\\lessgtr': 'uni2276',
+'\\ll': 'uni226A',
+'\\Ldsh': 'uni21B2',
+'\\lneqq': 'uni2268',
+'\\updownarrows': 'uni21C5',
+'\\star': 'uni22C6',
+'\\Nearrow': 'uni21D7',
+'\\nparallel': 'uni2226',
+'\\lq': 'quoteleft',
+'\\alpha': 'uni03B1',
+'\\clubsuitopen': 'uni2667',
+'\\rightrightarrows': 'uni21C9',
+'\\mapsdown': 'uni21A7',
+'\\risingdotseq': 'uni2253',
+'\\geqq': 'uni2267',
+'\\stareq': 'uni225B',
+'\\ltimes': 'uni22C9',
+'\\leftthreetimes': 'uni22CB',
+'\\ntriangleleft': 'uni22EA',
+'\\carriagereturn': 'uni21B5',
+'\\twoheadrightarrow': 'uni21A0',
+'\\Lsh': 'uni21B0',
+'\\Rrightarrow': 'uni21DB',
+'\\Finv': 'uni2132',
+'\\uplus': 'uni228E',
+'\\arceq': 'uni2258',
+'\\ddots': 'uni22F1',
+'\\kappa': 'uni03BA',
+'\\sigma': 'uni03C3',
+'\\Rightarrow': 'uni21D2',
+'\\cup': 'uni222A',
+'\\leftrightharpoons': 'uni21CB',
+'\\lambda': 'uni03BB',
+'\\circledcirc': 'uni229A',
+'\\Theta': 'uni0398',
+'\\wr': 'uni2240',
+'\\wp': 'uni2118',
+'\\Vdash': 'uni22A9',
+'\\varrho': 'uni03F1',
+'\\Vert': 'uni2016',
+'\\coloneq': 'uni2254',
+'\\gtrless': 'uni2277',
+'\\sqcap': 'uni2293',
+'\\leqq': 'uni2266',
+'\\backsim': 'uni223D',
+'\\nequiv': 'uni2262',
+'\\varnothing': 'uni2205',
+'\\vartriangleright': 'uni22B3',
+'\\beta': 'uni03B2',
+'\\nsubseteq': 'uni2288',
+'\\ngeq': 'uni2271',
+'\\leftrightarrows': 'uni21C6',
+'\\nexists': 'uni2204',
+'\\Bumpeq': 'uni224E',
+'\\eqgtr': 'uni22DD',
+'\\dashv': 'uni22A3',
+'\\nRightarrow': 'uni21CF',
+'\\dotplus': 'uni2214',
+'\\frakZ': 'uni2128',
+'\\approxeq': 'uni224A',
+'\\obar': 'uni233D',
+'\\geq': 'uni2265',
+'\\ncong': 'uni2247',
+'\\eqcolon': 'uni2255',
+'\\blacktriangleleft': 'uni25C0',
+'\\searrow': 'uni2198',
+'\\sqsupseteq': 'uni2292',
+'\\bigcirc': 'uni25CB',
+'\\vDash': 'uni22A8',
+'\\varkappa': 'uni03F0',
+'\\spadesuit': 'uni2660',
+'\\nleftrightarrow': 'uni21AE',
+'\\nvdash': 'uni22AC',
+'\\llcorner': 'uni231E',
+'\\imageof': 'uni22B7',
+'\\mho': 'uni2127',
+'\\upuparrows': 'uni21C8',
+'\\vdash': 'uni22A2',
+'\\AE': 'AE',
+'\\AA': 'uni212B',
+'\\prod': 'uni220F',
+'\\approxident': 'uni224B',
+'\\ss': 'germandbls',
+'\\lbrace': 'braceleft',
+'\\lbrack': 'bracketleft',
+'\\nsim': 'uni2241',
+'\\bot': 'uni22A5',
+'\\underbar': 'uni0331',
+'\\lessdot': 'uni22D6',
+'\\theta': 'uni03B8',
+'\\leftrightarrow': 'uni2194',
+'\\psi': 'uni03C8',
+'\\curlyvee': 'uni22CE',
+'\\not': 'uni0338',
+'\\rightharpoonup': 'uni21C0',
+'\\nsupseteq': 'uni2289',
+'\\Rsh': 'uni21B1',
+'\\bullet': 'uni2219',
+'\\beth': 'uni2136',
+'\\varphi': 'uni03C6',
+'\\varsigma': 'uni03C2',
+'\\boxplus': 'uni229E',
+'\\greater': 'greater',
+'\\breve': 'uni0306',
+'\\ae': 'ae',
+'\\ac': 'uni223E',
+'\\Delta': 'uni0394',
+'\\curvearrowleft': 'uni21B6',
+'\\odot': 'uni2299',
+'\\dot': 'uni0307',
+'\\kernelcontraction': 'uni223B',
+'\\Nwarrow': 'uni21D6',
+'\\vartriangle': 'uni25B5',
+'\\upharpoonright': 'uni21BE',
+'\\circ': 'uni2218',
+'\\dddot': 'uni20DB',
+'\\rightarrowbar': 'uni21E5',
+'\\gtreqless': 'uni22DB',
+'\\frakC': 'uni212D',
+'\\chi': 'uni03C7',
+'\\doteq': 'uni2250',
+'\\sterling': 'sterling',
+'\\iiint': 'uni222D',
+'\\flat': 'uni266D',
+'\\upsilon': 'uni03C5',
+'\\rtimes': 'uni22CA',
+'\\enspace': 'uni2002',
+'\\Phi': 'uni03A6',
+'\\wedgeq': 'uni2259',
+'\\mapsup': 'uni21A5',
+'\\varpi': 'uni03D6',
+'\\bigcap': 'uni22C2',
+'\\rightleftarrows': 'uni21C4',
+'\\Pi': 'uni03A0',
+'\\gtrsim': 'uni2273',
+'\\ast': 'uni2217',
+'\\mapsto': 'uni21A6',
+'\\candra': 'uni0310',
+'\\thinspace': 'uni2009',
+'\\oint': 'uni222E',
+'\\oplus': 'uni2295',
+'\\diamond': 'uni22C4',
+'\\looparrowright': 'uni21AC',
+'\\thickspace': 'uni2005',
+'\\ell': 'uni2113',
+'\\bigstar': 'uni2605',
+'\\mp': 'uni2213',
+'\\circeq': 'uni2257',
+'\\ddagger': 'daggerdbl',
+'\\simeq': 'uni2243',
+'\\nsime': 'uni2244',
+'\\ddot': 'uni0308',
+'\\downdownarrows': 'uni21CA',
+'\\nprec': 'uni2280',
+'\\backcong': 'uni224C',
+'\\nVDash': 'uni22AF',
+'\\textasciicircum': 'asciicircum',
+'\\bigtriangledown': 'uni25BD',
+'\\copyright': 'copyright',
+'\\oslash': 'uni2298',
+'\\ggg': 'uni22D9',
+'\\between': 'uni226C',
+'\\iint': 'uni222C',
+'\\nsubset': 'uni2284',
+'\\cdot': 'uni22C5',
+'\\Im': 'uni2111',
+'\\lfloor': 'uni230A',
+'\\bar': 'uni0304',
+'\\leftharpoonaccent': 'uni20D0',
+'\\pm': 'plusminus',
+'\\pi': 'uni03C0',
+'\\supseteq': 'uni2287',
+'\\nrightarrow': 'uni219B',
+'\\updownarrowbar': 'uni21A8',
+'\\scurel': 'uni22B1',
+'\\gimel': 'uni2137',
+'\\Subset': 'uni22D0',
+'\\Gamma': 'uni0393',
+'\\Vvdash': 'uni22AA',
+'\\lll': 'uni22D8',
+'\\blacktriangleright': 'uni25B6',
+'\\circledS': 'uni24C8',
+'\\circledR': 'registered',
+'\\hat': 'uni0302',
+'\\tau': 'uni03C4',
+'\\lnsim': 'uni22E6',
+'\\overleftrightarrow': 'uni20E1',
+'\\bumpeq': 'uni224F',
+'\\Updownarrow': 'uni21D5',
+'\\propto': 'uni221D',
+'\\triangleleft': 'uni25C1',
+'\\Cap': 'uni22D2',
+'\\ntrianglelefteq': 'uni22EC',
+'\\sqcup': 'uni2294',
+'\\bigcup': 'uni22C3',
+'\\Colon': 'uni2237',
+'\\supsetneq': 'uni228B',
+'\\triangleright': 'uni25B7',
+'\\curvearrowright': 'uni21B7',
+'\\pitchfork': 'uni22D4',
+'\\leftarrowtail': 'uni21A2',
+'\\bigwedge': 'uni22C0',
+'\\omega': 'uni03C9',
+'\\hookrightarrow': 'uni21AA',
+'\\rightthreetimes': 'uni22CC',
+'\\sharp': 'uni266F',
+'\\digamma': 'uni03DD',
+'\\slash': 'uni2215',
+'\\uparrow': 'uni2191',
+'\\veeeq': 'uni225A',
+'\\curlywedge': 'uni22CF',
+'\\in': 'uni2208',
+'\\prurel': 'uni22B0',
+'\\overleftarrow': 'uni20D6',
+'\\succcurlyeq': 'uni227D',
+'\\eqsim': 'uni2242',
+'\\varepsilon': 'uni03B5',
+'\\nmid': 'uni2224',
+'\\cwopencirclearrow': 'uni21BB',
+'\\zeta': 'uni03B6',
+'\\eta': 'uni03B7',
+'\\oiint': 'uni222F',
+'\\eth': 'eth',
+'\\forall': 'uni2200',
+'\\urcorner': 'uni231D',
+'\\times': 'multiply',
+'\\barleftarrow': 'uni21E4',
+'\\lrcorner': 'uni231F',
+'\\upharpoonleft': 'uni21BF',
+'\\dots': 'ellipsis',
+'\\nwarrow': 'uni2196',
+'\\less': 'less',
+'\\measeq': 'uni225E',
+'\\because': 'uni2235',
+'\\ddddot': 'uni20DC',
+'\\boxminus': 'uni229F',
+'\\wedge': 'uni2227',
+'\\nVdash': 'uni22AE',
+'\\Rdsh': 'uni21B3',
+'\\textquestiondown': 'questiondown',
+'\\trianglerighteq': 'uni22B5',
+'\\rho': 'uni03C1',
+'\\Supset': 'uni22D1',
+'\\therefore': 'uni2234',
+'\\diamondsuit': 'uni2662',
+'\\ni': 'uni220B',
+'\\acute': 'uni0301',
+'\\ne': 'uni2260',
+'\\rightarrow': 'uni2192',
+'\\Xi': 'uni039E',
+'\\iota': 'uni03B9',
+'\\nu': 'uni03BD',
+'\\div': 'divide',
+'\\triangleq': 'uni225C',
+'\\leftleftarrows': 'uni21C7',
+'\\rbrace': 'braceright',
+'\\phi': 'uni03D5',
+'\\trianglelefteq': 'uni22B4',
+'\\ntriangleright': 'uni22EB',
+'\\twoheadleftarrow': 'uni219E',
+'\\backslash': 'backslash',
+'\\eqless': 'uni22DC',
+'\\rbrack': 'bracketright',
+'\\downzigzagarrow': 'uni21AF',
+'\\backprime': 'uni2035',
+'\\barwedge': 'uni22BC',
+'\\check': 'uni030C',
+'\\notin': 'uni2209',
+'\\ominus': 'uni2296',
+'\\precsim': 'uni227E',
+'\\Equiv': 'uni2263',
+'\\rfloor': 'uni230B',
+'\\turnednot': 'uni2319',
+'\\curlyeqsucc': 'uni22DF',
+'\\blacksquare': 'uni25A0',
+'\\angle': 'uni2220',
+'\\textquotedblright': 'quotedblright',
+'\\sqrt': 'uni221A',
+'\\textasciigrave': 'grave',
+'\\succ': 'uni227B',
+'\\subsetneq': 'uni228A',
+'\\nsupset': 'uni2285',
+'\\fallingdotseq': 'uni2252',
+'\\curlyeqprec': 'uni22DE',
+'\\eqcirc': 'uni2256',
+'\\infty': 'uni221E',
+'\\rasp': 'uni02BC',
+'\\xi': 'uni03BE',
+'\\heartsuit': 'uni2661',
+'\\rightzigzagarrow': 'uni21DD',
+'\\nless': 'uni226E',
+'\\S': 'section',
+'\\P': 'paragraph',
+'\\veebar': 'uni22BB',
+'\\Leftarrow': 'uni21D0',
+'\\vartriangleleft': 'uni22B2',
+'\\O': 'Oslash',
+'\\L': 'Lslash',
+'\\daleth': 'uni2138',
+'\\H': 'uni030B',
+'\\acwopencirclearrow': 'uni21BA',
+'\\t': 'uni0361',
+'\\nleftarrow': 'uni219A',
+'\\ocirc': 'uni030A',
+'\\emdash': 'emdash',
+'\\sqsubset': 'uni228F',
+'\\vec': 'uni20D7',
+'\\vee': 'uni2228',
+'\\d': 'uni0323',
+'\\sqsubseteq': 'uni2291',
+'\\c': 'uni0327',
+'\\checkmark': 'uni2713',
+'\\o': 'oslash',
+'\\l': 'lslash',
+'\\adots': 'uni22F0',
+'\\k': 'uni0328',
+'\\i': 'dotlessi',
+'\\gamma': 'uni03B3',
+'\\rceil': 'uni2309',
+'\\lceil': 'uni2308',
+'\\rightarrowtail': 'uni21A3',
+'\\textasciiacute': 'acute',
+'\\minus': 'minus',
+'\\subseteq': 'uni2286',
+'\\rightleftharpoons': 'uni21CC',
+'\\Upsilon': 'uni03D2',
+'\\looparrowleft': 'uni21AB',
+'\\updownarrow': 'uni2195',
+'\\grave': 'uni0300',
+'\\intercal': 'uni22BA',
+'\\cap': 'uni2229',
+'\\int': 'uni222B',
+'\\sim': 'uni223C',
+'\\prime': 'uni2032',
+'\\complement': 'uni2201',
+'\\smile': 'uni2323',
+'\\lesseqgtr': 'uni22DA',
+'\\downharpoonright': 'uni21C2',
+'\\cupdot': 'uni228D',
+'\\overarc': 'uni0311',
+'\\boxbar': 'uni25EB',
+'\\hookleftarrow': 'uni21A9',
+'\\circleddash': 'uni229D',
+'\\downarrow': 'uni2193',
+'\\Lambda': 'uni039B',
+'\\gg': 'uni226B',
+'\\ulcorner': 'uni231C',
+'\\lambdabar': 'uni019B',
+'\\bigvee': 'uni22C1',
+'\\smallsetminus': 'uni2216',
+'\\ntrianglerighteq': 'uni22ED',
+'\\precnsim': 'uni22E8',
+'\\lasp': 'uni02BD',
+'\\vdots': 'uni22EE',
+'\\rightharpoonaccent': 'uni20D1',
+'\\top': 'uni22A4',
+'\\downharpoonleft': 'uni21C3',
+'\\delta': 'uni03B4',
+'\\gneqq': 'uni2269',
+'\\leftharpoonup': 'uni21BC',
+'\\mu': 'uni03BC',
+'\\parallel': 'uni2225',
+'\\exists': 'uni2203',
+'\\yen': 'yen',
+'\\frown': 'uni2322',
+'\\approx': 'uni2248',
+'\\boxtimes': 'uni22A0',
+'\\textquotedblleft': 'quotedblleft',
+'\\twoheaduparrow': 'uni219F',
+'\\dotminus': 'uni2238',
+'\\lesssim': 'uni2272',
+'\\rightharpoondown': 'uni21C1',
+'\\dagger': 'dagger',
+'\\backsimeq': 'uni22CD',
+'\\partial': 'uni2202',
+'\\mapsfrom': 'uni21A4',
+'\\multimap': 'uni22B8',
+'\\OE': 'OE',
+'\\circledast': 'uni229B',
+'\\Leftrightarrow': 'uni21D4',
+'\\nvDash': 'uni22AD',
+'\\mid': 'uni2223',
+'\\quad': 'uni2003',
+'\\nleq': 'uni2270',
+'\\sphericalangle': 'uni2222',
+'\\triangledown': 'uni25BF',
+'\\ngtr': 'uni226F',
+'\\textasciitilde': 'asciitilde',
+'\\leftharpoondown': 'uni21BD',
+'\\boxdot': 'uni22A1',
+'\\scrR': 'uni211B',
+'\\Downarrow': 'uni21D3',
+'\\bowtie': 'uni22C8',
+'\\natural': 'uni266E',
+'\\scrE': 'uni2130',
+'\\scrF': 'uni2131',
+'\\nLeftrightarrow': 'uni21CE',
+'\\scrB': 'uni212C',
+'\\scrM': 'uni2133',
+'\\scrL': 'uni2112',
+'\\nLeftarrow': 'uni21CD',
+'\\scrI': 'uni2110',
+'\\scrH': 'uni210B',
+'\\endash': 'endash',
+'\\bigtriangleup': 'uni25B3',
+'\\sum': 'uni2211',
+'\\Searrow': 'uni21D8',
+'\\Lleftarrow': 'uni21DA',
+'\\scre': 'uni212F',
+'\\scrg': 'uni210A',
+'\\scro': 'uni2134',
+'\\subset': 'uni2282'}
+
+type12tex = dict([(v,k) for k,v in tex2type1.items()])
+
Index: backends/backend_ps.py
===================================================================
--- backends/backend_ps.py	(revision 2528)
+++ backends/backend_ps.py	(working copy)
@@ -924,7 +924,10 @@
     numglyphs = font.num_glyphs
     glyphs = []
     for j in range(numglyphs):
-        glyphs.append('/%s %d def' % (font.get_glyph_name(j), j))
+        try:
+            glyphs.append('/%s %d def' % (font.get_glyph_name(j), j))
+        except RuntimeError:
+            pass
         if j != 0 and j%4 == 0:
             glyphs.append('\n')
         else:
@@ -1081,8 +1084,7 @@
 
             Ndict = len(psDefs)
             print >>fh, "%%BeginProlog"
-            type42 = _type42 + [os.path.join(self.basepath, name) + '.ttf' \
-                                for name in bakoma_fonts]
+            type42 = _type42 + bakoma_fonts
             if not rcParams['ps.useafm']:
                 Ndict += len(type42)
             print >>fh, "/mpldict %d dict def"%Ndict
Index: mathtext.py
===================================================================
--- mathtext.py	(revision 2528)
+++ mathtext.py	(working copy)
@@ -142,11 +142,10 @@
 from matplotlib.ft2font import FT2Font
 from matplotlib.font_manager import fontManager
 from matplotlib._mathtext_data import latex_to_bakoma, cmkern, \
-        latex_to_standard
+        latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1
 from matplotlib.numerix import absolute
 from matplotlib import get_data_path, rcParams
 
-
 bakoma_fonts = []
 
 # symbols that have the sub and superscripts over/under 
@@ -163,6 +162,63 @@
     r'\angstrom' : (  ('rm', 'A', 1.0), (None, '\circ', 0.5), 0.0 ),
     }
 
+
+def font_open(filename):
+    ext = filename.rsplit('.',1)[1]
+    if ext == 'afm':
+        return AFM(filename)
+    else:
+        return FT2Font(filename)
+
+
+def get_unicode_index(symbol):
+    """get_unicode_index(symbol) -> integer
+
+Return the integer index (from the Unicode table) of symbol.
+symbol can be a single unicode character, a TeX command (i.e. r'\pi'),
+or a Type1 symbol name (i.e. 'phi').
+
+"""
+    try:# This will succeed if symbol is a single unicode char
+        return ord(symbol)
+    except TypeError:
+        pass
+    try:# Is symbol a TeX symbol (i.e. \alpha)
+        return tex2uni[symbol]
+    except KeyError:
+        pass
+    try:# Is symbol a Type1 name (i.e. degree)? If not raise error
+        return type12uni[symbol]
+    except KeyError:
+        message = """'%(symbol)s' is not a valid Unicode character or
+TeX/Type1 symbol"""%locals()
+        raise ValueError, message
+
+
+#Not used, but might turn useful
+def get_type1_name(symbol):
+    """get_type1_name(symbol) -> string
+
+Returns the the Type1 name of symbol.
+symbol can be a single unicode character, or a TeX command (i.e. r'\pi').
+
+"""
+    try:# This will succeed if symbol is a single unicode char
+        return uni2type1[ord(symbol)]
+    except TypeError:
+        pass
+    try:# Is symbol a TeX symbol (i.e. \alpha)
+        return tex2type1[symbol]
+    except KeyError:
+        pass
+    # The symbol is already a Type1 name so return it
+    if isinstance(symbol, str):
+        return symbol
+    else:
+        # The user did not suply a valid symbol, show usage
+        raise ValueError, get_type1_name.__doc__
+
+
 class Fonts:
     """
     An abstract base class for fonts that want to render mathtext
@@ -171,11 +227,11 @@
     return the character metrics as well as do the drawing
     """
 
-    def get_kern(self, font, symleft, symright, fontsize, dpi):
+    def get_kern(self, facename, symleft, symright, fontsize, dpi):
         """
         Get the kerning distance for font between symleft and symright.
 
-        font is one of tt, it, rm, cal or None
+        facename is one of tt, it, rm, cal or None
 
         sym is a single symbol(alphanum, punct) or a special symbol
         like \sigma.
@@ -183,9 +239,9 @@
         """
         return 0
     
-    def get_metrics(self, font, sym, fontsize, dpi):
+    def get_metrics(self, facename, sym, fontsize, dpi):
         """
-        font is one of tt, it, rm, cal or None
+        facename is one of tt, it, rm, cal or None
 
         sym is a single symbol(alphanum, punct) or a special symbol
         like \sigma.
@@ -207,7 +263,7 @@
         'Dimension the drawing canvas; may be a noop'
         self.width, self.height = w, h
 
-    def render(self, ox, oy, font, sym, fontsize, dpi):
+    def render(self, ox, oy, facename, sym, fontsize, dpi):
         pass
 
 
@@ -226,66 +282,159 @@
             )
         return metrics
 
-class TrueTypeFonts(Fonts):
-    def __init__(self):
 
-        # inspect all the fonts in the current path and make a dict
-        # from font type (tt, rm, it, cal) -> unicode chars that it
-        # provides
+class UnicodeFonts(Fonts):
+    """An abstract base class for handling Unicode fonts.
+
+Specific terminology:
+ * fontface: an FT2Font object, corresponding to a facename
+ * facename: a string that defines the (type)face's name - 'rm', 'it' etc.
+ * filename: a string that is used for generating a fontface object
+ * symbol*: a single Unicode character or a TeX command,
+    or to be precise, a TeX symbol command like \alpha (but not \frac) or
+    even a Type1/PS name
+ * filenamesd: a dict that maps the face's name to the filename:
+    filenamesd = { 'cal' : 'fontnamecal.ext',
+                  'rm'  : 'fontnamerm.ext',
+                  'tt'  : 'fontnamett.ext',
+                  'it'  : 'fontnameit.ext',
+                  None  : 'fontnamesmth.ext'}
+    filenamesd should be declared as a class atribute
+ * glyphdict: a dict used for caching of glyph specific data
+ * fonts: a dict of facename -> fontface pairs
+ * charmaps: a dict of facename -> charmap pairs
+ * glyphmaps: a dict of facename -> glyphmap pairs. A glyphmap is an
+    inverted charmap
+ * output: a string in ['BMP','SVG','PS'], coresponding to the backends
+ * index: Fontfile specific index of a glyph/char. Taken from a charmap.
+
+"""
+
+    # The path to the dir with the fontfiles
+    basepath = get_data_path()
+    
+    def __init__(self, output='BMP'):
+        self.facenames = self.filenamesd.keys()
+        # Set the filenames to full path
+        for facename in self.filenamesd:
+            self.filenamesd[facename] = os.path.join(self.basepath,
+                self.filenamesd[facename])
+        if output:
+            self.output = output
+        # self.glyphdict[key] = facename, metrics, glyph, offset
+        self.glyphdict = {}
         
-        self.glyphd = {}
         self.fonts = dict(
-            [ (name, FT2Font(os.path.join(self.basepath, name) + '.ttf'))
-              for name in self.fnames])
-
+            [ (facename, font_open(self.filenamesd[facename])) for
+                    facename in self.facenames])
+        # a dict of glyphindex -> charcode pairs
         self.charmaps = dict(
-            [ (name, self.fonts[name].get_charmap()) for name in self.fnames])
-        # glyphmaps is a dict names to a dict of charcode -> glyphindex
+            [ (facename, self.fonts[facename].get_charmap())
+                for facename in self.facenames])
+        # a dict of charcode -> glyphindex pairs
         self.glyphmaps = {}
-        for name in self.fnames:
-            cmap = self.charmaps[name]
-            self.glyphmaps[name] = dict([(ccode, glyphind) for glyphind, ccode in cmap.items()])
-        
-        for font in self.fonts.values():
-            font.clear()
-        if useSVG:
-            self.svg_glyphs=[]  # a list of "glyphs" we need to render this thing in SVG
-        else: pass
-        self.usingSVG = useSVG
+        for facename in self.facenames:
+            charmap = self.charmaps[facename]
+            self.glyphmaps[facename] = dict([(charcode, glyphind)
+                for glyphind, charcode in charmap.items()])
+        for fontface in self.fonts.values():
+            fontface.clear()
+        if self.output == 'SVG':
+            # a list of "glyphs" we need to render this thing in SVG
+            self.svg_glyphs=[]
+
+    def set_canvas_size(self, w, h, pswriter=None):
+        'Dimension the drawing canvas; may be a noop'
+        # self.width = int(w)
+        # self.height = int(h)
+        # I don't know why this was different than the PS version
+        self.width = w
+        self.height = h
+        if pswriter:
+            self.pswriter = pswriter
+        else:
+            for fontface in self.fonts.values():
+                fontface.set_bitmap_size(int(w), int(h))
+
+    def render(self, ox, oy, facename, symbol, fontsize, dpi):
+        filename = self.filenamesd[facename]
+        uniindex, metrics, glyph, offset = self._get_info(facename,
+                                                    symbol, fontsize, dpi)
+        if self.output == 'SVG':
+            oy += offset - 512/2048.*10.
+            # TO-DO - make a method for it
+            # This gets the name of the font.
+            familyname = self.fonts[facename].get_sfnt()[(1,0,0,1)]
+            self.svg_glyphs.append((familyname, fontsize, uniindex, ox, oy,
+                                                            metrics))
+        elif self.output == 'PS':
+            # This should be changed to check for math mode or smth.
+            #if filename == 'cmex10.ttf':
+            #    oy += offset - 512/2048.*10.
             
-    def get_metrics(self, font, sym, fontsize, dpi):
-        cmfont, metrics, glyph, offset  = \
-                self._get_info(font, sym, fontsize, dpi) 
+            # Get the PS name of a glyph (his unicode integer code)
+            # from the font object
+            symbolname = self._get_glyph_name(uniindex, facename)
+            psfontname = self.fonts[facename].postscript_name
+            ps = """/%(psfontname)s findfont
+%(fontsize)s scalefont
+setfont
+%(ox)f %(oy)f moveto
+/%(symbolname)s glyphshow
+""" % locals()
+            self.pswriter.write(ps)
+        else: # BMP
+            fontface = self.fonts[facename]
+            fontface.draw_glyph_to_bitmap(
+            int(ox),  int(self.height - oy - metrics.ymax), glyph)
+
+    def get_metrics(self, facename, symbol, fontsize, dpi):
+        uniindex, metrics, glyph, offset  = \
+                self._get_info(facename, symbol, fontsize, dpi) 
         return metrics
 
-    def _get_info (self, font, sym, fontsize, dpi):
-        'load the cmfont, metrics and glyph with caching'
-        key = font, sym, fontsize, dpi
-        tup = self.glyphd.get(key)
+    # Methods that must be overridden for fonts that are not unicode aware
 
-        if tup is not None: return tup
+    def _get_unicode_index(self, symbol):
+        return get_unicode_index(symbol)
 
-        basename = self.fontmap[font]
+    def _get_glyph_name(self, uniindex, facename):
+        """get_glyph_name(self, uniindex, facename) -> string
 
-        if latex_to_bakoma.has_key(sym):
-            basename, num = latex_to_bakoma[sym]
-            num = self.charmaps[basename][num]
-        elif len(sym) == 1:
-            num = ord(sym)
-        else:
-            num = 0
-            raise ValueError('unrecognized symbol "%s"' % sym)
+Returns the name of the glyph directly from the font object.
 
-        #print sym, basename, num
-        cmfont = self.fonts[basename]
-        cmfont.set_size(fontsize, dpi)
-        head  = cmfont.get_sfnt_table('head')
-        glyph = cmfont.load_char(num)
+"""
+        font = self.fonts[facename]
+        glyphindex = self.glyphmaps[facename][uniindex]
+        return font.get_glyph_name(glyphindex)
 
+    def _get_info(self, facename, symbol, fontsize, dpi):
+        'load the facename, metrics and glyph'
+        #print hex(index), symbol, filename, facename
+        key = facename, symbol, fontsize, dpi
+        tup = self.glyphdict.get(key)
+        if tup is not None:
+            return tup
+        filename = self.filenamesd[facename]
+        # This is used only by the PS backend --- to integrate the fonts
+        # into the resulting PS. TO-DO: fix the PS backend so it doesn't do
+        # these dirty tricks
+        if self.output == 'PS':
+            if filename not in bakoma_fonts:
+                bakoma_fonts.append(filename)
+        fontface = self.fonts[facename]
+        fontface.set_size(fontsize, dpi)
+        head  = fontface.get_sfnt_table('head')
+        uniindex = self._get_unicode_index(symbol)
+        glyphindex = self.glyphmaps[facename][uniindex]
+        glyph = fontface.load_char(uniindex)
         xmin, ymin, xmax, ymax = [val/64.0 for val in glyph.bbox]
-        if basename == 'cmex10':
-            offset =  glyph.height/64.0/2 + 256.0/64.0*dpi/72.0
-            #offset = -(head['yMin']+512)/head['unitsPerEm']*10.
+        # This is black magic to me (Edin)
+        if filename == 'cmex10.ttf':
+            if self.output == 'PS':
+                offset = -(head['yMin']+512)/head['unitsPerEm']*10.
+            else:
+                offset =  glyph.height/64.0/2 + 256.0/64.0*dpi/72.0
         else:
             offset = 0.
         metrics = Bunch(
@@ -297,70 +446,100 @@
             ymin = ymin+offset,
             ymax = ymax+offset,
             )
-        
-        self.glyphd[key] = cmfont, metrics, glyph, offset
-        return self.glyphd[key]
+        self.glyphdict[key] = uniindex, metrics, glyph, offset
+        return self.glyphdict[key]
 
-    def set_canvas_size(self, w, h):
-        'Dimension the drawing canvas; may be a noop'
-        self.width = int(w)
-        self.height = int(h)
-        for font in self.fonts.values():
-            font.set_bitmap_size(int(w), int(h)) 
 
-    def render(self, ox, oy, font, sym, fontsize, dpi):
-        cmfont, metrics, glyph, offset = \
-                self._get_info(font, sym, fontsize, dpi)
+class MyUnicodeFonts(UnicodeFonts):
+    basepath = r'C:\WINDOWS\Fonts'
+    filenamesd = { 'cal' : 'KUNSTLER.TTF',
+                'rm'  : 'times.ttf',
+                'tt'  : 'cour.ttf',
+                'it'  : 'times.ttf',
+                None  : 'times.ttf',
+                }
 
-        if not self.usingSVG:
-            cmfont.draw_glyph_to_bitmap(
-                int(ox),  int(self.height - oy - metrics.ymax), glyph)
-        else:
-            oy += offset - 512/2048.*10.
-            basename = self.fontmap[font]
-            if latex_to_bakoma.has_key(sym):
-                basename, num = latex_to_bakoma[sym]
-                num = self.charmaps[basename][num]
-            elif len(sym) == 1:
-                num = ord(sym)
-            else:
-                num = 0
-                print >>sys.stderr, 'unrecognized symbol "%s"' % sym
-            self.svg_glyphs.append((basename, fontsize, num, ox, oy, metrics))
-        
 
-    def _old_get_kern(self, font, symleft, symright, fontsize, dpi):
-        """
-        Get the kerning distance for font between symleft and symright.
+# TO-DO: pretty much everything
+class BakomaUnicodeFonts(UnicodeFonts):
+    """A class that simulates Unicode support in the BaKoMa fonts"""
 
-        font is one of tt, it, rm, cal or None
+    filenamesd = { 'cal' : 'cmsy10.ttf',
+                'rm'  : 'cmr10.ttf',
+                'tt'  : 'cmtt10.ttf',
+                'it'  : 'cmmi10.ttf',
+                None  : 'cmmi10.ttf',
+                }
 
-        sym is a single symbol(alphanum, punct) or a special symbol
-        like \sigma.
+    # We override the UnicodeFonts methods, that depend on Unicode support
+    def _get_unicode_index(self, symbol):
+        uniindex = get_unicode_index(symbol)
 
-        """
-        basename = self.fontmap[font]
-        cmfont = self.fonts[basename]
-        cmfont.set_size(fontsize, dpi)
-        kernd = cmkern[basename]
-        key = symleft, symright
-        kern = kernd.get(key,0)
-        #print basename, symleft, symright, key, kern
-        return kern
+    # Should be deleted
+    def _get_glyph_name(self, uniindex, facename):
+        """get_glyph_name(self, uniindex, facename) -> string
 
-    def _get_num(self, font, sym):
-        'get charcode for sym'
-        basename = self.fontmap[font]
-        if latex_to_bakoma.has_key(sym):
-            basename, num = latex_to_bakoma[sym]
-            num = self.charmaps[basename][num]
-        elif len(sym) == 1:
-            num = ord(sym)
+Returns the name of the glyph directly from the font object.
+Because BaKoma fonts don't support Unicode, 'uniindex' is misleading
+
+"""
+        font = self.fonts[facename]
+        glyphindex = self.glyphmaps[facename][uniindex]
+        return font.get_glyph_name(glyphindex)
+
+    def _get_info(self, facename, symbol, fontsize, dpi):
+        'load the facename, metrics and glyph'
+        #print hex(index), symbol, filename, facename
+        key = facename, symbol, fontsize, dpi
+        tup = self.glyphdict.get(key)
+        if tup is not None:
+            return tup
+        filename = self.filenamesd[facename]
+        # This is used only by the PS backend --- to integrate the fonts
+        # into the resulting PS.
+        if self.output == 'PS':
+            if filename not in bakoma_fonts:
+                bakoma_fonts.append(filename)
+        fontface = self.fonts[facename]
+        fontface.set_size(fontsize, dpi)
+        head  = fontface.get_sfnt_table('head')
+        uniindex = self._get_unicode_index(symbol)
+        glyphindex = self.glyphmaps[facename][uniindex]
+        glyph = fontface.load_char(uniindex)
+        xmin, ymin, xmax, ymax = [val/64.0 for val in glyph.bbox]
+        # This is black magic to me (Edin)
+        if filename == 'cmex10.ttf':
+            if self.output == 'PS':
+                offset = -(head['yMin']+512)/head['unitsPerEm']*10.
+            else:
+                offset =  glyph.height/64.0/2 + 256.0/64.0*dpi/72.0
         else:
-            num = 0
-        return num
+            offset = 0.
+        metrics = Bunch(
+            advance  = glyph.linearHoriAdvance/65536.0,
+            height   = glyph.height/64.0,
+            width    = glyph.width/64.0,
+            xmin = xmin,
+            xmax = xmax,
+            ymin = ymin+offset,
+            ymax = ymax+offset,
+            )
+        self.glyphdict[key] = uniindex, metrics, glyph, offset
+        return self.glyphdict[key]
 
-    
+
+# TO-DO: Implement all methods
+class CMUUnicodeFonts(UnicodeFonts):
+    """A class representing Computer Modern Unicode Fonts, made by
+Andrey V. Panov
+panov /at/ canopus. iacp. dvo. ru
+They are distributed under the X11 License.
+
+"""
+
+
+# Old classes
+
 class BakomaTrueTypeFonts(Fonts):
     """
     Use the Bakoma true type fonts for rendering
@@ -555,7 +734,7 @@
             raise ValueError('unrecognized symbol "%s, %d"' % (sym, num))
 
         if basename not in bakoma_fonts:
-            bakoma_fonts.append(basename)
+            bakoma_fonts.append(os.path.join(self.basepath, basename) + '.ttf')
         cmfont = self.fonts[basename]
         cmfont.set_size(fontsize, dpi)
         head = cmfont.get_sfnt_table('head')
@@ -1312,7 +1491,7 @@
 
 
 
-def math_parse_s_ft2font(s, dpi, fontsize, angle=0):
+class math_parse_s_ft2font_common:
     """
     Parse the math expression s, return the (bbox, fonts) tuple needed
     to render it.
@@ -1321,152 +1500,83 @@
 
     return is width, height, fonts
     """
-
     major, minor1, minor2, tmp, tmp = sys.version_info
     if major==2 and minor1==2:
         raise SystemExit('mathtext broken on python2.2.  We hope to get this fixed soon')
 
-    cacheKey = (s, dpi, fontsize, angle)
-    s = s[1:-1]  # strip the $ from front and back
-    if math_parse_s_ft2font.cache.has_key(cacheKey):
-        w, h, bfonts = math_parse_s_ft2font.cache[cacheKey]
-        return w, h, bfonts.fonts.values()
+    def __init__(self, output):
+        self.output = output
+        self.cache = {}
+        
+    def __call__(self, s, dpi, fontsize, angle=0):
+        cacheKey = (s, dpi, fontsize, angle)
+        s = s[1:-1]  # strip the $ from front and back
+        if self.cache.has_key(cacheKey):
+            w, h, fontlike = self.cache[cacheKey]
+            return w, h, fontlike
+        if self.output == 'SVG':
+            self.font_object = BakomaTrueTypeFonts(useSVG=True)
+            #self.font_object = MyUnicodeFonts(output='SVG')
+            Element.fonts = self.font_object
+        elif self.output == 'PNG':
+            self.font_object = BakomaTrueTypeFonts()
+            #self.font_object = MyUnicodeFonts()
+            Element.fonts = self.font_object
+        elif self.output == 'PS':
+            if rcParams['ps.useafm']:
+                self.font_object = StandardPSFonts()
+                Element.fonts = self.font_object
+            else:
+                self.font_object = BakomaPSFonts()
+                #self.font_object = MyUnicodeFonts(output='PS')
+                Element.fonts = self.font_object
+        
+        handler.clear()
+        expression.parseString( s )
 
-    bakomaFonts = BakomaTrueTypeFonts()
-    Element.fonts = bakomaFonts
-    handler.clear()
-    expression.parseString( s )
+        handler.expr.set_size_info(fontsize, dpi)
 
-    handler.expr.set_size_info(fontsize, dpi)
+        # set the origin once to allow w, h compution
+        handler.expr.set_origin(0, 0)
+        xmin = min([e.xmin() for e in handler.symbols])
+        xmax = max([e.xmax() for e in handler.symbols])
+        ymin = min([e.ymin() for e in handler.symbols])
+        ymax = max([e.ymax() for e in handler.symbols])
 
-    # set the origin once to allow w, h compution
-    handler.expr.set_origin(0, 0)
-    xmin = min([e.xmin() for e in handler.symbols])
-    xmax = max([e.xmax() for e in handler.symbols])
-    ymin = min([e.ymin() for e in handler.symbols])
-    ymax = max([e.ymax() for e in handler.symbols])
+        # now set the true origin - doesn't affect with and height
+        w, h =  xmax-xmin, ymax-ymin
+        # a small pad for the canvas size
+        w += 2
+        h += 2
 
-    # now set the true origin - doesn't affect with and height
-    w, h =  xmax-xmin, ymax-ymin
-    # a small pad for the canvas size
-    w += 2
-    h += 2
+        handler.expr.set_origin(0, h-ymax)
 
-    handler.expr.set_origin(0, h-ymax)
+        if self.output == 'SVG':
+            Element.fonts.set_canvas_size(w,h)
+        elif self.output == 'PNG':
+            Element.fonts.set_canvas_size(w,h)
+        elif self.output == 'PS':
+            pswriter = StringIO()
+            Element.fonts.set_canvas_size(w, h, pswriter)
+        
+        handler.expr.render()
+        handler.clear()
 
-    Element.fonts.set_canvas_size(w,h)
-    handler.expr.render()
-    handler.clear()
+        if self.output == 'SVG':
+            self.cache[cacheKey] = w, h, self.font_object.svg_glyphs
+            return w, h, self.font_object.svg_glyphs
+        elif self.output == 'PNG':
+            self.cache[cacheKey] = w, h, self.font_object.fonts.values()
+            return w, h, self.font_object.fonts.values()
+        elif self.output == 'PS':
+            self.cache[cacheKey] = w, h, pswriter
+            return w, h, pswriter
 
-    math_parse_s_ft2font.cache[cacheKey] = w, h, bakomaFonts
-    return w, h, bakomaFonts.fonts.values()
+math_parse_s_ft2font = math_parse_s_ft2font_common('PNG')
+math_parse_s_ft2font_svg = math_parse_s_ft2font_common('SVG')
+math_parse_s_ps = math_parse_s_ft2font_common('PS')
 
-math_parse_s_ft2font.cache = {}
 
-def math_parse_s_ft2font_svg(s, dpi, fontsize, angle=0):
-    """
-    Parse the math expression s, return the (bbox, fonts) tuple needed
-    to render it.
-
-    fontsize must be in points
-
-    return is width, height, fonts
-    """
-
-    major, minor1, minor2, tmp, tmp = sys.version_info
-    if major==2 and minor1==2:
-        print >> sys.stderr, 'mathtext broken on python2.2.  We hope to get this fixed soon'
-        sys.exit()
-    cacheKey = (s, dpi, fontsize, angle)
-    s = s[1:-1]  # strip the $ from front and back
-    if math_parse_s_ft2font_svg.cache.has_key(cacheKey):
-        w, h, svg_glyphs = math_parse_s_ft2font_svg.cache[cacheKey]
-        return w, h, svg_glyphs
-
-    bakomaFonts = BakomaTrueTypeFonts(useSVG=True)
-    Element.fonts = bakomaFonts
-    handler.clear()
-    expression.parseString( s )
-
-    handler.expr.set_size_info(fontsize, dpi)
-
-    # set the origin once to allow w, h compution
-    handler.expr.set_origin(0, 0)
-    xmin = min([e.xmin() for e in handler.symbols])
-    xmax = max([e.xmax() for e in handler.symbols])
-    ymin = min([e.ymin() for e in handler.symbols])
-    ymax = max([e.ymax() for e in handler.symbols])
-
-    # now set the true origin - doesn't affect with and height
-    w, h =  xmax-xmin, ymax-ymin
-    # a small pad for the canvas size
-    w += 2
-    h += 2
-
-    handler.expr.set_origin(0, h-ymax)
-
-    Element.fonts.set_canvas_size(w,h)
-    handler.expr.render()
-    handler.clear()
-
-    math_parse_s_ft2font_svg.cache[cacheKey] = w, h, bakomaFonts.svg_glyphs
-    return w, h, bakomaFonts.svg_glyphs
-
-math_parse_s_ft2font_svg.cache = {}
-
-
-def math_parse_s_ps(s, dpi, fontsize):
-    """
-    Parse the math expression s, return the (bbox, fonts) tuple needed
-    to render it.
-
-    fontsize must be in points
-
-    return is width, height, fonts
-
-    """
-    cacheKey = (s, dpi, fontsize)
-    s = s[1:-1]  # strip the $ from front and back
-    if math_parse_s_ps.cache.has_key(cacheKey):
-        w, h, pswriter = math_parse_s_ps.cache[cacheKey]
-        return w, h, pswriter
-
-    if rcParams['ps.useafm']:
-        standardFonts = StandardPSFonts()
-        Element.fonts = standardFonts
-    else:
-        bakomaFonts = BakomaPSFonts()
-        Element.fonts = bakomaFonts
-    handler.clear()
-    expression.parseString( s )
-
-    handler.expr.set_size_info(fontsize, dpi)
-
-    # set the origin once to allow w, h compution
-    handler.expr.set_origin(0, 0)
-    xmin = min([e.xmin() for e in handler.symbols])
-    xmax = max([e.xmax() for e in handler.symbols])
-    ymin = min([e.ymin() for e in handler.symbols])
-    ymax = max([e.ymax() for e in handler.symbols])
-
-    # now set the true origin - doesn't affect with and height
-    w, h =  xmax-xmin, ymax-ymin
-    # a small pad for the canvas size
-    w += 2
-    h += 2
-
-    handler.expr.set_origin(0, h-ymax)
-
-    pswriter = StringIO()
-    Element.fonts.set_canvas_size(w, h, pswriter)
-    handler.expr.render()
-    handler.clear()
-
-    math_parse_s_ps.cache[cacheKey] = w, h, pswriter
-    return w, h, pswriter
-
-math_parse_s_ps.cache = {}
-
 if 0: #__name__=='___main__':
     
     stests = [ 
