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

Language version: ActionScript 3.0
Runtime version: AIR 1.5

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

See also

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
  lineGap : Number
The lineGap value is the suggested gap between lines.
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, lineGap:Number = 0.0)
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
emBoxproperty
public var emBox:Rectangle

Language version: ActionScript 3.0
Runtime version: 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].

lineGapproperty 
public var lineGap:Number

Language version: ActionScript 3.0
Runtime version: AIR 2.6

The lineGap value is the suggested gap between lines.

This value is set by the font designer, and can vary widely from font to font. In a multi-script font, different line gaps may be suitable for different scripts; no single value may suffice. Furthermore, different kinds of text usage for a particular script (for example, whether Japanese text is annotated with ruby or not) may require different line gaps.

strikethroughOffsetproperty 
public var strikethroughOffset:Number

Language version: ActionScript 3.0
Runtime version: 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 to a TextLine, the recommended procedure is to specify an eventMirror on the ContentElement which is to receive the decoration. In response to the Event.ADDED event, the bounds of the TextLineMirrorRegion can be used in conjunction with the strikethroughOffset to place the strikethrough.

See also

strikethroughThicknessproperty 
public var strikethroughThickness:Number

Language version: ActionScript 3.0
Runtime version: AIR 1.5

The strikethroughThickness value is the suggested thickness for a strikethrough.

subscriptOffsetproperty 
public var subscriptOffset:Number

Language version: ActionScript 3.0
Runtime version: 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

subscriptScaleproperty 
public var subscriptScale:Number

Language version: ActionScript 3.0
Runtime version: 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.

superscriptOffsetproperty 
public var superscriptOffset:Number

Language version: ActionScript 3.0
Runtime version: 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

superscriptScaleproperty 
public var superscriptScale:Number

Language version: ActionScript 3.0
Runtime version: 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.

underlineOffsetproperty 
public var underlineOffset:Number

Language version: ActionScript 3.0
Runtime version: 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 to a TextLine, the recommended procedure is to specify an eventMirror on the ContentElement which is to receive the decoration. In response to the Event.ADDED event, the bounds of the TextLineMirrorRegion can be used in conjunction with the underlineOffset to place the underline.

See also

underlineThicknessproperty 
public var underlineThickness:Number

Language version: ActionScript 3.0
Runtime version: AIR 1.5

The underlineThickness value is the suggested thickness for an underline.

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, lineGap:Number = 0.0)

Language version: ActionScript 3.0
Runtime version: 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.
 
lineGap:Number (default = 0.0)

See also