gridFitType (TextField.gridFitType property)

public gridFitType : String

The type of grid fitting used for this TextField instance. This property applies only if the antiAliasType property of the text field is set to "advanced".

For the gridFitType property, you can use the following string values:

String value

Description

"none"

Specifies no grid fitting. Horizontal and vertical lines in the glyphs are not forced to the pixel grid. This setting is usually good for animation or for large font sizes.

"pixel"

Specifies that strong horizontal and vertical lines are fit to the pixel grid. This setting works only for left-aligned text fields. To use this setting, the antiAliasType property of the text field must be set to "advanced". This setting generally provides the best legibility for left-aligned text.

"subpixel"

Specifies that strong horizontal and vertical lines are fit to the subpixel grid on an LCD monitor. To use this setting, the antiAliasType property of the text field must be set to "advanced". The "subpixel" setting is often good for right-aligned or centered dynamic text, and it is sometimes a useful trade-off for animation versus text quality.

Availability: ActionScript 1.0; Flash Player 8

Example

This example shows three text fields that use the different gridFitType settings. It assumes that you have a font embedded in the Library with the linkage identifier set to "Times-12". To embed the font, follow these steps:

var my_format:TextFormat = new TextFormat();
my_format.font = "Times-12";

var my_text1:TextField = this.createTextField("my_text1", this.getNextHighestDepth(), 9.5, 10, 400, 100);
my_text1.text = "this.gridFitType = none";
my_text1.embedFonts = true;
my_text1.antiAliasType = "advanced";
my_text1.gridFitType = "none";
my_text1.setTextFormat(my_format); 

var my_text2:TextField = this.createTextField("my_text2", this.getNextHighestDepth(), 9.5, 40, 400, 100);
my_text2.text = "this.gridFitType = advanced";
my_text2.embedFonts = true;
my_text2.antiAliasType = "advanced";
my_text2.gridFitType = "pixel";
my_text2.setTextFormat(my_format); 

var my_text3:TextField = this.createTextField("my_text3", this.getNextHighestDepth(), 9.5, 70, 400, 100);
my_text3.text = "this.gridFitType = subpixel";
my_text3.embedFonts = true;
my_text3.antiAliasType = "advanced";
my_text3.gridFitType = "subpixel";
my_text3.setTextFormat(my_format);

If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is used in this example.

See also

TextRenderer (flash.text.TextRenderer), antiAliasType (TextField.antiAliasType property), sharpness (TextField.sharpness property)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002207.html