xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Moore <Scott.Mo...@netDecide.com>
Subject RE: Text size
Date Mon, 08 Oct 2001 10:26:57 GMT
Okay.  Let's say I'm using the SVG font "Times", size 10 point.  If I
understand you correctly, there's a way for me to get an XML document that
describes each glyph in that font?  For each character in my string, I can
then determine it's size and add them all together to get the total string
size in pixels?

If you could point me in the right direction, I would much appreciate it.
What Batik class can I use to get this information?

Thanks again,
Scott



-----Original Message-----
From: Chris Lilley [mailto:chris@w3.org]
Sent: Monday, October 08, 2001 6:25 AM
To: Batik Users
Subject: Re: Text size




Scott Moore wrote:
> 
> Okay, I might be still confused, so let me elaborate on what you said.
> 
> If I create a SVG DOM and add a <text> node to it, along with the text to
be
> displayed.  I can then query the element I just added to the SVG DOM and
> there will be attributes on this node that describe the text that will be
> rendered, including it's size in pixels?

No. Not on that node. Thats why I said "if you use SVG fonts" because
these are XML. So if you know what SVG font you will use you can find
the total glyph width. But it does requires a little tree walking. Find
the roote element of the relevant font. For each character in your
string, iterate over the child elements of the font root node (the
'glyph' elements) looking at their 'unicode' attribute and matching it
to the character.

If you are handling more than short strings, then constructing an
ordered index would be worthwhile to speed procesing.

-- 
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message