Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
7.  Print Filter Enhancement With mp mp Print Filter Enhancement Overview Localization of the Configuration File Adding a Printer-resident Font  Previous   Contents   Next 
   
 

When you create a mapping file, include all the UCS-2 to jisx0201 cases.

cc  -G -o xu2jis0201.so xu2jis0201.c

Creating a Shared Object File

This example creates a shared object file.

Add this font by adding the following lines to the corresponding sections of mp.conf. The following example shows how to add the TrueType font. The PCF font follows the same pattern except that you change the keyword to PCF instead of TrueType.

FontNameAlias   jis0201R TrueType /home/fn/HG-Minchol.ttf
FontGroup     jis0201 TrueType jis0201R
MapCode2Font  0x0020 	0x007f  jis0201
CnvCode2Font   jis0201R 	 _ttfjis0201 <.so path>

where the .so path points to the xu2jis0201.so file.

Invoking mp(1) with the changed mp.conf file causes the range 0x0020-0x007f to be printed in the new font. Map the other Japanese character ranges too with the same .so file, for example, the range 0x0000FF61 0x0000FF9F.

To maintain backward compatibility, the /usr/openwin/lib/locale/$LANG/print/prolog.ps file, if it exists, is used to create output in the current locale, where $LANG is one of the locale components. In that situation, no configuration file mechanism is used.

Refer to /usr/lib/lp/locale/en_US.UTF-8/mp/mp.conf, which is a sample mp.conf file.

Customizing Existing prolog Files and Adding New prolog Files

The prolog files can be divided into two main categories:

  • PostScript prolog files (.ps)

  • X print server client prolog files(.xpr).

PostScript File Customization

The PostScript files fall into the following categories:

  • Common prolog file

  • Print layout prolog files

Locale-dependent prolog Files

The purpose of the prolog.ps file is to set up non-generic fonts. Applications use these predefined PostScript font names for printing. The prolog file must define at least the following font names for Desk Set Calendar manager and mp.

  • LC_Times-Roman

  • LC_Times-Bold

  • LC_Helvetica

  • LC_Helvetica-Bold

  • LC_Courier

  • LC_Helvetica-BoldOblique

  • LC_Times-Italic

The following example uses these fonts to print the particular local character set specified:

100 100 moveto
/LC_Times-Roman findfont 24 scale font setfont
(Any text string in your locale) show 

The Solaris localization kit provides a sample prolog.ps file for the Japanese environment. Alternatively, this file is found in the /usr/openwin/lib/locale/ja/print/ directory.

The following example shwos how to add or change composite fonts in an existing prolog.ps.

%
(Foo-Fine) makecodeset12 
(Base-Font) makeEUCfont
%

Suppose you want to define a composite font called LC_Base-Font:

LC_Base-Font is a composite font of Foo-Fine and a base font called Base-Font. Foo-Fine is a font that contains the local character set. You do not need any in-depth PostScript knowledge to add or change a font.

The best way to create a prolog.ps File is to study the example version. In the example prolog.ps, two routines need to be written, makecodeset12 and makeEUCfont. Makecodeset12 sets up local font-encoding information. This routine might differ from locale to locale. MakeEUCfont combines the base font and the locale font to form a composite font. The creator of the prolog file should have good knowledge of PostScript in order to write makecodeset12 and makeEUCfont.

prolog.ps file support is kept for backward compatibility only. Do not create a new prolog.ps file for the printing needs of a locale. Use mp.conf instead.

The path for prolog.ps is

/usr/openwin/lib/locale/$LANG/print/prolog.ps

Common PostScript prolog Files

The common prolog file is mp.common.ps.

Every other page layout prolog file needs to include this file.

The mp.common.ps file resides in the /usr/lib/lp/locale/C/mp/ directory, contains a PostScript routine to re-encode a font from the standard encoding to the ISO 8859-1 encoding. The .reencodeISO routine is called from the print layout prolog files to change encoding of the fonts. Usually this prolog file does not need any customization. If the users are creating their own prolog files, set the environment variable MP_PROLOGUE to point to the directory that contains the modified prolog files.

Print Layout prolog Files

The print layout prolog files, mp.*.ps files, contain routines for controlling the page layout for printing. In addition to giving a header and a footer for a print page with user name, print date, and page number, these prolog files can provide other information. For example, the prolog files can give effective print area dimensions and landscape and portrait mode of printing to be used.

The Print Layout prolog files are:

  • mp.pro.ps

  • mp.pro.alt.ps

  • mp.pro.fp.ps

  • mp.pro.ps

  • mp.pro.ts.ps

  • mp.pro.altl.ps

  • mp.pro.ff.ps

  • mp.pro.l.ps

  • mp.pro.ll.ps

  • mp.pro.tm.ps

 
 
 
  Previous   Contents   Next