How to install fonts from MACOSX folder on Windows

I have been sent a QuarkXPress document which contains a number of unusual fonts which were also sent to me. The fonts were in a folder named fonts and then it was all zipped up into a single archive containing the document and fonts folder. I believe this was done on a machine running Mac OS X.

I have unzipped the archive, but all of the files in the fonts folder have no size - i.e. they are 0 bytes files. However there is also a __MACOSX folder which has a fonts subfolder. In here I can see all the font files (prefixed with ._) and they all have a size, i.e. are not 0 bytes. Presumably these are the actual font files I need but I cannot figure out how to install them on Windows.

I have tried renaming the files to have .ttf and .otf extensions and then installing them but that doesn't seem to work - I just get an "Invalid font file" message.

Any other ideas?


Solution 1:

For some Mac fonts, the font information is stored entirely in the resource fork of the file. On Mac OS X, such fonts look like normal files in Finder, but from tools like ls (and anything else that uses the POSIX layer) these look like zero byte files.

The __MACOSX/._* files from the Zip file are AppleDouble encoded versions of the combination of the resource fork and some extra Finder information from the original files. AppleDouble files are used by Mac OS X when storing files that have a resource fork or Finder info on filesystems that do not support resource forks and Finder info (here Zip is considered a filesystem).

I am not a Windows user and my searches did not turn on any pre-made tools for this. I did find a set of tools that might work. It would be best to run them on a Mac, but they might work on Windows, too.


If you have access to a Mac

  • extract your Zip archive on that Mac (double-click it, do not use the command-line unzip) and
  • use a tool like Fondu to extract the TTF (or whatever) from the resource fork
    • (I just found the fondu, I have never used it before; caveat emptor)

If you do not have access to a Mac, you may still be able to use fondu, but you will need to compile fondu yourself (it looks like it is possible to build it on Linux, so you might also be able to build it in (e.g.) Cygwin). The next problem is that fondu does not seem able to read AppleDouble files, so you will have to find something that can extract the bare resource fork from the AppleDouble encoded ._*file. I am not sure which Windows-specific tools might be able to decode AppleDouble, but the Mac::AppleSingleDouble Perl module can do it:

perl -MMac::AppleSingleDouble -e 'for(@ARGV) {
    $a = new Mac::AppleSingleDouble($_);
    if(open $f, ">", $_.".rsrc") {
        binmode $f;
        print $f $a->get_entry(2);
        close $f;
    }
}'__MACOSX/._Webdings
# now I have a __MACOSX/._Webdings.rsrc file from which fondu can extract Webdings.ttf

If you are familiar with building Unix-oid tools, building fondu should be easy. For the Perl bit, you should be able to use the cpan tool that comes with most installations of Perl (or, if you are familiar with the layout and installation of Perl modules, just download the AppleSingleDouble.pm file and put it in an appropriate place).

Solution 2:

The Perl module that Chris Johnsen mentions is excellent - as is his little command line script! I've needed this info myself.

In other news, the t1unmac command in the t1utils package does the exact same font "unmaccing" but has appledouble support built in!