简体   繁体   中英

How to get the Font name from a font file in Mac osx 10.5?

I want to get the font name of a font file in Mac osx 10.5. I have done this for Mac osx 10.6 using CTFontManagerCreateFontDescriptorsFromURL like this.

        CFArrayRef fontDescription=CTFontManagerCreateFontDescriptorsFromURL(cfUrl);
        NSDictionary *dict=[(NSArray *)fontDescription objectAtIndex:0];

        fontName=[dict objectForKey:@"NSFontNameAttribute"];

Core Text is only available in Snow Leopard. You need to use the legacy Apple Type Services (ATS) for Leopard and below.

Also see the ATS programming guide .

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