Re: [xsl] evaluate rendered text lenght

Subject: Re: [xsl] evaluate rendered text lenght
From: Eliot Kimber <ekimber@xxxxxxxxxxxx>
Date: Tue, 24 May 2011 11:03:51 -0500
The renderedTextLength extension was pretty simple. It uses the Java 2D
package (which is part of the standard Java distribution) to take the text
string, the font size, and the font to render the text string and thus get
the approximate rendered length. It can only be approximate of course
because it doesn't perform kerning or interword-space tuning or anything),
but it's good enough for short text strings and is very accurate for
monospace fonts, which was my primary use case (figuring out how much to
drop the font of literal examples so they would fit within the available
rendition space).

It would be hard for someone to reimplement the extension but it's not
something I can do at the moment.

Also, the original extension was written as a Saxon 6 extension, so it would
not work with current Saxon versions.

Cheers,

E.

On 5/24/11 5:05 AM, "Giuseppe Briotti" <g.briotti@xxxxxxxxx> wrote:

> Hi all, I would like to evalutate the lenght of a string as it will be
> rendered in FOP. Of course, because of FOP formatting strategy, this
> info can be just an approximation, but for my purpouse can be enough.
>
> I've seen the Eliot Kimber extension (Function "renderedTextLength")
> but it is no longer available on Innodata Isogen web site. There are
> other alternatives?
>
> TIA
>
> Giuseppe Briotti
>

--
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 512.554.9368
www.reallysi.com
www.rsuitecms.com

Current Thread