Flex includes several font managers to handle embedded fonts. The font managers take embedded font definitions and draw each character in Flash Player. This process is known as transcoding. The font managers are Batik, JRE, and AFE (Adobe Font Engine), represented by the BatikFontManager, JREFontManager, and AFEFontManager classes, respectively.
The Batik and JRE font managers can transcode TrueType fonts. The AFE font manager adds support for OpenType fonts.
The Batik font manager transcodes only TrueType URL fonts (embedded by using src:url). It does not transcode system fonts. If you specify the font location when you embed the font, the compiler will use the Batik font manager. In general, the Batik font manager provides smoother rendering and more accurate line metrics (which affect multiline text and line-length calculations) than the JRE font manager.
The JRE font manager transcodes TrueType system fonts (embedded by using src:local), but the quality of output is generally not as good as the Batik font manager. If you install the font on your system, the compiler will use the JRE font manager because the Batik font manager does not support system fonts.
The AFE font manager is the only font manager that you can use to transcode OpenType fonts. It can also transcode TrueType fonts, but the fonts can only be URL fonts, not system fonts. If you embed an OpenType font, the compiler will use the AFE font manager to transcode the font because the other font managers do not support OpenType fonts, unless that OpenType font is a system font, in which case, the compiler will throw an error. None of the font managers can transcode OpenType fonts that are embedded as system fonts.
The following table shows which fonts are supported by which font managers:
|
Batik |
AFE |
JRE |
|
|---|---|---|---|
|
Font type |
TrueType |
TrueType, OpenType |
TrueType |
|
Method of embedding |
URL |
URL |
System |
You determine which font managers the compiler can use in the flex-config.xml file. The default setting is to use all of them, as the following example shows:
<fonts>
<managers>
<manager-class>flash.fonts.JREFontManager</manager-class>
<manager-class>flash.fonts.AFEFontManager</manager-class>
<manager-class>flash.fonts.BatikFontManager</manager-class>
</managers>
</fonts>
The preference of <manager> elements is in reverse order. This means that by default the Batik font manager is the preferred font manager; the compiler checks to see if a font can be transcoded using it first. If not, then the compiler checks to see whether the font can be transcoded using the AFE font manager. Finally, if the other font managers fail, the compiler checks to see whether the JRE font manager can transcode the font.
If you experience compilation or transcoding errors related to fonts, you should first try changing the order of the font managers in the flex-config.xml file or by using the command-line compiler arguments.