Update: a newer version available here
This is a bit late, my apologies to you all, yet again, thanks to Jan Jonas and Yasmin (geekgirl)
I tried my best to solve bi-directional issues, it took me sometime to re-construct the wrapping part using completely different approach, it seems to be good when embedding fonts, but more wrapping issues pops-up for non-embedded fonts and only on Mac! this is weird, the whole solution was to solve Arabic ligatures when embedding Arabic fonts!
In addition, an overall code review has been taken care of, a lot of modifications in several places throughout the code has been done, if you like this one then you can start from hear instead, but if you don’t I think I need to know 😉
Anyways, this is exactly why I released my solution as open-source from the first place, what good of a solution without sharing it with others to contribute, may be you’ll have better luck than I did when you update this one yourself ..
- Dynamic TextField
- HTML Enabled TextField
- Pre-Assigned TextFormat
- Arabic Font
- Embedding Fonts (just put a dynamic textfield on-stage and select at least Basic Latin (95 glyphs) and Arabic (1088 glyphs) from the Character Embedding menu).
- Arabic Ligatures.
- Word Wrapping.
- Bi-Directional text.
- HTML Text.
- Loading External text on run-time.
- Windows/Mac/Linux support.
- For matching/comparing input string, when referencing original input string use the data property (utils.data) instead of (TextField.text) where “utils” is an instance of StringUtils class.
Features Not Supported:
- Arabic Diacritics.
- New approach for wrapping text properly involving HTML tags, brackets, punctuation marks and bi-directional cases.
- Looping through input string thoroughly only once for better performance.
- Object class model structure with public properties and methods instead of static parser.
- Arabic character condition for letter (?).
- Beginning and ending text lines with non-Arabic characters (Embedding fonts required for Mac).
- Inline HTML tags (Embedding fonts required for Mac).
- Symmetrical swapping for bi-directional brackets.
- improper wrapping for non-embedded fonts only on Mac when begin text line with non-Arabic characters or when using custom format HTML tags.
Here is an example works with this external XML file (with run-time resizing vs. wrapping):
download the above example here
Well, still not perfect, for some reason I feel that a tiny code snippet can do all the magic to contain the mac issues with non-embedded fonts, just can’t find that one … yet!