How to get the Font Name from the Font file?
I have downloaded a Font file from the internet and the name of the font file is nuku1.ttf.
I have to use that in my application so I activated that by using this. CTFontManagerSetAutoActivationSetting(FontPath,2);
. After activating this font file 开发者_运维技巧how can get the font name for that file Programmatically? In other words where the AutoActivated Fonts are stored in mac?
CTFontManagerSetAutoActivationSetting(FontPath,2);
The CTFontManagerSetAutoActivationSetting
function takes a bundle identifier, not the path to a font. (Also, you should use the value names, not hard-coded numeric literals.)
To examine a font file, use the CTFontManagerCreateFontDescriptorsFromURL
function to create an array of CTFontDescriptor objects, one for each of the fonts in the file. Each descriptor will tell you the font's PostScript name, family name, and display name, among other attributes.
精彩评论