Persian Soft Keyboard and Applications for Android

[Permalink]

Update (July 25, 2010): Please read this before posting a comment, sending me an e-mail, or giving the software a rating on the Android Market. Also, note that the remarks below pertain to Android 2.2 and below, and may become obsolete in the future.

About the keyboard:

  • The app is a keyboard. Please do not say that “it doesn’t work” because “I see only squares”. A keyboard does not help you to render fonts or shape glyphs. This software is meant only for people who can already display Persian on their phones, but have no means of input. With that being said, I understand that many people who are looking for an input method for Persian are also looking for a way to display it. Just don’t confuse the two functionalities. (For information on how to display Persian, read on to the next section below.)
  • There is nothing sinister about the warning that the software may see sensitive information such as passwords and credit card numbers. It can see anything you type when it is the active keyboard — and so can every other soft keyboard. It does not do anything with this information except to use it to guess what you’re typing. If you don’t want your password or credit card number to be read by the app, just switch to the default Android keyboard when you need to type something secret. (Unless, of course, your password is actually in Persian.)
  • On most devices, you have to enable an input method after it’s installed by going into Settings, and to switch input methods you hold the trackball or long-tap with your finger in a text input field. These depend on the operating system, and are not things that I can change.

On installing a font and rooting your phone:

  • To display Persian on Android, it is not sufficient just to install a font. You also need to get the system to join the glyphs and to display them in right-to-left order.
  • To install a font, you will need to root your phone. Instructions can be found by using a search engine.
  • If you are unable to follow the instructions yourself, or cannot find someone who is physically present to take you through the steps, it is unlikely that anyone can help you online. It’s not a trivial task in most cases, and nobody wants to be responsible for accidentally bricking your phone. I will try to help, but please understand that your request is non-trivial. Furthermore, please see the remark above about it not being sufficient just to install a font. Even after a font is installed, there is still a lot of work to do to display Persian on Android. If you do not understand how to root a phone yourself, you will very likely not understand how to go through the rest of the process either.

About displaying Persian on your phone:

  • FarsiTel has just announced a Persianised version of Android. If you have a newer Android (2.1 and up) and want a completely Persian ROM, start your investigations there. Note that this solution includes a keyboard also (and it is a different one from mine).
  • You can also try Arabic Android for displaying Persian. Yes, it’s designed for Arabic, but it works for Persian also. You may have to pay to obtain right-to-left functionality. Look for the “Arabic Android” app in the market once you have the appropriate image from the site installed.
  • There is an app on the Android Market called “Persian Browser” that will enable font-shaping in the web browser only. If your browser displays Perso-Arabic glyphs but don’t join them or display them right-to-left, you can download this app to fix the problem.
  • To use these ROMs/apps, you may need to root your phone and/or install fonts. See the section above.
  • Disclaimer: I am not involved with these projects, and (to my knowledge) neither is my employer.

And, finally, I cannot make any comments about the state of official support for Persian on Android due to the terms of my employment. This is my personal web site, and is unaffiliated with my employer. Anything I write here about Persian support on Android reflects my personal opinion only.

The original post (from Nov. 16, 2009) follows.


I recently got a new smart phone — an Android-powered HTC Dream. As I wrote in a previous post, one of the first applications that I always look for is a multilingual dictionary, or at the very least a way to enter input in languages other than English.

It took me almost no time to write up a Persian Soft Keyboard, which I have put on the Android Market. (If you’re viewing this page on an Android device, you can download the application directly by clicking this link.)

Because Android is open source, it was remarkably easy to learn how to use the SDK. Unfortunately, despite this, there are a number of design decisions which make it difficult to enable Android devices for the Persian language (or many other languages). For one thing, it is impossible for the average user to install a new font, and the default fonts that ship with most Android phones don’t cover character sets outside of the Latin-based alphabets. For another, built-in support for complex text layout is very incomplete, and that includes the bidirectional text display and glyph-shaping which are essential for properly rendering Persian text.

