How to check if a character is supported by a font

2019-01-26 21:19发布

问题:

I'm working on an app with a text field. The text wrote in this field will be printed and I have an issue with some characters like emoji, chinese characters, etc... because the font do not provide these characters.

It's why I want to get all the character provided by a font (The font is downloaded so I can deal directly with the file or with an UIFont object).

I heard about CTFontGetGlyphsForCharacters but I'm not sure that this function do what I want and I can't get it work.

Here is my code :

CTFontRef fontRef = CTFontCreateWithName((CFStringRef)font.fontName, font.pointSize, NULL);
NSString *characters = @"