I have an app with educational context I want to use an appropriate Persian font for reading. how can I know which fonts are available to use? (I mean, I do not want to download external one) and can anyone suggest a good Persian font for educational context?
Hi you can custom the fonts based on the view your looking for Download a font from internet and put it under assets/fonts folder.
tv1=(TextView)findViewById(R.id.textView3);
tv2=(TextView)findViewById(R.id.textView4);
Typeface face= Typeface.createFromAsset(getAssets(), "font/font.ttf");
tv1.setTypeface(face);
Typeface face1= Typeface.createFromAsset(getAssets(), "font/font1.ttf");
tv2.setTypeface(face1);
"Noto" is a standard Font for other Languages.
You can find "Noto" -- https://www.google.com/get/noto/
"Droid Arabic Naskh" is good and support persian, too.
Related
I am developing an Android aap that uses Arabic Fonts.
I have successfully display Arabic text by using "tahoma.ttf"
But problem is that these Arabic Fonts Didn't give a cool look.
So i wanted to change that Font Style. Is there any way of doing this ?
If you want to use external font do :
First step is to pick a font that you want to use.
Create a fonts folder in your assets directory and copy your font there.
To access your custom font,use the Typeface class in the Android SDK to create a typeface that Android can use, then set any display elements that need to use your custom font appropriately.
Unfortunately, you can no longer use layout XML for this, since the XML does not know about any fonts you may have tucked away as an application asset.You can do like this in your code:
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/BPreplay.otf");
TextView tv = (TextView) findViewById(R.id.CustomFontText);
tv.setTypeface(tf);
Note: Android does not seem to like all TrueType fonts.So, if you try to use a different font and it does not seem to be working, it may be that the font is incompatible with Android, for whatever reason.
You can see more details in these pages:
Fun with Fonts
Musings of the Bare Bones Coder/using custom fonts
I have added an external font in /assets directory, and manually doing setFacetype(font).
Isn't there a general way to set the whole application to use a specific font if you have added it external? Or do you have to use Android's selected fonts in order to achieve this?
You cannot use your custom fonts through to whole application in a general way.
You cannot set your custom fonts through xml files.
You have to use the Typeface functions in your code to use your custom fonts within your application.
tv=(TextView)findViewById(res);
Typeface font = Typeface.createFromAsset(this.getAssets(), "MYFONT.TTF");
tv.setTypeface(font);
This also how to use it in a textview.
For whole application go to Using a custom typeface in Android.
and go to Manish Singla answer
Typeface mTypeface = Typeface.createFromAsset(getAssets(), "YOUR FONT NAME");
textview.setTypeface(mTypeface, Typeface.NORMAL);
I want to create an android application in which the user should be able to select a language of his choice(English/ Hindi/ Marathi).
I have checked some android forums and found that android does not support Devanagari fonts.
Is there a solution? Also, is there a solution without rooting the device?
As Devanagari fonts are not supported by Android, you can still give that support to your Application.
For Hindi font copy font file (saral.ttf or Shusha.ttf or any font hindi file) to your asset folder. then use the following code.
TextView text_view = new TextView(this);
Typeface font = Typeface.createFromAsset(getAssets(), "saral.TTF");
text_view.setTypeface(font);
text_view.setText("हिंदी");
the same way u can give support for marathi....
you can use following i18n solution for different languages
http://www.vogella.de/blog/2011/01/17/translating-android-applications-i18n/
http://www.kobu.com/i18n/android/index-en.htm
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.
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
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.
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.
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.
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
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.
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.