简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM