Font Typeface not working

TextView tv=(TextView)findViewById(R.id.textView1); Typeface face=Typeface.createFromAsset(getAssets(), "font.ttf"); tv.setTypeface(face); 

I do not see changes in the text font. I have a file "font.ttf" in the resource folder. Basically, I intend to show the word “urdu” in this text (requirement) and therefore add the Urdu font to the assets. However, he shows me the "WORD" in English.

Thanks for the help.

+4
source share
2 answers

Android does not support the full set of ttf fonts. Here is the font that I personally used in my application. Try using this instead. If this works, and your Urdu does not match your code, and Android does not support your font. If it doesn't work, then something is wrong with your code.

+4
source
 Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/burnstown_dam.otf"); TextView tv = (TextView) findViewById(R.id.CustomFontText); tv.setTypeface(tf); Typeface tf1 = Typeface.createFromAsset(this.getAssets(), "fonts/Jameel Noori Nastaleeq Kasheeda.ttf"); TextView textView = (TextView)findViewById(R.id.CustomFontText); textView.setTypeface(tf1); textView.setText("Your Font Language Here"); 
0
source

Source: https://habr.com/ru/post/1434877/


All Articles