I am trying to convert text characters into bitmap and rendering them.
The quality of the bitmap rendered is poor.
The code is inline. The bitmap is rendered first and then the source textfield is placed underneath for
comparison. The quality becomes noticeably better as the font size is increased…
I appreciate any pointers into making the bitmap quality better at this font size.
thanks,
-jlogan
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
public class Tbm extends Sprite
{
private var str:String = "abcdefghijklmnopqrstuvwxyz";
public function Tbm()
{
var fmt:TextFormat;
var bmd:BitmapData;
var bm:Bitmap;
var tf:TextField;
var len:int;
var dx:Number= 0;
fmt = new TextFormat();
fmt.font = "Arial";
fmt.size = 8;
len = str.length;
for (var i:int = 0; i < len; i++) {
tf = new TextField();
tf.text = str.charAt(i);
tf.setTextFormat (fmt);
tf.autoSize = TextFieldAutoSize.LEFT;
bmd = new BitmapData (tf.width, tf.height, true, 0);
bmd.draw (tf);
bm = new Bitmap (bmd);
bm.x+=dx;
bm.smoothing = true;
dx+= bm.width;
addChild (bm);
tf.x = bm.x;
tf.y = bm.height;
addChild (tf);
}
}
}
}