I can understand the decision to leave these features out, since space is limited on most Android devices. However, this means that users who use languages other than English end up having to go to a lot of trouble to get these languages to work, such as downloading versions of applications capable of handling their specific language. It would have been much simpler if the base Android system had been packaged with a font that covered the Unicode characters for the most common languages in the world and applications that were aware of how to lay out their writing systems.

As things are, even with a Persian font installed, most applications still don’t display Persian text properly because of directionality and glyph-shaping problems. I’ve included an option for the Persian Soft Keyboard to output Unicode presentation forms, i.e., glyphs which are already shaped and joined. Even though this option does not comply with the Unicode standard, it allows readable Persian text to be entered into and sent through the default SMS application, for example. (Whether the recipient will be able to read the message at the other end is another issue.)

Currently, I’m bundling a simple note pad and a translator application with the Persian Soft Keyboard package. At the moment, the available note pad applications can’t handle right-to-left text, and the available translators don’t do glyph-shaping correctly. I hope that more Android software authors make their applications aware of languages other than English, because I don’t really want to support or maintain applications which are redundant.

– davinci 11843

  • RSS
  • email
  • Facebook
  • Twitter
  • FriendFeed
  • del.icio.us
  • Digg
  • Google Bookmarks
  • Yahoo! Bookmarks
  • StumbleUpon
  • Technorati
  • Reddit

