0 Size Mac Fonts

This no longer works in Snow Leopard

I was trying to do this again after upgrading to Snow Leopard and the OS no longer handles extended attributes in the same fashion. Attributes are now in a new style and the old style attributes you can only print out the hex. To get the value you have to do xattr -px com.apple.ResourceFork file_name | xxd -r -p > file_name.ttf. I tried this a few times and even though the file contents matches up exactly with the resource fork, the font does not appear to work. I also noticed that simply copying or moving the individual fonts on my Mac would cause them to stop working.

I just ran into a very weird issue today trying to transfer fonts from a Mac to a PC. I had several fonts on my mac that were working, installable, usable, and showed as having a size. When I tried sending them to a friend they would show up as 0k. I tried sending individual fonts, as a zip, via gmail, from a link, nothing worked. I decided to take a look at the files, opening them in a text editor showed nothing. Listing their file size in the terminal showed them as 0 bytes. The only place I could think of that data being stored was somewhere in the file attributes.

Back in OS 9 Mac fonts used to store their data in the resource fork. Normally this is used for storing metadata about a file. Someone at Apple decided that putting fonts in there was a good idea. Now in OS X the resource fork has been moved to the extended attribute com.apple.ResourceFork. Extended attributes are not used in file size calculations by terminal. If you want to see the extended attributes you can use xattr -l file_name. Running that on the font file showed a giant chunk of data in com.apple.ResourceFork that was definitely the font info. Mystery solved.

Converting the file is easy once you figure this out. You can simply dump the resource fork into a file with the extension .ttf and OS X will interpret it as a PC true type font. Use xattr -p com.apple.ResourceFork file_name > file_name.ttf to get the data. This will allow you to copy the file to a PC. I make absolutely no promises as to how well this works, but it worked for me. You can also try converting using transtype http://www.fontlab.com/font-converter/transtype/