You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by cymoon <ma...@janhoeft.de> on 2009/06/18 13:49:45 UTC

shrink font to fit in given space

Hi,
do you have an idea how i could simulate something like the Antenna House
overflow extension.
They can set overflow to condense and dynamicaly shrink the font.

Example:
<fo:block overflow="condense" axf:overflowcondense="font-size">....
the result can be seen on 
http://www.antennahouse.com/XSLsample/pdf/ext-overflow_1.pdf

I was thinking about writing an Xalan-J extension, but this means to set up
a FOP during the XSL Transformation. That would be complicated and slow.
Getting the current font name also would be difficult.

So I was thinking about an extension for Fop. Looking at the source I did
not knew where to start. Do you have an idea how this could be implemented?

Cheers
Jan
-- 
View this message in context: http://www.nabble.com/shrink-font-to-fit-in-given-space-tp24091394p24091394.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: shrink font to fit in given space

Posted by Andreas Delmelle <an...@telenet.be>.
On 18 Jun 2009, at 13:49, cymoon wrote:

Hi Jan

> do you have an idea how i could simulate something like the Antenna  
> House
> overflow extension.
> <snip />
> So I was thinking about an extension for Fop. Looking at the source  
> I did
> not knew where to start. Do you have an idea how this could be  
> implemented?

I certainly don't want to discourage you, however, I don't think it  
will be trivial to implement.
If you're sure you want to have a go, then you'll need to look at  
layoutmgr.BlockLayoutManager, layoutmgr.inline.LineLayoutManager and/ 
or layoutmgr.inline.TextLayoutManager.

Reason why I don't think it is trivial, is that it will require  
multiple passes. You would first have to go through the line-breaking  
using the standard font-size, and see if the total combined height of  
the line-boxes would exceed the available space. If so, then you would  
have to redo the line-breaking using a smaller font-size, and repeat  
this loop until the totality of the line-boxes fit into the reference  
area. Only after the font-size has been decreased sufficiently to fit  
all the lines, can the LineLM returns its element-list to the parent  
BlockLevelLM.

Currently, FOP's layoutengine only has very limited restarting  
facilities, so you would be moving into unexplored territory... That  
said, if you're seriously interested in adding this functionality, I  
invite you to subscribe to fop-dev@ and follow-up there, as this is a  
bit off-topic for simple FOP usage.

At any rate, thanks very much for the interest.

Hope to read you on fop-dev@ soon.


Regards

Andreas

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