Skip to main content
Inspiring
August 31, 2015
Answered

how to style a sub-run using Flash Text Engine (FTE)?

  • August 31, 2015
  • 1 reply
  • 274 views

The documentation for Flash Text Engine library states that there is a way to create a  sub-run of text. I want for example, to be able to style part of line. In ye olde TextField this is easy to do because you call SetTextFormat() on a range of characters. But in the fancy Flash Text Engine, although the documentation says it is possible i don't see how to do it. There must be a way to add multiple textElements into a block, and have them rendered into lines as one might expect. I am prepared for example, to create a few words in an underlined text with a different font and color, to create element #1 (prior to style override), element #2 (containing the style override), and element #3 (back to default style). I don't mind that at all, but i can't tell you how many web pages Iooked at and can't find a single example of someone using FTE to do what I consider basic text formatting.

Since TLF uses FTE, it must be possible.

any help is greatly appreciated.

This topic has been closed for replies.
Correct answer magicmouse

I have figured it out. It turns out that each TextBlock can only have one content block, which is either a single text element, a single graphic element, or a single group. If you use the GroupElement trick, you can then use an array of content blocks (either text or graphic), and create by means of this vector of elements, a block containing a mix of styles. Effectively, for each style run that is similar, you create an element for that run and by means of this yes you can indeed create a textblock that has a mix of styles. A great deal of work compared to what people are used to using HTML text, BUT, hey, it works, and it supports fancy bidirectional text, and all sorts of Adobe goodness. Text handling is the mount everest of API understanding on most platforms. It is full of subtlety and complexity, and yet is essential. I doubt that more than 100 people on planet earth understand the truetype language, which underlies all modern computer font rendering. It is a bizarre language. I would bet there is more than 100 man years in the font renderer code in Photoshop alone.

1 reply

magicmouseAuthorCorrect answer
Inspiring
August 31, 2015

I have figured it out. It turns out that each TextBlock can only have one content block, which is either a single text element, a single graphic element, or a single group. If you use the GroupElement trick, you can then use an array of content blocks (either text or graphic), and create by means of this vector of elements, a block containing a mix of styles. Effectively, for each style run that is similar, you create an element for that run and by means of this yes you can indeed create a textblock that has a mix of styles. A great deal of work compared to what people are used to using HTML text, BUT, hey, it works, and it supports fancy bidirectional text, and all sorts of Adobe goodness. Text handling is the mount everest of API understanding on most platforms. It is full of subtlety and complexity, and yet is essential. I doubt that more than 100 people on planet earth understand the truetype language, which underlies all modern computer font rendering. It is a bizarre language. I would bet there is more than 100 man years in the font renderer code in Photoshop alone.