Code.Blodded
Code.Blodded

Reputation: 231

why does setting different scaleX and scaleY for textfield distorts the text?

i have a textField wherein i uses embedded fonts, the problem is when i change its size and i do not set the SAME scaleX and scaleY value, it seems to compress the letters inside it when i make it smaller, and stretch the text when i make it bigger...

i tried using width and height values (instead of scaleX and scaleY but its the same result)... it seems that the embedded fonts are maintaining some kind of aspect ratio or whatever, and again this only happens when embedFonts is set to true

Upvotes: 2

Views: 1304

Answers (2)

Benny
Benny

Reputation: 2228

//Why don't you use "device fonts"?

var tf:TextField = new TextField();
tf.text = "benny";
var myBitmapData:BitmapData = new BitmapData(300, 300);
myBitmapData.draw(tf);
var bmp:Bitmap = new Bitmap(myBitmapData);
this.addChild(bmp);
bmp.width = bmp.height = 1200;

bmp.x = stage.stageWidth/4;
bmp.y = stage.stageHeight/4;

Upvotes: 0

Corey
Corey

Reputation: 5818

An easy solution for maintaining a ratio is to use width/height and scaleX/Y together:

textField.width = 250;
textField.scaleY = textField.scaleX;

Upvotes: 2

Related Questions