>>>>> "Edin" == Edin Salkovi§ <[EMAIL PROTECTED]> writes:
Edin> I finally solved the problem of automaticaly generating the
Edin> dicts for unicode <-> TeX conversion. This is the first step
Edin> in enabling unicode support in mathtext.
Excellent.
Edin> The STIX projects is usefull after all ;) They keep a nice
Edin> table of Unicode symbols at:
Edin> http://www.ams.org/STIX/bnb/stix-tbl.ascii-2005-09-24
Edin> Any comments about the script are appreciated :). Now I'll
Since you asked :-)
I may not have mentioned this but the style conventions for mpl code
are
functions : lower or lower_score_separated
variables and attributes : lower or lowerUpper
classes : Upper or MixedUpper
Also, I am not too fond of the dict of dicts -- why not use variable
names? Here is my version
import pickle
fname = 'stix-tbl.ascii-2005-09-24'
uni2type1 = dict()
type12uni = dict()
uni2tex = dict()
tex2uni = dict()
for line in file(fname):
if line[:2]!=' 0': continue # using continue avoids unneccesary indent
uninum = line[2:6].strip().lower()
type1name = line[12:37].strip()
texname = line[83:110].strip()
uninum = int(uninum, 16)
if type1name:
uni2type1[uninum] = type1name
type12uni[type1name] = uninum
if texname:
uni2tex[uninum] = texname
tex2uni[texname] = uninum
pickle.dump((uni2type1, type12uni, uni2tex, tex2uni),
file('unitex.pcl','w'))
# An example
unichar = int('00d7', 16)
print uni2tex.get(unichar)
print uni2type1.get(unichar)
Also, I am a little hesitant to use pickle files for the final
mapping. I suggest you write a script that generates the python code
contains the dictionaries you need (that is how much of _mathext_data
was generated.
Thanks,
JDH
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel