Jump to content
Search Community

How to prevent extra-space in Text-Controls

Boris test
Moderator Tag

Recommended Posts

Hi Transformers,

i 'm working on a design-application, where the user has the oppotunity to add formatted text to the FlexTransformer. But how can i prevent the extra space that is rendered inside the Text Control, when the user is scale up the Text-Control.I need the exact x and y values because the whole canvas will be exported to an svg-file. I attached a screenschot with my issue.screen_text.jpg

Link to comment
Share on other sites

  • 3 weeks later...

Would you please send me an example Flex project that demonstrates the issue? It does NOT need to be your actual production files - in fact, I prefer that it's not. It would be much better if you could keep the example as simple as humanly possible in order to isolate the issue for troubleshooting. I suspect there's something else going on in your code that's making the space appear there. FlexTransformManager doesn't add any space by itself - it simply does a getBounds() on your object and draws its selection accordingly, so your object must have stuff in it that goes beyond the edges of the TextField. Or it could be that you're using a font with some odd spacing characteristics.

Link to comment
Share on other sites

I looked at the sample you sent me. This actually has nothing to do with TransformManager - it's just how Flash/Flex works with TextFields. There is always 2 pixels of padding on TextFields according to the Adobe docs but of course if you scale the TextField up 10x its normal size, that means the pixel gap is 20 (2 pixels * 10). On top of that, each font has its own spacing characteristics - some extend the full height from the baseline, some don't. The only way you could accurately tell where the letters begin precisely is to either use BitmapData and look for the dark pixels or use the getLineMetrics() or getCharBoundaries() in conjunction with localToGlobal() and globalToLocal() or do the math from the matrix or transform properties manually. I realize this probably isn't the answer you were hoping for, but again, this has nothing to do with TransformManager. I wish I could be of more assistance.

 

Good luck!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...