Alex Rivera | Logout

Issue when using a custom font - "native typeface cannot be made"

Asked 2011-09-23T16:07:26.183
51

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

Edit
Report

2 Answers

29

There are basically 4 things that can cause this:

  1. You use the wrong extension
  2. You have to place the fonts in the assets folder and not inside assets/fonts/
  3. You misspelled the fonts
  4. The fonts need to be lowercase (in my case the solution was to rename MyFont.ttf to myfont.ttf, strange)
answered 2013-05-30T21:20:41.700
0

As CommonsWare states in this answer

I would guess that there is a problem with the font itself. That error will be triggered when native code in the OS attempts to load the typeface.

Anyway try this one:

holder.tv_SuraName = (TextView)convertView.findViewById(R.id.Start_Name);
Typeface Font = Typeface.createFromAsset(this.getAssets(),"suralist_font.ttf");
holder.tv_SuraName.setTypeface(Font);
answered 2011-09-23T16:29:26.157

Your Answer