Hi!
I need to display antialiased systemfonts (because the swf filesize must be small, therefore i can't embedd fonts). So I wrote this script in order to manually antialias the text
Code:
public function renderTextField():BitmapData{
var w:int = this["mainTextField"].textWidth+10;
var h:int = this["mainTextField"].textHeight+10;
var bitmapData:BitmapData = new BitmapData(w*3,h*3,false,0x000000);
var antialiased:BitmapData = new BitmapData(w,h,false,0x000000);
var transf:Matrix = new Matrix();
transf.scale(3,3);
bitmapData.draw(this["mainTextField"],transf);
var bitmap:Bitmap = new Bitmap(bitmapData,"auto",true);
transf = new Matrix();
transf.scale(1.0/3.0,1.0/3.0);
antialiased.draw(bitmap,transf,null,null,null,true);
return antialiased;
}
this works pretty well, but there's a nasty thing. Sometimes the scaling of the draw call affects the texts formatting. for example, the last word of a line will be the first word of the next line instead. This must not happen! does anyone have an idea why it happens and how i can avoid it? i want the text to be rendered into the bitmapData exactly as it appears in the textbox
thanks!