Hi,

On 4 Aug 2009, at 14:12, Michael Droettboom wrote:
> However, after doing that I run into another error importing mathtex  
> from mathtext_demo.py:
>
>> >>> from mathtex.mathtex_main import Mathtex
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> mathtex_main.py", line 2, in <module>
>>    from mathtex.parser import MathtexParser
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> parser.py", line 7, in <module>
>>    from mathtex.boxmodel import *
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> boxmodel.py", line 4, in <module>
>>    from mathtex.fonts import *
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> fonts.py", line 5, in <module>
>>    from mathtex.ft2font import FT2Font, KERNING_DEFAULT
>> ImportError: No module named ft2font
> It looks like it's still looking for ft2font inside of mathtex,  
> which, of course, isn't there in the context of building in inside  
> of matplotlib.  I thought you said that mathtex would use the  
> ft2font from matplotlib if it were available -- maybe I  
> misunderstood what you meant.

fonts.py seemed to slip the net, somehow, and will not try to fallback  
on matplotlib. Easy to fix.

> These sorts of installation issues are hard to test given that  
> installs don't clean up after themselves.  Personally, I use  
> virtualenv to create "clean" python environments, then install  
> matplotlib in it, and then try running examples in that  
> environment.  It's real fast to just blitz the environment and  
> create a new one each time for this kind of testing.

Yes, I've been bitten by that several times now. I'll look into  
virtualenv, might save me some headaches.

> I was able to work around this (by installing mathtex directly), but  
> I ran into the following because I have "mathtext.fontset" set up  
> "stixsans" in my matplotlibrc:

I, for some reason, never ported stixsans over. Again easy to do and  
shouldn't take long. The stix and bakoma fonts currently work and  
unicode support is in mathtex, just needs some support code in  
matplotlib.

> But I don't know if it matters to do this until the matplotlib/ 
> mathtex branch is merged back into the trunk.

It is probably wroth doing it as soon as mathtex has a couple of  
stable releases behind it.

>> There is a slight performance penalty associated with using mathtex  
>> --  due to each expression being parsed twice -- where matplotlib  
>> caches  parsed expressions. If this is a problem let me know and  
>> I'll work on  something.
>>
> It would be great to preserve the caching behavior, even if that  
> lives in the matplotlib side and not in the mathtex project itself.   
> Where it matters is with interactive panning and zooming: if the  
> tick labels use math, as in a log plot for example, they can get re- 
> renderered many times.  I recall benchmarking it at the time I did  
> the big math re-write, and it was definitely worth worrying about at  
> the time, though I can't find my notes.  If you benchmark and come  
> to a different conclusion (because things have become faster in  
> other ways) just let us know.

It is probably easiest if I add it to the Mathtex class itself.  
Parsing is currently the biggest bottle-neck even with packrat parsing  
enabled. I did try zooming around the mathtext demo plot and found  
there to be quite a lot of lag, so it does seem worth it.

Overall I think the best plan of action is to add caching support and  
stixsans into mathtex, fix the error with imports and then release  
version 0.2 of mathtex. Then matplotlib can be updated (and set to  
pull 0.2 from subversion).

Regards, Freddie.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to