flex - Fast way to set text format for a range of Text using TLF -


I have to set text format for some tokens in plain text. I am trying to use the text layout framework to improve the speed of the operation, but I have decided that TLF is still slow (10X in my test) compared to the old settext format (). I call this function for each token:

  public function setTextFormat (format: textual format, start: int, end: int): zero {var selection: selection location = new selection location (This._textFlow, start, end, this._normalFormat); IEditManager (_textFlow.interactionManager) .applyLeafFormat (format, selection); }  

Is there any fast and clever way to perform this operation?

Thanks

Most of the TLF updates are recalculated and updated on processing time performance . Unfortunately, the applicable lafformate () call does both format-union and reactivation operations, with the cooperation of special formats with some parts of your text model. You need to split those two parts.

Rather than dealing with their tokens in reference to their full positions, you can split them into different floating objects (most likely span elements), which can be uniquely identified. "ID" property Once your tokens are in different elements, a lot of them are repeated through, the format features have to be changed, and only in the end The performance emphasizes the update. string in id) {var element: span element = _textFlow.getElementByID (ID) as span element; If (element) {element.format = getAppropriateFormatForElement (element); }} _textFlow.flowComposer.updateAllControllers ();

As a separate, splitting your tokens into elements allows the door to open its token classification in elements, so that you create a separate classification mapping structure. Can be freed from keeping.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -