|
From: <pl...@pi...> - 2012-10-12 19:03:54
|
On 10/12/12 19:34, Ethan A Merritt wrote: > On Thursday, October 11, 2012 12:42:22 pm Allin Cottrell wrote: >> I'm comparing the output of gnuplot's svg and pngcairo >> drivers, with a thought of making greater use of SVG. But >> there seems to be a slight problem with the placement of key >> text in the SVG output. Here's a little test script >> >> set term svg font "Sans,8" size 680,400 >> set output 'test.svg' >> set key left top >> plot sin(x) title "PRIME" w l, cos(x) title "UNEMP" w l >> >> In the PNG version the key is just fine, but in SVG the "U" of >> "UNEMP" gets tangled up with the y-axis (more or less, >> depending on the magnification). I'm looking at the SVG using >> librsvg, and also via the Adobe NPSVG3 library. To show what >> I'm talking about, > >> I'm attaching the SVG output as converted to PNG by rsvg-convert >> (at 96dpi). > ^^^^^^^^^^ > > That dpi setting turns out to be relevant. > I went back to the SVG spec and learned the following: > > - you can specify font-size in either absolute or relative units > > - font-size="8pt" requests an 8 point font regardless of the > display resolution or current scaling. That's what gnuplot does. > In theory, if you view an SVG document in a viewer that allows > you to rescale the figure, the font should display as the same > size even after rescaling the plot. That is, if you shrink the > figure the font does _not_ shrink with it. Not what I am finding in practise. I have a gnuplot graph in svg which contains text formatted as follows: <g transform="translate(41.3,43.7)" style="stroke:none; fill:black; font-family:verdana; font-size:9.00pt; text-anchor:end"> Both Opera and FF zoom both the text and graph lines with the zoom feature (if that is what you were referring to by rescale). Frankly , that is what I would expect. Like if I zoom an html document, the main reason would be to increase the rendition of the font size. Maybe I misunderstood "rescale". /Peter. > > - font-size="8" or font-size="8px" requests a font size relative to > the current display units. It will scale up or down as the figure > is re-sized. > > - For a 95dpi display, 8pt is translated to 10px. That is, it is > displayed 25% larger than gnuplot was expecting. This is probably > at the heart of the problem. > > - You can confirm this by opening the output of your test command in > inkscape and then saving it to a new *.svg file. The original gnuplot > output contains text marked "font-size:8pt" but inkscape converts this > to "font-size:10" (no units). > > I don't know what is the best thing to do here. > Being able to specify an absolute font size makes sense in many > cases, but not in all cases. Perhaps we need a gnuplot terminal option > that controls whether gnuplot writes out absolute or relative units for > the font size. I suppose the code that estimates text length would have > to be aware of this also. > > Ethan > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > |