Thaana on Android: Font installation

I have owned a Google Nexus One device since it came out early this year and I love it for the great hardware specifications of the phone and the customizability of Android. As usual, one of the first things I did when I got it was to explore Thaana usage on the Android OS. I have been meaning to do a write up since, so after almost a year here it is finally! This post addresses getting Thaana to display by installing a Thaana font.

Overview


With a healthy ecosystem of phones and tablets running Android now available, the free and open-source Android mobile operating system seem to be getting more and more popular across the world and in Maldives. Its official app-store hosts a large number of applications, a lot of which are free, and there are a number of third-party app-stores with more relaxed rules around as well. There is a healthy and growing developer community that's taking advantage of the open code to add new features and hack in interesting modifications - like the Nexus One does not officially have a FM radio or support HD video but developers have added code hacks for both into a custom ROM!

As awesome as Android is, unfortunately, all versions of the official Android OS (including the latest version 2.2 (Froyo) release) has limited support for international scripts, which is bad news for Thaana. Android can display Thaana characters as it supports Unicode fonts but it looks all jumbled up when diplayed as Android lacks support for bi-directional text rendering, both in the OS and the included web browser. The lack of BiDi support means Thaana input is also impossible as Thaana is a right-to-left script.

The next version of Android, version 2.3 (Gingerbread), is scheduled to have BiDi support and better support for international scripts, so hopefully that fixes things although it still wouldn't officially support Thaana.

The only easy way currently, as far as I am aware of, of viewing Thaana on Android correctly is by using Opera Mobile browser with Thaana fonts installed in Android. Now, none of the Android-based devices on the market seem to ship with a Thaana-supporting Unicode font preinstalled and Android does not currently provide a mechanism for user installation of fonts which means the process of installing a Thaana font is a little bit convoluted.

Installing Thaana fonts


Next, you need to install the Thaana font. Chopey has already posted a guide on how to do it manually and Gaanagaa has posted a Windows-based software to do automatically for you. I favour a different approach which relies on using a special Zip file to update your Android with the Thaana fonts in a manner similar to how Android devices update themselves with new releases. This method is, in my opinion, a lot easier and you do not need anything other than a rooted phone and the zip file I have prepared to do it. I have packaged the free FreeSerif font which includes beautiful Thaana glyphs as well as a large number of other characters from other writing systems.

Using my Thaana fonts update for Android
1. Make sure your device is rooted. You will need a rooted device to install any font via any method, including this one. There are a number of guides and free software available on the web for various Android phones (try xda-developers.com or modaco.com or samdroid.net) to help you do just that.

2. Put update_thaanafonts(jaa)_signed.zip to the root of the SD card in your device. You can do this by downloading the file straight from the web on to the SD card of your device OR download the file to your computer first and copy it to your device using a cable or Bluetooth.

3. Power off your phone and boot into recovery mode. The specifics of how you do this depends on which recovery tool was installed during rooting of your phone but involves pressing some combination of keys at the same time to start your device in recovery mode. Try the methods listed here if you aren't sure.

4. Select the update from Zip option in your recovery tool and select the update_thaanafonts(jaa)_signed.zip file from the list and OK it.

5. The update should progress and will ask you to reboot once completed.

6. Congratulations you now have a Thaana font installed! To make any practical use of it, you will need to install the Opera Mobile browser application available for free on the Android Market.



Enjoy :-)

Thaana on Amazon Kindle

I tinkered with the Amazon Kindle ebook reader device a few nights back and explored the use of Thaana on it. Here are my findings.

Overview


The Kindle is an amazing product - the screen is extremely easy on the eyes, the device is light and comfortable to handle and the battery lasts for a few weeks without a charge. The software supports MOBI, PRC, TXT, TPZ, AAX and PDF format books and documents and also includes a web browser.

Kindle 2 devices do not come with any Thaana Unicode fonts bundled in, hence making it impossible to view Thaana documents on a vanilla device. Kindle 3 does come with the impressive Code2000 Unicode font bundled in. This is good news for Thaana support as Code2000 currently contains over 61,000 glyphs from a huge range of writing systems and has supported Thaana for what must be close to a decade. However, the use of Code2000 seems to be limited to the web browser and is not involved in rendering ebooks.

It is possible to use either of the Kindle font hacks (see "Adding a Thaana font" below) to replace the system's ebook reader font to get Thaana to display within the reader component for all of the supported ebook formats. But this turns out to be pointless as neither device has proper support for handling right-to-left scripts like Thaana and hence words and paragraphs are all jumbled up in reverse.

Kindle screenshot: No Thaana characters in a vanilla device
Kindle screenshot: No Thaana characters in a vanilla device

Kindle screenshot: Thaana characters display after hack
Kindle screenshot: Thaana characters display after hack


PDF with font-embedding: The only thing that works!


