Sep 30

You have a flash / flex application where you want to allow users to customize the text formatting, font style / font weight for some text box. So you would provide a small set of fonts which would all get embedded into the swf.

If we working with external fonts in Actionscript 3.0, the external font must have a class definition for allowing the Font class and ApplicationDomain to detect and register it. We can produce class definition for the external font  with embed tag in Flex or Font symbol in Flash library. 

In Flash CS3 you can create a font symbol in the library, and export it for ActionScript. But with this way if you embed the font in the library then flash automatically embeds all available characters. So the compiled external font swf size will increased and bloated the load-time with unused fonts. This was the largest issues especially if we working with Asian fonts. You can find more informations about it in this nice article

With Flex 3.0 and mxmlc (Flex SDK 2-3) there’s the embed metatag where you can even define font character ranges which should be embedded for reducing compiled external font swf size:

[Embed(	source='font.ttf', 
	fontName='Font Name', 
	unicodeRange='U+0021-U+0021, ... , U+2122-U+2122')]

or with this tag :
Read the rest of this entry »