Between 0.90 and 0.91, the SVG backend was changed to store the glyph 
outlines of the characters in the SVG file itself.  (This is on by 
default, but can be turned off with the rc parameter 
svg.embed_char_paths).  This helps make the SVG files much more 
portable, as the need to install the math fonts has long been a FAQ on 
this list.  I've been doing all my testing with Firefox and Inkscape. 
Is there a simple Qt-based SVG viewer I could add to my testing regimen?

I won't pretend to be an expert on the SVG spec, but it does say this:

<http://www.w3.org/TR/SVG/struct.html#Head>

====

To provide some SVG user agents with an opportunity to implement 
efficient implementations in streaming environments, creators of SVG 
content are encouraged to place all elements which are targets of local 
URI references within a 'defs' element which is a direct child of one of 
the ancestors of the referencing element. For example:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
<svg width="8cm" height="3cm"
      xmlns="http://www.w3.org/2000/svg";>
   <desc>Local URI references within ancestor's 'defs' element.</desc>
   <defs>
     <linearGradient id="Gradient01">
       <stop offset="20%" stop-color="#39F" />
       <stop offset="90%" stop-color="#F3F" />
     </linearGradient>
   </defs>
   <rect x="1cm" y="1cm" width="6cm" height="1cm"
         fill="url(#Gradient01)"  />
   <!-- Show outline of canvas using 'rect' element -->
   <rect x=".01cm" y=".01cm" width="7.98cm" height="2.98cm"
         fill="none" stroke="blue" stroke-width=".02cm" />
</svg>

View this example as SVG (SVG-enabled browsers only)

In the document above, the linear gradient is defined within a 'defs' 
element which is the direct child of the 'svg' element, which in turn is 
an ancestor of the 'rect' element which references the linear gradient. 
Thus, the above document conforms to the guideline.

====

So we are complying to that part of the spec.  The spec doesn't seem to 
say anything about whether the defs must appear before or after their 
use -- but maybe I just can't find the relevant paragraph.

In any case, this should be easy enough to fix on matplotlib's end, and 
certainly won't break compliance with the spec.  I'll have a look, and 
may come back to you for help with testing with Qt if you don't mind.

Cheers,
Mike

Christiaan Putter wrote:
> Hi there,
> 
> Just an update regarding the svg problem I was having:
> 
> I simply went back to 0.90 and that's working now.
> 
> Would still be nice to know if the svg output from matplotlib complies 
> with the standard or whether it's Qt that's messing things up.
> 
> Merry x-mass!
> 
> cputter
> 
> 
> 
> On 21/12/2007, *Christiaan Putter* <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     Hi guys and girls,
> 
>     Quick question regarding matplotlib's svg backend...
> 
>     I've embeded pyhton into c++ and Qt's (4.3.3) svg support is having
>     some problems with .svg files created by matplotlib.  Text isn't
>     showing up.  Firefox displays the same .svg file correctly though...
> 
>     The problem:
> 
>     It seems some text stuff is stored in a section called defs at the
>     end of the file with stuff linking to this earlier in the file.  Qt
>     doesn't like that and only displays the normal plot stuff (lines,
>     etc.) but not the labels and other text.
> 
>     More exact:
> 
>     <use xlink:href="#c_7" .....
> 
>     references
> 
>     <path id="c_7" d="M10.6875 .....
> 
>     at the end of the file.
> 
> 
> 
>     When I simply cut and paste the defs section to the beginning of the
>     file it solves the problem.
> 
>     What does the svg standard say about this?  I assume Qt's
>     implementation is defect...
> 
>     Has anybody else encountered this problem?  I'll send an e-mail to
>     Qt too and ask them about it.
> 
>     Hope you're all having a nice day.
> 
>     Regards,
>     cputter
> 
> 
> 
>     -------------------------------------------------------------------------
>     This SF.net email is sponsored by: Microsoft
>     Defy all challenges. Microsoft(R) Visual Studio 2005.
>     http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>     _______________________________________________
>     Matplotlib-users mailing list
>     Matplotlib-users@lists.sourceforge.net
>     <mailto:Matplotlib-users@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>     <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to