OSX: CGGlyph to UniChar

前端 未结 1 457
北海茫月
北海茫月 2021-01-20 12:32

I am currently writing a simple bitmap font generator using CoreGraphics and CoreText. I am retrieving the kerning table of a font with:

CFDataRef kernTable          


        
相关标签:
1条回答
  • 2021-01-20 12:44

    I don't know a direct method to get the Unicode for a given glyph, but you could build a mapping in the following way:

    • Get all characters of the font with CTFontCopyCharacterSet().
    • Map all these Unicode characters to their glyph with CTFontGetGlyphsForCharacters().
    • For each Unicode character and its glyph, store the mapping glyph -> Unicode in a dictionary.
    0 讨论(0)
提交回复
热议问题