The prolog files can be divided into two main categories:
PostScript prolog files (.ps)
X print server client prolog files(.xpr).
The PostScript files fall into the following categories:
Common prolog file
Print layout 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 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
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.
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:
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
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.
The name of the user who is running mp, obtained from the system passwd file.
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
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 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.
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.
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.
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:
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.
These files are located by default at /usr/lib/lp/locale/C/mp/. An .xpr file corresponds to each PostScript prolog layout file except the mp.common.ps file. 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:
STARTCOMMON/ENDCOMMON
STARTPAGE/ENDPAGE
STARTCOLUMN/ENDCOLUMN
STARTFORCEDPAGE/ENDFORCEDPAGE
STARTFORCEDCOLUMN/ENDFORCEDCOLUMN
Certain keyword/value pairs can be used in these three areas. Each area is described in the following section.
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 a slash (/) character.
0 means the printing occurs in portrait and 1 means in landscape.
A value that indicates the number of lines per logical page.
A value that indicates the number of single-column characters per line.
The number of logical pages per physical page.
The heading-font point size in decipoints.
The body-font point size in decipoints.
The dots-per-inch scale in which the current .xpr file is created.
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.
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.
The font strings are X Logical Font Descriptions. The token that separates the keyword EXTRAHDNGFONT from the comma-separated font name list is a quote " character, not a space or tab. 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 the /usr/openwin/server/etc/XpConfig/C/print/models/<model name>/fonts directory.
The fonts.dir file contains the XLFD of the printer-resident fonts.
In the .xpr file, a font usually is specified as shown in the following example:
"-monotype-Gill Sans-Regular-r-normal- -*-%d-*-*-p-0-iso8859-2"
The %d, if present, is replaced by mp to the point size of the current heading fonts in the .xpr file. The x resolution and y resolution are specified by *. The average width field is set as 0 to indicate selection of a scalable font, if possible. You can also provide more specific font names.
The same as EXTRAHDNGFONT, except that these fonts are used to print the page body.
Provides 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.
The same as x displacement, except that the shifting happens in the y direction.
These two keywords are useful when you deal with some printers that have nonstandard margin widths that require you 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 drawing 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. The 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.
The x/y unsigned coordinates define a pair of points for connecting a line.
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 described in STARTPAGE/ENDPAGE Keywords except that the entries in this section are applied 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.
When you create a new .xpr prolog file, you specify only the values that differ from the default.
The following table lists the mp program defaults for different keywords if these values are not specified in the .xpr file for the STARTCOMMON/ENDCOMMON section:
Table 7–2 STARTCOMMON/ENDCOMMON Keyword Values
Keyword |
Value |
---|---|
ORIENTATION |
0 |
PAGELENGTH |
60 |
LINELENGTH |
80 |
YTEXTBOUNDARY |
3005 |
NUMCOLS |
01 |
HDNGFONTSIZE |
120 |
PROLOGDPI |
300 |
STARTTEXT |
135 280 |
PAGESTRING |
0 |
No default values are needed for the other two sections bound by STARTPAGE/ENDPAGE and STARTCOLUMN/ENDCOLUMN.
To create a page with no decoration, use four logical pages per physical page in portrait format. Specify the following sections and values:
STARTCOMMON
NUMCOLS 04
LINELENGTH 20
ENDCOMMON
When you create a page with no decoration, you do not need to specify the following two sections:
STARTPAGE/ENDPAGE
STARTCOLUMN/ENDCOLUMN
These parameters are not needed if you are not putting decorations on the printed page. All the coordinates are in 300 dpi by default unless you are not specifying the PROLOGDPI keyword. If the target printer resolution is different, the .xpr file is scaled to fit into that resolution by the program.
Before you create an .xpr file, you must know the paper dimensions. 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, some margin space is assigned around the physical paper. Even if you try to print from 0,0 the printing will not be in the top left corner of the page. Consider this limitation when you create a new .xpr file.