ActionScript 3.0 Language and Components Reference | All Packages | All Classes | Language Elements | Index | Appendixes | Conventions | Frames No Frames |
Font

Package | flash.text
Class | public class Font
Inheritance | Font Object

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

The Font class is used to manage embedded fonts in SWF files. Embedded fonts are represented as a subclass of the Font class. The Font class is currently useful only to find out information about embedded fonts; you cannot alter a font by using this class. You cannot use the Font class to load external fonts, or to create an instance of a Font object by itself. Use the Font class as an abstract base class.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | fontName : String [read-only] The name of an embedded font. | Font
|  | fontStyle : String [read-only] The style of the font. | Font
|  | fontType : String [read-only] The type of the font. | Font
|  | prototype : Object [static] A reference to the prototype object of a class or function object. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | enumerateFonts(enumerateDeviceFonts:Boolean = false):Array [static] Specifies whether to provide a list of the currently available embedded fonts. | Font
|  | hasGlyphs(str:String):Boolean Specifies whether a provided string can be displayed using the currently assigned font. | Font
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | registerFont(font:Class):void [static] Registers a font class in the global font list. | Font
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

fontName | property

`fontName:String` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

The name of an embedded font.

Implementation
`public function get fontName():String`

fontStyle | property |

`fontStyle:String` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

The style of the font. This value can be any of the values defined in the FontStyle class.

Implementation
`public function get fontStyle():String`

See also

flash.text.FontStyle

fontType | property |

`fontType:String` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

The type of the font. This value can be any of the constants defined in the FontType class.

Implementation
`public function get fontType():String`

See also

flash.text.FontType
Method Detail

enumerateFonts | () | method

`public static function enumerateFonts(enumerateDeviceFonts:Boolean = false):Array`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

Specifies whether to provide a list of the currently available embedded fonts.

Parameters

| `enumerateDeviceFonts:Boolean` (default = `false`)`` — Indicates whether you want to limit the list to only the currently available embedded fonts. If this is set to `true` then a list of all fonts, both device fonts and embedded fonts, is returned. If this is set to `false` then only a list of embedded fonts is returned.

Returns

| `Array` — A list of available fonts as an array of Font objects.

Example
This example first calls the static method `Font.enumerateFonts()` to get a list of all device and embedded fonts. Then it sorts the resulting Array of Font objects by the `fontName` property.

Next the example shows how to call the `Font.enumerateFonts()` method with the `enumerateDeviceFonts` parameter set to false. The resulting Array only includes embedded Font objects. (If you run this code within an application that does not contain any embedded fonts, the `embeddedFonts` array will be empty.)

    import flash.text.Font;

    var allFonts:Array = Font.enumerateFonts(true);
    allFonts.sortOn("fontName", Array.CASEINSENSITIVE);

    var embeddedFonts:Array = Font.enumerateFonts(false);
    embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE);

hasGlyphs | () | method |

`public function hasGlyphs(str:String):Boolean`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

Specifies whether a provided string can be displayed using the currently assigned font.

Parameters

| `str:String` — The string to test against the current font.

Returns

| `Boolean` — A value of `true` if the specified string can be fully displayed using this font.

registerFont | () | method |

`public static function registerFont(font:Class):void`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

Registers a font class in the global font list.

Parameters

| `font:Class` — The class you want to add to the global font list.

Submit Feedback on LiveDocs
© 2004-2008 Adobe Systems Incorporated. All rights reserved.
Tue May 20 2008, 04:02 AM -07:00