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(1) 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:
|
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 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 only 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 routine. |
endcol | usage : page_number col_number endcol Used to display header and footer information. Move to the new print position, and so forth. |
For adding 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. |
.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:
STARTCOMMON/ENDCOMMON
STARTPAGE/ENDPAGE
STARTCOLUMN/ENDCOLUMN
STARTFORCEDPAGE/ENDFORCEDPAGE
STARTFORCEDCOLUMN/ENDFORCEDCOLUMN
STARTCOMMON/ENDCOMMON Keywords
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 "/".
- ORIENTATION 0/1
"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.
- PAGESTRING 0/1
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.