Check if custom font can display character

Viewed 5695

I have a custom font which is displaying the box character. The font I am using does not support all languages apparently. I want to check if the String I am about to display can be displayed by my custom font. If it cannot then I want to use the standard Android font (which I know can display the characters). I can't find a method to check if my Typeface can display a particular String though. I am sure I have seen a method around that does this somewhere. Anyone know?

7 Answers

Use PaintCompat.hasGlyph which relies on Paint.hasGlyph in API version 23 and above, but has a backwards-compatible implementation for older Android versions.

Related