ActionScriptCompiler 2.0 (ASC 2.0) from Adobe no longer allows font embedding. Instead you must embed font SWFs.
From the release notes: “Font transcoding has been removed from [Embed] syntax. Fonts should be pre-transcoded and embedded as a SWF, which can be performed using a tool like fontswf or Flash Professional CS6.”
This change caused problems with a project that uses MinimalComps from Keith Peters (www.minimalcomps.com) because the package uses an embedded pixel font. Solution below.
[UPDATE: 9/10] According to a TWEET by Thibault Imbert, font embedding will return in a future release of the new compiler.
Cutting to the chase:
I created pf_ronda_seven.swf from the pf_ronda_seven.ttf font using the fontswf command line utility bundled with Flash Builder 4.7 from labs.adobe.com. It was important to use the -3 option
when running fontswf so my font SWF would use DefineFont3 and be compatible with regular text fields. The default is DefineFont4 for creating text swfs for use with TLF text fields. For more context about DefineFont3 vs DefineFont4, read about Keith Peters’ experience with it when Flex 4 was released in 2010: www.bit-101.com/blog/?p=2555
To use the new font SWF I updated the Embed tag in Component.as:
[Embed(source="../../../../assets/pf_ronda_seven.swf", symbol="PF Ronda
I committed all this work (the fontSWF and updated Component.as) to GitHub:
For more related info, read on…
I also tried generating the font SWF with Flash CS 5.5 IDE. I found that I had to have the font enabled on my system with FontBook to create a functional font SWF. However, with the fontswf command line utility it’s not necessary to have the font enabled (nor, presumably, even installed). I also ensured that the DefineFont3 checkbox was selected in the font library symbol before publishing the SWF.
It may also be helpful to describe how to discover the fontName to use when creating your TextFormat object. This will show you all the fonts embedded in your SWF, and you can investigate each of them to find its fontSWF property:
Though, the symbol name you have to specify in the Embed tag for SWFs generated from the fontswf utility seems to be the same as the fontName String you must use when creating your TextFormat object, so you have to know that string to do your Embed in the first place… Nevertheless, the enumerateFonts property was helpful when I was working with the SWF generated from the Flash IDE, so maybe this tip will help someone else.