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.


Sira machan. kool one

If anyone creating hybrid apps can try this too
akurulk.github.com
ගොඩක් ස්තූතියි මචං.
කාලයක් තිස්සෙ මාත් හොය හොය හිටියෙ වැඩේ කික් උනේ නැහැ කලින්.
තෑන්ස්!
Thank you very much for your valuable comments
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.
thanks for the valuable info machan.
please can you mention how to prevent that error?
thanks for your time.
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.
yes true….. chrishi..
Good
thanka machan karana vidiya share kalata.
This is really a great article helping Sri Lankan app developers. Thanks.
Thanks for you valuable comments
Thank You mcn… mama thawama Test kalee na.. but wadee hariyai kiyala hithanawa..
Pingback: Sinhala Fonts for Your Android App | chanakaudaya
meka hadapu kenek innawanam mata kiyanna. http://www.facebook.com/pdappi