|Articles & Tutorials|
|Flash CS5 - Embedding custom fonts|
|Thursday, 09 June 2011 15:42|
Embedding fonts is necessary when you're using a custom font in a non-static text field, because you can't be sure that the end user will have it installed in its machine.
There are many ways to do it. Let's see a first procedure.
Go to "Text -> Font Embedding...", in the Top menu:
or, in the same way, right-click on the Library window and select "New Font..."
The Font Embedding window will open.
If the Font frame on the left is empty, or you just want to add another font, press the + button.
Now, select the custom font you want to embed from the Family drop-menu, and choose its Style. For example, I'm embedding Gunship, with Regular style. Give a name to your Font (in my case, it's "MyFont").
Now, you have to select which glyphs you want to include for your fonts. Just remember that the more characters you include, the bigger your final swf will be, so choose wisely. For example, if you need that font only for a player score text, you should embed only numerals. If you want to include other characters, just put them in the "Also include these characters" frame. For example, I'm including the "-" symbol along with all numerals.
Also, if you want to access the font in ActionScript, go to the Actionscript tab and select "Export for ActionScript". It will automatically select the other options and assign a Class name.
If you're using a font for a TLF text container, select TLF (DF4) as the Outline Format, otherwise select Classic (DF3).
We're done, press OK and your font will appear in the Library.
If you still need to modify your font properties, just right-click on it and select "Properties..."
Let's see another procedure. Let's say we already have a dynamic text field in our stage, with our custom font set:
A faster way to embed its font would be to the Properties inspector, while our text field is still selected, and press the "Embed..." button
And, as before, the Font Embedding window will appear, this time with the text field font already selected.