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)
Related
I have textview. I could not show japanese characteristics. So downloaded font to Assets/fonts folder. I tried this code
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/ipag.ttf");
TextView tv=(TextView) findViewById(R.id.name);
tv.setTypeface(tf);
But application not working. What should be changed?
This code has work for me:
first declare the font:
Typeface font;
second inside the onCreate:
font = Typeface.createFromAsset(getAssets(), "myfont.ttf");
third: also inside the onCreate:
myTest = (Button) findViewById(R.id.myTest);
myTest.setTypeface(font);
My application can change the languaje and japanesse in one of those, and it works well.
This is the font used:
http://wowslider.com/styles/miso-bold-webfont.ttf.
by the way, the font is inside the Assets folder.
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 am new to android development, I need to implement Rich text Editor in my Application. So i googled and found some solutions. I am using this solution:
http://code.google.com/p/android-richtexteditor/source/browse/?r=4#svn/trunk/src/net/sgoliver
It supports the Bold, Italic and Underline in it. Now I want to change the font-style of selected text in EditText, How do i do that?
I know how to set the font-style for all the text in EditText. Suggestions will be appriciated!
Copy the font files (*.ttf) to the assets folder of your application.
Consider I have copied the font file "verdana.TTF" to the assets folder, then the following code will set the font to verdana
EditText et=(EditText) findViewById(R.id.editText1);
Typeface tf = Typeface.createFromAsset(getAssets(),"verdana.TTF");
et.setTypeface(tf);
Hope you got the solution
editText.setTypeface(Typeface.SERIF); as like as TextView.
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/Comic.ttf");
EditText et = (EditText)findViewById(R.id.et);
et.setTypeface(tf);
you can place ttf file in assets and set font style here
try this code..create font folder like this assets/font and put your font file in it..
edittxt = (EditText) findViewById(R.id.edittxt);
Typeface myTypeface = Typeface.createFromAsset( this.getAssets(), "font/YOURFONT.otf");
edittxt.setTypeface(myTypeface);
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("પૂર્વ વડાપ્રધાન રાજીવ ગાંધી");