% Copyright (C) 1992 Aladdin Enterprises. All rights reserved.
% Distributed by Free Software Foundation, Inc.
% This file is part of Ghostscript.
% Ghostscript is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
% to anyone for the consequences of using it or for whether it serves any
% particular purpose or works at all, unless he says so in writing. Refer
% to the Ghostscript General Public License for full details.
% Everyone is granted permission to copy, modify and redistribute
% Ghostscript, but only under the conditions described in the Ghostscript
% General Public License. A copy of this license is supposed to have been
% given to you along with Ghostscript so you can know your rights and
% responsibilities. It should be in a file named COPYING. Among other
% things, the copyright notice and this notice must be preserved on all
% Print a template for a name / address / phone book.
/HeadingFont { (Helvetica) findfont 12 scalefont setfont } def
/NameHeading (Name and Address) def
/NumberHeading (Telephone) def
/AreaCodeFont { (Helvetica) findfont 6 scalefont setfont } def
/InnerMargin 18 def % We aren't going to bind the sheets after all
% Determine the page height and width.
clippath pathbbox /SheetHeight exch def /SheetWidth exch def pop pop
% Adjust the sheet dimensions for peculiarities of the BubbleJet....
/SheetHeight SheetHeight 48 sub def
/PageHeight SheetWidth def
/PageWidth SheetHeight 2 div def
/BodyHeight PageHeight HeadingHeight sub SpacerGap sub 9 sub def
% Compute the width and height of the name/address and phone number lines.
/EntryHeight BodyHeight EntriesPerPage div def
/LineHeight EntryHeight LinesPerEntry div def
/BodyWidth PageWidth InnerMargin sub def
/InfoWidth BodyWidth SpacerGap sub def
/NameAddressWidth InfoWidth NameFraction mul def
/PhoneNumberX NameAddressWidth SpacerGap add def
/PhoneNumberWidth InfoWidth NameAddressWidth sub def
% Print one entry at the current origin.
{ % Print the area code label
PhoneNumberX 6 add LineHeight -0.4 mul moveto
LineHeight -0.4 mul add moveto (CODE) show
EntryLineWidth setlinewidth
{ neg LineHeight mul 0 exch moveto
NameAddressWidth 0 rlineto
PhoneNumberWidth 0 rlineto
InterLineWidth setlinewidth
% Print the heading. (0,0) is upper left corner of page.
NameHeading stringwidth pop
NameAddressWidth exch sub 2 div HeadingHeight -0.75 mul moveto
NumberHeading stringwidth pop
PhoneNumberWidth exch sub 2 div PhoneNumberX add
currentpoint exch pop moveto
% Draw a spacer. Relative X and Y are on the stack.
{ SpacerLineWidth setlinewidth
{ exch neg exch 0 SpacerGap neg }
ifelse rmoveto rlineto stroke
0 HeadingHeight neg moveto
NameAddressWidth HeadingHeight SpacerGap add neg moveto
0 BodyHeight neg PrintSpacer
0 HeadingHeight SpacerGap add neg translate
0 EntryHeight neg translate
PageWidth InnerMargin 2 mul add 0 translate