Type1 and True Type fonts installation for StarOffice 4/5

Frank Becker <fb@alien8.de>

Version 0.95, 23 June 2000

This document will explain step by step how to install Adobe Type 1 [TM] and True Type [TM] fonts for the usage with Sun [TM] StarOffice [TM] 4 and 5.

1. Introduction

Many people seem to have problems installing additional Type1 or True Type fonts [TM] for proper use with StarOffice. I was one of them. Thanks to many helpful people I have learned how to install them in order to use them with StarOffice. To make it easier for others with the same problem I wrote this text. There are other sources dealing with the same matter. You will find them in the section Other StarOffice font installation sources.

What you can learn here is the manual way of doing things. You will need to be able to operate an text editor. I am not going to use the tool spadmin coming with the StarOffice 5.1 package. It is strongly recommended not to use the tool psetup coming with StarOffice versions before 5.1. It basically did not work for plenty of people.

A short remark on converting TrueType fonts to Type 1 fonts. I recommend that only if you are feeding a PostScript printer with what comes out of StarOffice. The problem here is that especially small font sizes will not be as accurate as if you use the original TTF. How to do it is explained e. g. in the StarOffice installation handbook. If someone might have told you that scalable fonts are called scalable since they are scalable it is not the full truth.

BTW, my X Server is Xfree86 4.0. It comes with the xfsft TrueType font server already built in.

I would like to thank all the folks who have taught me what you can read here and who have helped me with this document. A special thank goes to Sun for providing StarOffice for free.

1.1 What can you learn?

The following will tell you how to install Adobe Type 1 fonts and True Type Fonts (TTF) in order to use them with Sun StarOffice 4/5 (www.sun.com/staroffice). For the True Type Fonts you will need an TTF server. I am using xfstt v 1.0. You can find xfstt here. In order to compile it, you must have the C++ compiler installed on your Linux machine.

1.3 What to read first?

You do not have to read the following, but it could be helpful.

1.4 Other StarOffice font installation sources

At least the ones I am aware of:

Font resources:

Fonts at The Gimp.
Jim's Fonts for X.

Type1 Tools:

Type1 tools.

TrueType resources:

2. Definition of File Locations

That is where some stuff is installed in the case of StarOffice 4.0 up to 5.1. As you can see I also installed Ghostscript. Further on I only will use the defined shell variables.

|Description                 |Variable in   |                                |
|                            |this document | Location                       |
|main SO5 installation       | $SO5         | /opt/Office51                  |
|local SO5 user installation | $SO5_u       | /home/user/Office51            |
|Ghostscript home directory  | $GS          | /usr/share/ghostscript         |
|X-Server Type1 font path    | $XT1         | /usr/X11R6/lib/X11/fonts/Type1/|

In the case of StarOffice 5.2 some locations are a bit different.

|Description                 |Variable in   |                                |
|                            |this document | Location                       |
|main SO5 installation       | $SO5         | /opt/office52                  |
|local SO5 user installation | $SO5_u       | /home/user/office52            |
|SO 5.2 printing stuff       | $SO5_p       | /opt/office52/share/xp3        |
|Ghostscript home directory  | $GS          | /usr/share/ghostscript         |
|X-Server Type1 font path    | $XT1         | /usr/X11R6/lib/X11/fonts/Type1/|

3. Preparation?

3.1 Backup of configuration files

Save copies of

$GS/5.50/Fontmap (or whatever Ghostscript version > 5.0 you
are using)

and whatever you are editing.

I hope you know that a backup can save your neck.

3.2 Fontpath settings

Check the fontpath used by your X server.
You can display it by
xset q

It is usually defined in /etc/XF86Config.
The order of the entries is important! (first :unscaled, after that Type1, at the end scalable)

The entries in /etc/X11/XF86Config (or /etc/X11/XF86Config for XFree86 < 4.0) could look like:

Section "Files"

If you change it, do
xset fp rehash

If you are already using the xfstt True Type font server, the corresponding entry in /etc/XF86Config is something like

    FontPath   "tcp/localhost:7100"  

Of course, instead of localhost you could have any machine in a network. In that case you must make sure that the font server's configuration file contains the correct font path. The configuration file is usually /usr/X11R6/lib/X11/fs/config.

3.3 Compile an AFM!

In order to print your documents containing the newly installed fonts, you need a proper metric file, called AFM (Adobe Font Metric).

In general, if you want to use Type1 fonts the AFM will be provided by your font collection. However, be warned. The provided AFM might be found faulty by StarOffice even if other applications may not complain.

