How to install fonts into office2pdf (optional)

Introduction

Wine needs two types of fonts files to operate correctly: If a given truetype font is not available, the application will just fall back on an alternative similar looking font (a builtin font such as Helvetica for Arial, Times for Times New Roman or Courier for Courier New), and the result will still look acceptable.

However, if a truetype font is available, but no corresponding Afm font metrics, the result will be rather disastrous: the application will assume that the font is available, but during printout, wine will have a problem as the corresponding afm file is not there. So, wine will attempts to embed (download) a bitmapped or a Type42 font into the generated postscript file, and the result will look rather poor. Thus, whatever you do, don't install truetype fonts without the corresponding afm metrics. Better leave the extra fonts away altogether.

Getting the truetype fonts

Either copy them over from a windows machine (search for *.ttf files), or download them from http://corefonts.sourceforge.net/ (or http://sourceforge.net/project/showfiles.php?group_id=34153&release_id=105355). The fonts are supplied as .exe files which can however uncompress into .ttf files using the cabextract utility found on the same page. Put the extracted fonts into ~/fonts/ttf.

Getting the Wingdings font

You can either copy it from a Windows machine, of download it from this site.

Get and compile the ttf2pt1 tool

Get, compile and install the ttf2pt1 tool.

offi2pdf:~> tar xfzv ttf2pt1-3.4.3.tgz
offi2pdf:~> cd ttf2pt1-3.4.3/
offi2pdf:~/ttf2pt1-3.4.3> make all
offi2pdf:~/ttf2pt1-3.4.3> su
root:/home/offi2pdf/ttf2pt1-3.4.3> make install

Make the afm files and the generic.ppd printer definitions


offi2pdf:~> cd fonts/ttf
offi2pdf:~/fonts/ttf> ~/office2pdf/util/toLower
offi2pdf:~/fonts/ttf> cd ..
offi2pdf:~/fonts> mkdir afm
offi2pdf:~/fonts> cd afm
offi2pdf:~/fonts/afm> ~/office2pdf/util/makeAfm
offi2pdf:~/fonts/afm> ~/office2pdf/util/makePpd -f /usr/share/wine/generic.ppd >~/.wine/generic.ppd
offi2pdf:~/fonts/afm> ~/office2pdf/util/makeFontSubTable >~/wininstall/fontsub.reg
offi2pdf:~/fonts/afm> wine regedit l:fontsub.reg
The loLower command above renames all files named *.TTF to *.ttf, because ttf2pt1 apparently cannot deal with *.TTF

The font subsitution table (two lasts steps) is due to a bug/feature in wine: additional fonts are only correctly recognized if they are substituted with themselves...

Note: For some reason, symbol fonts (such as symbol or wingdings) don't turn out right if they are in the fonts/ttf directory. Put these into ~/.wine/drive_c/windows/fonts instead, and generate no .afm.

Note2: Depending on the wine version, the .ppd file (needed for the makePpd command) may be in a different directory than /usr/share/wine/generic.ppd. Use rpm -q -l wine | fgrep generic.ppd to find it.

Edit wine config

The following settings need to be changed/added to ~/.wine/config:

[ppd]
"generic" = "/home/offi2pdf/.wine/generic.ppd"

...

; the TrueType font dirs you want to make accessible to wine
[FontDirs]
"dir1" = "/home/offi2pdf/fonts/ttf"

...

; List of all directories directly contain .AFM files
[afmdirs]
"1" = "/home/offi2pdf/fonts/afm"
Note: due to a wine bug, you need to indicate full path in these keys, as environment variables are not understood here.

Note2: The FontDirs and afmdirs sections may already contain numbered entries. If that is the case, add 1 to all existing numbers (i.e. 1 becomes 2, 2 becomes 3, etc), and put the new offi2pdf entry as 1.


Alain Knaff
Last modified: Sun Sep 12 19:31:13 CEST 2004