1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Update: a newer version available here

Well, I discovered some annoying bugs, all fixed in this version ..
As per my previous post here, I still recommend embedding fonts to avoid improper rendering.

ActionSctipt 2.0 version available here
ActionSctipt 3.0 version available here

Requirements:

  1. Dynamic TextField
  2. HTML Enabled TextField
  3. Pre-Assigned TextFormat
  4. Arabic Font

Recommended Properties:

  1. embedFonts: for proper rendering on Mac/Linux.

Properties:

  1. data: for referencing original input string, use the data property (utils.data) instead of (TextField.text) where “utils” is an instance of StringUtils class.
  2. wrapFactor: optional reduction value (Mac only) for wrapping correction when using bi-directional text, possible values: .98 or less.
  3. htmlLines: array of spliced text block HTML lines.
  4. numLines: integer value of total text block lines.

Features Supported:

  1. 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).
  2. Arabic Ligatures.
  3. Word Wrapping.
  4. Bi-Directional text.
  5. HTML Text.
  6. Loading External text on run-time.
  7. Windows/Mac/Linux support.
  8. Arabic enabled input fields using actionscript method (createArabicInput) with the help of javascript (arabicinput.js) beta

Features Not Supported:

  1. Arabic Diacritics (not necessarily for reading Arabic language in general, arabs are using diacritics mostly for writing Quran, and in that case diacritics are not the only missing feature, there’re many other ligatures cases in Arabic used for Quran writing).

Change List:

  1. Proper rendering for HTML bullet list (include the bullet character “•” in the Character Embedding menu).
  2. Optimized conditions for basic thorough loop.
  3. New properties for referencing text block lines (htmlLines, numLines).

Fixed Bugs:

  1. Multi-level HTML tags, for example:
      <a href="#"><font>text</font></a>
  2. Line-break determination on Mac.

Known Bugs:

  1. 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

Test files are available here using ASUnit Framework

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

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 ..

ActionSctipt 2.0 version available here
ActionSctipt 3.0 version available here

Requirements:

  1. Dynamic TextField
  2. HTML Enabled TextField
  3. Pre-Assigned TextFormat
  4. Arabic Font

Features Supported:

  1. 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).
  2. Arabic Ligatures.
  3. Word Wrapping.
  4. Bi-Directional text.
  5. HTML Text.
  6. Loading External text on run-time.
  7. Windows/Mac/Linux support.
  8. Arabic enabled input fields using actionscript method (createArabicInput) with the help of javascript (arabicinput.js) beta

Properties:

  1. 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:

  1. Arabic Diacritics.

Change List:

  1. New approach for wrapping text properly involving HTML tags, brackets, punctuation marks and bi-directional cases.
  2. Looping through input string thoroughly only once for better performance.
  3. Object class model structure with public properties and methods instead of static parser.

Fixed Bugs:

  1. Arabic character condition for letter (?).
  2. Beginning and ending text lines with non-Arabic characters (Embedding fonts required for Mac).
  3. Inline HTML tags (Embedding fonts required for Mac).
  4. Symmetrical swapping for bi-directional brackets.

Known Bugs:

  1. 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!

Test files are available here using ASUnit Framework