Pacoteflash.text
Classepublic class Font
HerançaFont Inheritance Object

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.



Propriedades Públicas
 PropriedadeDefinido por
 Inheritedconstructor : 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
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Métodos Públicos
 MétodoDefinido por
  
enumerateFonts(enumerateDeviceFonts:Boolean = false):Array
[static] Specifies whether to provide a list of the currently available embedded fonts.
Font
  
Specifies whether a provided string can be displayed using the currently assigned font.
Font
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
[static] Registers a font class in the global font list.
Font
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Detalhes da propriedade
fontNamepropriedade
fontName:String  [read-only]

The name of an embedded font.


Implementação
    public function get fontName():String
fontStylepropriedade 
fontStyle:String  [read-only]

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


Implementação
    public function get fontStyle():String

Veja também

fontTypepropriedade 
fontType:String  [read-only]

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


Implementação
    public function get fontType():String

Veja também

Detalhes do método
enumerateFonts()método
public static function enumerateFonts(enumerateDeviceFonts:Boolean = false):Array

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

Parâmetros

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.

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

Exemplo

This exemplo 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 exemplo 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()método 
public function hasGlyphs(str:String):Boolean

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

Parâmetros

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

Retorna
Boolean — A value of true if the specified string can be fully displayed using this font.
registerFont()método 
public static function registerFont(font:Classe):void

Registers a font class in the global font list.

Parâmetros

font:Classe — The class you want to add to the global font list.