Hi James,

James Shaw wrote:

That's what I would expect, but it doesn't seem to be the case for me -- the document appears much smaller than I would expect.

If you are using your own frame you may need subclass the canvas and implement the 'setMySize' method. Here is what the JSVGViewerFrame does (from squiggle):

                public void setMySize(Dimension d) {
                    setPreferredSize(d);
                    invalidate();
                    if (JSVGViewerFrame.this.autoAdjust) {
                        JSVGViewerFrame.this.pack();
                    }
                }


Depending on how complex your object is you might try to use translate and scale tranforms.
<svg width="20cm" height="10cm" viewBox="0 0 20 10" style="fill:red;stroke:blue">
<g transform="translate(0,10) scale(1,-1)">
<line x1="0" y1="0" x2="20" y2="10" style="stroke: blue; stroke-width: 1" />
</g>
</svg>


Patrick

Thanks for this suggestion. I did try to use scale(1,-1) but it caused the object to disappear entirely (am I doing something really stupid here?)

I don't know if it's really stupid ;) but the translate is also important other wise everything will be drawn in the negative part of the coordinate system. The general thing is to translate by the height of the viewing area (for vertical flip).

Also, since switching from hardcoded cms to userspace coords, I've noticed discrepancies in line widths between the SVG viewed in a JSVGCanvas and via FOP (using the PDFTranscoder). To avoid these problems, I would really like to stick with centimetres and find a simple way of reflecting objects.

Use translate and scale together...


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to