O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Determining Font Availability

To determine the list of device fonts and embedded fonts available at runtime, use the Font class's static method enumerateFonts( ). The enumerateFonts( ) method returns an array of Font objects, each of which represents an available device font or embedded font. The enumerateFonts( ) method defines a single Boolean parameter, enumerateDeviceFonts, which dictates whether the returned array includes device fonts. By default, enumerateDeviceFonts is false, so the array returned by enumerateFonts( ) does not include device fonts. Each Font object in the returned array defines the following variables describing the font it represents:

fontName

Indicates the name of the font. For device fonts, fontName is the name that appears in the system font list. For fonts embedded in the Flash authoring tool, fontName is the name that appears in the Font menu of the Font Symbol Properties dialog box used to embed the font. For fonts embedded using the [Embed] metadata tag, fontName is the string value specified for the fontFamily parameter of the [Embed] tag used to embed the font.

fontStyle

Indicates the font variation (regular, bold, italic, or bold-italic) as one of the following four ActionScript constants: FontStyle.REGULAR, FontStyle.BOLD, FontStyle.ITALIC, FontStyle.BOLD_ITALIC.

fontType

Indicates whether the font is an embedded font or a device font. This variable refers to one of the following two ActionScript constants: FontType.EMBEDDED, or FontType.DEVICE.

Example 27-16 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required