Skip to main content
Feb 22, 2011 10:20 PM UTC
Question

last line in the container ignoring descenders

Hi,

I have a project which is using TLF 1.0. When adding lines to a container, it appears that if the bottom/last line's descenders will not fit within the container, then that line will not get added. In this case, we would like to mimic what InDesign does, in that the last line can have the descenders go below the container, as long as the baseline is within the container. Is there a way to get TLF to also behave this way?

Thank you for the info.

Will

This topic is closed to new replies. Start a new post to keep the conversation going.

13 replies

Inspiring
Feb 22, 2011 10:57 PM UTC

Use Configuration.overflowPolicy.

Note that a Configuration can be passed to the constructor of a TextFlow.  Once the TextFlow is constructed it's Configuration can'be changed.  The TextConverters also support specifying a Configuration.

Hope that helps,

Richard

Translate
Feb 22, 2011 11:29 PM UTC

Hi Richard,

Thank you for the response. The use of OverflowPolicy is interesting. I will experiment with it more.

In the mean time, is there a way to draw the descenders so they extend outside of the container? InDesign is able to do this, where the descenders literally hang outside of the container boundary.

Will

Translate
Inspiring
Feb 24, 2011 7:31 PM UTC

It is possible.  The clipping is done by the scrollRect on the container.

What you'll want to do is subclass ContainerController and override updateVisibleRectangle.  You could either copy the existing code and compute an adjusted width/height or call super and then adjust the scrollRect to include descenders if necessary.  The scroll rect does the clipping.

If you're using TextContainerManager then you'll want to subclass drawBackgroundAndSetScrollRect.  See CustomTextContainerManager in this testing application in the open source depot.

http://sourceforge.net/adobe/tlf/svn/451/tree/trunk/asTestApps/src/TCMTester.as

In this case it's expanding the scollRect for drawing a border but it's a similar idea.

Hope that helps,

Richard

Translate