Using fonts in Flash 5 and later
Macromedia Flash provides flexibility for using fonts, during both authoring and playback. This TechNote provides an introduction to working with fonts in Flash 5 and later. For Flash 4 specific information on using fonts, see Using fonts in Flash 4 (TechNote 14171).
What types of fonts can Flash use?
In authoring mode, Flash can use TrueType, PostScript Type 1 (with Adobe Type Manager installed) and bitmap fonts. For more information, see What types of fonts can be used with Flash? (TechNote 4105).
Embedded and device fonts
For playback of Flash movies, there are two options for dealing with fonts. Font outlines can be embedded in the published SWF, or you can choose to let the Flash Player use fonts installed on the playback system. These latter types of fonts are called "device fonts".
The main benefit to embedding font outlines is that text fields will always display in the chosen font, regardless of whether that font is installed on the playback system. Also, text fields whose fonts are embedded will always be anti-aliased (smoothed) by the Flash Player.
Note: Bitmap fonts, and other fonts that do not contain outline information, will never anti-alias.
One drawback to embedding fonts is an increase in SWF file size. If several different movies use the same font or fonts, you can reduce file size by using shared font symbols. See Using font symbols (TechNote 14786) for more information.
Using device fonts results in a smaller movie size, since font data is not included in the file. Device fonts are often a good choice for displaying text at small point sizes, as anti-aliased text can be blurry at small sizes. See Small fonts are blurry and hard to read (TechNote 14420) for more information. Device fonts are a good choice for large blocks of text, such as scrolling text.
Text fields that use device fonts may not display the same across different systems and platforms, however, since Flash Player uses fonts installed on the system. For the same reason, device fonts will not anti-alias and may appear jagged at large point sizes. Flash device font "types" offer a compromise between the display consistency offered by embedded fonts and the small file size of using device fonts.There are someother limitations to consider when using device fonts.
The different types of text fields in Flash -- Static, Dynamic, and Input -- behave differently in terms of how fonts are included, or not included. These differences are discussed next.
Static text fields
By default, font outlines for characters used in a Static text field are included in a published SWF. As a result, Static text fields will anti-alias. Because outlines for just those characters used in a Static text field are included in the published SWF, and not every character in the font, Static text fields are a good choice for animating small amounts of anti-aliased text.
If you want a Static text field to use device fonts, select the Use Device Fonts option in the Text Options panel.
Choosing this option has two effects:
| 1 | Text contained in the field will not be anti-aliased (smoothed) by Flash Player during playback. This can improve legibility for text at small point sizes, while making text at larger sizes appear jagged. See Small fonts are blurry and hard to read (TechNote 14420) for more information. Anti-aliasing can affect performance, so select this option if optimal frame rate is more important than smooth fonts edges. |
| 2 | If the font used to create the text field is installed on the playback system, Flash Player will use that font to display the text. Otherwise, Flash Player will substitute a font installed on the playback system. Typically, a standard font such as Times will be used. To get more consistent display using device fonts use one of Flash's device font "types". |
Note: A Static text field in Flash 5 and later is analogous to a "type block" in Flash 4. See the Flash 4 TechNote Using type blocks and text fields in Flash (TechNote 14154).
Dynamic and Input text fields
Font outlines for Dynamic and Input text fields are, by default, not embedded in published SWFs. Consequently, these types of text fields will not anti-alias. To have Dynamic or Input text fields anti-alias, you must embed font outlines for the chosen font. The various Embed fonts options in the Text Options panel (see illustration below) allow you to embed outlines for the entire font, capital letters, lowercase letters, numbers, punctuation, or specific characters of your choosing.
For example, for an Input text field that is meant to only accept numbers, you might choose the option to only embed font outlines for numbers. This will help keep file size down in the published SWF.
If font outlines for a Dynamic or Input text field are not embedded, it will behave similarly to a Static text field with Use Device Fonts enabled (see above).
Note: Dynamic and Input text fields in Flash 5 are analogous to non-editable and editable"text fields", respectively, in Flash 4. See the Flash 4 TechNoteUsing type blocks and text fields in Flash (TechNote 14154).
Device fonts"types"
A compromise between the display consistency of embedded fonts and the smaller file size of using device fonts is to use one of Flash's device font "types". The Fonts pop-up menu in the Character panel contains three of these fonts: _sans, _serif, and _typewriter. These fonts define a general font type for a text field that, during playback, will be substituted with an installed font that matches that type. For example, on Windows systems, Flash Player (typically) substitutes Times New Roman ; a common Windows font ; for _serif. The following table shows how the font types typically map to commonly installed fonts on Windows and Macintosh platforms.
| Device font type | Windows | Macintosh |
| _sans | Arial | Helvetica |
| _serif |
Times New Roman | Times |
| _typewriter | Courier New | Courier |
Note: For Static text fields, even if Use Device Fonts is not selected in the Text Options panel, choosing one of these fonts will cause Flash Player to use device fonts.
Limitations of device fonts
Because Flash Player relies on the system to display device fonts (including thefont types discussed above) there are some limitations on animating and tweening text that use device fonts.
| |
Device fonts cannot be masked. Although the mask may display correctly inside the Flash authoring environment, the final SWF will not display the text block. |
| |
Device fonts cannot be alpha tweened. A device font used in a symbol can be motion tweened, but any alpha changes applied to the symbol will not display for the device font's text block. |
| |
Device fonts cannot be scaled or rotated. Again, scaling or rotating may display fine during authoring, but will cause text to disappear in the published SWF. A text field that has been scaled or rotated, or a text field inside a symbol that has been scaled or rotated, will not display text. |
Summary
While authoring a Flash movie, you have the option of using TrueType, PostScript Type 1 (with ATM installed), and bitmap fonts. For playback, you can choose to either include font outlines in the published SWF, or use fonts already installed on the playback system (device fonts). Text fields whose fonts are embedded will always display in the chosen font and will anti-alias.
Using device fonts can keep SWF file size down since font outlines are not included in the SWF. However, text fields that use device fonts may display differently on different systems and platforms. Device font "types" provide a way to maintain some degree of control text appearance without including font outlines. Device fonts also often make text at small point sizes more readable.
Font outlines for characters used in Static text fields are embedded (and, therefore, anti-alias), unless the Use Device Fonts option is selected in the Text Options panel. Conversely, font outlines for Dynamic and Input text fields are, by default, not embedded (and, therefore, do not anti-alias), unless one or more of the Embed fonts options are selected.
Additional information
| |
Breaking apart text Text can also be broken apart (Modify > Break apart) into its component lines and fills. Typically, you would only want to do this when you need to shape tween a text block into another shape. Breaking apart large amounts of text can increase file size significantly. |
| |
HTML formatting Choosing the HTML formatting option for a Dynamic or Input text field will cause that text field to always anti-alias. For more information about using HTML in Flash seeUsing HTML text formatting in Flash (TechNote 14808). |
See the Using Type section of the Flash support center for more information on using fonts in Flash. For more details on managing and installing fonts see Font installation on Windows (TechNote 3649) or Font installation on the Macintosh (TechNote 3648).
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
