Marathi Font Support for Textview in Android - android

I have a widget layout containing textview. I want to set marathi text to that textview.
I am trying ticker widget which shows marathi news on screen. the problem is i am unable to set marathi font to remoteview. Any Help? Thanks in advance
Edited:
Here is My code
RemoteViews remoteViews = new RemoteViews(this .getApplicationContext().getPackageName(), R.layout.widget_layout);
// Set the text
remoteViews.setTextViewText(R.id.txt_marqee, stringBuffer);
this is my remoteview inflating widget_layout. And this layout contains textview which i am using as a ticker. I want to set devnagari font to remoteview. Any help?

As Devanagari fonts are not supported by Android, you can still give that support to your Application.
For Marathi font copy font file to your asset folder. then use the following code.
TextView text_view = new TextView(this);
Typeface font = Typeface.createFromAsset(getAssets(), "MarathiFont.ttf");
text_view.setTypeface(font);
text_view.setText("मराठी");
the same way u can give support for hindi....

For this you will have to Get a MarathiFont.ttf file, then
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/MarathiFont.ttf");
and then :
text.setTypeFace(tf);

Dude its so simple Just use follwing line of code
TextView info=(TextView)findViewById(R.id.info);
Typeface face=Typeface.createFromAsset(getAssets(), "fonts/georgia.ttf");
info.setTypeface(face);
Place your font in assets in fonts folder. Work karel. Thanks

First up all you should add the marathi font (ttf) in devices. Below is the adb command for adding the font.
adb su push .ttf /system/fonts/DroidSansFallback.ttf
Then use this font for display.

1)download marathi fonts from website as follows:
http://www.angelfire.com/pop/top4/fonts/
2)apply following code:
TextView info=(TextView)findViewById(R.id.textview);
Typeface face=Typeface.createFromAsset(getAssets(), "fonts/your font.ttf");
info.setTypeface(face);

Related

Adding costum font to android in font family xml

In the android guides for Fonts in XML, they give the example of font family XML you create by adding:
android:font="#font/lobster_regular"
Which I think its the font you added to your assets/font folder. But when i try it I don't get it why it isn't able to find the font I've added. It only fins sans, serif and mono-space. Anyone have a clue what it might be the problem?
I know there are other ways to add a custom font, but due to the material calendar that I want to use, I need it to define in the styles XML, only way to customize it. I tried calligraphy lib, but does not help.
Using typeface you easily set font family
Typeface type = Typeface.createFromAsset(getAssets(),
"fonts/fontname");
now set this typeface to your textview
tv.setTypeface(type);
Add this to your activity code:
TextView tv = (TextView) findViewById(R.id.appname);
Typeface face = Typeface.createFromAsset(getAssets(),
"fonts/fontname");
tv.setTypeface(face);
Note that for this you'll have to create a fonts folder at app/src/main/assets

How to set Marathi font to text view in android?

I am developing android application in Marathi language,
for that i want to set Marathi font to text view.
So please let me know how to set that
Thanking you..
Put your font in assets folder, then create new Typeface from it
Here is an example
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "SomeFont.ttf");
txt.setTypeface(font);
First of all put your fonts in assests folder in your project.
then in textview in java file where you want to put marathi, use this code:
Typeface mfont = Typeface.createFromAsset(getAssets(), "roboto_light.otf");
<your Textview>.setTypeface(mfont);
Download marathi fonts and save it in assests folder and set typeface using that font.
Sample:
TextView textView = (TextView)findViewById(R.id.textview);
Typeface tf = Typeface.createFromAsset(getAssests(), "name_of_font.ttf");
textView.setTypeface(tf);
you need to pass unicode character like\u... to you textview text.
you can use converter to convert the language. Or can take a look http://www.unicodeonline.com/
For getting the exact value you can pass your unicode into
ResourceBundle.getBundle(unicodestoragelocation,locale).getString(UnicodeValue)

How to use mathematical fonts in android?

I am creating an app which uses math fonts like lambda,integral etc in android. And how could i use an keyboard for that? plz help nothing found on google
If you have a .ttf font file with your symbols, place it in the /assets folder then use it on a TextView like this:
Typeface font = Typeface.createFromAsset(getAssets(), "font.ttf");
TextView tv = (TextView) findViewById(R.id...);
tv.setTypeface(font);
As for using the keyboard see:
http://www.addictivetips.com/mobile/create-your-own-custom-keyboard-for-android-devices/ and creating custom android keyboard layout

How to change the Font styles and face in Android?

I want to change the font face and styles in android. How to do this? Am using emulator. Is this possible to change in emulator. Is there any permissions available to do that. Thanks in Advance.
in android only five fonttype-face
TypeFace
Typeface.DEFAULT
Typeface.MONOSPACE
Typeface.SANS_SERIF
Typeface.DEFAULT_BOLD
Typeface.SERIF
and font-type
Typeface.NORMAL
Typeface.BOLD
Typeface.BOLD_ITALIC
Typeface.ITALIC
you can use like as
textView.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
and other way is you can download any .ttf file and put it in asset folder and use like as this
Typeface type=Typeface.createFromAsset(context.getAssets(),
"DroidSansMono.ttf");
textView.setTypeface(type, null);
You can change the font style and font face in your XML files. For example if you want to change your Button's style and face. Choose your button in xml and follow the below methods :
Button -> Right Click -> Properties -> Typeface and style
Hope this will help you.
If you want to change in code ;
This is good reference;
http://mobile.tutsplus.com/tutorials/android/customize-android-fonts/
what you want?. Do you want to change the font face and styles of text in textview. if yes then use this
Typeface type = Typeface.createFromAsset(this.getAssets(),"your font name");
text.setTypeface(type);
and for styles use these links:
Style-resource
Themes
If you want to use a font which is not default (like "Helvetica") for the text in Android application then put the font file(Helvetic.ttf) in assets folder and do use this code as below:
Typeface tf= Typeface.createFromAsset(getAssets(), "Helvetica.ttf");
TextView mTextView =(TextView) findViewById(R.id.text);
mTextView.setTypeface(tf);
if u want to use custom font jus download .ttf file and put the file into assets folder
and use like this:
TextView tv=(TextView)findViewById(R.id.textView);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/arial.ttf");
tv.setTypeface(tf);

Custom Font Issue In Android

I am trying to use custom font in android. I have written java code as given below.
TextView txt = (TextView) findViewById(R.id.customfont);
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/Molot.otf");
txt.setTypeface(font);
where I have stored the custom font in "./assets/fonts/" folder.
But, I am getting nullpointerexception on the 3rd line.
Can anybody give me the solution for this issue? Thanks
Android supports only TTF font type not OTF. Check this link
"RuntimeException: native typeface cannot be made" when loading font
Android supports OTF as well. Your font may be corrupt.
Download delicious font from www.exljbris.com/delicious.html. It is an otf font and it works for me.
Try this
Typeface font = Typeface.createFromAsset(getAssets(), "/fonts/Molot.otf");

Categories

Resources