The Textrenderer Class
The TexTRenderer class was created to provide more control over the advanced anti-aliasing capabilities of embedded fonts.It is important when using this class to import it first at the beginning of your script, like this:
import flash.text.TextRenderer;
Properties
antiAliasType
Availability :
FP:8, AS:1.0Generic Template :
Textrenderer.antiAliasType;Description: This string literal property controls the specific anti-aliasing type for the movie. Available options are
- default
Using this option will restore anti-aliasing controls back to individual text fields. - off
This option will set all text fields' anti-aliasing to normal, overriding any individual settings. - on
This option will set all text fields' anti-aliasing to advanced, overriding any individual settings.
Example :This example will set anti-aliasing for all text fields to normal:
import flash.text.TextRenderer;
TextRenderer.antiAliasType = "off";
maxLevel
Availability :
FP:8, AS:1.0Generic Template :
Textrenderer.maxLevel;Description: This numerical value controls the level of ADF (Advanced Distance Fields) for all text fields in a movie; it can accept 3, 4, or 7, with 7 being of the highest quality.Example :
This example will set ADF level to the maximum setting:
import flash.text.TextRenderer;
TextRenderer.maxLevel = 7;
Methods
setAdvancedAntialiasingTable
Availability :
FP:8, AS:1.0Generic Template :
TexTRenderer.setAdvancedAntialiasingTable(font, style, color, advancedTable);Parameters:
- font
The name of the font to be used as a string literal. - style
The style being used as a string literal. Possible values are "bold," "bolditalic," "italic," and "none." - color
This string literal can either be "dark" or "light." - advancedTable
An array of object elements representing GSM settings for font .- fontSize
Pixel size of font . - insideCutOff
Affects stroke weight; is usually a positive number. - outsideCutOff
Affects stroke weight; is usually a negative number.
- fontSize
Description: This method will set up a custom CSM lookup table for a given font.Example :This example will create a lookup table for the Arial font:
import flash.text.TextRenderer;
//items to add to the arrau
var item_obj:Object =
{fontSize:12, insideCutoff:.5, outsideCutoff:-.5};
var item_obj2:Object =
{fontSize:15, insideCutoff:.9, outsideCutoff:-.91};
//create the array
var lookup_array:Array =
new Array(item_obj, item_obj2);
//setup the lookout table
TextRenderer.setAdvancedAntialiasingTable
("Arial", "bold", "dark", lookup_array);