Overthinking Text

Part 1 of my 65,536 part series on overthinking things

Remember 2008? What a great year. Especially in November, when we made history. I remember watching the ceremony on video feed with friends. People were cheering and crying.

No, wait. I mean 2007, not 2008. You know, when Adobe showed us a sneak peek of Flash Player 10, and Peter Elst’s posted video coverage gave his blog a bazillion hits as Flashmongers everywhere watched Emmy Huang spin a MovieClip in 3D. “Whoop dee doo”, you might say with hindsight-equipped eyes. It’s 2010 and all those new tricks are now old hat, right?

Not exactly. While the novelty of 2.5D and IK handles may have faded away, one of Flash Player 10’s new features– the advanced text engine– has lagged behind the rest. That’s because the text engine is very low-level, and wasn’t exposed to designers in the Flash Professional authoring environment. Until CS5 was released this past April, only developers had access to the FTE. That’s kind of ridiculous, and Adobe knew that. And so began the efforts (by many different people) to bring TextField-like usability and new text functionality to the Flash platform.

Since the release of Flash Player 10, a team at Adobe has been hard at work to create a higher level framework for using the new text features. It’s called the Text Layout Framework; in Flash CS5, it’s the “TLF Text” option in the Properties panel. The TLF exposes all those neat new tricks to designers, but ironically it’s almost entirely inaccessible to developers, which almost defeats the purpose. Plus it’s riddled with memory issues and quirks; if you want to read more angst directed at the TLF, read Grant Skinner’s recent article and the comments that follow it. The TLF team has released the code to the framework as they work toward their 2.0 release, but still, there’s some demand for text systems that out-TLF the TLF.

…Er, well not entirely. The TLF tries to cover a lot of bases; most projects don’t need all that functionality, so they’d benefit from smaller text layout systems that have lesser overhead than the TLF. That might sound like a tall order to give to an ActionScript 3 developer, but that’s only because historically, we weren’t able to directly manipulate text this way. It’s outside of our comfort zone, but ActionScript developers have produced more complicated libraries in the past. So while gearing up the Wireworld player for an Android port, I decided to redesign the view, and while doing that I decided to utilize the new text engine. I wasn’t looking for any bells or whistles, just the ability to select and possibly edit text within a single-line field. So I started implementing Tyro.

Tyro’s not exactly finished yet– it hasn’t been commented, for instance– but if you want it, go ahead and use it. It doesn’t try to be everything, but it does have some pretty complicated selecting behaviors that roughly match the behavior of rich text on OS X. It feels natural when you use it. It supports cut, copy and paste, and most of the other features available in the TextField. It just also happens to benefit from some of the new text features. And just as long as you don’t expect bidirectionality, HTML+CSS or muliple lines, it’s a hell of a lot simpler than the TLF.

A huge resource I benefitted from while I built Tyro was a guy in a chair named Paul Taylor. He’s working on a project called TinyTLF, and unlike Tyro, it does intend to do most of the things the TLF does, only with a better architecture and a smaller footprint.

In most other cases, if someone tried to implement something that Adobe already went out of their way to implement themselves, you might think they’d be wasting their time. But even if we set aside the recent complaints that the TLF isn’t up to snuff, I feel that high-level text functionality is simply not the sort of thing you can effectively implement once. Not when its general use case includes support for every language, on any Flash-supported device. Not when it’s responsible for rendering that visual information that millions of designers slave over for hours on end, nudging each character this way and that. Text composition is a real beast. So shouldering the burden of rendering text for a project that you care about doesn’t seem very unreasonable to me.

Besides, the more text layout systems there are in the wild, the better. They’ll increase developers’ general understanding of text, just like the Great Tween Engine Craze increased our understanding of programmatic motion. We’re all more competent programmers as a result.

So if you need Tyro, pick it up and use it, it’s yours. If you need it to support Hebrew, don’t hesitate to get your hands dirty; the Flash text engine’s API is fully documented. Just be sure to show me טירון once you’re done with it.


You can leave a response, or trackback from your own site.

Leave a Reply