The only ebook format that worked for Thaana was PDF with font-embedding (PDFs without the fonts embedded fails to render Thaana correctly even when the device was loaded with a Thaana Unicode font). Many of the existing Thaana PDF documents work just fine (see the screenshots below) as most of them have the required Thaana fonts embedded.

Kindle screenshot: PDF with Thaana fonts embedded
Kindle screenshot: PDF with Thaana fonts embedded

Kindle screenshot: Thaana Quran translation PDF
Kindle screenshot: Thaana Quran translation PDF.


Thaana in the browser


Thaana viewing via the WebKit-based web browser in Kindle was flawless in websites using Unicode Thaana (hence Haveeru Daily website is excluded). Code2000 has decent Thaana glyphs and looks very much readable on the device.

Kindle screenshot: Muraasil.com on Kindle
Kindle screenshot: Muraasil.com on Kindle


Unlike desktop systems, there is no native option to switch to a Thaana keyboard but because Javascript works, Thaana entry on websites using my Javascript Thaana Keyboard handler works just fine.

Kindle screenshot: Thaana entry using JTK
Kindle screenshot: Thaana entry using JTK


Adding a Thaana font


There are two ways of loading a Kindle with a Thaana font, though it is quite pointless for ebook reading purposes due to the reasons above. The rooted device method can be used to replace Code2000 with a font of your liking within the browser but keep in mind that Kindle will use the same font for the glyphs for English, numbers and puncuation and hence the font should be easy on the eye. In my opinion, this rules out most of the existing Thaana fonts, especially the common ones such as Faruma and the MV series of Thaana Unicode fonts. The best font I could find was the opensourced GNU Freefont which has very nice English glyphs and also includes the Thaana glyphs from Mohamed Ishan's Thaana Unicode Akeh font.

Rooted device + font replacement method
This method makes permanent changes to the Kindle and requires that you root your Kindle through a very simple procedure and install an associated custom fonts hack. The details are available here.

User fonts method
This method only works for Kindle 3 devices and does not require rooting the device and makes temporary changes to the Kindle by enabling a hidden user font mode in the device. The changes persist as long as you do not alter the font-face settings on the Kindle. Details on how to do this are available here.

Creating Thaana ebooks


For now, the only method for getting Thaana to work on Kindle devices seem to be via font-embedding in PDF documents. The easiest, and perhaps the most cost effective, method of producing such documents would be to prepare the document using your choice of document editor (like MS Word or OpenOffice) and printing out the document to the virtual printer provided by print-to-PDF software such as the free PDFCreator applications.

How-to for Windows:
1. Download and install the PDFCreator application.
2. Go to the print function in whichever software you are using and select the PDFCreator virual printer.



3. When the PDFCreator print window comes up, click the "Options" button.



4. On the PDFCreator print options window that comes up. Select "PDF" under "Formats" from the left, switch the "Fonts" tab and make sure "Embed all fonts" is ticked. Customise the "Subset font..." option if you would like and click "Save".


5. You only need to set font embedding as above once and the program will use it in future prints. When you are back at the print screen, set the Document title and other details as you please and click "Save".

To ensure that the PDF you saved (or any other PDF that you may have) has the Thaana fonts embedded, load it up your favourite PDF viewer software and check the document properties.



Conclusion?


Thaana on Kindle is very limited for now. The only option to produce and read Thaana ebooks is using the PDF ebook format with the Thaana fonts embedded in the PDF. This does mean that Kindle devices can be used to read Thaana without rooting or any hacks. Thaana usage on the web browser in Kindle matches that of a mobile device or even a desktop or laptop computer.

Toodles.

Domain names in Thaana?

The Internationalized Domain Names for Applications (IDNA) standard which allows non-Latin alphabet to be used as domain names has been around for a few years and many of the top domain registries do support IDN registration now. ICANN, the corporation responsible for the management of the domain name system, also recently approved the creation of country-code top level domains in non-Latin alphabet. Hence, countries can now use top-level domains in their own language. Egypt, for example, now has adopted "‏مصر" as an option in addition to the usual Latin-based top level domain "eg".

