How to tell if a particular font has a specific glyph >64k

前端 未结 1 1474
离开以前
离开以前 2021-01-16 12:38

It\'s relatively easy to determine if a particular Unicode font contains a glyph for a code point when the code point fits into a 64 bit value.

if (CTFontGet         


        
1条回答
  •  生来不讨喜
    2021-01-16 12:54

    This is what I wound up using (where codePoint is the 32 bit code point you want to test for):

        UniChar characters[2];
        CFIndex length = (CFStringGetSurrogatePairForLongCharacter(codePoint, characters) ? 2 : 1);
    
        CGGlyph glyphs[2];
        if (CTFontGetGlyphsForCharacters(ctFont, characters, glyphs, length)) {
            // It Exists
        }
    

    0 讨论(0)
提交回复
热议问题