Embedding Fonts in Flex
Jan 04
Recently I was faced with the challenge of embedding fonts in Flex. This enables you to set the alpha and rotation of text, which doesn’t work with standard device fonts. If you’re familiar with Flash you can set which fonts to embed by editing a text field’s properties. To achieve the same effect in Flex is a little different. First you need create a style and link to the font in your file system. Next you need to specify a fontFamily name and reference this name in any styles that you want to apply to your application. In the example below you can see that I’ve created a family called “arial” and associated it with all instances of mx.controls.Text.

The text field is created dynamically because I wanted to test embedding fonts on the fly. This still works for static fields that are created through mxml. Click here for more information on embedding fonts in Flex.
