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

Package | flash.text.engine
Class | public final class FontMetrics
Inheritance | FontMetrics 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
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
|  | 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
|  | prototype : 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
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | FontMetrics(emBox:Rectangle, strikethroughPosition:Number, strikethroughThickness:Number, underlinePosition:Number, underlineThickness:Number, subscriptScale:Number, superscriptScale:Number) Creates a FontMetrics object. | FontMetrics
|  | 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
|  | 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

emBox | property

`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

FontMetrics class overview

strikethroughPosition | property |

`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

FontMetrics class overview

strikethroughThickness | property |

`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

FontMetrics class overview

subscriptScale | property |

`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

FontMetrics class overview

superscriptScale | property |

`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

FontMetrics class overview

underlinePosition | property |

`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

FontMetrics class overview

underlineThickness | property |

`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

FontMetrics class overview
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

FontMetrics class overview
flash.text.engine.ElementFormat.getFontMetrics()

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