Squirrel Logo

OpenOffice.org Font Tweaks - Renaming Fonts

Johan Vromans


Warning: Draft version.

Warning: All this information has been checked with OpenOffice.org version 1.1.2 on GNU/Linux (Red Hat 7.2).

As already described in article "OpenOffice.org and Fonts", working with fonts on X11-based systems like Linux is tricky, and can often lead to unexpected surprises. OpenOffice.org does a great job to make font use on these systems reliable, however, there are cases where a little help is necessary.

Renaming Fonts

Renaming fonts is the ultimate (read: desparate) trick. You can use it to bypass all built-in intelligence of OpenOffice.org and other tools.

Consider this family of Type1 fonts, called ITC Garamond. The family consists of the following members, with their Postscript font names between parentheses:

   ITC Garamond Bold         (Garamond-Bold)
   ITC Garamond Bold Italic  (Garamond-BoldItalic)
   ITC Garamond Light        (Garamond-Light)
   ITC Garamond Light Italic (Garamond-LightItalic)

Actually, there are many more members, but that is not relevant for this article.

The core of the problem is a combination of three aspects. First, ITC did not add an ITC prefix or postfix to the Postscript names, as most foundries do for most other fonts. The second aspect is that OOo on Linux insists on calling the font family "Garamond" instead of "ITC Garamond". The third aspect is that modern Microsoft Windows systems have a standard font Garamond, from MonoType:

   Garamond Bold        (Garamond-Bold)
   Garamond Bold Italic (Garamond-BoldItalic)
   Garamond             (Garamond)
   Garamond Italic      (Garamond-Italic)

Now, if I create a document on Linux that uses the font "ITC Garamond Light", OOo will register this internally as "Garamond Light". If this document is then opened on a Windows system, OOo will use the standard Garamond font, and since that does not have the "Light" typeface, OOo will use the regular typeface the document, which will change the layout and appearance.

What if I transfer the fonts from Linux to Windows as well? Splendid! Now Windows will have:

   Garamond Bold             (Garamond-Bold)
   Garamond Bold Italic      (Garamond-BoldItalic)
   Garamond                  (Garamond)
   Garamond Italic           (Garamond-Italic)
   ITC Garamond Bold         (Garamond-Bold)
   ITC Garamond Bold Italic  (Garamond-BoldItalic)
   ITC Garamond Light        (Garamond-Light)
   ITC Garamond Light Italic (Garamond-LightItalic)

The OOo font picker will happily show both families, "Garamond" and "ITC Garamond", because stripping the ITC prefix only happens on Linux. So this didn't work. Worse even, when a document is created on Windows using font "ITC Garamond Light" OOo will register internally the name "ITC Garamond Light". When the document is transferred to Linux, OOo on Linux will not be able to find the correct font at all.

How to trick OOo into "doing the right thing" with these fonts? As indicated a desparate trick: rename the fonts.

Using the Fontforge program all properties (and more) of a font can be changed. For the Garamond fonts I used the following new names:

   ITCGaramond Bold         (ITCGaramond-Bold)
   ITCGaramond Bold Italic  (ITCGaramond-BoldItalic)
   ITCGaramond Light        (ITCGaramond-Light)
   ITCGaramond Light Italic (ITCGaramond-LightItalic)

It is important to change both the family name and the Postscript font name. Since I had to cope with the kerning problem (see "Converting Type1 Fonts to TrueType") as well, it could be done at the same time as the conversion to TrueType.

Fontforge provides the script function "SetFontNames". When called with two arguments, the first argument is the new font name, and the second argument is the new family name. This is the script that handles renaming and TrueType generation for the Garamond fonts:

   Open("Garamond-Light.pfb")
   SetFontNames("ITCGaramond-Light", "ITCGaramond")
   Generate("ITCGaramond-Light.ttf", "", 0)
   Open("Garamond-LightItalic.pfb")
   SetFontNames("ITCGaramond-LightItalic", "ITCGaramond")
   Generate("ITCGaramond-LightItalic.ttf", "", 0)
   Open("Garamond-Bold.pfb")
   SetFontNames("ITCGaramond-Bold", "ITCGaramond")
   Generate("ITCGaramond-Bold.ttf", "", 0)
   Open("Garamond-BoldItalic.pfb")
   SetFontNames("ITCGaramond-BoldItalic", "ITCGaramond")
   Generate("ITCGaramond-BoldItalic.ttf", "", 0)

The resultant fonts can be installed on Linux and Windows. OOo and all other applications on both platforms will now see the right fonts.



© Copyright 2003-2018 Johan Vromans. All Rights Reserved.
OOo/oofonts04.html last modified 23:30:27 08-Aug-2004