2 Answers
2

My previous answer was for the unedited question. To answer the new question of how to install fonts programatically on a Mac, Rich's answer is correct, just move them into the fonts folder.

EDIT: To fit within the spirit of my previous answer, here's a (roughly done) AppleScript which will install a font file located at /some/path/to/a/font_file.ttf by using the OS X application "Font Book"

This could be executed in C++ via the osascript command; if you need help with that, it's a separate question altogether. Or you could do as Rich suggested and just move the file using the C rename() function.

Previous answer (for reference purposes only):

I suggest using the "Font Book" program located in /Applications. In addition to automatically coping the font to the proper font folders (outlined in Rich Bradshaw's answer) Font Book will verify the font before installing. Fonts are notorious for being corrupt and causing issues. In addition, Font Book shows the fonts which are installed and allows you to disable them.

To add fonts using Font Book, open the application and choose "Add Fonts" from the "File" menu. Before doing this I highly recommend to choose "Preferences" from the "Font Book" menu and ensure that "Validate fonts before installing" is enabled. Also, here you can decide if the fonts will be installed just for the current user, or for all users of the computer.