You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by cbornste <cb...@tietronix.com> on 2001/10/10 09:57:15 UTC

Text Problems

In the javadoc for org.apache.batik.gvt.GraphicsNode there is the following caveat:

"Note: The boundaries of some nodes (notably, text element nodes) cannot be precisely determined independent of their GraphicsNodeRenderContext" 

What exactly does this mean? Does it mean that I can not know precisely the bounds of a text element? 

Also, if I want to render SVG which has a text element should I use a TextNode instead of a GraphicsNode? Are there any examples using TextNode?  I have been following the DOM API examples and am having no luck getting text to render properly.

Thanks

Charles Bornstein
Tietronix Software 

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


Text Problems

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "CB" == cbornste  <cb...@tietronix.com> writes:

CB> In the javadoc for org.apache.batik.gvt.GraphicsNode there is the
CB> following caveat: "Note: The boundaries of some nodes (notably,
CB> text element nodes) cannot be precisely determined independent of
CB> their GraphicsNodeRenderContext"

    This note is a bit out of date but the essence is correct.  The
GraphicsNodeRenderContext object no longer exists but it use to hold a
FontRenderContext (or some such object).  This object was intended to
be paired with the device the content was to be rendered for (this is
now associated with a TextNode when the GVT tree is built).  See the
problem is that the exact details of platform fonts varies depending
on the output device.  So for example the exact details of the font
you get for Times will likely be slightly different for a Mac display
a Win32 display or an X11 display (in fact for X11 the font may change
depending on what 'display' you are going to, along the same lines it
is also quite possible for the exact metrics to change from PC to PC
or Mac to Mac, if 'non-standard' or additional fonts have been
installed).

    This is on top of well know issues about the differences in screen
fonts and printer fonts.

CB> What exactly does this mean? Does it mean that I can not
CB> know precisely the bounds of a text element?

    It means that you can only know precisely the bounds of a text
element if you know precisely what font it will be rendered with.

    This is where the term 'platform' font comes in.  In SVG you can
use SVG to describe your font in this case you _can_ know exactly what
font will be used to render the content, and hence virtually all
uncertanty in the resultant display can be removed.

CB> Also, if I want to render SVG which has a text element should I
CB> use a TextNode instead of a GraphicsNode? Are there any examples
CB> using TextNode?  I have been following the DOM API examples and am
CB> having no luck getting text to render properly.

    I'm a bit confused since you talk about the DOM api but all the
classes you mention are GVT classes which is our 'view' of the DOM
'model' (in MVC).  If you are talking about GVT classes then the
answer is clearly yes, you should be using TextNodes to hold your
text.

CB> Thanks

    Hope it helps.

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