The IDNA standard, along with the recent ICANN approval, means that there is now a framework allowing domain names to be written entirely written in Thaana. Before one gets too excited, there are a few issues to be aware of though. First, unfortunately the use of fili (diacritics) in the name seems to be not supported by IDNA (I've yet to read up to see whether this is an issue with the current implementations of IDN or something inherent in the IDNA standards). So, any domain name will be just a jumble of Thaana letters for now. I had to choose the address "ޖ.com" instead of "ޖާ.com" because the latter is unsupported. Second, for us to be able to have fully Thaana domain names, the government has to first adopt a suitable top-level domain (perhaps "ދވހރއޖ" or "ރއޖ"?), get ICANN approval and then wait for licensed Maldivian domain registrars (only Dhiraagu as far as I am aware) to start accepting registrations under the new top-level domain. This might seem quite pointless but given the increasing number of Thaana-based websites, I think we are soon going to see an explosion in the number of websites with domain names in Thaana.

Let's see how it all goes... :-)

Thaana text rendering: A solution for devices without the required fonts

A few years ago I wrote a PHP-based Thaana text rendering class while investigating solutions to the problem of displaying Thaana text in web browsers on various devices. The class dynamically converts any given Thaana text into a formatted image of given dimensions and type. The use of images to display Thaana means that the information can be viewed on a large variety of devices and does away with the demand for the device to support Thaana fonts. On the flip side, the use of images does mean that this approach has higher bandwidth and data transfer requirements than text.

Features

The class makes use of the powerful image manipulation services provided by the GD library to create images from text and hence inherits the wide of features it offers. However, since the GD library does not (or atleast did not, back then) support right-to-left scripts and does not offer line wrapping to fit text within a bounding box, custom code had to be written to handle the unsupported text direction and formatting. The class also supports use of any Thaana font, made possible by GD support for loading TrueType fonts.

Applications

This piece of code was briefly put to live use around 2004 on the (now defunct) MUnet.net's Radheef service. More recently, it has been put to great use by Muraasil.com to display Thaana on their mobile service so that user's can read news in Thaana on mobile devices, including Windows Mobile-based phones and the iPhone.

Demo

Give it a go and play around: Thaana text rendering demo.

I am not releasing the code publicly just yet...

Thaana Common Fonts Research

Thaana Common Fonts Research (CFR) is a Thaana related research project I launched late last month and has been running since. Today, I finally got around to writing down some introductory information on the project, so here it is.

Introduction

This project will conduct some basic research into the prevalence and distribution of Thaana fonts.

Purpose

The investigation is aimed at obtaining:
- An understanding of the prevalence of individual Thaana fonts
- An understanding of the co-occurrence dynamics of Thaana fonts
- The distribution of Thaana Unicode and non-Unicode Thaana fonts
- The OS dependence of the fonts

Significance

This study will help us to:
- Get a first look into the distribution of Thaana fonts
- Develop recommendations for the use of fonts on the web
- Develop recommendations for the use of fonts in software and in documents
- Formulate plans for improving the reach of Thaana (and hence, Dhivehi)

Method

The research is conducted via the World Wide Web by sampling the fonts installed on the devices used by Maldivian web users.

The process goes like as follows:
1) A small, invisible Flash-based data collector is embedded into websites.
2) When a user visits a participating website, the data collector automatically compiles a list of the fonts installed on the system. This is done once per user device.
3) The font names and the operating system of the user is sent to my server where the data is logged for later analysis.

It is intended that data sample collection will be carried out until the end of this month (June 2009).

Participate

Webmasters and website owners can participate and contribute to this research by embedding the Flash-based data collector using the HTML code shown below into their website. Please change the DOMAINHERE bit to the domain name of your site so that I know who to chase if there are issues. The field is also used to note your contribution and participation in the project.
<object data="http://labs.jawish.org/cfr/cfr.swf" height="1" width="1" type="application/x-shockwave-flash">
	<param name="flashvars" value="site=DOMAINHERE" />
	<param name="movie" value="http://labs.jawish.org/cfr/cfr.swf" />
</object>


If you operate a high traffic Thaana-based website, I urge you to consider participating and help make this project a success. My thanks in advance!

Statistics

As of writing this post, 2293 data samples has been collected and 269 Thaana fonts have been identified and is being tracked.

You can see LIVE stats on the CFR project home.

Thaana @ Projects

It is something that has persisted on my to-do list but I have finally got around to compiling all my Thaana related work, which currently are scattered across various posts on my blog, into a single page for easy access and reference.

- Check out my newly created Projects > Thaana page


PS: My final, final exams at university are underway these days and things have been pretty hectic, thus the lack of posts of late... Wish me luck!

Javascript Thaana Keyboard version 4.2.1

Here's an update to my Javascript Thaana Keyboard library which provides easy entry of Thaana on web pages without the involvement of OS-based keyboard switching. Hit the demo page to see it in action.

This release is solely a bugfix release addressing an issue with the display of newly entered text in multiline fields where text exceeds the size of the visible area. I originally cut this release in February but decided to hold back on a public release till I had further issues to fix or had new features added, neither of which has come since...

Thanks goes to Ahmed Ali for bringing the bug to my attention.

Changelog

+ Fixed issue with the display of newly entered text in multiline fields where text exceeds the size of the visible area.

Usage

Usage remains same as before. Please refer to my detailed post on the 4.0 release.

Demo

As usual, a demonstration and testing page is available.

Download

- full source version (5.66 KB)
- packed version (2.47 KB) [recommended]