International Language Environments Guide

PostScript File Customization

The PostScript files fall into the following categories:

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:

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 Oracle 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 shows how to add or change composite fonts in an existing prolog.ps file.

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

You could define a composite font called LC_Base-Font, for example. LC_Base-Font might be a composite of a Foo-Fine font that contains a locale character set and a Base-Font. You do not need in-depth knowledge of PostScript programming 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. The routine makecodeset12 sets the local font-encoding information. This routine might differ from locale to locale. The routine 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.

The prolog.ps file support is reserved for backward compatibility only. Do not create a new prolog.ps file for generating printed output for a locale. Use mp.conf instead.

The path for prolog.ps file 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. This file 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 you create your own prolog file, 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 issuing 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:

A set of standard functions needs to be defined in every prolog file. These functions are called when a new print page starts, a print page ends, or a new column ends. The implementations of these functions define the print attributes of the printout.

The following PostScript variables are defined at runtime by the mp binary. All the print layout files can use these variables for printing dynamic information such as user name, subject, print time. This information taken from the variables normally appears in the header or footer of the print page.

User

The name of the user who is running mp, obtained from the system passwd file.

MailFor

Variable used to hold the name of the type of article to print. The possible values for this variable are:

  • Listing for – When the input is a text file

  • Mail for – When the input is a mail file

  • Article from – When the input is an article from a news group

Subject

The subject taken from the mail and news headers. You can use the -s option to force a subject to the mail and news files as well as to normal text files.

Timenow

The time of print that appears in the header and footer. This information is taken from the localtime() function.

The following functions are implemented in print layout prolog files. All of these functions can use subfunctions.

endpage

Usage: page_number endpage

Called when the bottom of a printed page is reached. This function restores the graphic context of the page and issues a showpage. In some prolog files the header and footer information is displayed in a page-by-page mode rather than in a column-by-column mode. You can implement this function to call subfunctions that display the header and footer gray-scale lozenges.

newpage

Usage: page_number newpage

Routines or commands to be executed when a new page begins. Setting landscape print mode, saving the print graphic context, and translating the page coordinates are some of the functions for these routines.

endcol

Usage: page_number col_number endcol

Used to display header and footer information, move to the new print position, and so forth.

To add new print layout prolog files, you need to define the following variables explicitly within the print layout prolog file:

NumCols

Number of columns in a print page. Default is 2.

PrintWidth

Width of print area in inches. Default is 6.

PrintHeight

Height of print area in inches. Default is 9.