How to get all characters of the font with CTFontCopyCharacterSet() in Swift?

前端 未结 2 1305
清歌不尽
清歌不尽 2021-01-27 00:51

How does one get all characters of the font with CTFontCopyCharacterSet() in Swift? ... for macOS?

The issue occured when implementing the approach from an

2条回答
  •  长发绾君心
    2021-01-27 01:35

    You can do something like this.

    let cs = CTFontCopyCharacterSet(font) as NSCharacterSet
    let bitmapRepresentation = cs.bitmapRepresentation
    

    The format of the bitmap is defined in the reference page for CFCharacterSetCreateWithBitmapRepresentation

提交回复
热议问题