John Hunter wrote: > On 7/25/07, Michael Droettboom <[EMAIL PROTECTED]> wrote: >> The new mathtext with an underlying TeX-like box model is passing all >> unit tests for all backends. I'm now at a point where I'd like to merge >> this back into the trunk, but I'd like some feedback as to how to best >> deal with the backward-incompatible change wrt font changes. > > This is really, really cool stuff. On a mostly unrelated note, do > you thing the TeX box layout algorithms could be used to solve more > general figure layout problems, eg positioning axes and tick labels, > etc? That seems like it would be worth some thought, but nothing springs to mind. > > I think we should strive for TeX correctness and should not support > the incorrect usage in a > compatibility mode. The improvements you've made are sufficiently > important that mathtext users will gladly accept a little breakage. > We can put up a news flash on the main site, and note the changes in > the CHANGELOG and API_CHANGES file, as well as in the mathtext_demo. Sounds good. > > I have a few questions about the mathtext_demo.py. A number of these > are probably just related to the bakoma fonts, which are just so > horrific it pains me to look at them (like why is the s in sin so much > lighter?) I think that's due to lack of hinting in the font. If you generate a .ps and zoom in enough, they do look much better. > > * The i in the {i+1} subscript looks too small. It also looks to > small compared to the j in the \Delta_i^j example. Are the i and j > coming from the same file, and do you have any idea why it is small? Hmmm. Both i's look identical here. Perhaps an optical illusion from the rotation? I agree, in general, though that there is some tweaking to font sizes and positioning that still needs to be done. Since mathtext always uses the same glyph outlines regardless of font size, unlike TeX which changes the actual shapes in response to font size, some compromises had to be made in that regard. > > * There is a lot of space between the \prod symbol and the rest of > the expression and between the \mathcal{R} and the \prod symbol -- > what controls this? It looks like it is being affected by the wide > \prod subscript {i=\alpha_{i+1}} -- is this correct and is this how > TeX handles it? Since the subscript is under the prod, it seems like > it's width should not affect the spacing of the R and the sin Yes, as others have pointed out, this is normal TeX behavior. The subscript affects the width of the entire vertical list. If it didn't, it could bump into subscripts before and after. (Think of $R_i \prod_{i=\alpha_{i+1} $-- the subscripts would run together). The TeX box model only supports a strict hierarchy of boxes within boxes (excepting shifting and kerning), and doesn't ever do any checks for boxes overlapping boxes with other parents. (It's really a lot less smart than many, myself included, assume.) The hacks that Gael and Jouni suggest may help, but aren't currently supported by the mathtext parser (though they could be fairly easily). Exposing some of the low-level commands for TeX gurus might be useful in general, though I worry (somewhat abstractly) that since they will probably never behave 100% like TeX, they will just disappoint. > * Have you given any thought to the "cross font" kerning problem. > Eg, if the parens comes from one file, and the 2 from another and the > \pi from a 3rd, how to we kern "( 2 \pi )? I haven't looked at how TeX does this yet, though I suspect the job is easier there, being that it has its own universe of math fonts that are built to work together. The current implementation does kern consecutive characters of the same font and fontsize, but that's all. I have noticed, though, that TeX kerns a lot less in math mode than one might expect. For instance, $AVA$ isn't kerned at all (presumably to keep variables looking like separate entities), though $\rm AVA$ is. > > * have you succeeded in get any non bakoma fonts to work, eg with the > UnicodeFont code? No, I haven't tried that yet. I've certainly broken the UnicodeFont classes by changing the API a little bit. Is there a font you would suggest that was known to work with the old mathtext that I should test with? > > Anyway, this is really great stuff. Thanks! It's been fun working through this. You may want to check out mathtext_examples.py in my branch for examples that exercise other new features.
Cheers, Mike ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel