shrink font to fit in given space

View: New views
2 Messages — Rating Filter:   Alert me  

shrink font to fit in given space

by cymoon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: shrink font to fit in given space

by Andreas Delmelle-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: fop-users-help@...