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/
Thanks for posting this, I had the same problem and was able to solve after coming across your post :)
I maintain two graphic designers – one OS X, one Windows. Mystery solved as to why fonts aren’t interchangeable between the platforms. Thank you.
Thank you very much for hints!
But seems like with “postscript type 1” fonts this method did not work properly. But the CrossFont utility saves me. It can eat mac os’s zips with zero size fonts and generate proper *.otf
Thanks for this. I tried this, and the fonts still don’t work on a PC. CrossFont or Fontlab seem to be either Windows based or don’t work on my mac and I have 10.6.8. Anything anybody has come across that works with a more recent mac? If I move my fonts off my mac, they reduce to 0kb.
Thank you so much for this article, without Transtype I could not have done it.
The .ttf format is perfect for everything!
Apple:Whenever I install a font using Font Book it copies a zero byte file into ~/Library/Fonts/ – Apple Questions
[…] The same issue was encountered here I think: dmertl.com/blog/?p=11 […]
With OS X El Capitan 10.11.6, I’ve just used the suggested sequence of commands to successfully extract a Lucida font from com.apple.ResourceFork:
xattr -px com.apple.ResourceFork Lucida\ Bright | xxd -r -p > Lubri1.ttf