Printing Display Objects

1. Generating a Print File

			Attributes: 	print
					printdisstyle
					printdisfile
					printfile

2. Size and Position

	2a. Paper Size

			Attribute:	printsize

	2b. Margins

		2b(i). For the Object

			Attributes:	printbottom
					printleft
					printright
					printtop

		2b(ii). For the Disclaimer

			Attributes:	printdisbottommargin
					printdisleftmargin
					printdisrightmargin
					printdistopmargin

	2c. Justification and Size of the Object

			Attribute:	printlayout

	2d. Disclaimer Rules

			Attribute:	printdisrulewidth

3. Orientation

			Attributes:	printdisorientation
					printorientation

4. Color and fonts

	4a. Color

			Attribute:	printmode

	4b. Fonts

			Attributes:	printdisfont
					printfont


---------------------------------------------------


1. Generating a Print File

	Attributes:	print
			printdisfile
			printdisstyle
			printfile


There are provisions in s for printing an object that is displayed on the
screen.  On request, s generates a PostScript file, which you can send to a
printer.  Although room is left for them, scrollbars are not shown, since they
would have no use.

First, load s, define a positioning function, and construct and show a layout
to be used as an example throughout this tutorial:

     $load s
     scrs.SCREEN-34 12
     br{w;m}:{w has (`yx;scr-m+`yxs of w);}
     p((2)99)100
     tttp,55 >1 2 3ϡ<p
     s.164
     dd,d  d.5((32)16)*2
     qtqs,>(d;-d)+<s
     g`tt`qt;
     `g is `graph;
     `q`t has <(`class;`array; `out;7.4; `space;8);
     l(`g;`t`q)
     `l has (`class;`layout; `show;1); br{`l;0};

The "printfile" attribute names the file in which the PostScript text is to be
stored.  The default file is print.ps

     `printfile of `l

but you can use this attribute to name any file you want.  We will use
print.ps throughout the tutorial, and we will also be storing in print.eps.
If you already have a file of either name and want to keep it, rename it now.

To have a PostScript file generated, you use "print", which is an action
attribute:

     `l has `print;

If you like, you can have the final print.ps file printed at the end of the
tutorial.  For now, we'll conserve paper and serve your convenience by using
ghostview to display it on the screen.

Here we give the ghostview main window a size that is a compromise between
legibility and obscuration.  You can change its size when the mouse cursor is
in it by pressing + or -.  You can zoom in on the spot where the mouse pointer
is by clicking the left button or (larger) the middle button or (still larger)
the right button.  There is a Dismiss button at the bottom of the zoom popup,
but you can also dismiss it (when the pointer is in the popup) by pressing the
q key.  Be careful: the main ghostview window, and therefore ghostview, is
dismissed by pressing the q key when the pointer is in the main window.

You may be able to drag the ghostview window to a location on the screen where
you can conveniently keep it all during the tutorial session.  If there is no
such location, you can close the window each time after examining it and open
it again after the next specification of the print attribute.

     $ghostview -color -magstep -3 -nolocator print.ps &

The layout is shown in landscape orientation.  You will see later how to
control its orientation.

Since filing an image for printing is accomplished through an attribute, only
one object and its children can be put in a single .ps file using s.  If you
want to print several on one page, put them in a layout or use .eps files
(section 2c).  On the other hand, an object does not have to be at the top
level to be printed:

     `g has `print

If you have closed the ghostview window, opening it will cause it to appear
with the layout in it and then, after a moment, with just the graph.  When
switching the main window from an icon, ghostview checks to see whether the
file has been changed and reopens it if it has.  If you have not closed the
window, to see the latest version just press the period key (or press the r
key or select Reopen from ghostview's File menu or Redisplay from its Page
menu).  In either case, reopen print.ps  each time print has been specified.

There is another possible component on a page printed by s: a disclaimer.  It
is always obtained from a file.  You specify the file by placing its full name
in the "printdisfile" attribute.  The text in the file can have linefeeds;
they will be ignored.  At the moment, you must have a space or a linefeed at
the end of the file in order to get its last word included in the disclaimer.
A default disclaimer is provided in the file common/tk/disclaimer:

     `printdisfile of `l

The "printdisstyle" attribute governs whether and how a disclaimer appears:

     `printdisstyle of `l

The default, as you have just seen, is for it not to appear.  It can appear as
an appendage to the object or more independently.  In the latter case, it can
have no decoration, a rule between it and the object, rules above and below
it, or a box around it.  See its appearance after each of these statements:

     `l has (`printdisstyle;`append; `print;1);
     `l has (`printdisstyle;`text; `print;1);
     `l has (`printdisstyle;`toprule; `print;1);
     `l has (`printdisstyle;`rule; `print;1);
     `l has (`printdisstyle;`box; `print;1)


2. Size and Position


Various attributes control the size of the paper, the size and position of the
object, and the shape and position of the disclaimer:


2a. Paper Size

	Attribute:	printsize

