Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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 (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:

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 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:

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: 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.


Comment on Re: Using fonts in GD on OS X.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://580280]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2014-09-02 00:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls