TextArea and Embbeded Fonts

The subject of embedding fonts in the TextArea Component came up yesterday. I didn’t know the answer. But, after some research I found the following works with regular text.

Create a TextArea on the stage. Add some text to the text property in the Component Inspector.

Give the TextArea the Instance name: a_txt.

Create a new Font in the Library, by clicking the little button in the upper right of the library. Choose New Font. Choose the Font and size. Click OK. Find the find in the Library, right click, choose: Linkage. In the Linkage box select Export for ActionScript. Note the Class name. In my example it was Font1.

Add the following on a frame or in class that can access the text Area.

var font:Font = new Font1() as Font;
var tf:TextFormat = new TextFormat();
tf.font = font.fontName;

a_txt.textField.embedFonts = true;
a_txt.setStyle( “textFormat”, tf );

Leave a Reply

Your email address will not be published. Required fields are marked *