Sunday 2 November 2008

Romanized Sinhala On Linux

This post may not be of interest to non Sri Lankans, but considering that a large number of Fedora users are from Sri Lanka (http://fedoraproject.org/maps/f9/), I decided to post this here.

I was introduced to the new Sinhala smart font by my friend McoreD, and all credits should go to him for discovering this gem. Currently, all available Sinhala fonts are not romanized. Therefore, typing them and displaying them is a real headache. The new smart font Suriyakumara is the first of it's kind, introducing a romanized sinhala font that is very easy to write and display. If the reader does not have the font installed, the displayed text will be in English, but still readable because the characters are directly translated in to their English equivalents. So no more weird looking gobbledygook we have come to experience with the traditional Sinhala fonts. Anyway, take a look at http://www.lovatasinhala.com/ and you will see what I am talking about. The animated header expresses this concept very nicely.

Getting the font to work on Windows involves installing a new keyboard layout. But in Linux, it was a breeze to setup. I was actually amazed by the ease with which I managed to get it working. This is definitely one of those things where the Linux way is much easier than the Windows way.

1. To begin, download the Suriyakumara font.
wget http://www.americansmartfonts.com/download/Suriyakumara.ttf

2. Make a new folder for the font in /usr/share/fonts and copy it over.
sudo mkdir /usr/share/fonts/sinhala
sudo cp Suriyakumara.ttf /usr/share/fonts/sinhala
cd /usr/share/fonts/sinhala


3. Run the font scaler and refresh the font cache
sudo mkfontscale && sudo mkfontdir
sudo fc-cache


4. The font is now installed. If Firefox was running while you were doing the above, close it and open it again. Then browse to http://www.lovatasinhala.com/. You should see the left column in Sinhala now.

5. Typing in Sinhala is easy. For example, open up Thunderbird, create a new message and type "penguyin" without the quotes. Select what you typed and change the font to Suriyakumara. You should see "Penguin" written in Sinhala.

6. Some characters such as "th" require latin characters. To be able to type those, go to System > Preferences > Hardware > Keyboard.

7. Click the Layouts tab and click the Add button.


8. Select "Serbia" from the Layout menu and select "Latin with guillements" from the Variants menu. Click Add.


9. By clicking Layout options, you can change the way you want to switch between the different keyboard layouts. I set it to switch when I press both ALT keys together.

10. Give it a spin. For example, to type "thaththa" do the following : "Alt+P aa Alt+P Alt+P aa". The full guide is here.


There is an active dev group over at http://groups.google.com.au/group/SinhalaUserGroup. Take part and help this wonderful project.