[Update: Out of respect for people who don't have Flash Player 10 you now have to click on the image to launch the example.]

The new low-level text engine in Flash Player 10 is quite complex and most Flash developers won’t use it directly. Adobe is planning on releasing an advanced set of text components later this year that utilizes the new engine and will provide an easy way for developers to take advantage of the new features. With that being said, if you WANT to roll your sleeves up and use the engine by all means go for it. Perhaps you can develop some great components for the rest of us to use.

Below is an example of the new advanced ligature support in Flash Player 10. There are two things that you need in order to see the demo. The first is obviously Flash Player 10. The second is the font Adobe Caslon Pro which should already be installed if you have CS3.

The TextLine class is a new DisplayObject that contains blocks of text built with the new engine. The ElementFormat class sets up the format of a particular block of text and allows you to set, among other things, the type of ligatures to use. You supply a value from the LigatureLevel class. This demo below shows the difference between two of the modes, LigatureLevel.EXOTIC and LigatureLevel.NONE. You can type new text to see the effect on different character combinations. The important pieces of code are shown below the example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var font:FontDescription = new FontDescription();
font.fontName = "Adobe Caslon Pro";

var elementFormat:ElementFormat = new ElementFormat();
elementFormat.fontDescription = font;
elementFormat.fontSize = 60;
elementFormat.color = 0x000000;
elementFormat.ligatureLevel = LigatureLevel.EXOTIC;

var tb:TextBlock = new TextBlock();
tb.content = new TextElement("fj fi ct ff", elementFormat);
var tl:TextLine = tb.createTextLine();
tl.x = 25;
tl.y = 120;
addChild(tl);