Skip to main content
February 22, 2011
Question

last line in the container ignoring descenders

  • February 22, 2011
  • 1 reply
  • 2690 views

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 has been closed for replies.

1 reply

Adobe Employee
February 22, 2011

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

February 22, 2011

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

Adobe Employee
February 24, 2011

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