My application have listview with friends name in Marathi and Hindi fonts.
But names in Marathi and Hindi fonts are displayed as block.
I also have .ttf file for Marathi and Hindi fonts and i also added that in assets->fonts folder.
Try this ::
here i have set comic font in my textview. you can copy file in assets folder and apply following code :
Typeface face;
face = Typeface.createFromAsset(this.getAssets(), "fonts/comic.TTF");
tran_banner = (TextView) findViewById(R.id.tran_banner);
tran_banner.setTypeface(face, Typeface.BOLD);
Related
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)
Basically i am creating an app which have multiple languages fonts means english as well as local language(Hindi & some other) fonts. but the problem is it display only english text not the other.Text in other languages shown in rectangle box. I want to show all types of text. please suggest me.
Here is the snapshot
I got my answer. here is the link
This file support all Indian language fonts and english too. Just copy paste this file in assets filder and include in the code
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/file_name.ttf");
TextView tv = (TextView) findViewById(R.id.yourtextview);
tv.setTypeface(tf);
I am trying to change typeface in a Textview which shows a chinese text.
My code is:
chinesetext = (TextView)findViewById(R.id.textChinese);
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/DFXSM1B.ttf");
chinesetext.setTypeface(tf);
DFXSM1B.ttf is in my assets/fonts folder.
I am unable to see the textview typeface changed.
How can I change to a custom typeface in a chinese text ?
I am using paint to set typeface, it dosen't work for chinese text...
I used the font family is 思源宋体 Medium
and my code like this: (that is very simple)
var typeface = Typeface.createFromAsset(context.assets, "fonts/font1.otf")
paint.typeface = typeface
All the files in asset folder must have lower-cased names.
Rename the file in lower case (dfxsm1b.ttf) and it must work.
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);
I am developing application which is having Gujarati font in text-view but my problem is that in text-view it shows the box instead of Gujarati font i have tried by "TypeFace" and text is at string.xml but it is not working please help me i have to submit on tuesday at school so please please help me
Thank you in advance
TextView cap = (TextView) view.findViewById(R.id.caption);
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/gujaratifont.ttf");
cap.setTypeface(tf);
cap.setText(R.string.gujarati);
Drop your file in assets Folder.
Try to do like this. getResources().getString(R.string.gujarati);
Its one reason is because Resources could not get to the TextView. Just Check it out.
TextView cap = (TextView) view.findViewById(R.id.caption);
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"fonts/gujaratifont.ttf");
//(or)
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"gujaratifont.ttf");
cap.setTypeface(tf);
cap.setText(R.string.gujarati);
and place your font file in assets folder.
i.e., create a folder with name fonts in assets folder and place that gujarati font in fonts folder.
if you want gujarati font download it from HERE
TextView mtxt = (TextView) findViewById(R.id.action_settings);
Typeface face1 = Typeface.createFromAsset(getAssets(),
"Lohit-Gujarati.ttf");
mtxt.setTypeface(face1);
mtxt.setText("પૂર્વ વડાપ્રધાન રાજીવ ગાંધી");