About the font managers

Note: This is an advanced topic. Most developers do not need to adjust the font managers for their applications.

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, AFE (Adobe Font Engine), and CFF, represented by the BatikFontManager, JREFontManager, AFEFontManager, and CFFFontManager classes, respectively.

The CFF font manager supports both TrueType and OpenType fonts. It also supports URL and system fonts. Use this manager for all CFF fonts.

The AFE font manager supports both TrueType and OpenType fonts. It also adds support for all non-CFF font embedding in Flex 4. The AFE font manager is the only font manager that you can use to transcode TrueType or OpenType fonts for non-CFF fonts. The fonts can only be referenced by a path to the font file, not by an OS-specific font name. 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 Batik font manager transcodes only TrueType fonts, but does not support TrueType Collections (*.ttc). 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, 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 following table shows which fonts are supported by which font managers:

CFF

Batik

AFE

JRE

Font type

TrueType, OpenType

TrueType

TrueType, OpenType

TrueType

Method of embedding

URL, system

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.BatikFontManager</manager-class> 
        <manager-class>flash.fonts.AFEFontManager</manager-class> 
         <manager-class>flash.fonts.CFFFontManager</manager-class> 
    </managers> 
</fonts>

The preference of <manager> elements is in reverse order. This means that by default the CFF 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 and then the Batik font manager. Finally, if the other font managers fail, the compiler checks to see whether the JRE font manager can transcode the font.