haxenme/NME — pull request #75 by cocoademon (2013-05-03 04:19:50+00:00)
Title: Add setTextFormat support for indexed regions to browser.text.TextField

This change implements setting the text format of substrings in the
browser target.

Also trigger RebuildText on a full setTextFormat to handle changing
alignment on existing text, matching the Flash target behaviour.

Update samples/02-Text to include examples of setting text regions.

#### Implementation

Setting a region format splits the existing paragraph spans, and then
sets the format on those spans individually. Doing this repeatedly can
lead to a lot of span fragmentation, which may be a performance issue.
Setting the format for the whole TextField again rebuilds the spans from
scratch again.

#### Limitations:
Currently only supports face, size & colour. Does not gracefully handle
overlapping regions. As there's no simple way to retrieve the TextFormat
from a paragraph span, setting the format of a region inherits default
traits from the internal mFace, mTextHeight & mTextColour variables.