Posted in as3 by nicoB on March 2nd, 2008
In my last project I lost some time just to set a textformat to a simple textfield. The font was well linked in the librairy, but the textformat (particularly the font) didn’t apply to the textfield.
I found the reason : flash renames bitmap fonts and adds the suffix : _SIZEpt_st.
- Verdana becomes Verdana_12pt_st
- Arial becomes Arial_12pt_st
- etc.
For example : You want to use a Verdana Bitmap 12px :
Create a new Font in the library, and export it to Actionscript :

If you create a TextFormat and Apply “Verdana” font, it won’t work :
import flash.text.TextFormat;
//create Textfield
var txt : TextField = new TextField();
txt.width = 200;
txt.height = 20;
txt.text = "I’m not in Verdana Bitmap";
addChild(txt);
//apply textformat
var format : TextFormat = new TextFormat();
format.font = "Verdana";
txt.setTextFormat(format);
The reason is : the font is renamed to “Verdana_12pt_st” :
import flash.text.TextFormat;
//create Textfield
var txt : TextField = new TextField();
txt.width = 200;
txt.height = 20;
txt.text = "I’m in Verdana Bitmap";
addChild(txt);
//apply textformat
var format : TextFormat = new TextFormat();
format.font = "Verdana_12pt_st";
txt.setTextFormat(format);
The trick to get the embedded fonts list on your flash file:
var embeddedFonts:Array = Font.enumerateFonts(false);
for (var i:uint = 0; i < embeddedfonts.length; i++){
var f : Font = embeddedFonts[i];
trace(f.fontName);
}

March 17th, 2008 at 4:25 am
wow it’s good to know that !
April 25th, 2008 at 4:17 pm
Merci , on comprend mieux pourquoi un bon flasheur est un flasheur qui connait les bugs
Et félicitation, être cité sur le blog PV3D, c’est la classe
June 30th, 2008 at 6:53 am
Great to know–how did you find this out?
October 18th, 2008 at 5:45 pm
Another way to guarantee that you are getting the correct font name (without using the for loop)…
After embedding the font in the library (with identifier “MyArialBMP”
:
var myArial:MyArialBMP = new MyArialBMP();var fontname:String = myArial.fontName;
var format:TextFormat = new TextFormat();
format.font = fontname;