Has anyone looked into embedding fonts in SVG files? That might alleviate some of the installation problems that were recently mentioned on the matplotlib-users list. The relevant spec: http://www.w3.org/TR/SVG11/fonts.html If there are no plans under way, I may have a crack at it, since I'm sort of on an "embedding fonts" kick lately anyway... ;) Cheers, Mike
On 7/10/07, Michael Droettboom <md...@st...> wrote: > Has anyone looked into embedding fonts in SVG files? That might > alleviate some of the installation problems that were recently mentioned > on the matplotlib-users list. > > The relevant spec: > > http://www.w3.org/TR/SVG11/fonts.html > > If there are no plans under way, I may have a crack at it, since I'm > sort of on an "embedding fonts" kick lately anyway... ;) It's definitely come up before. Paul Barret may have had a look at it. I'm not sure why we ended up not doing it. You can search the archives if you are interested. If it isn't too hard, and major SVG renderers support it, it seems like a great idea. JDH
John Hunter wrote: > On 7/10/07, Michael Droettboom <md...@st...> wrote: >> Has anyone looked into embedding fonts in SVG files? > > It's definitely come up before. Paul Barret may have had a look at > it. I'm not sure why we ended up not doing it. You can search the > archives if you are interested. If it isn't too hard, and major SVG > renderers support it, it seems like a great idea. "major SVG renderers" support seems to be the issue at first glance. None of the big open source options -- Firefox, inkscape, rsvg -- seem to support it. Please let me know if I'm missing something. Firefox has even pushed SVG fonts off of the Firefox 3 timeline: http://weblogs.mozillazine.org/tor/archives/2007/03/svg_priorities_in_firefox_3.html Until there's something readily available to test with, there's probably not much point. Cheers, Mike
On 2007年7月10日 13:43:49 -0400, Michael Droettboom wrote: > "major SVG renderers" support seems to be the issue at first glance. > None of the big open source options -- Firefox, inkscape, rsvg -- seem > to support it. That's my understanding as well. > Until there's something readily available to test with, there's probably > not much point. It's a classic chicken-and-egg. I know the cairo-svg maintainer is hoping to add SVGFont stuff to cairo's SVG output to try to boostrap past this problem. -Carl
Actually, it just occurred to me that you could use 'defs' and 'use' to define characters as paths and reuse them. And that's something that works today in virtually any SVG renderer. It totally blitzes the logical representation of the text (i.e. searching and copying as text etc.), but if it was only done for math text, then that's probably not a big deal. IMHO, math text is where matching the exact font is most important, where a reasonable substitute is often not installed, and where searching doesn't make a lot of sense. In any case, editing the SVG in something like Inkscape will be harder, since the text has become raw paths. Thanks to ft2font, it was fairly easy to get outlines of math characters embedded in the SVG file. I've put up an example mathtext_demo.py SVG here: ftp://ftp.stsci.edu/tmp/mdroe/mathtext_demo.svg I'll commit this code once it's cleaned up and better tested etc. if it's agreed this is something we want to do. I think in any case this should be optional -- it gives the file some portability at the expense of editability. Cheers, Mike Carl Worth wrote: > On 2007年7月10日 13:43:49 -0400, Michael Droettboom wrote: > >> "major SVG renderers" support seems to be the issue at first glance. >> None of the big open source options -- Firefox, inkscape, rsvg -- seem >> to support it. >> > > That's my understanding as well. > > >> Until there's something readily available to test with, there's probably >> not much point. >> > > It's a classic chicken-and-egg. I know the cairo-svg maintainer is > hoping to add SVGFont stuff to cairo's SVG output to try to boostrap > past this problem. >
I've tested this approach with Firefox 2.0 and rsvg 2.16. The text alignment is actually much better since the text layout is fully under the control of matplotlib. This has been checked into SVN, and can be used by setting the rcparam "svg.embed_char_paths" to True. The following are my usual "size benchmarks" (that I used for PS and PDF as well): without character paths -> with character paths fonts_demo_kw.py: 10314 -> 69256 mathtext_demo.py: 10606 -> 37896 unicode_demo.py: 7677 -> 43473 over all demos in backend_driver.py: 17,722,815 -> 18,789,999 Cheers, Mike Michael Droettboom wrote: > Actually, it just occurred to me that you could use 'defs' and 'use' to > define characters as paths and reuse them. And that's something that > works today in virtually any SVG renderer. > > It totally blitzes the logical representation of the text (i.e. > searching and copying as text etc.), but if it was only done for math > text, then that's probably not a big deal. IMHO, math text is where > matching the exact font is most important, where a reasonable substitute > is often not installed, and where searching doesn't make a lot of > sense. In any case, editing the SVG in something like Inkscape will be > harder, since the text has become raw paths. > > Thanks to ft2font, it was fairly easy to get outlines of math characters > embedded in the SVG file. I've put up an example mathtext_demo.py SVG here: > > ftp://ftp.stsci.edu/tmp/mdroe/mathtext_demo.svg > > I'll commit this code once it's cleaned up and better tested etc. if > it's agreed this is something we want to do. I think in any case this > should be optional -- it gives the file some portability at the expense > of editability. > > Cheers, > Mike > > Carl Worth wrote: > >> On 2007年7月10日 13:43:49 -0400, Michael Droettboom wrote: >> >> >>> "major SVG renderers" support seems to be the issue at first glance. >>> None of the big open source options -- Firefox, inkscape, rsvg -- seem >>> to support it. >>> >>> >> That's my understanding as well. >> >> >> >>> Until there's something readily available to test with, there's probably >>> not much point. >>> >>> >> It's a classic chicken-and-egg. I know the cairo-svg maintainer is >> hoping to add SVGFont stuff to cairo's SVG output to try to boostrap >> past this problem. >> >> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > >