how to use punjabi font in the android application?

别等时光非礼了梦想. 提交于 2019-12-28 18:57:07

问题


hi i want to develop an application in which i Want to use punjabi text. But my emmulator does not show Punjabi text. Is there any api or something else so that my emulator can show the punjabi text or suggest me any other way to implement punjabi language in my application.

Thanks in advance.


回答1:


You can use custom TrueType fonts by copying the .ttf file into your projects's 'assets' folder.

Then in your application you can use the font like this;

final Typeface customF = Typeface.createFromAsset(this.getAssets(), "custom.ttf");
final TextView textV = (TextView) findViewById(...);
textV.setTypeface(customF);

However i've had so many problems trying to use TrueType fonts so you might want to do some real life testing with your (pubjabi) font.




回答2:


Typeface font = Typeface.createFromAsset(getAssets(), "bulara_5.ttf");  
text.setTypeface(font);  
text.setText("ਪੰਜਾਬੀ");

This worked for me on non rooted phone OSv 2.1

Link for font file I used: http://homepage.ntlworld.com/paul-grosse/bulara.zip




回答3:


I don't think that android 2.3 supports the punjabi font. Hence you see those boxes.

Follow this thread to know when your favourite language will be supported. I've heard that Samsung android devices support some Indian regional fonts.



来源:https://stackoverflow.com/questions/6199813/how-to-use-punjabi-font-in-the-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!