Hi Brendon,

"Brendon J. Wilson" <[email protected]> wrote on 12/13/2009 
11:24:25 PM:

> 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.

   I haven't checked the recently but my recollection is that there
were some issues with the way those events were specified that made
it problematic to implement them.

 
> 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();

   The problem is that the flowDiv/flowPara/flowSpan implement the
SVG Text positioning interface rather than SVG Locatable.  You should
be able to detect overflow by checking if the 'getExtentOfChar' for
the last 'printing char' is empty (i.e. the flow text hid it).

> 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?

    The layout code actually tracks if overflow occurs but it isn't
exposed anywhere.  In 'FlowTextPainter.getTextRuns' the 'textWrap'
function called at the end returns true if there was overflow, but
that return value is propagated anywhere.

Reply via email to