Android - Native typeface cannot be made for TTX font

486 views Asked by At

I noticed that the fonts in my application no longer display correctly under Android Lollipop. After some checking I found the issue here:

https://code.google.com/p/android-developer-preview/issues/detail?id=608&thanks=608&ts=1404735239

where the recommendation is to convert my TTF fonts to TTX. I tried doing it with one of the fonts and converted it using to the tool to a TTX font. I renamed the old TTF font to TTF_OLD and placed the TTX font in the directory. Using the line of code:

Typeface typeface = Typeface.createFromAsset(context.getAssets(), "somefont.ttx");

which only differs from my previous line of code in the extension name, it now no longer works and complains "native typeface cannot be made". Why is this? Is there some special way to make android use a TTX font as opposed to a TTF font?

Many many thanks

1

There are 1 answers

0
Udbhav On BEST ANSWER

The recommendation on the issue at code.google.com says that you should make your font go through a roundtrip though ttx tools. What that meant was you can do the following.

  1. Convert your ttf font file to ttx file using the ttx tool.

    ttx -o somefont.ttx somefont.ttf

  2. Convert the ttx file created in step one to a ttf file, again using the ttx tool.

    ttx -o somefont_converted.ttf somefont.ttx

Using this process. I was able to successfully make my font available nexus 5 running the factory lollipop image.