Custom Font not working on Android

前端 未结 2 672
小蘑菇
小蘑菇 2021-01-16 11:13

I am doing the below. All I get is the basic font, not my custom symbol font.

Any ideas?

     Paint pnt = new Paint();
    // SymbolNo is 38. Returns         


        
2条回答
  •  春和景丽
    2021-01-16 12:01

    Not every font works with Android. It just silently fails.

    One course of action is to find an app that definitely handles a custom font -- such as this sample app of mine -- as a basis for experimentation. You can run that app to confirm that its fonts appear, then replace one of those with your font. If that works, then there is something messed up in the way you are loading in the font (though I have no idea what or how). If the font fails to work in my sample app, where the font that ships with that app does work, the problem lies in the font.

    Unfortunately, I have no idea what makes a font work or not work. You could try opening the font in a font editor, making a minor change (e.g., deleting some glyph you know that you won't need), saving it back out, and seeing if the revised font works. If it does, that means that however the font was saved originally has something in it that Android does not like, but that your font editor can generate Android-friendly fonts.

提交回复
热议问题