- From: darcy w.christ <darcy@1000camels.com>
- Date: Tue, 21 Oct 2003 17:26:36 -0400
- To: www-svg@w3.org
hi, i'm new to this list. i hope my question is appropriate for this list. i'm trying to produce an svg from a script. the svg is very simple. All i really need to do is create an image of a certain size, and place multiple lines of text within a certain location on the image. My problem is that i am unable to get control over the text. Here's what i'm producing so far: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd"> <svg width="864" height="648"> <style type="text/css"> <![CDATA[ .textClass { font-size: 139px; font-family: Arial; fill: #000000; } ]]> </style> <rect x="0" y="0" width="864px" height="648px" fill="none" stroke="none" /> <rect x="445" y="68" width="374px" height="160px" fill="none" stroke="black" /> <text class="textClass" x="445" y="68" dy="1em" text-anchor="start"> <tspan>text</tspan> </text> </svg> i've also played around with mutliple lines like so: <tspan x="445" dy="1em">second line</tspan> my issue is that i would like to be able to vertically center the text within the box. i am getting the font size from another image application (image magick) and it is choosing the font size based upon the space of the box and the text itself. But when i take the values i have an create this svg, everything is good except the vertical placement. i've even figured out how to center or align right by setting the text-anchor and changing the x value appropriately. But, as for the height, i'm not sure how to approach this. How does one work with the font information (like ascenders and descenders)? Is there a way to refer to them in a relative way, much like the dy property that i use? i appreciate any help, including tips on the best place to learn more about svg. ~darcy w. christ 1000camels
Received on Tuesday, 21 October 2003 17:38:40 UTC