Flash Text Layout Framework goes Open Source

The Flash Platform team at Adobe announced yesterday that they’re open-sourcing the Text Layout Framework that they’ve been working on on top of the text foundation built into Flash 10.

This is Kind of a Big Deal, because as far as I’m aware open-source code that handles text editing and display of Unicode text that supports right-to-left layout and editing is very rare.

I work on LiveCycle Designer, and because we made a commitment to a partner to support it, our XML editor lets you edit XML source that has HATV (Hebrew, Arabic, Thai, Vietnamese) text embedded in it. If you’re not familiar with these languages, in a nutshell, they’re read from right to left instead of left to right the way English is read. A text editor that supports these languages will understand that they’re edited from right to left as well, which changes how the editor behaves when the caret is in an RTL text run. For example:

<Button id="לחצן"/>

This is some XML that might represent a button whose ID is “Button” in Hebrew. Drag-select over that text. Does your browser treat the Hebrew text differently than the surrounding English characters? It probably does.

When you’re editing, the typical behaviour is if the caret were on the equal sign and you hit right arrow a few times, the caret would move to the quote, then to the last character of the Hebrew text, then left, left, left, left, then jump to the closing quote. This is because the right arrow key is interpreted as “move to the next character”, not “move right”.

The TLF that Adobe is giving away comes with a TextEditor class that knows about all this. Copy that text and paste it into the TLF Sample and try editing it yourself.

The TLF supports a lot of other cool text features. Here’s a list:

  • Selection, editing and flowing text across multiple columns and linked containers
  • Vertical text, Tate-Chu-Yoko (horizontal within vertical text) and justifier for East Asian typography
  • Rich typographical controls, including kerning, ligatures, typographic case, digit case, digit width and discretionary hyphens
  • Cut, copy, paste, undo and standard keyboard and mouse gestures for editing
  • Rich developer APIs to manipulate text content, layout, markup and create custom text components
  • ActionScript-based object-oriented model for rich text layout enabling live updates

But the RTL text support is the one that affects me most since we’ve been looking for a replacement for what we currently use in Designer, and this might be it.

There are a lot of open-source text editors, but as far as I know the only one that supports this is the code editor in Eclipse, which is written in Java. The text input widgets on the major OS platforms support it, and now, so does Flash.