Home > actionscript 2, actionscript 3, flash, flex > ‘W’ Arial text cut off fix for as2 and as3

‘W’ Arial text cut off fix for as2 and as3

December 15th, 2008

Three times today while browsing the internet I saw the front part of “W” get cut off in a swf, so I thought I would post one way to deal with this.
All that you need to do is set your TextFormat leftMargin to .6. Not entirely sure why its .6, but I checked and in both as2 and as3 .6 solves it and .5 does not. Most likely it is rounding to 1 pixel, but I have found .6 can be farther to the left than setting it to 1. The reasoning for making it as small as possible is so that you can do it to all TextFormat instances used on dynamic TextFields without shifting text throughout your app to the right.

So in both as2 and as3 -
var tf:TextFormat = new TextFormat();
tf.leftMargin = .6;
textFieldYourUsing.setTextFormat(tf);

Here is an example in as3 -

Here is an example in as2 -

You can grab the not very interesting source code here.

actionscript 2, actionscript 3, flash, flex

  1. January 21st, 2009 at 19:00 | #1

    hey, thanks for the as2 advice. I have this app that I built about a year ago which required embedded fonts because it would allow users to create textfields. I had to compile the fonts into the swf before knowing about this and the whole thing turned out to be 900kb! Now with use of dynamic loading, I got the filesize down to 150kb without any sort of noticeable hangup. Thank you very much!

  1. No trackbacks yet.