Greetings,
I think that my previous question could be
summarised as "what is logical width" ? And I think the answer is "pixels"
:-)
I generally recieve SVG files exported in
centimetres, and this is what the coords I posted previously are (with a
filter on the export). Exporting in pixels are 1:1 gives a clearer
example:
<text x="149" y="210" fill="#3E555F"
font-weight="normal" font-size="24" font-family="Aachen BT">SPORTS CLUB
NAME</text>
Calling the font-size of 24 against
pango_layout_get_size (with the text above) gives back a logical width of
234. Dividing this by half = 117. Adding 117 to 149 gives 266, and
so when I adjust the alignment::
<text x="266" y="210" fill="#3E555F"
font-weight="normal" font-size="24" font-family="Aachen BT"
style="text-anchor:middle">Sports</text>
It gives exactly the same SVG file!
Awesome.
Z.
----- Original Message -----
Sent: Wednesday, October 15, 2003 10:41
AM
Subject: Pango: Convert logical width to
x coordinate width ?
Greetings All,
I am using pango_layout_get_size to get the width
of some text I have layed out (i.e. text, font and font size) this gives me
back (according to the docs) the "logical width." of the text.
What I want to do is convert this to x
coordinates that would then work with SVG markup. I believe that SVG xy
coordinates a fairly similar to html, so I just thought somebody might have
thought about this before.
For example if I had::
<g><text x="2639.1" y="3865.21"
fill="#CF352D" font-weight="normal" font-size="1467" font-family="Aachen
BT">SPORTS CLUB
NAME</text></g>
And I called pango to get the "logic width" of
the text I get 8250. I want to adjust the x attribute by half of the
"x-width" of the text, but obviously 4125 is too large, but something like
half of this would be close. Unfortunately I need it to be
exact.
Any suggestions are greatly appreciated
:-)
Z.
|