Home » Archive

Articles in the Fonts Category

AS3, Fonts »

[12 Jun 2008 | 2 Comments | ]

I just noticed that setting the unicode range of an embedded font with the “systemFont” parameter doesn’t seem to work.
The only way to embed a font properly while specifying a character range is to use the “source” parameter and point to the file you want to embed.
To point to your desired font, you can either use an absolute or a relative path:

absolute : “c:\windows\fonts\font.tff”
relative : “/directory/font.ttf”

Then, simply use the “unicodeRange” parameter as follow :

Embed(source="font_file_name", fontName="font_name", mimeType="application/x-font-truetype", unicodeRange="U+0030-U+0039,U+002E")]

To get a complete list of all the unicode ranges available in flash since …

AS3, Fonts »

[27 May 2008 | No Comment | ]

Just don’t forget to set the “embedFonts” property of your TextField at “true” in order to show the text:

import flash.text.TextField;
import flash.text.TextFormat;

[Embed(source="your_font_file_name", fontName="font_name_temp", mimeType="application/x-font")]
public static const FONT_NAME_TEMP_FONT:Class;

// create a new TextField
var tf_tmp:TextField = new TextField();

// don't forget this one
tf_tmp.embedFonts = true;

// and finally, just use the font name you specified earlier
tf_tmp.defaultTextFormat = new TextFormat("font_name_temp", 8, 0xFFFFFF);