Hi HH,
[EMAIL PROTECTED] wrote on 09/13/2006 12:19:36 AM:
> 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 would suggest trying to modify the flowText to use flowRoot (fairly
easy using something like XSLT unless you were using the vertical align
options).
The advantage is that the flowDiv element of flowRoot implements the
TextContent interface which let's you ask for the BBox of individual chars
in the text.
This should make it fairly easy to reverse engineer the line breaking.
Even if you are using the vertical align features you might do this
and do the vertical alignment after you have broken the text into lines
(as vertical alignment for rects is trivial).
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]