(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

7. WYSIWYG Publishing and Fonts

7.1 Introduction and Overview

Installing fonts for WYSIWYG publishing on Linux is a relatively complex task. It typically involves three steps:

  • Make the font available to the X server
  • Make the font available to ghostscript
  • Make the font available to the application
The main reason for the complexity is that the font printing system ( ghostscript ) is unrelated to the screen font system. In a way, Linux's left hand does not know what it's right hand is doing. This problem is nontrivial to solve, because it is possible that printer fonts and display fonts reside on different machines, so there is no guarantee that all fonts the XClient uses are printable.

The good news is that most WYSIWYG applications use what is a reasonable solution to this problem. The solution involves constructing some kind of mechanism that maps screen fonts to printer fonts ( this is the main issue. There are also other issues, such as grouping bold, italic and roman variants into ``families'' of fonts ). Unfortunately, there is no standard way to do this. It seems that font management standards which address this issue would greatly simplify the installation of fonts into WYSIWYG publishing systems, because all applications could use a system-wide ( as opposed to application-specific ) configuration.

7.2 Applixware

There are two ways to install fonts into Applixware. One method involves using FontTastic, which is Applixware's ``private'' font server. The other method involves editing Applixware's fontmap, to use a font already installed on the system. Installing into the font server is more convenient, but fonts installed in this manner may only be printed at 300 dpi.

FontTastic

Using FontTastic is the easy way to do it. To install new fonts like this, simply do the following:

  1. Run Applixware as root
  2. Click on the tools menu.
  3. Choose ``Font Installer''
  4. Check ``OK'' in the popup dialog
  5. Click the ``Catalogs'' menu and choose ``create''
  6. Fill in the catalog name box. It doesn't matter what you put there. For the rest of this example, we'll assume it's called ``foobar''
  7. Select your foobar catalog from the catalog manipulations list.
  8. From the ``Services'' menu, select ``install fonts into -> FontTastic font server''
  9. Make sure catalog foobar is selected in the catalogs list, then press the ``select files'' button.
  10. Use the select files dialog to select the fonts you want to install. Press ``OK'' when you've selected the files. For example, if you want to select arial.ttf in the directory /usr/share/fonts/ttfonts/, you would type /usr/share/fonts/ttfonts in the ``Current Directory'' dialog, then select arial.ttf from the files dialog box, then click ``OK''. Note that you can select multiple files, but they all must come from the same directory.
  11. You can edit your list by checking on the different fonts in the list box and possibly removing or renaming them.
  12. When you're ready, click the ``install fonts'' button. Then click ``OK''.
  13. Go to the ``services'' menu and choose ``update''. Check ``OK'' on the annoying modal dialog, then choose exit from the services menu. Exit applix.
  14. Congrats, you're done ! The new fonts will be available when you restart Applix.

Using System Wide Fonts With Applixware

This method is more involved, but produces better results. I recommend that this method is used for fonts that are really important, and that you use a lot. There are a few steps to this:

Make the fonts available to X

This is explained in the previous section

Make the fonts available to ghostscript

This is explained in in the previous section

Edit the fontmap.dir

This is the final step in making your fonts available to Applix, and also the most time consuming step. The file fontmap.dir is in under the axdata/fontmetrics of your applix installation. The purpose of this step is basically to tell applix which screen fonts go with which outline fonts. This is in general a very nontrivial problem, because the screen fonts are not always on the same computer that the application is installed.

We describe how to add fonts to fontmap.dir. In this example, we add the font Baskerville Italic.

  1. First, we add a line that says FontRecord = Baskerville-Normal-Italic In fact, the name we use in FontRecord is completely arbitrary. However, the font record must be unique to the font. Because of this, it's good practice to use the name that ghostscript uses for the font.
  2. Next, we a line that says Family = Baskerville The family name for a font is the name that appears in Applix's font selection menu. Typically, it is non-unique, since bold, italic, roman and bold-italic variants of a font will typically go under the same family.
  3. If the font is either a bold, or italic variant, or both, we need to add the following lines:
            Slant = 1 
            
    
    if the font is italic, and
            Weight = 1 
            
    
    if the font is bold. If the font is bold and italic, we add both lines. In this example, we need only add the line
            Slant = 1 
            
    
  4. We add a line that looks like this:
            ScreenName = "-paradise-baskerville-medium-i-normal--0-0-0-0-p-0-iso8859-1"
            
    
    The screen name is the name that the X-server uses for the font. We can list font names containing the string ``bask'' by typing
            xlsfonts|grep -i bask
            
    
  5. Now we add a line that gives the name of the printer font: PostScriptPrinterName = Baskerville-Normal-Italic
  6. Next, we need to specify the location of the font metric file and the outline file
            MetricsFile = /usr/share/fonts/misc/baskvli.afm
            Type1FontFileName = /usr/share/fonts/misc/baskvli.pfb
            
    
    If you are adding a TrueType file, you can use ttf2pt1 to generate an afm file :
                    ttf2pt1 -A foo.ttf - > foo.afm
                    
    
    ( or get the ttfutils package and use ttf2afm ) Then you use something like this:
            MetricsFile = /usr/share/fonts/misc/foo.afm
            
    
    Do not include a Type1FontFileName directive -- let ghostscript take care of this.

That's it. Now after adding the whole family of fonts, you should have something like this:

        FontRecord = Baskerville-Normal
        Family = Baskerville
        ScreenName = "-paradise-baskerville-medium-r-normal--0-0-0-0-p-0-iso8859-1"
        PostScriptPrintName = Baskerville-Normal
        MetricsFile = /usr/share/fonts/misc/baskvl.afm
        Type1FontFileName = /usr/share/fonts/misc/baskvl.pfb

        FontRecord = Baskerville-Normal-Italic
        Family = Baskerville
        Slant = 1
        ScreenName = "-paradise-baskerville-medium-i-normal--0-0-0-0-p-0-iso8859-1"
        PostScriptPrintName = Baskerville-Normal-Italic
        MetricsFile = /usr/share/fonts/misc/baskvli.afm
        Type1FontFileName = /usr/share/fonts/misc/baskvli.pfb

        FontRecord = Baskerville-Bold
        Family = Baskerville
        Weight = 1
        ScreenName = "-paradise-baskerville-bold-r-normal--0-0-0-0-p-0-iso8859-1"
        PostScriptPrintName = Baskerville-Bold
        MetricsFile = /usr/share/fonts/misc/baskvlb.afm
        Type1FontFileName = /usr/share/fonts/misc/baskvlb.pfb     

        FontRecord = Baskerville-Bold-Italic
        Family = Baskerville
        Weight = 1
        Slant = 1
        ScreenName = "-paradise-baskerville-bold-i-normal--0-0-0-0-p-0-iso8859-1"
        PostScriptPrintName = Baskerville-Bold-Italic
        MetricsFile = /usr/share/fonts/misc/baskvlbi.afm
        Type1FontFileName = /usr/share/fonts/misc/baskvlbi.pfb     

It is possible to do more with this configuration file. The file itself has a glossary which explains the format of the configuration file.

7.3 Star Office

Here, we cover Star Office 5.0. The procedure with Star Office 5.1 is similar, but the utility is called spadmin, not psetup. It's worth mentioning up front that John McLaughlin's page is an excellent source on this issue, and it inspired most of what follows.

Having tried both Star Office 5.0, and 5.1, I have found that Star Office 5.1 seems to give me less grief when adding new fonts. I was not succesful adding true type fonts to Star Office 5.0, but it proved somewhat easier with Star Office 5.1.

Backup Your Configuration Before you Start !

It's good to make a backup in case you inadvertantly hose your configuration. Modifying fonts will impact several files in the xp3. You should definitely backup the file xp3/psstd.fonts. I recommend going further and backing up the whole xp3 directory. You can do this by cd-ing to your Star Office directory, then using

        tar cvzf xp3.tgz xp3
        
to create a backup. To restore a backup, delete the xp3 directory and unpack the archive
        rm -rf xp3
        tar xvzf xp3.tgz
        

Adding Type1 Fonts to Star Office

Adding Type1 fonts to Star Office is relatively simple. If you want to use your TrueType fonts with Star Office 5.0, the best thing to do is convert them to Type1 fonts, and then follow the procedure outlined here. If you have Star Office 5.1, you might wish to use the proceedure for installing TrueType fonts instead ( though it is somewhat more difficult ). Firstly, do the usual thing -- make the font available to both X and ghostscript. Once this is done, the font can be installed into Star Office using the psetup tool. The procedure is as follows:

  1. As root, run psetup ( or spadmin if you have Star Office 5.1 )
  2. Press the ``add fonts'' button.
  3. The easiest thing to do after this is press the ``initialize font paths'' button. This puts a list of all fonts in your X font path in the list box.
  4. Choose the directory containing the font you wish to install ( it should be in the box ), and then press ``OK''.
  5. Click the ``convert all font metrics button''.
That's it. You're done. You can exit ( or click ``OK'' until it exits ). When you restart Star Office, you will have the new fonts.

Adding TrueType Fonts to Star Office

Adding TrueType fonts to Star Office is nontrivial, but possible. After some hard work, and long hours stareing at John McLaughlin's page page, I finally got them working in Star Office 5.1. Note that this does not work with version 5.0. The following steps are appropriate it you are printing through ghostscript:

  • Make the fonts available to X.
  • Make the fonts available to ghostscript.
  • You need to have afm files for the fonts you wish to add. Use
            ttf2pt1 -A foo.ttf - > foo.afm
                    
    
    to create the afm files. Alternatively, you can get the
  • ttfutils package and use ttf2afm The advantage of this is you can handle several at a time, eg
            ttf2afm *.ttf
            
    
  • Star Office needs pfb files corresponding to each ttf file. You can create them with the command
            touch foo.pfb
            
    
    Actually, Star Office only uses these files for printing purposes. And by enterring the font in the PPD, thus duping Star Office into thinking the fonts are inside your printer ( when they're actually inside ghostscript's rendering system ), you get around needing to use these files. Star Office just seems to require that the pfb file exists to install the font.
  • Now you can run spadmin and install the font(s).
  • Now add the fonts to the PPD file corresponding to your printer configuration. The name you use for the font should be the same name Star Office uses for it, not the ghostscript font name. For example, if the font is foobar.ttf and the corresponding afm file is foobar.afm, you use the name ``foobar'' for the font in the PPD file. The entry should look something like this:
    *Font cloistrk: Standard "(001.002)" Standard ROM
                    
    

On the other hand, if you are not printing from ghostscript, you have different issues to deal with. In this case, tricking Star Office into thinking that your printer has the fonts is a bad idea, because your printer does not have the fonts in the ROM, so while gv will display the postscript files nicely, your printer will not be able to print them. If you have a postscript printer, the main differences are as follows:

  • Do not edit the PPD file.
  • Instead of using touch foo.pfb to create empty pfb files, you need the pfb files to be Type42 postscript fonts. A Type42 font is really a ``printer TrueType font''. You don't really notice Type42 fonts even when you use them, because most applications handle them transparently. To create Type42 fonts, you use ttfps to create the files.
            ttfps foo.ttf foo.pfb
                            
    

There are some gotchas. Sometimes, Star Office might not choose the screen font you like. It is sometimes worth checking xp3/psstd.fonts and possibly editing it to make sure that Star Office is really using the font you had in mind for screen display. Also, Star Office doesn't handle configuration problems gracefully. If there's something wrong with your configuration, it's possible that the word processor will not even start. This is why you should back up your xp3 directory.

Under the Hood

If you wish to install TrueType fonts in Star Office, you may need to learn how Star Office handles things. When you run spadmin or psetup, the following happens:

  • Star Office makes symbolic links to the pfb outline files in your xp3/pssoftfonts directory.
  • The afm file is copied into the directory xp3/fontmetrics/afm/
  • An entry is added to the xp3/psstd.fonts file. This file stores the names of all the screen fonts used by Star Office ( in particular, it maps the screen fonts to the outline filenames ).

This is why it's good to simply backup the whole xp3 directory -- it is the only convenient way to restore Star Office to a clean configuration.

7.4 Word Perfect

Nothing yet. Rod Smith's webpage is the definitive resource regarding installing fonts on Word Perfect.


Next Previous Contents