I've read tons of posts about setting the size of a TextField
to match the width of the string containing it. I'm looking for a way to do it the other way around. The TextField
in my application should have a fixed with and I want to squeeze the text in it by changing the width of a single character.
The solution I'm working width now decreases the size of the font until it fits into the TextField
, but I want to squeeze the text (so decreasing just width, not height) until it fits in the TextField
. Any ideas how to achieve this?
I don't think it's possible to scale font on a single axis.
The only thing i could think of is to bake the text field and scale the resulting bitmap:
var tf:TextField = new TextField();
tf.text = "bitmap text";
var myBitmapData:BitmapData = new BitmapData(80, 20);
myBitmapData.draw(tf);
var bmp:Bitmap = new Bitmap(myBitmapData);
this.addChild(bmp);