Sep 5, 2010

Flash solution for RTL languages

Download Flash actionscript solution for RTL arabic language here.
Requirements:

1. dynamic TextField
2. HTML enabled TextField
3. pre-defined TextFormat
4. arabic fonts must include a complete Arabic Presentation Forms-B (glyphs from FE70 to FEFE according to the Unicode Standard 5.2)
reference: http://www.unicode.org/charts/PDF/UFE70.pdf


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.


features not supported:

1. arabic diacritics.

example:

import com.xvisage.utils.StringUtils;
var format:TextFormat = new TextFormat();
format.font = "Arial";
format.size = 24;
format.color = 0x0066CC;
var output:TextField = this.createTextField("output", 1, 10, 10, Stage.width-20, format.size);
output.autoSize = true;
output.embedFonts = true;
output.wordWrap =true;
output.multiline = true;
output.html = true;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(done:Boolean) {
if (done) {
output.htmlText = StringUtils.parseArabic(this.firstChild.firstChild.nodeValue, output, format);
output.setTextFormat(format);
}
}
xml.load("arabic.xml");