- From: Erik Dahlström <ed@opera.com>
- Date: Tue, 07 Jul 2009 13:16:51 +0200
- To: tim.edwards@multigig.com, www-svg@w3.org
On Mon, 06 Jul 2009 23:08:03 +0200, R. Timothy Edwards <tim.edwards@multigig.com> wrote: > I have been looking at SVG as an alternate output format for xcircuit, > as there has been some interest in using xcircuit to generate output > that is more compatible with other systems (the primary output format > is PostScript). > > I am presently attempting to determine if it is possible to generate > SVG output without flattening the hierarchy of objects in xcircuit. > I have been able to hack in the use of parameterized properties of > drawing elements using the scripts in the primer for the SVG 2.0 > specification. Which is not nearly as good as having parameters > defined natively, but it's a start. > > I got stumped looking for a way to specify flip-invariant text. This > appears to be an oversight in the SVG definition. If I define a symbol > or other re-usable object containing text, and then use that object > with the transform "scale=(-1,1)", then the text will render backwards. > There should be a way to declare text to always read in the declared > orientation (e.g., left-to-right). The correct way to do this is to > compute the bounding box of the text based on the text scale, rotation, > justification, etc., using the innermost transformation matrix, then > flip and rotate the text within that bounding box such that it is > rendered left-to-right and has an angle of -90 to 90 degrees. > > Is such a thing possible? I don't think it's possible at the moment. > Can it be hacked in with scripts? Yes, probably. You can get the "innermost" matrix (or CTM) for the text element by calling getCTM() on the element. If you're looking for some example SVG/script code working with matrices and transforms, have a look here[1][2] and perhaps read some assorted parts of the SVG spec[3][4][5][6]. > Is it being considered for future definitions of SVG? This is not exactly what you are asking for, but it is possible to "anchor" elements to the coordinate system used by the root svg element with the help of transform="ref(svg)" [7]. Example: <svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 200 200"> <g transform="scale(-1,1)"> <path d="M-50 10l12 40a29 40 0 1 1 50 40" fill="green"/> <text font-size="20" x="-200" y="3em">Hello world</text> </g> <g transform="scale(-1,1)"> <path d="M-50 10l12 40a29 40 0 1 1 50 40" fill="yellow" stroke="black"/> <text transform="ref(svg)" font-size="20" y="3em">Hello world</text> </g> </svg> You seem to be interested in having the feature included in a future SVG version, and it sounds like a useful thing to have, so it's certainly up for discussion. I've raised ISSUE-2289 [8] to track this request. Cheers /Erik [1] http://my.opera.com/MacDev_ed/blog/getting-screen-boundingboxes-in-svg [2] http://my.opera.com/MacDev_ed/blog/2009/01/21/getting-boundingbox-of-svg-elements [3] http://www.w3.org/TR/SVG11/coords.html#InterfaceSVGPoint [4] http://www.w3.org/TR/SVG11/coords.html#InterfaceSVGMatrix [5] http://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransform [6] http://www.w3.org/TR/SVG11/types.html#InterfaceSVGLocatable [7] http://www.w3.org/TR/SVGMobile12/coords.html#transform-ref [8] http://www.w3.org/Graphics/SVG/WG/track/issues/2289 -- Erik Dahlstrom, Core Technology Developer, Opera Software Co-Chair, W3C SVG Working Group Personal blog: http://my.opera.com/macdev_ed
Received on Tuesday, 7 July 2009 11:15:54 UTC