Reading Hebrew and Arabic in Flex

Some History on Bi-Directional texts, Semitic languages and the languages which are read from right to left:

Arabic, Hebrew, and the non-Semitic languages using the Arabic or the Hebrew alphabet, such as Persian and Yiddish, are written from right to left (except for their numbers!). Urdu which is also derived from Arabic and Persian language and ancient indo – aryan language binti is written from right to left. Ancient Egyptian, Etruscan, Greek and the oldest Latin could be written in both directions. Also Chinese and Japanese can be written right to left (also written from top to bottom, vertically). Korean is NOT written from right to left.

More on these @

Here is a sample test to read a text from right to left and vice versa.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="" 
         xmlns:mx="library://" minWidth="955" minHeight="600">
       <s:VerticalLayout />
      @namespace s "library://";
      @namespace mx "library://";      
     @font-face {
       src: url("font/DroidSans.ttf");
       fontFamily: DroidSans;
     s|Label {
        fontFamily: DroidSans;
        fontSize: 24;

          import flashx.textLayout.formats.Direction;
         private var textDirection:String = "rtl";         
         protected function onClick( event:MouseEvent ):void {
            if (myLabel.getStyle("direction")=="ltr") {
               myLabel.setStyle("direction", Direction.RTL);
             } else {
               myLabel.setStyle("direction", Direction.LTR);
         text="שלום ‎בעולם‎"
         layoutDirection="{ textDirection }"
         label="toggle RTL-LTR"
          text="{ myLabel.getStyle('direction') }"

In order to run the above source code, you will need the fonts shown below:

You may get this here

Hope you enjoyed reading the post !!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s