Hi all,

I'm trying to auto size a font to not exceed the block dimensions, giving a
default max size and downgrading to predefined steps until it fits or a
minimum size is reached.

I can't use the SVG "trick" because I want to fit to a max defined width,
and and as the size is reduced more text will fit in a single line.

My idea is to build an external processor step that calculates the optimum
font size to be used for the block. But to do this I need the exact font
width (in millipoints) of each character (or word) of the selected font
triplet on each font size I intend to use.

Browsing the fop project  source I've found the
org.apache.fop.fonts.Font.getCharWidth(), but It's for me a bit tricky to
instantiate correctly this Class.

I assume the the best way to get this is to start from the
org.apache.fop.tools.fontlist.FontListMain that does already the fop
configuration and loading of the font. But as a xsl-fo end-user, I've no
knowledge on the fop internals (structure/architecture) to go from A to B.

Can you please give me some hints or practical examples?
Wold it make sense to extend the org.apache.fop.tools to provide this
functionality?
Or am I on the wrong way?

Thanks in advance for any hint or feedback you can provide.

Regards.

p.s. I'm generating documents using a custom font, that I've imported using
org.apache.fop.fonts.apps.TTFReader and imported using the specific
configuration file.




--
View this message in context: 
http://apache-fop.1065347.n5.nabble.com/Extract-font-width-using-FOP-tp37360.html
Sent from the FOP - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to