Packageflash.text.engine
Classpublic final class FontMetrics
InheritanceFontMetrics Inheritance Object

Language Version : ActionScript 3.0
Player Version : Flash Player 10

The FontMetrics class contains measurement and position information about a font. All measurements are in pixels. Objects of this class are returned by the flash.text.engine.ElementFormat.getFontMetrics() method.

See also

flash.text.engine.ElementFormat.getFontMetrics()


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
  strikethroughPosition : Number
The strikethroughPosition 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
  subscriptScale : Number
The subscriptScale value is the suggested scale factor to apply to the point size for a subscript.
FontMetrics
  superscriptScale : Number
The superscriptScale value is the suggested scale factor to apply to the point size for a superscript.
FontMetrics
  underlinePosition : Number
The underlinePosition 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, strikethroughPosition:Number, strikethroughThickness:Number, underlinePosition:Number, underlineThickness:Number, subscriptScale: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 the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail
emBoxproperty
public var emBox:Rectangle

Language Version : ActionScript 3.0
Player Version : Flash Player 10

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 might be a rect [L,T,R,B] of [0, -8.8, 10, 1.2].

See also

strikethroughPositionproperty 
public var strikethroughPosition:Number

Language Version : ActionScript 3.0
Player Version : Flash Player 10

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

Note that depending on the rotation of the line, this value should be 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 + strikethroughPosition. In a line with TextRotation.ROTATE_90, strikethrough.x = line.x - strikethroughPosition.

When applying decorations such as strike-throughs, the recomended 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 strikethroughPosition to place the strikethrough.

See also

strikethroughThicknessproperty 
public var strikethroughThickness:Number

Language Version : ActionScript 3.0
Player Version : Flash Player 10

The strikethroughThickness value is the suggested thickness for a strikethrough.

See also

subscriptScaleproperty 
public var subscriptScale:Number

Language Version : ActionScript 3.0
Player Version : Flash Player 10

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

superscriptScaleproperty 
public var superscriptScale:Number

Language Version : ActionScript 3.0
Player Version : Flash Player 10

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

underlinePositionproperty 
public var underlinePosition:Number

Language Version : ActionScript 3.0
Player Version : Flash Player 10

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

Note that depending on the rotation of the line, this value should be 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 + underlinePosition. In a line with TextRotation.ROTATE_90, underline.x = line.x - underlinePosition.

When applying decorations such as underlines, the recomended 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 underlinePosition to place the underline.

See also

underlineThicknessproperty 
public var underlineThickness:Number

Language Version : ActionScript 3.0
Player Version : Flash Player 10

The underlineThickness value is the suggested thickness for an underline.

See also

Constructor Detail
FontMetrics()Constructor
public function FontMetrics(emBox:Rectangle, strikethroughPosition:Number, strikethroughThickness:Number, underlinePosition:Number, underlineThickness:Number, subscriptScale:Number, superscriptScale:Number)

Language Version : ActionScript 3.0
Player Version : Flash Player 10

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

Parameters
emBox:Rectangle — The emBox of the font in pixels.
 
strikethroughPosition:Number — The position for a strikethrough in pixels.
 
strikethroughThickness:Number — The thickness for a strikethrough in pixels.
 
underlinePosition:Number — The position for an underline in pixels.
 
underlineThickness:Number — The thickness for an underline in pixels.
 
subscriptScale:Number — The scale to apply to the point size of a subscript.
 
superscriptScale:Number — The scale to apply to the point size of a superscript.

See also