How could I programmatically install a font on the Mac platform (Snow Leopard)? What steps would I need to follow? I would like for the user to input a font file, then my software installs it.
How could I programmatically install a font on the Mac platform (Snow Leopard)? What
Share
Fonts belong in ~user/Library/Fonts/ for a single user or /Library/Fonts/ to be accessible to all users. You need to get permission in order to write to /Library/Fonts/, although there is an API for that which makes it relatively easy. (I have the code somewhere and can look it up if no one else knows offhand.)
As requested, here are some API docs:
http://developer.apple.com/mac/library/documentation/Security/Reference/authorization_ref/Reference/reference.html
This is old code I have that did the update under Carbon (hence the pascal strings). It was based on sample code which is probably somewhere in the above URL. I haven’t looked into doing this under Cocoa, and this is a edited version of the code (still a bit messy), so YMMV.