Created
June 5, 2020 22:28
-
-
Save ahmedk92/d8816a899b2331227724127b2b6e94fe to your computer and use it in GitHub Desktop.
Print Glyph Names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let font = CGFont("fontName" as CFString)! | |
for glyphIndex in 0..<font.numberOfGlyphs { | |
let hexPart = (font.name(for: CGGlyph(glyphIndex))! as String).replacingOccurrences(of: "uni", with: "") | |
if let int = Int(hexPart, radix: 16) { | |
print(Character(Unicode.Scalar(int)!)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment