python - How to do different anchor points for translation and rotation on a text element in an SVG -
i want build svg set text using 1 anchor point x,y translation , different anchor point rotation. specifically, want translate text point (x,y) (x,y) upper left corner of text. want rotate text center point. can't translate text using center point anchor because impossible width , height of text in advance. (i using python)
here's image depicting 2 anchor points i'd use.
also should note want able view file in adobe illustrator.
there can way svg embedded javascript: http://jsfiddle.net/bluc315m/3/
<svg width="320" height="320" viewbox="0 0 320 320" onload="init(this, 100, 100, 30)"> <script> function init(doc, x, y, ang) { var e = doc.queryselector("#txt"); var b = e.getboundingclientrect(); var w = b.width; var h = b.height; e.setattribute( "transform", "translate(" + x + "," + y + ")" + "translate(" + (w/2) + "," + (h/2) +")" + "rotate(" + ang + ")" + "translate(" + (-w/2) + "," + (h/2) +")" ); } </script> <g stroke="#999" stroke-width="0.5"> <path d="m100,0v320"/> <path d="m0,100h320"/> </g> <text id="txt" x="0" y="0" font-size="20" fill="black" stroke="none">text</text> </svg>
but don't know if adobe illustrator can manage this.
Comments
Post a Comment