International Language Environments Guide

ProcedureHow to Add a Printer-Resident Font

The example in the following procedure illustrates how to add a new PCF, TrueType, or Type1 printer-resident font to the configuration file.

Complete this procedure to replace the currently configured font. In the first two steps, a PCF font used to display the characters in the range 0x00000021 - 0x0000007f is replaced with a TrueType font.

  1. Before you add a new font, look at various components in the configuration file that correspond to the currently configured font.

    FontNameAlias iso88591R  PCF  /usr/openwin/lib/X11/fonts/75dpi/courR18PCF.Z
    FontNameAlias iso88591B  PCF  /usr/openwin/lib/X11/fonts/75dpi/courB18PCF.Z
    FontGroup       iso88591         PCF       iso88591R iso88591B
    MapCode2Font    0x00000020      0x0000007f      iso88591
    CnvCode2Font iso88591R _xuiso88591 /usr/lib/lp/locale/$LANG/mp/
    CnvCode2Font iso88591B _xuiso88591 /usr/lib/lp/locale/$LANG/mp/

    For example, you could map the /usr/openwin/lib/locale/ja/X11/fonts/TT/HG-MinchoL.ttf fonts to the en_US.UTF-8 locale. Because HG-MinchoL.ttf is a Unicode TrueType font file, you use the .so module mapping function to directly return the incoming ucs-2 code points.

    unsigned short _ttfjis0201(unsigned short ucs2) {
    1. Save the mapping to the ttfjis0201.c file.

    2. Create a shared object file.

      cc -G -Kpic -o ttfjis0201.c
  2. To map a PCF file, such as /usr/openwin/lib/locale/ja/X11/fonts/75dpi/gotmrk20.pcf.Z, check the following encoding that corresponds to XLFD in the /usr/openwin/lib/locale/ja/X11/fonts/75dpi/fonts.dir file.

    1. For jisx0201 encoding, prepare a shared object that maps from ucs-2 to jisx0201. Obtain the mapping table for creating the .so module. For a Unicode locale, find the character set mappings to Unicode in the directory.

    2. Use these mappings to write a xu2jis0201.c file:

      unsigned short _xu2jis0201(unsigned short ucs2) {
                               if(ucs2 >= 0x20 && ucs2 <= 0x7d )
                                       return (ucs2);
                                       return (0x7e);
                               if(ucs2 >= 0xff61 && ucs2 <= 0xff9f)
                                       return (ucs2 - 0xff60 + 0xa0);
    3. When you create a mapping file, include all the usc—2 to jisx0201 cases.

      cc  -G -o xu2jis0201.c