SVG text size and position confusion

Post questions on how to use or achieve an effect in Inkscape.
James777
Posts: 12
Joined: Tue May 05, 2009 8:40 pm

SVG text size and position confusion

Postby James777 » Mon Apr 08, 2013 7:45 am

I am confused about how text works in terms of it's positioning and sizing with Inkscape becuase when i look in the code for the SVG it is giving me different values than in Inkscape.

For example i made a SVG test where the position of X: 0 in Inkscape but in the SVG code X: -6.9352403 and Y is also different.

I want to calculate the text area so i can scale the text with PHP and the test with a font size of 295.9022216796875px it gives me a area of Width: 744.090 and Height: 219.037 however if there is more characters it will be larger than the page area. How is the text Width and Height calculated?
Last edited by James777 on Mon Apr 22, 2013 11:15 pm, edited 1 time in total.

Jelle
Posts: 78
Joined: Sat Nov 06, 2010 11:25 am

Re: SVG text size and position confusion

Postby Jelle » Wed Apr 10, 2013 4:55 pm

Hi James,

It seems to be related to the font used. Probably the kerning of the font starts at x: -6.9352403 When I opened it in Inkscape on my Linux box the postion had move to -7.8 for Sans, whereas using Arial gave me a x: 0. The kerning of a font is taken from the font file itself and then passed to Inkscape. Changing the font to a somewhat better kerned one may do the trick for you.

A small tip. Rather than using the default A4, you might consider using a pixel based document size, such as 1024x768 or similar. Working in pixels can make things a lot easier and files more readable for later use with XML manipulation using PhP or javascript. Inkscape uses a 90 dpi resolution translation, so 1 mm is something like 3.45etc. pixels, making it rather hard to work from mm in scripts.

Cheers,

Jelle


Return to “Help with using Inkscape”