Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Using fonts in GD on OS X.

by jimt (Chaplain)
on Oct 24, 2006 at 14:03 UTC ( #580280=note: print w/replies, xml ) Need Help??

in reply to Using fonts in GD on OS X.

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 ( claim to be able to run gdtestft with a dfont file. Theres also this useless little comment: ( that gave me hope. Bus error for me.

I tried re-configuring gd an ran the gtestft script and got this error:

dyld: Symbol not found: _FSPathMakeRef Referenced from: /usr/local/lib/libfreetype.6.dylib Expected in: flat namespace

So I dug some more and I found this 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:

Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ ApplicationServices.framework/Versions/A/Frameworks/ ImageIO.framework/Versions/A/ImageIO Expected in: /usr/local/lib/libJPEG.dylib

Progres, at least. That lead me to this link:, 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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://580280]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2018-06-21 07:28 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.