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 Mark Lundquist <ml...@comcast.net> on 2006/07/15 22:22:02 UTC
Need help w/ text flow
Hi, this is my first post to this group. I'm using Batik bundled with
Cocoon. I do not really know SVG, so I hope you will pardon my
ignorance here... I'm sort of just looking for a formula to do something
simple. This is for a web application with a design that calls for an
exotic font for some "header" text above one of the page elements, so
I'm using Batik to serialize the text to a PNG image on he server side.
All I need to is to flow some text within a box :-)
After some scrounging around, I came up with this:
<?xml version="1.0"?>
<svg
xmlns="http://www.w3.org/2000/svg"
version="1.2"
>
<flowRoot
style="
fill: black;
font-size: 30;
font-family: inkburrow;
"
>
<flowRegion>
<!--
THE BOX
@height makes no difference?!
-->
<rect x="0" y="30" width="150" height="500"/>
</flowRegion>
<flowDiv>
<flowPara>
foo bar baz spaz <!-- THE TEXT -->
</flowPara>
</flowDiv>
</flowRoot>
</svg>
It's "sort of" working :-/... you can see the results here:
http://dev.wrinkledog.com/ml/text-flow-example.png
I can make the box narrower or wider with the expected effects on the
line break point. However, the box always clips just below the top of
the second line of text (as shown in the example image), no matter what
value I set for the <re...@height> attribute.
I'd sure appreciate any pointers here! :-)
Thanks,
—ml—
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Need help w/ text flow
Posted by Mark Lundquist <ml...@comcast.net>.
Hi Thomas, thx a lot for your reply!
thomas.deweese@kodak.com wrote:
> I suspect the problem is that what ever is rasterizing the text
I think that's just the Batik transcoder, right?
> has specified a fixed height for the output PNG. Normally this comes
> from the height attribute of the <svg> element but as your's doesn't
> have anything I'm not sure where width/height information is comming
> from.
A default I suppose, and I'll bet the default width just happens to be
plenty big enough that I'm not getting clipped horizontally...
> You should be able to use the SVG DOM to query the size of
> the flowRoot element with the 'getBBox' method, 'onload'.
>
Awesome... do you have a reference on that for me by any chance? I know
not the technique of which you speak (remember, I am innocent of almost
all knownledge of SVG! :-)
thx a lot!
—ml—
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Need help w/ text flow
Posted by th...@kodak.com.
Hi Mark,
news <ne...@sea.gmane.org> wrote on 07/15/2006 04:22:02 PM:
> Hi, this is my first post to this group. I'm using Batik bundled with
> Cocoon. I do not really know SVG, so I hope you will pardon my
> ignorance here... I'm sort of just looking for a formula to do something
> simple. This is for a web application with a design that calls for an
> exotic font for some "header" text above one of the page elements, so
> I'm using Batik to serialize the text to a PNG image on he server side.
> All I need to is to flow some text within a box :-)
This is actually a bit tricky as it requires generating a dynamically
sized output. My guess is that your clipping is due to what ever is
rasterizing the SVG having a fixed size (80 pixels high).
You should be able to use the SVG DOM to query the size of
the flowRoot element with the 'getBBox' method, 'onload'.
> I can make the box narrower or wider with the expected effects on the
> line break point. However, the box always clips just below the top of
> the second line of text (as shown in the example image), no matter what
> value I set for the <re...@height> attribute.
I suspect the problem is that what ever is rasterizing the text
has specified a fixed height for the output PNG. Normally this comes
from the height attribute of the <svg> element but as your's doesn't
have anything I'm not sure where width/height information is comming
from.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org