Issue when using a custom font - "native typeface cannot be made"
Solution 1
The font file is either corrupt or unsupported for some reason. You can drop it on the SD card and load it from file, to make sure it's not a problem with your assets.
Solution 2
My problem was incorrect placement of the assets folder.
When using Android Studio the assets folder should be inside of the source sets e.g.
src/main/assets/
Found in this answer
Solution 3
There are basically 4 things that can cause this:
- You use the wrong extension
- You have to place the fonts in the assets folder and not inside assets/fonts/
- You misspelled the fonts
- The fonts need to be lowercase (in my case the solution was to rename MyFont.ttf to myfont.ttf, strange)
Solution 4
Double check the extension isn't in caps, ie. suralist_font.TTF
Fonts often come seem to come that way and it might be overlooked.
Solution 5
I had this same problem, I created mine in assets>fonts>whatever.ttf and was getting the same error. I added the fonts extension (fonts/whatever.ttf) and it fixed the problem in every case.
holder.tv_SuraName =(TextView)convertView.findViewById(R.id.Start_Name);
holder.tv_SuraName.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "fonts/suralist_font.ttf"));
Omar
Updated on February 15, 2020Comments
-
Omar about 4 years
I'm trying to use a font I found on the internet, but the problem is that I get an FC with "native typeface cannot be made".
Here is the code in the getView of my ListVIew:
holder.tv_SuraName =(TextView)convertView.findViewById(R.id.Start_Name); holder.tv_SuraName.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "suralist_font.ttf"));
Can anyone tell me why can I use the custom rom? You can get it HERE .. the file is .ttf