64 Responses to “Persian Soft Keyboard and Applications for Android”


  • Hello,

    How could I use Farsi/Persian font on new Motorola Droid phone which run with Google android? I mostly interested in using this font for the web browser?
    Thanks in advance for the information

  • Hi, Hassan,

    The options available for using Persian on Android phones will depend on the particular combination of hardware, software, and provider/contract.

    Generally speaking, however, you’ll need root access to install a Persian font. And if you want to browse Persian language web sites, you’ll need a browser that supports bidirectional text and glyph-shaping.

    – davinci

  • Hello Davinci,

    Is there any browser that supports bidirectional text and glyph-shaping available on Motorola Droid phone use has Android 2.0 OS?

    • Well, yes and no. Since Android is open source, anyone can download the browser source code and add those features. But it takes some technical expertise as well as time and effort. There are browsers which are not open source which have those features built-in, available from providers or software companies in the Middle East, aimed primarily at the Arabic language market. I can’t help you beyond this, as the availability of the software and the legality of installing them depends on your contract with your provider.

      – davinci

  • Hello davinci ,
    We can not Download This Program With Market Because Market Is Not available For Iranian !?
    Please Upload This Program in 4shared & … and tell us That`s Download Link !
    very Thanks !

  • Looks great but both links (market://search?q=pname:net.stargrads.android.inputmethod.persiansoftkeyboard) and 4share end up in “Not Found” dead ends. I’d loved to be able to use my newly acquired Motorola Droid (Verizon) in sweet Persian mode (Farsi shekar-ast!)

    • Are you accessing the market link with your actual mobile device? It’s working for me, but maybe it’s blocked in Iran.

      Sorry that the previous 4shared link doesn’t work any more, when I updated the app 4shared changed the URL. Try this link instead.

      – davinci

  • thank you for your persian keyboard its perfect ,i had a question regarding character seperation on persian fonts in other application ,i realazie that you had made some kind of string reshaping in your applications right ?is there any way to do the same for other applications to (like sms) ? i would appretiate if you could provide me with your sources so i can get a better grip what going on and then if there is not to make the sms fonts work im going to write on my self .

    Regards Amin
    
    • The answer to your question is rather complicated. I’ll try to explain things briefly. For a fuller explanation, see Chapter 8 of the Unicode Standard.

      Basically, each Perso-Arabic character should be mapped to one code point when a string is stored in memory, regardless of the character’s context or appearance. It is up to the renderer (text editor, browser, etc.) to convert the characters to their “presentation forms”, or how they are displayed, i.e., initial, medial, final, etc. There are a number of advantages of separating encoding from display, such as being able to search for a sequence of characters in the middle of a word. (For example, if you wanted to search for the character “ye”, you don’t have to worry about whether it occurs at the beginning, middle, or end, or how many dots it has.)

      Since it affects text display throughout the system, rendering and layout should ideally be handled by the operating system. Unfortunately, the Android OS (as it is released on many devices) does not do glyph-shaping or complex text layout.

      One way to get around this is to encode a string using the codes for the presentation forms. Leaving aside for the moment the directionality of the text, the individual characters will have the right shapes when they are displayed. Note that the Unicode Standards specifically says NOT to do this — it breaks all kinds of things and is generally a bad idea. When you turn on the “Join characters” option in my soft keyboard app, it basically activates this hack (after it displays a warning).

      Because the glyph shaping is happening at the input, there’s no need for any apps to do any special processing. So you should be able to send messages in Persian using the default SMS app without any problems. I’ve been using it for a while and it works very smoothly. The only reason I bundled a notepad and a translator is because I couldn’t find any notepads that recognised when text should be displayed right-to-left, or any translation app that converted Unicode output to their presentation forms for display. Strangely, the default SMS app (at least on my phone) is able to recognise that Perso-Arabic text should be displayed right-to-left, as are some other bundled apps.

      If you’re unable to enter Persian using the soft keyboard in the SMS app, let me know what problem you’re having exactly, and I may be able to help you.

      I can’t release the source code right now, because I’m actually trying to get complex text layout (including Perso-Arabic glyph shaping) included in a future official release of Android. However, when I have some time, I plan to write a blog post about what I did that should include enough detail and code snippets for anyone else to be able to do similar things.

      – davinci

  • Where is the “jeh” on the persian keyboard?

  • any thing new on BIDIac implementation for android ?

  • Hello All,

    Persian VOA has a new application for Android. They recommend to install Farsi font for that application. Does anybody have any idea how to install that font and where to get the font.

    Thanks in advance.

  • Thanks Davinci for the reply,

    if I install either the DejaVu Sans font or the Free Persian Font. Does the browser for my phone will be able to read Farsi font also.

    Thanks in advance for the information.

  • Hi, everyone,

    I found out a way to get Persian mostly working in Android. Download and install Cyanogen with Arabic WebCore, and the appropriate Arabic Android image for your phone, from here, and install it. Note that the download includes the DejaVu font. This will allow the display of Arabic, but you will see squares for some Persian-only letters in some applications, because the Arabic Android’s glyph-shaping does not handle Persian correctly. However, the VOA PNN app on Android market has its own glyph-shaper which does handle Persian correctly. You’ll have a mostly functional Persian-enabled Android phone if you follow these steps!

    – davinci

  • Hello Davinci,

    Does it include internet browser? Does Persian BBC show farsi font correctly?

    Thanks in advance.

  • Hello Davinci,

    How do you like Nexus One? I have given up on Iphone to come to Verizon and I plan to buy Nexus One next month when Nexus One comes to Verizon. Do you recommend Nexus One?

    Best Regards

    • I have a Nexus One myself. I don’t have enough experience with other devices to give a fair assessment of how it compares.

      – davinci

    • I think the Nexus One seriously kicks the iPhone’s butt. I absolutely hate hate hate how the iPhone works and I find the UI much inferior to the Android UI.
      The Android does have it’s downsides, but I would take it over anything Apple 100 times.

  • Salam
    I new to android phones, can one of you please explain how I can install the persian fonts and a browser to view bbc farsi and VOA
    regrads

  • nice work boy
    check it out http://www.androlib.com/android.application.net-stargrads-android-inputmethod-persiansoftkeyboard-zAit.aspx
    may need you submit your app.

    i need your app. but cant find it anywhere

  • hello mr.

    can you read or speak farsi?? or persian??

    we have a forum for iranian people, and we need to make android farsi,

    i mean we want be able to read and write farsi in android. we know we can count on your knowledge.
    we trying to collect a good number of donation. its about 40$ now, but so soon its getting to be more.
    we need your help, its not about money for us its about to be able to be a human in our country. we very pleased if you help us

    we need you to write a program for us, or teach us how to write.

    thank you,

    واقعأ ممنوتون میشیم

    • bale, mitunam. There are many Android programming tutorials online. It’s not too difficult to get started. The links referred to above contain software that allows newer Android models to read Persian. Unfortunately, I can’t give technical help online, since there are so many different models of hardware and versions of software. If you have a specific question, I can try to help.

      – davinci

  • خوب پس لطفأ به این تاپیک سر بزنید، ما تا به حال چیزی در حدود 100 دلار چمع کردیم و میخویم اونو تقدیم شما بکنیم. تمام خواسته های ما هم در این تاپیک قید شده. و اما یه سوال خصوصی شما ایرانی هستید؟؟

  • سلام ممنون از جواب شما، خوشحالم که فارسی رو اینقدر خوب بلدید.

    دوست عزیز مااز شما خواهش میکنیم آندروید رو برای ما فارسی کنید،اگر شما خودتون رو در فروم نشون بدید مطمئن باشید این کمک هایی که تا الان به 50 60 دلار رسیده، مطمئنأ چند برار خواهد شد.
    لطف کنید به تاپیک ما سر بزنید.

    http://www.handheldusers.com/forum/t5166.html

    منتظر شما هستیم، مطمئنأ مبلغ ناقابل خواهد بود در قبال لطف بزرگ شما

    بدرود.

    hello thanks for your answer.

    its interesting, you can read farsi very well.
    

    dear friend, we ask you to making android farsi for us.

    if you come into our forum, and show yourself, be sure these donates become more.

    pleas meet us at this forum

    http://www.handheldusers.com/forum/t5166.html

    we’ll wait for you. we sure these donates aren’t enough, but it shows your help.

    • من ایرانی نیستم.

      می‌تونید از لینک که امین نوشت فایل‌های دانلود کنید که آندروید رو فارسی می‌کنند. بعد از گوشیتون «روت» کردید، فایل‌ها رو بگزار رویش.

      – davinci

  • Hi there guys , i just thought that you might be intersted on this ,
    about a month ago i was interested on having farsi on my htc hero i search around and found this http://code.google.com/p/arabicandroid/downloads/list ive downloaded it ,this a library patche for android which can enable arabic for nexous one , so on my hero i had to flash a ROM called vanilian ROM to be able to run this patch. and it worked just fine .
    i was able to surf the web with no problem with farsi fonts meaning it did all the glyphing and all of that in the OS level so not only browser supported farsi but also every thing else like , sms and email clients went well on this rom to .

    my only problem was that this rom was not stable enough for me but i think it would work fine for nexouses 2.1 android .

    so just go see the link above and tell me if it works out 4 you 2

    Regards Amin

    • Hi, Amin,

      As I noted on Feb. 23, it is not necessary to install the entire ROM. The *only* files needed are the browser libraries (libskia, libskiagl, and libwebcore).

      – davinci

  • Thanks Davinci

    I have Hero Android and not nexouse one , i have tryed to copy the libskia, libskiagl, and libwebcore in there places but when i reboot , the phone does not boot correctly until i have replaced the old libraries in /system/lib/ , but this is normal because these libraries were ment for android 2.1 not my 1.5 cupcake , i tryed some custome android 2.1 roms on my hero with this procedure and it works , but there all have some issues like battery consuption and things like that .

    what i would like to do is to have my original rom support persian , what do you think i have to do .

    should the libraries be compiled with cupcakes headers or some thing like that ?
    if so where do you think i can get the hold of these libraries sources ? (there is nothing on there hope page on google code )

    • Me too have a Hero and the same problem applies here. As you did I’ve tried to use these libraries with no luck. Do you think when the official 2.1 update arrives we can use these libraries? I don’t think the next official update would have support for farsi so we might have to use these libraries instead.

      • Hi
        go find a stable 2.1 ROM from http://hero-roms.blogspot.com/ and then copy the libraries in it , so far i could not find any ROM which works with these libraries and in the mean time its stable , i found behero very stable on HERO but after installing arabic libraries some application crash and dont work including browser . but in some other apps persian works fine , so tell be me if you found an stable ROM to use with your HERO .

        Best Amin

        • Currently I prefer to wait for the official release and see what would happen. I think i read somewhere that 2.1 update 1 works fine with persian. I don’t know about that, Only time can tell ;-)

  • ﺳﻼﻡ ﺩﺍﻭﯾﻨﭽﯽ ﻋﺰﯾﺰ
    ﺍﺑﺘﮑﺎﺭ ﻭ ﺧﻼﻗﯿﺖ ﺗﻮ ﺑﻪ ﻣﻦ ﮐﻤﮏ ﮐﺮﺩ ﮐﻪ ﺍﯾﻦ ﻣﺘﻦ ﺭﻭ ﺍﻻﻥ ﺍﺯ ﻣﻮﺗﻮ ﺩﺭﻭﯾﺪ ﺑﺮﺍﯼ ﻫﻤﻪ ﺑﻨﻮﯾﺴﻢ. ﺧﯿﻠﯽ ﺍﺯﺕ ﻣﻤﻨﻮﻧﻢ.

    I’d also like to thank the arabicandroid developers for their amazing work. I did encounter some error messages but finally I’ve got it to work and other than a few minor bugs, the Farsi font on my Motorola Droid works beautifully. I’m sharing the steps that I took for those that are interested:

    - root the phone using the “DroidReview” tutorial (How to ROOT your Droid – The Easy Way!) on Youtube.
    - download the related pack from arabicandroid site to the root of sdcard. – download “ROM Manager” available on the Market.
    - boot into recovery mode using ROM Manager and Apply recovery mode using ROM Manager and Apply the pack in the recovery mode and voila!

    A few things that may or may not have helped in my installation:

    - rename the pack into update.zip
    - the recovery mode “X + power button, etc” was not letting me install the pack but somehow the ROM Manager made this possible. Don’t ask me how :)
    - check the box for “Unknown sources” in how :) – check the box for “Unknown sources” in”Application settings”
    - change the “Text encoding” in Browser Settings to UTF-8

    Thank you!

  • I’m not sure if the “Ultimate Droid v9.8.0″ ROM would work on phones other than Motorola Droid but I tried it on mine, then applied this pack http://arabicandroid.googlecode.com/files/update_nexus_mt_signed_ERE27.zip and it worked. I had installed Davinci’s Persian keyboard and Notepad before and they still seem to be working fine. One glitch though: I left my last comment (just below here) using my phone (when I had 2.0.1) and as you can see the portion I wrote in Farsi is in reverse! FYI, it didn’t look that way on my phone when I was posting it :) I think the issue may have been from when I was copy/pasting the text with the Persian Notepad. Hopefully, Davinci can look into this.

    One last thing, I did try “CyanogenMod 5.0.5.7″ & “Verizon Droid 2.1 Stock Image” ROMs but neither of the “arabicandroid” packs worked on them. Luckily I had some other ROMs available on the sdcard; otherwise the phone wouldn’t boot at all (quite scary!). I recommend using “ROM Manager” available on the Market to all the newbies like myself.

  • hi,i have motorola Dext and would like to see my Emails (when they are send as farsi)not as a sqears.can you help me.i am not very tecnical .

    • Click this link for a tutorial on how to get Hebrew fonts to work on Android. The steps for Persian are similar, if all you need is the font. If you also need glyph-shaping, see the comments just above yours on this page. But definitely try to install the font first. You’ll know whether you need glyph-shaping if the squares are replaced by unjoined Perso-Arabic glyphs.

      – davinci

  • It doesn’t show up in the market for Froyo :-(

  • Dear hooman plz check out this topic on XDA : http://forum.xda-developers.com/showthread.php?t=693102
    then u can see all app in market on froyo

    good luck .

  • dear davinci can u plz upload the lastest version for us !? i really appreciate that .

    • I’m not sure what you’re requesting. Where do you want me to upload the app? It’s on both the Android market and in the 4shared link in one of the messages above.

      – davinci

      • I didn’t see the 4shared link.
        I think in the market you gotta tell which Android versions the app can run on and 2.2 is not included. I’ve never posted apps to the market so I can’t tell.

  • Any idea how I can get farsi fonts on the HTC EVO 4G? any rom that would work for that matter?

    • Any TTF that supports Persian will work. The EVO is not different from other Android phones, you just need to replace the font in the system fonts subdirectory. If you want true shaping, however, you’ll have to use, e.g., Arabic Android.

      – davinci

  • Hello

    My browser in emulator android doesn’t support neither reshaping nor Right to left for

    arabic.

    I haven’t find system/lib in my Computer.

    Please help me

    • The stock Android doesn’t support RTL. You’ll have to use a ROM that does.

      The system/lib directory is not on your computer but on the phone itself. You’ll have to use the Android debug bridge (adb) to access it.

      – davinci

      • Hello

        1)I have many problem in installing new rom for my emulator android because I haven’t areel phone.Plese what are steps can help me.
        2)I have found in arabicandroid my class .cpp to change webcore but when i tape make after changing there are many erro.please help

        Thanks in advances

        • Why are you trying to install a ROM on an emulator? Most likely this will not work, since the emulator does not perfectly simulate an Android device. In particular, its boot code is quite different from that found on physical devices.

          I’m not involved in the development of Arabic Android. I have not seen the source code and cannot comment on it.

          It sounds like you’re trying to do development without a phone or a system that’s been properly set up.

          – davinci

  • hello there:
    i got my droid x from verizon on july 15th but i am still struggle to root it and install farsi font on it.
    does anybody knows how to root my device and install farsi font on it?
    did anybody root droid x with os 2.2?
    thx

  • Dear: Davincy
    You are a unique person and have a very nice character, rarely a programmers have such a patience that you have. Thank you so much for your Persian Soft Keyboard App. I do have a Galaxy I7500 which is a forgotten smart phone by Samsung. I rooted my phone and I installed Drakaz Galaxo 1.6.3.3, replaced DroidSansFallback.ttf with new ones from different sources on the web, and then installed your keyboard plus a messaging App named Mirsal. Now, I do not see just square boxes any more on Persian sites. But, the problem is character connection and right to left order of characters. I downloaded Persian Browser, the three versions from the Bohloo site but when I try to install them I get parsing error message no matter what. I have updated the three SO (libwebcore …) files from an Arabic site but when I reboot, it goes into a loop and never pass the first screen, removing these three Lib files brings it back to square one.
    I read that Android 2.0 and above have right to left writing support in the kernel, so I installed Mustymod 1.03b and went through all of the work all above with no avail. Now I am back to Galaxo 1.6 again. I can copy text from Persian web pages and paste them into Marsil an empty message, save it and then reopen it. Then the text shows very nicely, all characters connected correctly and in right to left order. Do you think I am doing something wrong or not doing something where I should do? Thank you so much for the hard work and wish you success in your goals.
    Sincerer greetings
    Haloo

    • You sound like you’re doing everything that I would have tried. I’m not familiar with the device or the ROMs you mention. I’ve had success with CyanogenMod, although it doesn’t look like it’s available for your phone. Without the device in my hands, I can’t really say what you need.

      – davinci

Leave a Reply

Subscribe without commenting