in Actionscript 3

Flash Player 10 Text Ligatures Demo

[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.

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;

Write a Comment



  1. I cant see the flash in any browser. Im getting an error from my flash debugger ..

    Class Garamond_Premr_Pro_DF4$ must inherit from Sprite to link to the root.
    Class flash.text.engine::TextBlock could not be found. at global$init()

  2. Why are all the commands that unintuitive?

    tb.content = new TextElement(“fj fi ct ff”, elementFormat);
    var tl:TextLine = tb.createTextLine();

    I thought in as3 you would try to keep things simple and clear… though the possibilities are great I’m a bit confused the commands are that different from the known ones.

  3. Getting two errors when opening this post (and startpage since it’s a new post :P). Now the flashfile is flipping like a crazy person.

    I do not have FP 10 installed, neither do I have Adobe Caslon Pro… But still, I get these annoying errors when opening the blog!

    TypeError: Error #2023: Class Garamond_Premr_Pro_DF4$ must inherit from Sprite to link to the root.


    VerifyError: Error #1014: Class flash.text.engine::TextBlock could not be found.
    at global$init()

  4. Adobe has done nice job with the new text engine classes. I am intending to use them also for Arabic in flex4 sdk and they are a big plus… I could get some cool effects in Arabic with your example. thank you.

  5. Hi Lee,

    Today at the CS4 launch broadcast I was eagerly waiting for some info about the new rich text capabilities / components that will ship with Flash CS4 but no info was given, also on the new CS4 info pages there is no word about this.

    You wrote: “Adobe is planning on releasing an advanced set of text components later this year”

    Does all this mean that Adobe will not ship any new text engine based components with Flash CS4 but that such components will be released on a later date and if so when?

  6. Ligature hotness! Can we access other openType features now like swash and alternate characters? Any chance of hanging quotation or other optical alignment?

  7. If you can’t see the demo then you either don’t have the latest version of Flash Player 10 and/or you don’t have the Caslon font. Unfortunately I can’t upload the font for you. You now have to click on the image above to launch the Flash so at least people can see what the result is.

  8. @Hector Embedding fonts is different for the new text engine and I haven’t quite figured it out yet. I’m looking into it though.

  9. For those of you with Flash CS3, this is not what you need, nor does it have much of anything to do with which Flash player you have. You need the Flash 10 Player from Adobe Labs.

  10. Lee, off topic but how are you getting the browser to dim and show the Flash example? I’ve seen this done on the Adobe site as well.

    Is this a Javascript trick or a Flash trick?



  11. I don’t know, this is where I have to say just making a text box, formatting it, and adding it to the stage is much simpler than all the code to do that. Although, I guess it depends what you’re doing. Still cool to know Player 10 is coming along. Thanks Lee.

  12. Okays, love this, but i am having a problem recreating it,
    my problem is i have no idea how to embed a CFF font or convert a type1 otf font to a type2, and can’t find any documentation that tells me specifically how to do so.

    is always “embeddedCFF” (like it’s supposed to be)

    but my FontDescription.isFontCompatible
    for my font is always false because my

    for the font i am trying to display is always “embedded”

    any help would be greatly appreciated.