From: John H. <jdh...@ac...> - 2004-10-27 14:44:16
|
>>>>> "Robert" == Robert Kern <rk...@uc...> writes: John> Another idea I had while reading Knuth's "TeX: The Program" John> is to use the layout information in the TFM font metric John> files. Apparently math fonts have additional layout John> information in them, like where to place superscripts. I've John> looked at several tfm parsing implementations, and Robert> I wish you luck! Who needs luck when we've got people like you around! :-) Robert> Taking this as a challenge (and having little to do while Robert> waiting for images to process), I wrote a TFM parser that Robert> handles the extra parameters for math symbols. This Robert> format[1] is excruciatingly painful. Robert> http://starship.python.net/crew/kernr/tfm.py Robert> And then I realized that the output of tftopl(1) is Robert> incredibly easy to parse and contains the same Robert> information. <sigh> Robert> Either way, you now have the information you need for some Robert> fonts, at least. Awesome - impressive work for an afternoon. Thanks for pointing me to that dvi specification reference. I was trying to discern the format from TeX: The Program, which despite its literate style, was less accessible than the reference you pointed to. It is painful, though, as you say, no matter how you slice it. Funny that I missed tftopl in my hunt for a parser, which was sitting right on my system the whole time. In order to use this information in mathtext, we have reconstruct the mapping from TeX symbol name to font and character number for each of the tex symbols we use (cmr10, cmi10, cmex10 and cmsy10) . Currently mathtext hardcodes the mapping from tex name to bakoma fontname/number. A better approach would be to use either the mathml or unicode number as the internal code for each symbol, and then provide mappings from these to the tfm fontname/charnum and to the corresponding tex symbol names - my guess is that this has already been done and we just have to dig it up. Then we could use any of the fonts (Wolfram, Design Science, Symbol, AMS, Bakoma) at http://www.mozilla.org/projects/mathml/fonts/encoding for matplotlib mathtext, since the mapping from mathml/unicode to fontname/charnum already exists on pages like http://www.mozilla.org/projects/mathml/fonts/encoding/cmr.html, and is easily parsed (I already did this when I was working on PS mathtext with type1 fonts before Paul had the bright idea of just embedding the truetype fonts in the ps document and reusing what we already had. In summary, it would be nice to be able to readily go from tex name <-> mathml/unicode name <-> fontname/charnum in a variety of files, including at a minimum the bakoma ttf and the corresponding tfm files. Got some images to process today <wink> Does this sound like the right approach to you? JDH |