Adobe® Flex® 4 Language Reference
Hide Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flash.text.engine 
FontMetrics 
Packageflash.text.engine
Classpublic final class FontMetrics
InheritanceFontMetrics Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The FontMetrics class contains measurement and offset information about a font. The flash.text.engine.ElementFormat.getFontMetrics() method returns objects of this class.

See also



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  emBox : Rectangle
The emBox value represents the design space of the font and is used to place Chinese, Korean, or Japanese glyphs relative to the Roman baseline.
FontMetrics
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  strikethroughOffset : Number
The strikethroughOffset value is the suggested vertical offset from the Roman baseline for a strikethrough.
FontMetrics
  strikethroughThickness : Number
The strikethroughThickness value is the suggested thickness for a strikethrough.
FontMetrics
  subscriptOffset : Number
The subscriptOffset value is the suggested vertical offset from the Roman baseline for a subscript.
FontMetrics
  subscriptScale : Number
The subscriptScale value is the suggested scale factor to apply to the point size for a subscript.
FontMetrics
  superscriptOffset : Number
The superscriptOffset value is the suggested vertical offset from the Roman baseline for a superscript.
FontMetrics
  superscriptScale : Number
The superscriptScale value is the suggested scale factor to apply to the point size for a superscript.
FontMetrics
  underlineOffset : Number
The underlineOffset value is the suggested vertical offset from the Roman baseline for an underline.
FontMetrics
  underlineThickness : Number
The underlineThickness value is the suggested thickness for an underline.
FontMetrics
Public Methods
 MethodDefined By
  
FontMetrics(emBox:Rectangle, strikethroughOffset:Number, strikethroughThickness:Number, underlineOffset:Number, underlineThickness:Number, subscriptOffset:Number, subscriptScale:Number, superscriptOffset:Number, superscriptScale:Number)
Creates a FontMetrics object.
FontMetrics
 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
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

emBox

property
public var emBox:Rectangle

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The emBox value represents the design space of the font and is used to place Chinese, Korean, or Japanese glyphs relative to the Roman baseline. Typically a square, sized to the point size of the font. The origin (coordinate 0,0) of the emBox is set to the left edge and Roman baseline of the rect. For example, for a 10-point font, the emBox can be a rect [L,T,R,B] of [0, -8.8, 10, 1.2].

See also

strikethroughOffset

property 
public var strikethroughOffset:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The strikethroughOffset value is the suggested vertical offset from the Roman baseline for a strikethrough.

Note that depending on the rotation of the line, this value is either added or subtracted from the position of the line to find the position for the strikethrough. In a line with TextRotation.ROTATE_0, strikethrough.y = line.y + strikethroughOffset. In a line with TextRotation.ROTATE_90, strikethrough.x = line.x - strikethroughOffset.

When applying decorations such as strikethroughs, the recommended procedure is to specify an eventMirror on the ContentElement which is to receive the decoration. In response to the flash.events.Event.ADDED event, the bounds of the TextLineMirrorRegion can be used in conjunction with the strikethroughOffset to place the strikethrough.

See also

strikethroughThickness

property 
public var strikethroughThickness:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The strikethroughThickness value is the suggested thickness for a strikethrough.

See also

subscriptOffset

property 
public var subscriptOffset:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The subscriptOffset value is the suggested vertical offset from the Roman baseline for a subscript.

The subscriptOffset value is used with ElementFormat.baselineShift to position the subscript.

See also

subscriptScale

property 
public var subscriptScale:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The subscriptScale value is the suggested scale factor to apply to the point size for a subscript. A scale factor of 1.0 means no scaling.

See also

superscriptOffset

property 
public var superscriptOffset:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The superscriptOffset value is the suggested vertical offset from the Roman baseline for a superscript.

The superscriptOffset value is used with ElementFormat.baselineShift to position the superscript.

See also

superscriptScale

property 
public var superscriptScale:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The superscriptScale value is the suggested scale factor to apply to the point size for a superscript. A scale factor of 1.0 means no scaling.

See also

underlineOffset

property 
public var underlineOffset:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The underlineOffset value is the suggested vertical offset from the Roman baseline for an underline.

Note that depending on the rotation of the line, this value is either added or subtracted from the position of the line to find the position for the underline. In a line with TextRotation.ROTATE_0, underline.y = line.y + underlineOffset. In a line with TextRotation.ROTATE_90, underline.x = line.x - underlineOffset.

When applying decorations such as underlines, the recommended procedure is to specify an eventMirror on the ContentElement which is to receive the decoration. In response to the flash.events.Event.ADDED event, the bounds of the TextLineMirrorRegion can be used in conjunction with the underlineOffset to place the underline.

See also

underlineThickness

property 
public var underlineThickness:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The underlineThickness value is the suggested thickness for an underline.

See also

Constructor Detail

FontMetrics

()Constructor
public function FontMetrics(emBox:Rectangle, strikethroughOffset:Number, strikethroughThickness:Number, underlineOffset:Number, underlineThickness:Number, subscriptOffset:Number, subscriptScale:Number, superscriptOffset:Number, superscriptScale:Number)

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Creates a FontMetrics object. The FontMetrics object contains information about the metrics of a font in an element format. The flash.text.engine.ElementFormat.getFontMetrics() method returns objects of this class.

Parameters
emBox:Rectangle — The emBox of the font in pixels.
 
strikethroughOffset:Number — The offset for a strikethrough in pixels.
 
strikethroughThickness:Number — The thickness for a strikethrough in pixels.
 
underlineOffset:Number — The offset for an underline in pixels.
 
underlineThickness:Number — The thickness for an underline in pixels.
 
subscriptOffset:Number — The offset for a subscript in pixels.
 
subscriptScale:Number — The scale to apply to the point size of a subscript.
 
superscriptOffset:Number — The offset for a superscript in pixels.
 
superscriptScale:Number — The scale to apply to the point size of a superscript.

See also