In the case of TrueType fonts you must create one. There are several tools that can generate it. Unfortunately, StarOffice seems to be quite picky about AFMs. E.g. if your AFM contains the ^M from MS DOS files it will not work. Anyway, the afmmaker.ps script has proven to be quite useful in generating AFMs which StarOffice likes. And the good news is: In most cases you can create an AFM yourself.

  1. Insert the following entry

    /abc-roman (abc.pfb) ;

    into your Ghostscript Fontmap file $GS/5.50/Fontmap

  2. In afmmaker.ps, change the section (line 14 in my copy) to

    /fontName /abc-roman def % font name

    Also follow the comments in afmmaker.ps!

  3. Now do

    gs -q -sNODISPLAY -dBATCH afmmaker.ps > abc.afm
  4. You should get a file called abc.afm. Make sure that the fontname in it is exactly the same as the one in $GS/5.50/Fontmap.

Here is an example how the beginning of such an AFM file might look like:

StartFontMetrics 2.0
Comment Generated by afmmaker.ps, Copyright(c) Yeong Yu
FontName Arial
FullName Arial
FamilyName Arial
Weight Medium
ItalicAngle 0.0
IsFixedPitch false
FontBBox -0.709473 -0.324707 1.07178 1.03711
UnderlinePosition -0.105957
UnderlineThickness 0.0732422
Notice Typeface © The Monotype Corporation plc. Data © The Monotype Corporation
plc/Type Solutions Inc. 1990-1992. All Rights Reserved
EncodingScheme ISOLatin1Encoding
StartCharMetrics 201
C 32 ; WX 277 ; N space ; B 277 0 278 0 ;        

4. Installation of Type1 Fonts

In this chapter you will learn how to install a Type1 font to display and print it with StarOffice.

4.1 What to do first?

Make sure you followed the steps in Chapter 3. Preparation.

