[reportlab-users] KeepInFrame Shrinkage

Robin Becker robin at reportlab.com
Fri Aug 22 15:33:28 EDT 2008


Philippe Robitaille wrote:

> Hello:

>

> I am building an application that calls for some flowables to keep together in the same frame. I opted for the shrink action to take when the text is too long. This action seemed like the least offensive relative to masking, overflowing or raising an error.

>

> I have two points to be made about this.

>

> First, for the most part, shrinking the flowables renders beautifully with text that has a small recuction in point size. Very elegant. However, on some instances I yield PDF output where the keepInFrame objects are shrunk to some ridiculously small point size. I can't see that there is a way to specify maximum shrinkage. But I think there should be. I will not be able to use shrink if it renders even a small percentage of instances as un-readable.

>

> Secondly, I am wondering if you should not consider another form of action for KeepInFrame. If you have a flowable with a dozen lines of text, it might be reasonable to offer a "reduce leading" action as well. And of course there might be a "tighten kerning" action although this does not seem to be a primitive supported at all. All good things in time, I suppose.

>

> Are there any words of advice? Maybe I should be considering some contortions with a Try/Except using the raise error action.

>

> Regards,

> phil robitaille

......
There are some things to consider here. First off the shrinkage is
determined by an algorithm which considers both width and height. We
use a newton style algorithm to home in on the appropriate shrink
factor. If you have some fixed width elements they may overwhelm the
rest of the content. Secondly you can already specify the leading in the
styles of paragraphs etc etc.

No matter what if you try to cram 5inches of test into 1in of width the
results are likely to be laughable.

An example of what you consider bad behaviour is welcome if it leads to
a better solution.
--
Robin Becker


More information about the reportlab-users mailing list