如何判断特定字体是否具有> 64k的特定字形
当代码点适合64位值时,确定特定Unicode字体是否包含代码点的字形相对容易。
if (CTFontGetGlyphsForCharacters(ctFont, chars, glyphs, 1)) { // It exists }
但是CTFontGetGlyphsForCharacters采用了一个16位类型的UniChar数组。 有没有一种方法可以确定字形是否可用于超出此范围的字符? 例如,U + 1F4A9?
这就是我最后使用的东西(其中codePoint是你要测试的32位代码点):
UniChar characters[2]; CFIndex length = (CFStringGetSurrogatePairForLongCharacter(codePoint, characters) ? 2 : 1); CGGlyph glyphs[2]; if (CTFontGetGlyphsForCharacters(ctFont, characters, glyphs, length)) { // It Exists }