# mathtext baseline

Hi,

I really love mathtext! I wrote a simple formula parser
and now I can label my graphs with easy to read chemical
names (I've attached it below for the curious).

The problem is that the baseline is wandering. On my machine
the following has the 'h' too low and the 'io' too high:

import pylab
ax = pylab.subplot(111)
pylab.text(0.5,0.5,r'$\rm{Thiol}$', va='bottom')
pylab.show()

I'm using wxAgg on OS X. I know I've installed freetype, but
beyond that I have no idea what font it is using.

Do others experience the same problem?

Any idea where I can start when debugging this?

- Paul

Hi,

I really love mathtext! I wrote a simple formula parser
and now I can label my graphs with easy to read chemical
names (I've attached it below for the curious).

The problem is that the baseline is wandering. On my machine
the following has the 'h' too low and the 'io' too high:

Just guessing, but...

There is a problem we have with text alignment in the ft2font module.
We can either align to top, bottom or center, but we need an option to
align to the glyph baseline. Michael is currently working on mathtext
and is now our resident font guru. Michael, can you take a look at
this. This would be an important enhancement for mathtext, multiline
text, and a text entry widget.

Thanks,
JDH

···

On 7/21/07, Paul Kienzle <pkienzle@...537...> wrote:

import pylab
ax = pylab.subplot(111)
pylab.text(0.5,0.5,r'$\rm{Thiol}$', va='bottom')
pylab.show()

I'm using wxAgg on OS X. I know I've installed freetype, but
beyond that I have no idea what font it is using.

Do others experience the same problem?

Any idea where I can start when debugging this?

- Paul

-------------------------------------------------------------------------
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.
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

I suspect my recent mathtext changes will help with Paul's problem.

I should probably give a quick update -- I've been coding pretty experimentally lately and didn't want to report on too much if I was likely to back it out later.

I've implemented a fairly direct Python translation of the TeX box layout model, which replaces the directional references used for layout in trunk. My main motivation was to help in the recursive layout of fractions (particularly in the vertical alignment) and the wandering baseline issue. Of course, this will only solve the baseline problem for mathtext (not other text), but I see the argument now for fixing that at a lower level. Both of these problems probably could have been solved within the existing framework, but I felt in the long run it would be useful to use the framework where so many math layout problems have already been solved. I'm still deciding whether to parse like TeX does (which uses two parsing phases and therefore makes some things a little easier/more efficient) or continue with the existing mpl parser. I suspect the existing mpl parser will result in more legible code at the expense of running some layout operations more times than strictly necessary. I'm not terribly concerned about performance -- TeX was designed for much weaker machines, and for much larger documents.

I expect to have the old parser up and running with the new box model in the next couple of days. It may be most expeditious to just wait for that.

Cheers,
Mike

John Hunter wrote:

···

On 7/21/07, Paul Kienzle <pkienzle@...537...> wrote:

Hi,

I really love mathtext! I wrote a simple formula parser
and now I can label my graphs with easy to read chemical
names (I've attached it below for the curious).

The problem is that the baseline is wandering. On my machine
the following has the 'h' too low and the 'io' too high:

Just guessing, but...

There is a problem we have with text alignment in the ft2font module.
We can either align to top, bottom or center, but we need an option to
align to the glyph baseline. Michael is currently working on mathtext
and is now our resident font guru. Michael, can you take a look at
this. This would be an important enhancement for mathtext, multiline
text, and a text entry widget.

Thanks,
JDH

import pylab
ax = pylab.subplot(111)
pylab.text(0.5,0.5,r'$\rm{Thiol}$', va='bottom')
pylab.show()

I'm using wxAgg on OS X. I know I've installed freetype, but
beyond that I have no idea what font it is using.

Do others experience the same problem?

Any idea where I can start when debugging this?

- Paul

-------------------------------------------------------------------------
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.
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

-------------------------------------------------------------------------
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.