After a couple hours of Googling and hacking, it would appear time to
send an email to this list to see if there's a solution I'm missing.
The Desired Result: An area of text that uses the largest font size
possible while still fitting into a given rectangle.
The Proposed Solution: Use the 'flowroot' element, check for overflow,
and iteratively adjust the font size of the text.
The Problem: Based on emails from this list dating from 2006, it does
not appear overflow events are implemented, and my alternative
attempts to formulate my own overflow detection mechanism have been
unsuccessful.
The SVG:
---
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="982px" height="1200px" viewBox="0 0 982 1200">
...
<flowRoot xml:space="preserve">
<flowRegion vertical-align="middle">
<rect x="74.472" y="376.98" width="833.958" height="296.985"
id="bounding"/>
</flowRegion>
<flowDiv>
<flowPara justification="middle" top-margin="10" left-
margin="10" right-margin="10" bottom-margin="10" fill="#331C1D" font-
family="'Futura-Medium'" font-size="72" id="title"><flowLine>Some
interesting text</flowLine></flowPara>
</flowDiv>
</flowRoot>
</svg>
---
While this code allows me to get the rectangle into which I'm flowing
text:
---
SVGElement svgElement = (SVGElement) doc.getElementById("bounding");
SVGLocatable locatable = (SVGLocatable) svgElement;
SVGRect altbounds = locatable.getBBox();
---
but a similar call to attempt to get the bounding box for the laid out
text (I presume, I'm actually shooting in the dark at this point)
results in an uncaught exception:
---
SVGElement svgElement = (SVGElement) doc.getElementById("title");
SVGLocatable locatable = (SVGLocatable) svgElement;
SVGRect altbounds = locatable.getBBox();
---
Even if I move the id="title" to the flowDiv, the result is the same.
So I'm at a bit of a loss.
Is there another, easier way to figure out the actual dimensions of
the laid out text in a flowDiv, or check the flowRoot for overflow? Or
are overflow events still not implemented?
Thanks in advance,
Brendon
---
Brendon J. Wilson
www.brendonwilson.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]