开发者

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


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

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


//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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