Sinhala Fonts for Your Android App


When you are going to develop a localized app in Sinhala the biggest problem you are facing is Sinhala support for android. So here you can find simple example how to use Sinhala fonts with your android app. For the coding example I am using Amal Sinhla font,

First start a new Android project( In Eclipse go to New -> Other -> Android -> Android Project ). Then place your Sinhla font TTF file (Amal.TTF) in the ./assets directory. Create it if it doesn’t exist. Following figure show you how it looks after you add it.

Now you can do coding. Change the main.xml file as follows.


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 >
<TextView
 android:id="@+id/sinhala_font"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="wdhqfndajka"
 android:textSize="25sp"
 />
</LinearLayout>

Add following code lines to main activity class.


TextView txt = (TextView) findViewById(R.id.sinhala_font);
 Typeface font = Typeface.createFromAsset(getAssets(), "amal.TTF");
 txt.setTypeface(font);

Every thing is done. You can run the project. It will look like as shown in the bellow figure. Now you can develop a Sinhala enable android app easily. You can add not only Sinhala fonts like this but also any customized font.

About these ads

16 thoughts on “Sinhala Fonts for Your Android App

  1. ගොඩක් ස්තූතියි මචං.
    කාලයක් තිස්සෙ මාත් හොය හොය හිටියෙ වැඩේ කික් උනේ නැහැ කලින්.
    තෑන්ස්!

  2. Great way to start. but thing is if you use this font you can not set any dynamic strings with english and sinhala since the font amal.ttf got only sinhala letters with it. And also if we render something like “කෝ ” it might render as “ක ේ” (without space). So the best thing is come up with complete font set which contains both english and sinhala with all ispili and papili.

      • I’m working on it machan. I still couldn’t find the correct solution. SETT is soo expensive. So I had to come up with my own solution. When I was working on it I came across very interesting stuff. Android emulator doesn’t give same renderings when you developing in windows and Linux. But ultimately the way android render in real device is same as the way it gives in Linux platform. So for testing purpose we have to use Linux.

      • thx for your kind feedback machan.
        have to research more on the subject as you said. I tht SETT was an open sourced product. :(
        any alternatives to achieve the maximum sinhala unicode rendering without using SETT FTW? thx again!

    • Thank you for your valuable comment. Is it a problem with amal.ttf? And also it is not wise to use this method for dynamic strings. Specially I posted this, those who like design UI with different fonts.

  3. Pingback: Sinhala Fonts for Your Android App | chanakaudaya

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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