How to display only one letter in Flex Text Layout Framework ContainerController?

Posted by rattkin on Stack Overflow See other posts from Stack Overflow or by rattkin
Published on 2010-04-23T23:19:28Z Indexed on 2010/04/23 23:23 UTC
Read the original article Hit count: 264

Filed under:
|
|
|

I'm trying to implement dropped initials feature into my Flex application. Since Text Layout Framework does not support floating, the only known solution is to create additional containers that will be linked together, displaying the same textflow. Width and positioning of these containers has to be set in such a way that it will pretend that it's float.

I'm using the same solution for dropped initials. Basically, I'm creating three containers, one for the initial letter (first letter in text flow), the other for text floating around, and the 3rd one to display text below these two. All these containers share one textflow.

I have big issues with forcing controller to display only one letter from the text flow, and size it accordingly, so that it wont take any unnecessary aditional space and won't get any more text into it.

Using ContainerController.getContentBounds() returns me size of whole sprite of the letter (with ascent/descent empty parts), not the height/width of the actual rendered letter. I'm using textFlow.flowComposer.getLineAt(0).getTextLine().getAtomBounds(0), but i think it's still not right. Also, even if I set container for this dimensions, it sometimes display additional text in it, especially for bigger fonts. See screen :

alt text

Also, if I set width to just 1px less that contentBounds, things are going crazy, containers are moved around, positioned with big margins, etc.

How should I solve this? Is it a bug in TLF / Player? Can I fix it somehow? Can I detect the size of the letter, or make containercontroller autosize to fit just one letter only?

© Stack Overflow or respective owner

Related posts about tlf

Related posts about flex