[R-SIG-Mac] FreeType on osx

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Mar 16 12:30:21 CET 2008

On Sun, 16 Mar 2008, Duncan Murdoch wrote:

> Simon Urbanek wrote:
>> On Mar 15, 2008, at 1:30 PM, Duncan Murdoch wrote:
>>> I'm trying to add FreeType support to rgl.  I see that there are
>>> versions that ship with OSX, and also versions on DarwinPorts and
>>> fink.
>>>  What would be the recommended advice to users on this, and what would
>>> a configure script need in order to find FreeType?
>> FreeType is a bit of a pain (I'll elaborate on that below). For CRAN
>> binaries of packages that use FreeType we use a static build instead
>> of the system one because those are too old. From a package's point of
>> view it's easy, though, because you only have to ask pkgconfig or
>> freetype-config. I wouldn't bother doing anything Mac-specific,
>> because both Tiger and Leopard have freetype-config, but their
>> versions are too old or buggy to bother.
>>> On Linux, looking for freetype-config works, but that's not working
>>> on  my OSX 10.4 laptop.
>> It should - do you have X11 on your PATH?
>>>  Would it work in Leopard out of the box, or does a user need to
>>> install FreeType explicitly?
>> Sort of - X11 in Leopard is broken out of the box, so you have to fix
>> that first, but once you do, it works. Both Tiger and Leopard come
>> with FreeType.
>> The real problem is that FreeType (even the last release) is somewhat
>> broken on OS X. It doesn't support system fonts properly. The CVS
>> version is a bit better, but still has a bug that causes font styles
>> to be mixed up. In addition, it is incompatible with the one shipped
>> in the OS. But anyhow, I don't think you should worry about all this
>> as a package maintainer - I'll have to sort those things out anyway
>> now that we use FreeType in R :).

> Thanks, it was the lack of X11 in the path that was the problem for
> detection, but now I'm seeing some bad glyphs.
> I'm using FTGL as a wrapper for Freetype, so the problem might be there,
> or it might be the broken Freetype.

I've seen that, and in all cases it was to do with which font freetype was 
told to use.

You could try to make sure that the Apple TrueType fonts (what Simon is 
calling 'system fonts') are used -- it seems that almost everything else 
gets used incorrectly on MacOS.  I'm not sure FTGL has support for those 
-- its demo hardcodes paths to .ttf fonts, for MacOS in a user area.

Finding suitable fonts is probably also a concern on Linux and other 
Unix-alikes.  There are some free ttf fonts available that you could ship: 
they are not as nice as the Apple ones, but they would provide a good 
platform-independent default.  (E.g. Liberation, mentioned in 
R-admin.texi.)  If you want a symbol font, you are going to be out of luck 
-- the only symbol fonts I know of are the Apple and Windows ones, and 
freetype does not use the Windows one correctly (or at least, no 
freetype-based program I have tried does, and it seems to do with the 

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-SIG-Mac mailing list