flash.text.engine

# EastAsianJustifier - AS3

Package | flash.text.engine
Class | public final class EastAsianJustifier
Inheritance | EastAsianJustifier TextJustifier Object

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

The EastAsianJustifier class has properties to control the justification options for text lines whose content is primarily East Asian text.

Use the constructor `new EastAsianJustifier()` to create an EastAsianJustifier object before setting its properties. Setting the properties of an EastAsianJustifier object after it has been applied to a TextBlock does not invalidate the TextBlock.

View the examples

More examples

Justifying East Asian text

Related API Elements

JustificationStyle
LineJustification
TextBlock.textJustifier

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | composeTrailingIdeographicSpaces : Boolean Specifies whether ideographic spaces at the ends of lines should be composed or dropped during justification. | EastAsianJustifier
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | justificationStyle : String Specifies the justification style for the text in a text block. | EastAsianJustifier
|  | lineJustification : String Specifies the line justification for the text in a text block. | TextJustifier
|  | locale : String [read-only] Specifies the locale to determine the justification rules for the text in a text block. | TextJustifier

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku") Creates an EastAsianJustifier object. | EastAsianJustifier
|  | clone():flash.text.engine:TextJustifier [override] Constructs a cloned copy of the EastAsianJustifier. | EastAsianJustifier
|  | getJustifierForLocale(locale:String):flash.text.engine:TextJustifier [static] Constructs a default TextJustifier subclass appropriate to the specified locale. | TextJustifier
|  | 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
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | 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

### composeTrailingIdeographicSpaces

property

`composeTrailingIdeographicSpaces:Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.3, AIR 2.7

Specifies whether ideographic spaces at the ends of lines should be composed or dropped during justification.

The default value is `false`

Implementation
`public function get composeTrailingIdeographicSpaces():Boolean`
`public function set composeTrailingIdeographicSpaces(value:Boolean):void`

### justificationStyle

property

`justificationStyle:String`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

Specifies the justification style for the text in a text block.

The default value is `JustificationStyle.PUSH_IN_KINSOKU`.

Use one of the constants in the JustificationStyle class to set the value for this property. The following table lists the possible values:

String value | Description
--- | ---
`JustificationStyle.PUSH_IN_KINSOKU` | Specifies push in justification.
`JustificationStyle.PUSH_OUT_ONLY` | Specifies push out justification.
`JustificationStyle.PRIORITIZE_LEAST_ADJUSTMENT` | Specifies justification wherein the least adjustment is prioritized.

Implementation
`public function get justificationStyle():String`
`public function set justificationStyle(value:String):void`

Related API Elements

JustificationStyle
Constructor Detail

### EastAsianJustifier

()
Constructor

`public function EastAsianJustifier(locale:String = "ja", lineJustification:String = "allButLast", justificationStyle:String = "pushInKinsoku")`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

Creates an EastAsianJustifier object.

Parameters

| `locale:String` (default = "`ja`")`` — The locale to determine the justification rules. The default value is `"ja"`.
| `lineJustification:String` (default = "`allButLast`")`` — The type of line justification for the paragraph. Use `LineJustification` constants for this property. The default value is `LineJustification.ALL_BUT_LAST`.
| `justificationStyle:String` (default = "`pushInKinsoku`")`` — The justification style for the text in a text block using an East Asian justifier. Use `JustificationStyle` constants for this property. The default value is `JustificationStyle.PUSH_IN_KINSOKU`.

Throws

| `ArgumentError` — The `locale` specified is `null` or too short to represent a valid locale.
| `ArgumentError` — The `lineJustification` specified is not a member of `LineJustification`.
| `ArgumentError` — The `justificationStyle` specified is not a member of `JustificationStyle`.

Related API Elements

JustificationStyle
LineJustification
Method Detail

### clone

()
method

`override public function clone():flash.text.engine:TextJustifier`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5, Flash Lite 4

Constructs a cloned copy of the EastAsianJustifier.

Returns

| `flash.text.engine:TextJustifier` — A copy of the `EastAsianJustifier` object.

Examples How to use this example
EastAsianJustifierExample.as
This example displays a block of Japanese text vertically, using EastAsianJustifier properties to justify the text.
Copy

    package {
        import flash.text.engine.TextBlock;
        import flash.text.engine.TextLine;
        import flash.text.engine.TextElement;
        import flash.text.engine.TextBaseline;
        import flash.text.engine.EastAsianJustifier;
        import flash.text.engine.LineJustification;
        import flash.text.engine.TextRotation;
        import flash.text.engine.FontDescription;
        import flash.text.engine.ElementFormat;
        import flash.display.Stage;
        import flash.display.Sprite;
        import flash.system.Capabilities;

        public class EastAsianJustifierExample extends Sprite {

            public function EastAsianJustifierExample():void {

                var Japanese_txt:String = String.fromCharCode(
                    0x5185, 0x95A3, 0x5E9C, 0x304C, 0x300C, 0x653F, 0x5E9C, 0x30A4,
                    0x30F3, 0x30BF, 0x30FC, 0x30CD, 0x30C3, 0x30C8, 0x30C6, 0x30EC,
                    0x30D3, 0x300D, 0x306E, 0x52D5, 0x753B, 0x914D, 0x4FE1, 0x5411,
                    0x3051, 0x306B, 0x30A2, 0x30C9, 0x30D3, 0x30B7, 0x30B9, 0x30C6,
                    0x30E0, 0x30BA, 0x793E, 0x306E
                ) +
                "FMS 2" +
                String.fromCharCode(0x3092, 0x63A1, 0x7528, 0x3059, 0x308B, 0x3068,
                    0x767a, 0x8868, 0x3057, 0x307e, 0x3057, 0x305F, 0x3002);

                var textBlock:TextBlock = new TextBlock();
                var font:FontDescription = new FontDescription();
                var format:ElementFormat = new ElementFormat();
                format.fontSize = 12;
                format.locale = "ja";
                format.color = 0xCC0000;
                textBlock.baselineZero = TextBaseline.IDEOGRAPHIC_CENTER;
                textBlock.textJustifier = new EastAsianJustifier("ja", LineJustification.ALL_INCLUDING_LAST);
                textBlock.lineRotation = TextRotation.ROTATE_90;
                var linePosition:Number = this.stage.stageWidth - 75;
                if (Capabilities.os.search("Mac OS") > -1)
                    // set fontName: Kozuka Mincho Pro R
                    font.fontName = String.fromCharCode(0x5C0F, 0x585A, 0x660E, 0x671D) + " Pro R";
                else
                    font.fontName = "Kozuka Mincho Pro R";
                textBlock.content = new TextElement(Japanese_txt, format);
                var previousLine:TextLine = null;

                while (true)
                {
                    var textLine:TextLine = textBlock.createTextLine(previousLine, 320);
                    if (textLine == null)
                        break;
                    textLine.y = 20;
                    textLine.x = linePosition;
                    linePosition -= 25;
                    addChild(textLine);
                    previousLine = textLine;
                }
            }
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00