• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

last line in the container ignoring descenders

Guest
Feb 22, 2011 Feb 22, 2011

Copy link to clipboard

Copied

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

TOPICS
Text layout framework

Views

2.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 22, 2011 Feb 22, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 22, 2011 Feb 22, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 25, 2011 Feb 25, 2011

Copy link to clipboard

Copied

OverflowPolicy allows me to specify FIT_DESCENDERS or FIT_ANY, giving me choices of "the whole line must fit" or "any part of line fits," respectively. What InDesign does is in between, more like a "FIT_ASCENDERS," where the line fits if the whole ascender fits. Is there a way to achieve this? FIT_ASCENDERS is too "strict," while FIT_ANY is too "broad."

Thank you for your help.

Will

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 28, 2011 Feb 28, 2011

Copy link to clipboard

Copied

What might work for you is if you leave the Configuration setting as FIT_ANY, but then have an UpdateCompletionEvent listener that checks the last line. With FIT_ANY, the last line is included even if only a pixel of it fits. You could get the TextFlowLine for the last line, and see if the ascenders fit. If they do *not* fit, then resize the container so the height is exactly enough to fit the previous line.

We have the idea for adding another option to the OverflowPolicy, but haven't gotten to that yet. Sorry about that.

Please let us know if this solution works for you.

Thanks,

- robin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 28, 2011 Feb 28, 2011

Copy link to clipboard

Copied

Hi Robin,

Thank you for the help.

To clarify, if I want to do this in an editable environment, then I would restore the container height to "original" at the start of compose. At update complete event, I would check the last line of the container, resize the container height if needed, and update controllers if change occurred. And if I have multiple containers for the text flow, then I would go through each container, recompose after a container has changed height, as moving lines can affect subsequent containers. Does this sound right?

Will

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 01, 2011 Mar 01, 2011

Copy link to clipboard

Copied

Yes, that sounds right. To change the height *before* composition, you can do it from a FlowOperationEvent "flowOperationBegin" listener.

- robin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 01, 2011 Mar 01, 2011

Copy link to clipboard

Copied

Thanks! I will give this a try.

Will

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2011 Mar 15, 2011

Copy link to clipboard

Copied

HI...

I had issue regarding text flow. I have one editable text area in which I am getting fixed data from IDML.on that text area user can also add,edit,update text.

If user enters more text than TextArea height on save button it shoud give alert message that "Text going out of boundary of text area".

I am trying to R&D on descenders property that FIT_ANY with  UpdateCompletionEvent listener that checks the last line but didn't getting exactly how it will help me.

Please help me.

Thanks in advance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 16, 2011 Mar 16, 2011

Copy link to clipboard

Copied

Sounds like you are trying to detect text overflow? If you are, you can compare ContainerController's last character absolute position with TextFlow's total text length to see if text overflow occurred. If so, you can display the alert.

Will

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2011 Mar 16, 2011

Copy link to clipboard

Copied

Hi will,

Thanks for reply.

Yes exactly I want text overflow for that I had to work on textflow.textLength property also wiht the help of text container property.

I think ther is text flow CompositionCompleteEvent is useful for it but not getting how to use that one can u please tell me how to use that one.

Or is there other way to detect text overflow from text area boundary.

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 16, 2011 Mar 16, 2011

Copy link to clipboard

Copied

On updateComplete, you can do something like:

     var lastContainerController:ContainerController = textFlow.flowComposer.getControllerAt(textFlow.flowComposer.numControllers-1);

     if (lastContainerController.absoluteStart+lastContainerController.textLength < textFlow.textLength) {

          // text overflow

     }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2011 Mar 16, 2011

Copy link to clipboard

Copied

LATEST

Thanks will..

This is helpful for me.

I have got solution from CompositionCompleteEvent.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines