Skip to content
Volker Enderlein edited this page Jan 12, 2020 · 2 revisions

You are here: HomeDocumentationMac information pageCoin3D/Mac FAQFeature-Specific Questions → Fonts

How can I use Mac OS X fonts with Coin?

There is no native support for handling fonts on Mac OS X yet. You can use the FreeType library, though. Complete instructions follow.

  1. [Optional] Install FreeType. The FreeType library is included in the Coin-2.1.1 binary SDK. If you build Coin from source code, you have to build FreeType yourself. Version 2.1.7 or later is required. You can download the libfreetype source code from the FreeType website. Building should be straightforward for developers who are familiar with compiling software on UNIX systems (i.e. it's a simple ./configure && make && make install). Note that the FreeType library coming with Apple's X11 Beta 3 is too old and does not work!

  2. Get yourself some TrueType fonts. For this, you have several options:

  • Install the msttcorefonts Fink package, which contains the Microsoft True Type Core Fonts for the Web (including Arial, Comic Sans MS, Courier New, etc.) into /sw/lib/X11/fonts/msttf. If you do not use fink-unstable, you have to copy the .info file first:
    $ cp /sw/fink/dists/unstable/main/finkinfo/x11/msttcorefonts-1.2-2.info
    /sw/fink/dists/local/main/finkinfo/
    $ fink install msttcorefonts
  • Convert your Mac OS X system fonts to TrueType by using the fondu utility. Simply copy the *.dfont files from /Library/Fonts to the folder where you want to store your TrueType fonts (e.g. /Library/Fonts/TTF) and run fondu in that directory:
    $ cp /Library/Fonts/*.dfont ~/Library/Fonts/TTF
    $ cd ~/Library/Fonts/TTF
    $ fondu *.dfont
  • Download some of the many free TrueType fonts available on the web.
  1. Use it : Set the COIN_FONT_PATH environment variable to the directory containing your TrueType fonts. Setting the COIN_DEBUG_FONTSUPPORT environment variable to 1 will output debug information related to font support.

A simple example how to use fonts in Coin looks like this:

#Inventor V2.1 ascii
Separator {
  Font { name "HelveticaNeue.ttf" }
  Text2 { string "Helvetica" }
}

For the most common fonts, you can use the font name, e.g. "Courier New", instead of the font file name. (This is actually how it should be, but currently only a number of fonts can be used that way. Specifying the file name works in all cases.)

Clone this wiki locally