xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 3z5y05...@sneakemail.com
Subject Manually breaking <flowText>s
Date Wed, 13 Sep 2006 04:19:36 GMT
I've a collection of SVG documents that were written (generated actually, but nevermind that)
with the use of the Batik <flowText> element in mind, and would like to find a sensible
way of breaking them up into individual <text>s or <tspan>s as they now need to
be used by some non-Batik SVG apps.  I found the following in the mailing list archives:
http://thread.gmane.org/gmane.text.xml.batik.user/3257/focus=3257

Indicating two alternatives: modifying GlyphLayout, and the somewhat more enigmatic suggestion
of post-processing the layout code's output.  I'd prefer the latter to the former, as I'd
rather not have to maintain a (trivial) branch of the Batik codebase.  I have, however, had
a rather difficult time figuring out just what is meant by the latter suggestion.  After some
time with the javadoc, my best guess is as follows:

1. Build a DOM for the document
2. Get a GVTBuilder
3. build(), and get the gvtRoot
4. Traverse the GVT Tree, looking for instaceof TextNodes?
5. getTextRuns() on the TextNode(s)?
6. getLayout.getGlyphVector() on the TextRuns??
7. getNumGlyphs(), then getGlyphPosition() looking for "newlines" (x2 <= x1 &&
y2 > y1)??
8. Use the getGlyphPositions to write
out <tspan>s
9. Recover the character data corresponding to the elements of the GlyphVector via--magic??
Does getGlyphCode() help here?

As one can see, the uncertainty in this procedure begins at a middling level and  quickly
progresses to high intensity confusion.  I would appreciate any suggestions that persons more
familiar with the Batik code may have.

-- 
HH

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


Mime
View raw message