d3ru / eggbotcode

Automatically exported from code.google.com/p/eggbotcode
0 stars 0 forks source link

Eggbot driver ignores SVG "viewbox" attribute #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Open the attached test.svg in Inkscape, looks like a nice big numeral "2"
2. Plot it on the Eggbot
3. Doesn't plot as large as you might expect, eh?

At issue is that the SVG document uses the "viewbox" attribute which is 
basically stating that the entire document needs a transform applied to 
transform from a width of 35.56 and height 8.89 to whatever the display 
dimensions are.

Not too sure how we will want to handle this.  In the short term, perhaps a 
warning about the "viewbox" is in order.  I do suspect that setting the initial 
transform to correspond to a scaling

scale(page_width/viewbox_width, page_height/viewbox_height)

is probably the correct solution.  The second test file, test2.svg, does this.

Original issue reported on code.google.com by newman.d...@gmail.com on 28 Nov 2010 at 5:23

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This issue appears to make it so that SVG output created by Corel Draw may not 
print at the correct scale.

Original comment by windell@oskay.net on 28 Nov 2010 at 5:27

GoogleCodeExporter commented 9 years ago
I have coded a fix which honors the viewbox's width and height with a 
scale(self.svgWidth/viewboxWidth, self.svgHeight/viewboxHeight).  Need to also 
translate by -viewboxMinX, -viewboxMinY.  Will ignore for the time being the 
not-nearly-as-simple preserveAspectRatio attribute.  (See the SVG spec, it's a 
multifaceted attribute.)

Am hoping I'll find time to test the fix Sunday or Monday.

Original comment by newman.d...@gmail.com on 28 Nov 2010 at 6:56

GoogleCodeExporter commented 9 years ago
Fix tested and checked in.  SVN revision 177.

Original comment by newman.d...@gmail.com on 28 Nov 2010 at 11:55

GoogleCodeExporter commented 9 years ago
See also Issue 36

Original comment by newman.d...@gmail.com on 5 Feb 2011 at 4:05