4.2 Add the Font "abc roman"

  1. First you need the font file abc.pfb or whatever font you want to install of course.

  2. Check if the font is already installed on your X-Server and you can select it with e. g. xfontsel, gfontsel (GNOME), kfontmanager (KDE) etc. (If the font is not installed get type1inst-0.6.1.tar.gz. It has its own description.)

  3. Link abc.pfb to $SO5/xp3/pssoftfonts:

    ln -s $XT1/abc.pfb $SO5/xp3/pssoftfonts

    (Note: If you don't see your font in StarWriter or they are not printed you might have not done that step. Or there might be a problem with the AFM. But wait...)

  4. Open $XT1/fonts.scale in a texteditor.

    Find a line similar to

    abc.pfb -abc_foundry-abcroman-regular-n-normal--0-0-0-0-p-0-iso8859-1

    Note that this is one single physical line although the text above might appear as several lines in your browser. Append it to $SO5/xp3/psstd.fonts like this

    more $XT1/fonts.scale | 
         grep abc.pfb >> $SO5/xp3/psstd.fonts

    Change this line in $SO5/xp3/psstd.fonts to

    abc, -abc_foundry-abcroman-regular-n-normal--%d-%d-%d-%d-p-0-iso8859-1

    Again, this is one single physical line in the file! That means replace






    by a comma.

    You can achieve that easily with sed like that:

    sed s/.pfb/,/g $SO5/xp3/psstd.fonts >
    sed s/--0-0-0-0-p-0-/--%d-%d-%d-%d-p-0-/g $SO5/xp3/psstd.fonts.temp >
  1. If you don't have an AFM file, read section 3.3 Compile an AFM! first.

    Now link the AFM file abc.afm to $SO5/xp3/fontmetrics/afm/

    ln -s $XT1/afm/abc.afm $SO5/xp3/fontmetrics/afm/

    If you already have such an AFM file check that it does not contain "^M" at the end of every line. You can fix it by converting the AFM file form DOS to Unix format.

    unix2dos abc.afm

    Note! In order to let Ghostscript know about that font you have to put it into the Fontmap ($GS/5.50/Fontmap) as

    /abc-roman (abc.pfb);

  2. Chapter 6. Test your new Font will tell you how to prove your installed font.

5. Installation of TrueType Fonts (TTF)

Maybe you skipped the part about Installation of Type1 Fonts. In that case I strongly recommend to have a short look at it. To install TTFs is quite similar.

I am using xfstt v1.0 on Xfree86 3.3.5. I don't think any other TTF server will cause problems. If you installed TTFs successfully on a different TTF-server I am happy to mention that here. Just drop me an E-mail.

If you do have a PostScript printer and there is no way in having a software-PS converter in between - very bad luck for you. There is currently no way to use TTFs with true PostScript printers. Since most of these beasts understand PCL anyway, you can still convert StarOffice's PostScript output to PCL. I am using Ghostscript for that. Make sure you are using a version >= 5.10!

The example font here is called Arial [TM]. Actually, there is no need for this font since Helvetica [TM] is the standard.

5.1 What to do first?

Make sure you followed the steps in Chapter 3. Preparation. Please mind especially section 3.3.

If you are using xfstt and you did the sample installation of it you also will have


in your X server's fontpath. If the font server is running on another port as 7101, you must of course use this port in the fontpath specification.

Please make sure that you do not use TTFs you already have as Type1 fonts. That might cause problems!

5.2 Tell Ghostscript about TTFs

  1. In order to be able to print your TTFs your PS-converter has to be aware of them. xfstt will generate a list of the installed TTFs by

    xfstt --gslist --sync > /tmp/ttfgs.fontmap

    Your file might contain entries like:

            (Arioso Bold) (/usr/share/fonts/truetype/./arib____.ttf) ;
            (Arial) (/usr/share/fonts/truetype/./arial.ttf) ;
  2. That file has to be appended to $GS/5.50/Fontmap by

    cat /tmp/ttfgs.fontmap >> $GS/5.50/Fontmap 

5.3 Tell StarOffice about TTFs

The following steps are quite similar to what you already know from chapter 3. Don`t worry, I am going to explain it again:

  1. Generate a $SO5/xp3/psstd.fonts compatible list of your TTFs.

    1. Get the TrueTypeUtilites running. All you need is tt2so.

    2. tt2so /var/cache/xfstt/ttname.dir >

      For a specific font you can use grep:

      tt2so /var/cache/xfstt/ttname.dir | grep Arial >
  2. Append that file to $SO5/xp3/psstd.fonts by

    cat psstd.fonts.ttf >> $SO5/xp3/psstd.fonts
  3. Copy the created AFM file into the appropriate StarOffice directory.

    cp arial.afm $SO5/xp3/fontmetrics/afm/

    Alternatively, you may wish to create a symbolic link.

    Make sure the name of the AFM file is exactly as given in $SO5/xp3/psstd.fonts. That means if tt2so gives you


    your AFM has to be named Arial.afm. If StarOffice cannot find the AFM it is looking for it will tell you in the shell you started it from.

  4. Finally, you have to tell your PostScript Printer Description (PPD) file about the new fonts. This file is often called "the StarOffice printer driver" although that is not absolutely correct.

    Find out which printer you are using. That might be a bit tricky. If you did a multi-user installation (aka network-installation) and a printer installation as that particular user you will find a file ~/.Xpdefaults. Otherwise use $SO5/xp3/Xpdefaults.
    This file will contain your installed printers. In its [windows] section you will find the standard printer. In my case the entry is: device=HP LJ 6L,SGENPRT PostScript,LPT1_queue. The important part here is SGENPRT.

    Now edit the file $SO5/xp3/ppds/SGENPRT.PS. In the section include for StarOffice 5.0 or section Fonts for StarOffice 5.1 insert a line similar to this:

    *Font Font-Name: Standard "(001.000)" Standard ROM

    In the case of our font arial.ttf it has to look like:

    *Font Arial:Standard"(001.000)"StandardROM
  5. Restart StarOffice and check if it works as described in 6. Test your new Font.

6. Test your new Font

6.1 Display it in StarWriter

You might ask why StarWriter. Well, it is the only application that only offers what it can print. You might get quite disappointed when you assume that anything what e. g. StarCalc displays it also can print.

  1. Start StarOffice from a shell, e. g.

  2. Open a new StarWriter document.


    mark "Something" and change the font to "abc roman"

Scale the Text to about 48 points.

Does it have the staircase effect (ugly steps)? Does the font scale? Does StarOffice complain in the shell? Do you see the fonts in StarCalc and StarWriter? Actually, only StarWriter counts.
If yes: Congratulation.
If no: Check all the steps over and over again.
Still not?: Sorry, no idea? Maybe the AFM file as most of the times? I am not going to provide these pix with funny fonts appearing in a StarOffice document here. Believe it or not it works on my box.

6.2 Print the Font

Print the actual document. You are not forced to waste paper at all. Just divert the output into a PostScript file and display it with the PostScript viewer of your choice.

If you can see the fonts on the screen but not when you print your document: Print the document to a file first and feed this file directly to Ghostscript like gs <filename>. If Ghostscript complains about a font it doesn't find, double check its Fontmap and the font name in $SO5/xp3/psstd.fonts.

Well folks, that`s it. All what is left to say: Enjoy working with StarOffice!