|Pathologically Eclectic Rubbish Lister|
Re: Using fonts in GD on OS X.by jimt (Chaplain)
|on Oct 24, 2006 at 14:03 UTC||Need Help??|
What a PITA. I'm documenting here so others may learn from my pain.
There are vague claims on the internet that GD will work with Mac OS X style dfont files. For example, the instructions on compiling gd on OS X (http://www.paginar.net/matias/articles/gd_x_howto.html) claim to be able to run gdtestft with a dfont file. Theres also this useless little comment: (http://use.perl.org/comments.pl?sid=24188&cid=37044) that gave me hope. Bus error for me.
I tried re-configuring gd an ran the gtestft script and got this error:
So I dug some more and I found this http://lists.freedesktop.org/archives/fontconfig/2006-October/002501.html which claimed that freetype-2.2.1 enables MacOS specific font format support, but requires Carbon framework functions, however freetype-config and freetype2.pc don't pass the appropriate linker flags. It has instructions for flags to add, which I did.
Now gdtestft tossed this error:
Progres, at least. That lead me to this link: http://tolstoy.newcastle.edu.au/R/devel/05/05/0752.html, which told me that I should remove my symlink to my own intalled /usr/local/libjpeg.dylib. So I did that, re-configured and re-made gd, and now gdtestft died quietly and simply with a segfault, instead of a bus error. Sigh.
So, I opted for workarounds, which lead me to Fondu, a set of programs to interconvert between mac font formats and pfb, ttf, otf and bdf files on unix. This is happily installable via fink or darwin ports or compilation or whatever else you want.
I then used fondu to convert my Monaco.dfont file into a Monaco.ttf file, and GD would then happily read it and operate on it for me. And, for my purposes since I'm just using a single font, I can live with that. Using multiple font would be a nuisance.
Supposedly there's a way to make it all work with dfonts directly, but I still haven't found the magic incantation. If someone knows it and is willing to share, then please do. Otherwise, this workaround will get me by for now.