You can specify the size of the paper on which you intend to print the file
using the "printsize" attribute.  There are five sizes, three American and two
European.  The six attribute values and the five corresponding sizes are:
`letter or `a 8.5 by 11 inches,  `legal 8.5 by 14 inches,  `b 11 by 17 inches; 
`a4 210 by 279 millimeters,		      `b5 182 by 257 millimeters.

The default is letter:

     `printsize of `l


2b. Margins

There are separate margins for the object and the disclaimer.


2b(i). For the object

	Attributes:	printbottom
			printleft
			printright
			printtop

The page margins for the object are specified, in inches, as the values of the
"printtop", "printleft", "printright", and "printbottom" attributes.  The
directions for these margins (top, etc.) always refer to the object, not the
paper or the disclaimer.  Their values are used by printlayout, which we will
discuss shortly (section 2c).

     `printtop `printleft `printright `printbottom of `l


2b(ii). For the disclaimer

	Attributes	printdisbottommargin
			printdisleftmargin
			printdisrightmargin
			printdistopmargin

The margins of the disclaimer are specified, in inches, as the values of the
"printdistopmargin", "printdisleftmargin", "printdisrightmargin", and
"printdisbottommargin" attributes.  Their directions (top, etc.) always refer
to the disclaimer, not the paper or the object.

If printdisstyle is text, toprule, rule, or box, then: Printdisbottommargin
determines how far the bottom line of the disclaimer is from the edge of the
paper.  Printdisleftmargin and printdisrightmargin establish the width of the
disclaimer and its justification on the paper.  Printtopmargin gives the
minimum distance between the top of the disclaimer and the nearest edge of the
object.

     `printdistopmargin `printdisleftmargin of `l
     `printdisrightmargin `printdisbottommargin of `l
     `l has (`printdisleftmargin;2; `printdisrightmargin;4);
     `l has (`printdisbottommargin;1; `print;1);


2c. Justification and Size of the Object

	Attribute:	printlayout

The "printlayout" attribute has seven possible values:

  `center (the default) centers the object within all four margins, subject to
any constraints imposed by the disclaimer and its margins.

  `margins places the four edges of the object at the four margins, again
subject to any disclaimer constraints.

  `left, `right, `top, and `bottom place the designated edge of the object at
the corresponding margin and center the object in the other direction.

  `eps causes any specification of the print attribute to produce an
Encapsulated PostScript file, without a disclaimer and without margin -- just
the object --, stored in fn.eps if the printfile value flnm is of the form
fn.ps and in flnm.eps otherwise.

When printlayout is margins, you will probably see the layout going over its
top margin and indeed off the page; that is a bug, which will be fixed.  The
example, nevertheless, illustrates other aspects of the margins value:

     `printlayout of `l
     `l has(`printdisleftmargin`printdisrightmargin`printdisbottommargin;(;;));
     `l has (`printlayout;`margins; `print;1);
     `l has (`printlayout;`left; `print;1);
     `l has (`printlayout;`eps; `print;1);

After executing the last statement, use the ghostview File menu to open
print.eps for viewing.  After looking at that file, use the menu to open
print.ps again.


2d. Disclaimer Rules

	Attribute:	printdisrulewidth

The "printdisrulewidth" attribute controls the width of any rules the
disclaimer has: single, double, or box.  The default value of 0 means very
thin:

     >`printdisrulewidth of `l
     `l has (`printdisrulewidth;10; `printlayout;`center; `print;1);
     `l has (`printdisrulewidth;0);


3. Orientation

	Attributes:	printdisorientation
			printorientation


The "printorientation" and "printdisorientation" attributes pertain to the
orientation, landscape or portrait, of the object and the disclaimer,
respectively.  If printdisorientation is `none or if printdisstyle is `append,
the disclaimer orientation is the same as the object orientation.

     `printorientation `printdisorientation of `l
     `l has (`printdisorientation;`portrait; `print;1);
     `l has (`printorientation;`portrait; `print;1);


4. Color and fonts


4a. Color

	Attribute:	printmode

The "printmode" attribute allows you to choose the color characteristics of
the object, and only the object, in the PostScript file, although of course
the actual color will depend upon the printer used.  Since we specified the
color option for ghostview, you will see full color here when it is specified.
The possible values are `mono (black and white, the default), `reverse (black
and white reversed), `colorfg (the colors specified by fg attributes, with a
white background), and `color.  You obtain grayscale by specifying color and
printing the PostScript file on a non-color printer.

     `printmode of `l
     `l has (`printmode;`reverse; `print;1);
     `l has (`printmode;`colorfg; `print;1);
     `l has (`printmode;`color; `print;1);


4b. Fonts

	Attributes:	printdisfont
			printfont

The "printdisfont" attribute specifies the font used for the disclaimer:

     `printdisfont of `l
     `l has (`printdisfont;'times-roman-12'; `print;1);

 The "printfont" attribute specifies the printer font to be used for any
display font that is unavailable on the printer, such as manfnt.85:

     `printfont of `l
     `t has (`font;'manfnt.85');
     `l has `print;
     `l has (`printfont;'palatino-roman'; `print;1);

     _ex `p`s`d,free `l;

To dismiss ghostview, press q with the pointer in its window.
