International Language Environments Guide

Customizing Existing prolog Files and Adding New prolog Files

The prolog files can be divided into two main categories:

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 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


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 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 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.



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


usage : page_number endpage



usage : page_number newpage



usage : page_number col_number endcol

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



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


Width of print area in inches. Default is 6.


Height of print area in inches. Default is 9.

.xpr File Customization

These files are located by default at /usr/lib/lp/locale/C/mp/. An .xpr file corresponds to each PostScript prolog layout file, except for mp.common.ps. You can define an alternate prolog directory by defining the MP_PROLOGUE environment variable.

These files work as keyword/values pairs. Lines that start with # are considered comments. Spaces separate different tokens unless explicitly stated. Three main sections for each .xpr file are bound by the following keyword pairs:

Certain keyword/value pairs can be used in these three areas. Each area is described next.


All the keyword/value pairs that appear after the STARTCOMMON keyword and before the ENDCOMMON keyword define general properties of the print page. Different valid values for a keyword are separated by using "/".


"0" means the printing occurs in portrait and "1" means in landscape.

PAGELENGTH unsigned-integer

A value that indicates the number of lines per logical page.

LINELENGTH unsigned-integer

A value that indicates the number of single column characters per line.

NUMCOLS unsigned-integer

The number of logical pages per physical page.

HDNGFONTSIZE unsigned-integer

The heading font point size in decipoints.

BODYFONTSIZE unsigned-integer

The body font point size in decipoints.

PROLOGDPI unsigned-integer

The dots-per-inch scale in which the current .xpr file is created.

YTEXTBOUNDARY unsigned-integer

This y-coordinate establishes the boundary for text printing in a page or logical page (column). This boundary is used as an additional check to see whether text printing is occurring within the expected area. This boundary is needed for Complex Text Layout and EUC printing, as character height information obtained from corresponding fonts can be wrong.

STARTTEXT unsigned-integer unsigned-integer

The decipoint x/y points where the actual text printing starts in the first logical page in a physical page.


The 1 indicates that a "Page" string needs to be appended before the page number in the heading.

0 indicates that only the page number is displayed.

EXTRAHDNGFONT font string 1, font string 2, ... font string n

The 'font string 1' to 'font string n' are X Logical Font Descriptions. The Token that separates the keyword EXTRAHDNGFONT from the comma separated font name list is ", not spaces or tabs. These fonts are given preference over the built-in fonts when the heading is printed. Usually, EXTRABODYFONT is used to assign printer-resident fonts that are configured in /usr/openwin/server/etc/XpConfig/C/print/models/<model name>/fonts directory.

The fonts.dir file contains the XLFD of the printer-resident fonts.

Usually a font is specified as

 "-monotype-Gill Sans-Regular-r-normal- -*-%d-*-*-p-0-iso8859-2" 

in the .xpr file. "%d", if present, is replaced by mp(1) to the point size of the current heading fonts in the .xpr file. The x resolution and y resolution are specified by * and the average width field is set as 0 to indicate selection of a scalable font, if possible. You can give more specific font names also.

EXTRABODYFONT font string 1, font string 2, ... font string n

The same as EXTRAHDNGFONT, except that these fonts are used to print the page body.

XDISPLACEMENT signed/unsigned int

Gives the x coordinate displacement to be applied to the page for shifting the contents of the page in the x direction. This displacement can be a +ve or -ve value.

YDISPLACEMENT signed/unsigned int

The same as x displacement except that the shifting happens in the y direction.

These two keywords are useful when you find that some printers have nonstandard margin widths and you need to shift the printed contents in a page.


The keyword value pairs in this section are bound by STARTPAGE and ENDPAGE keywords. This section contains drawings and heading information that is to be applied for a physical page. A physical page can contain many logical pages, but all the drawing routines that are contained between these keywords are applied only once to a physical page.

The valid drawing entities are LINE and ARC. XDrawLine() and XDrawArc() functions are executed on values of these keywords.

The dimensions within this section are mapped in PROLOGDPI units. Angles are in degrees.

LINE x1 y1 x2 y2

The x/y unsigned coordinates define a pair of points for connecting a line.

ARC x y width height angle1 angle2

x and y are both unsigned integers that represent the arc origin. Width and height are unsigned integers that represent the width and height of the arc.


Unsigned coordinates represent the position in which the user information is printed on the heading.


Unsigned coordinates represent the position in which the time for printing is printed on the heading.


Unsigned coordinates represent the position to print the page string for each printed page.


Unsigned coordinates represent the position to print the subject in the page.


When the -n option is given to mp, all the decorations given within a STARTPAGE/ENDPAGE section do not print. However, everything included within a STARTFORCEDPAGE/ENDFORCEDPAGE section prints even if the -n option is given.


All keywords are the same as secribed in STARTPAGE/ENDPAGE except that the entries in this section are applied to NUMCOLS times to a physical page.

If NUMCOLS is 3, then the printable area of the physical page is divided into three, and lines, arcs, or heading decorations appear three times per page.


When the -n option is given to mp, all the decorations given within a STARTCOLUMN/ENDCOLUMN section do not print. However, everything included within a STARTFORCEDCOLUMN/ENDFORCEDCOLUMN section prints even if the -n option is given.

Creating a New .xpr File

The following values are the mp(1) program defaults for different keywords if these values are not specified in the .xpr file for the STARTCOMMON/ENDCOMMON section.

No default values are needed for the other two sections bound by STARTPAGE/ENDPAGE and STARTCOLUMN/ENDCOLUMN.

When you create a new .xpr prolog file, you need to specify only the values that differ from the default.

To create a page with no decoration, use four logical pages per physical page, in portrait format.

In this situation, you do not need the other two sections:

These parameters are not needed if you are not putting decorations on the printed page. All the coordinates are in 300 dpi default unless you are not specifying the PROLOGDPI keyword. If target printer resolution is different, the .xpr file is scaled to fit into that resolution by the program.

When you create a .xpr file, you must know the paper dimensions beforehand. For U.S. paper, 8.5x11 inches, for a printer of resolution 300 dpi, 2550X3300 are the total dimensions. Most printers cannot print from the top left corner of the paper. Instead, they put some margin around the physical paper. That means that even if you try to print from 0,0 the printing won't be in the top left corner of the page. You need to consider this limitation when you create a new .xpr file.