We're using device fonts ("Arial,_sans") for our labels, etc., since our app will eventually be localized into all sorts of languages. However, we've noticed that the fonts look really aliased. Is there a way to fix this? Thanks!
Antialiasing with Device Fonts(5 posts) (4 voices)
I don't think that there's a way to control anti-aliasing on device fonts. Adobe's documentation says that the antiAliasType property of TextField can only be controlled if the font is embedded.
Is it possible to render embed font as a texture?
And does it reduce drawing calls this way? )
Are you trying to turn it into a bitmap font at runtime? I guess that's possible, but you'd need to figure out how to pack the characters into BitmapData yourself.
Some of people want anti-aliasing for device font in Japan(and asian country), and they have made bellow technique for native TextField and BitmapData:
var enlarge:Number = 2.0; var fontSize:int = 12; var textWidth:Number = 100; var textHeight:Number = 100; var tForm:TextFormat = new TextFormat("_等幅") // "_typewriter", in western tForm.size = fontSize * enlarge; var tf:TextField = new TextField(); tf.defaultTextFormat = tForm; tf.width = textWidth * enlarge; tf.height = textHeight * enlarge; tf.text = "デバイスフォントにアンチエイリアスをかけるよ。"; var tbd:BitmapData = new BitmapData(textWidth * enlarge, textHeight * enlarge, true, 0xffffff); var bd:BitmapData = new BitmapData(textWidth, textHeight, true, 0xffffff); tbd.draw(tf); var tb:Bitmap = new Bitmap(tbd); bd.draw(tb, new Matrix(1 / enlarge, 0, 0, 1 / enlarge)); var bm:Bitmap = new Bitmap(bd, PixelSnapping.ALWAYS); tbd.dispose(); addChild(bm);
I suggest this implementation to use anti-aliasing for device font in starling.Posted 2 years ago #
You must log in to post.