|
From: <edi...@gm...> - 2006-08-20 14:21:19
Attachments:
mathtext2_demo.py
|
The SoC deadline (for code) is tommorow (Aug 21st.), so I decided to commit what I have done till now to the repository. JDH is going on a vacation and will not be able to review it for at least a week, but I had to commit it before 21st. Aug - that's the SoC rules. Hopefully, I'll be adding new stuff the next week (and after), but that doesn't count as part of SoC anymore... Since this is my first commit, can anyone please test it. I tested it only on my windows box. I changed __init__.py, mathtext.py CHANGELOG I added mathtext2.py mathtext2_demo.py Anyone who wants to test the new mathtext2 has to add the following line(s) to the matplotlibrc (mathtext2 is disabled by default): mathtext2: True # Needed to enable the new mathtext # Font lines, feel free to change or uncomment (BaKoMa is used by default) mathtext.rm : FreeSerif.ttf mathtext.it : FreeSerifItalic.ttf # Text italic mathtext.tt : FreeMono.ttf # Typewriter (monospaced) mathtext.mit : FreeSerifItalic.ttf # Math italic mathtext.cal : FreeSansOblique.ttf # Caligraphic mathtext.nonascii: FreeSerif.ttf # Used for \sum, \infty etc. The FreeFont fonts (or any other for that matter) have to be downloaded and put into the mpl-data dir. The default settingsuse the current bakoma fonts, and they play pretty well with FreeSerif.ttf as the nonascii (unicode) font. so I recommend you just put the line mathtext.nonascii: FreeSerif.ttf and comment out the rest (experiment a little with fonts). Tonight I plan to add support for fractions. Beware that the only supported backend for now is Agg. mathtext2_demo.py is attached |
|
From: Darren D. <dd...@co...> - 2006-08-20 14:57:18
|
Hi Edin, On Sunday 20 August 2006 10:21 am, Edin Salkovi=C4=87 wrote: > The SoC deadline (for code) is tommorow (Aug 21st.), so I decided to comm= it > what I have done till now to the repository. > > JDH is going on a vacation and will not be able to review it for at > least a week, > but I had to commit it before 21st. Aug - that's the SoC rules. Hopefully, > I'll be adding new stuff the next week (and after), but that doesn't > count as part of SoC anymore... > > Since this is my first commit, can anyone please test it. I tested it > only on my windows box. > > I changed > __init__.py, > mathtext.py > CHANGELOG > > I added > mathtext2.py > mathtext2_demo.py > > Anyone who wants to test the new mathtext2 has to add the following line(= s) > to the matplotlibrc (mathtext2 is disabled by default): > > mathtext2: True # Needed to enable the new mathtext > > # Font lines, feel free to change or uncomment (BaKoMa is used by default) > mathtext.rm : FreeSerif.ttf > mathtext.it : FreeSerifItalic.ttf # Text italic > mathtext.tt : FreeMono.ttf # Typewriter (monospaced) > mathtext.mit : FreeSerifItalic.ttf # Math italic > mathtext.cal : FreeSansOblique.ttf # Caligraphic > mathtext.nonascii: FreeSerif.ttf # Used for \sum, \infty etc. > > The FreeFont fonts (or any other for that matter) have to be downloaded a= nd > put into the mpl-data dir. The default settingsuse the current bakoma > fonts, and they play pretty well with FreeSerif.ttf as the nonascii > (unicode) font. > > so I recommend you just put the line > mathtext.nonascii: FreeSerif.ttf > > and comment out the rest (experiment a little with fonts). > > Tonight I plan to add support for fractions. Beware that the only > supported backend for now is Agg. > > mathtext2_demo.py is attached I just updated my svn repository, added the lines you indicated to my rc fi= le,=20 but when I run the example, mpl can't find the freefonts that I already hav= e=20 installed on my system. The freefonts I have installed are not ttf, but pfb= =2E=20 Where should we download from? ftp://ftp.cs.umn.edu/pub/gimp/pub/gimp/fonts= ,=20 for example? I dont think those are what I am looking for. Do they really=20 need to go in mpl-dir? It would be more appropriate if they could be=20 installed somewhere like /usr/share/fonts. |
|
From: <edi...@gm...> - 2006-08-21 10:00:40
Attachments:
mathtext2.py
_mathtext_data.py
|
QmVjYXVzZSBTb0MgaXMgZW5kaW5nLCBhbmQgdGhlIHBlb3BsZSBmcm9tIEdvb2dsZSBzYWlkIHdl IG5lZWQgdG8KcHJvdmlkZSB0aGUgbGluayB0byB0aGUgY29kZSwgSSBkZWNpZGVkIHRvIGF0YWNo IHRoZSBtYXRodGV4dDIucHkgY29kZQpoZXJlLiBJIGFsc28gZGVjaWRlZCB0byBhdHRhY2ggX21h dGh0ZXh0X2RhdGEucHkgKHRoYXQgZG9lcwpcdGV4Y29tbWFuZCAtPiB1bmljb2RlIGNoYXIgdHJh bnNsYXRpb24pLiBJIGtub3cgdGhpcyBjYW4gYmUgc2VlbiB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aWNAZ21haWwuY29tPiB3cm90 ZToKPiBJZiBhbnlvbmUgaXMgaGF2aW5nIHByb2JsZW1zIHdpdGggZmluZGluZyB1bmljb2RlIGZv bnRzLCBjaGVjayB0aGUKPiBGcmVlRm9udHMgKEZyZWVTZXJpZiBpcyB0aGUgb25lIHRoYXQgaGFz IHRoZSBtb3N0IGNoYXJhY3RlcnMgaW4gaXQpOgo+IGh0dHA6Ly9kb3dubG9hZC5zYXZhbm5haC5n bnUub3JnL3JlbGVhc2VzL2ZyZWVmb250Lwo+IGh0dHA6Ly9kb3dubG9hZC5zYXZhbm5haC5nbnUu b3JnL3JlbGVhc2VzL2ZyZWVmb250L2ZyZWVmb250LXR0Zi0yMDA2MDEyNi50YXIuZ3oKPgo+IFRo ZSBvbmx5IGN1cnJlbnRseSBzdXBwb3J0ZWQgZm9udHMgYXJlIFRydWUvT3BlblR5cGUuCgpPb3Bz LiBJIGhhdmVuJ3QgaGFkIHVwZGF0ZWQgdGhlIF9tYXRodGV4dF9kYXRhLnB5IGZpbGUuCgpEYXJy ZW4gY2FuIHlvdSBjaGVjayBpZiBub3cgZXZlcnl0aGluZyB3b3JrcyBwcm9wZXJseSAoZXZlbiB3 aXRoIHBmYiBmb250cyk/CgpJdCB0dXJucyBvdXQgdGhhdCBtcGwgbm93IHNoaXBzIHdpdGggdGhl IEJhS29NYSBmb250cyBpbiB0aGUgbXBsLWRhdGEKZGlyLCBzbyBJIHRob3VnaCB0aGF0IHB1dHRp bmcgdGhlIHVuaWNvZGUgZm9udHMgdGhlcmUgd291bGQgYmUgZmluZS4KSSdsbCBzZWUgd2hhdCBJ IGNhbiBkbyByZWdhcmRpbmcgaW50ZWdyYXRpbmcgbWF0aHRleHQyIHdpdGggdGhlCmN1cnJlbnQg Zm9udCBtYW5hZ2VyLgo= |
|
From: Darren D. <dd...@co...> - 2006-08-23 16:27:13
Attachments:
mathtext_demo.png
|
Hi Edin,
I am not able to run the example when I have freefont installed=20
in /usr/local/share/fonts (although they are accessible by other programs, =
so=20
they are installed properly as far as X is concerned), but if I copy the=20
ttf's to the fonts directory in matplotlib's source, and then python setup.=
py=20
install, I am able to run your example, and have attached the resulting png=
=2E=20
Note the line is missing in the 3/2 fraction.
Darren
On Monday 21 August 2006 14:25, you wrote:
> Hmm, it looks like mpl is using the old mathtext which doesn't support
> \frac (mathtext.py) not mathtext2.py. Are you sure you put the
> following
>
> mathtext2: True # Needed to enable the new mathtext
>
> line in your rc file. mathtext2 is disabled by default.
>
> Hopefully I'll try tomorrow the SVN version on a Linux box.
>
> Thanks,
> Edin
>
> On 8/21/06, Darren Dale <dd...@co...> wrote:
> > Lets take this offlist for now.
> >
> > I just updated from svn, and tried running mathtext2_demo.py. I get the
> > following error:
> >
> > python mathtext2_demo.py
> > Traceback (most recent call last):
> > File "mathtext2_demo.py", line 40, in ?
> > savefig('mathtext_demo.png')
> > File "/usr/lib64/python2.4/site-packages/matplotlib/pylab.py", line
> > 811, in savefig
> > return fig.savefig(*args, **kwargs)
> > File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line
> > 671, in savefig
> > self.canvas.print_figure(*args, **kwargs)
> >
> > File
> > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkagg.=
py
> >", line 113, in print_figure
> > orientation, **kwargs)
> >
> > File
> > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py",
> > line 454, in print_figure
> > self.draw()
> >
> > File
> > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py",
> > line 391, in draw
> > self.figure.draw(renderer)
> > File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line
> > 534, in draw
> > for a in self.axes: a.draw(renderer)
> > File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line
> > 1057, in draw
> > a.draw(renderer)
> > File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line 33=
9,
> > in draw
> > bbox, info =3D self._get_layout(renderer)
> > File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line 18=
6,
> > in _get_layout
> > w,h =3D renderer.get_text_width_height(
> >
> > File
> > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py",
> > line 244, in get_text_width_height
> > width, height, fonts =3D math_parse_s_ft2font(
> > File "/usr/lib64/python2.4/site-packages/matplotlib/mathtext.py", line
> > 1579, in __call__
> > handler.expr.set_size_info(fontsize, dpi)
> > File "/usr/lib64/python2.4/site-packages/matplotlib/mathtext.py", line
> > 1195, in set_size_info
> > self.elements[0].set_size_info(self._scale*fontsize, dpi)
> > File "/usr/lib64/python2.4/site-packages/matplotlib/mathtext.py", line
> > 1107, in set_size_info
> > self.metrics =3D Element.fonts.get_metrics(
> > File "/usr/lib64/python2.4/site-packages/matplotlib/mathtext.py", line
> > 593, in get_metrics
> > cmfont, metrics, glyph, offset =3D \
> > File "/usr/lib64/python2.4/site-packages/matplotlib/mathtext.py", line
> > 613, in _get_info
> > raise ValueError('unrecognized symbol "%s"' % sym)
> > ValueError: unrecognized symbol "\frac3"
> >
> > On Monday 21 August 2006 06:33, you wrote:
> > > On 8/21/06, Edin Salkovi=C4=87 <edi...@gm...> wrote:
> > > > If anyone is having problems with finding unicode fonts, check the
> > > > FreeFonts (FreeSerif is the one that has the most characters in it):
> > > > http://download.savannah.gnu.org/releases/freefont/
> > > > http://download.savannah.gnu.org/releases/freefont/freefont-ttf-200=
60
> > > >126. tar.gz
> > > >
> > > > The only currently supported fonts are True/OpenType.
> > >
> > > Oops. I haven't had updated the _mathtext_data.py file.
> > >
> > > Darren can you check if now everything works properly (even with pfb
> > > fonts)?
> > >
> > > It turns out that mpl now ships with the BaKoMa fonts in the mpl-data
> > > dir, so I though that putting the unicode fonts there would be fine.
> > > I'll see what I can do regarding integrating mathtext2 with the
> > > current font manager.
> > > ---------------------------------------------------------------------=
=2D-
> > >-- Using Tomcat but need to do more? Need to support web services,
> > > security? Get stuff done quickly with pre-integrated technology to ma=
ke
> > > your job easier Download IBM WebSphere Application Server v.1.0.1 bas=
ed
> > > on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&d=
at=3D12164
> > >2 _______________________________________________
> > > Matplotlib-devel mailing list
> > > Mat...@li...
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> >
> > --
> > Darren S. Dale, Ph.D.
> > Cornell High Energy Synchrotron Source
> > Cornell University
> > 200L Wilson Lab
> > Rt. 366 & Pine Tree Road
> > Ithaca, NY 14853
> >
> > dd...@co...
> > office: (607) 255-3819
> > fax: (607) 255-9001
=2D-=20
Darren S. Dale, Ph.D.
Cornell High Energy Synchrotron Source
Cornell University
200L Wilson Lab
Rt. 366 & Pine Tree Road
Ithaca, NY 14853
dd...@co...
office: (607) 255-3819
fax: (607) 255-9001
|