如何检查字体是否受字体支持 [英] How to check if a character is supported by a font

查看:176
本文介绍了如何检查字体是否受字体支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个带有文本字段的应用程序。在这个字段中写的文字将会被打印出来,而且我也遇到了一些像表情符号,中文字符等字符的问题,因为这个字体没有提供这些字符。

这就是为什么我想要得到字体提供的所有字符(字体被下载,所以我可以直接处理文件或UIFont对象)。

I听说> CTFontGetGlyphsForCharacters 但我不确定这个函数做了我想要的,我不能得到它的工作。

这是我的代码:

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

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 = @"
                        

这篇关于如何检查字体是否受字体支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