[mod.computers.laser-printers] Four Questions for PostScript Wizards

herbw@midas.tek.CSNET (Herb Weiner) (08/28/86)

--------
I would appreciate any information that anyone (are you listening, Adobe?) can
supply to the following four questions:

1.  I have successfully defined fonts (FontType=3) in PostScript.  Can anyone
    tell me how to make these fonts look like Adobe downloadable fonts?

    a.  How does one create a file which will be automatically downloaded by
        the new LaserWriter drivers?

    b.  Judging by the ICONS I have found, there is more than one format for
        downloadable fonts (at least Apple, Adobe).  What are the differences?

    c.  How does one create a font (with a FontType other than 3?) to which
        one can apply the charpath operator?  This operator seems to work only
        with Adobe fonts.

    d.  I have NO interest in encrypting the font, and I am NOT looking for
        information about EEXEC.

2.  Footnote 4 on page 286 of the PostScript Language Reference Manual implies
    that it is possible for a sophisticated user to other page setup procedures
    for the Apple LaserWriter besides letter, legal, and note.  I realize that
    such a procedure would be device specific and would not work on all
    PostScript devices.  My interest in doing this is to maximize the amount
    of virtual memory available on a device (the LaserWriter) which has severely
    limited amounts of physical memory, while providing sufficient margins to
    get my job done.  Clearly, three choices is not enough!

    a.  Can anyone tell me what I should use as the fourth (proc) parameter to
        framedevice?

    b.  Alternatively, can someone provide me with the definitions of the built
        in procedures letter, legal, and note, which the footnote implies are
        available for study?

    c.  Alternatively, if Adobe considers these proprietary, can they supply
        an encrypted downloadable procedure for the Apple LaserWriter (Plus)
        which takes three arguments (matrix, width, height) and does the
        appropriate framedevice?

    d.  Incidentally, is it possible to have non-symetrical margins; e.g.
        1 inch on the left and 1/2 inch on the right?

3.  With the same motivation as for question 2, is it possible to reduce the
    amount reserved for font cache in the Apple LaserWriter, and thereby
    increase the amount of virtual memory available?  Obviously, this would
    have an impact on performance.

4.  Page 260 of the PostScript Language Reference Manual states that there is
    a limit of 6 open files in the Apple LaserWriter.  Since it does not appear
    possible to open a user-defined file (which I suppose would be buffered in
    memory), and since I can only account for 5 files (%stdin, %stdout, %stderr,
    %statementedit, %lineedit), can anyone tell me why the limit is 6?

I hope that you find these questions stimulating, and eagerly await your
responses.

                                  -- Herb Weiner, PostScript Enthusiast
                                     ...!tektronix!midas!herbw
                                     Tektronix
                                     P.O. Box 4600
                                     Beaverton, Oregon 97076
                                     (503) 629-1157

greid@adobe.UUCP (09/02/86)

Here are some more answers to your questions, with a lot of help from
Ed Taft.  Incidentally, my answer to your question about using
"charpath" on user-defined fonts was hasty--there is no reason that
charpath should not work on a user-defined font, assuming that it
really is an outline font, and not a bitmap font.

Here are some more:

question 2:
>  a.  Can anyone tell me what I should use as the fourth (proc) parameter to
>       framedevice?

>  b.  Alternatively, can someone provide me with the definitions of the built
>      in procedures letter, legal, and note, which the footnote implies are
>      available for study?

There's nothing proprietary about the built-in device setup procedures;
their definitions can be displayed by means of "==". They are rather
tricky to write, however, since they require some knowledge of how the
(undocumented) lower-level operators and the print engine work.
Unfortunately, the device setup procedures are different for the
LaserWriter and LaserWriter Plus.

Appended to this message are definitions for an A4 paper size. The
LaserWriter version is fully written out; specifying a different paper
size requires copying this procedure and changing certain numbers. The
LaserWriter Plus version (similar to the "a4" procedure built into the
LaserWriter Plus) simply calls a lower-level device setup procedure
with a bunch of parameters on the stack. [ Ed ]

>3.  With the same motivation as for question 2, is it possible to reduce the
>    amount reserved for font cache in the Apple LaserWriter, and thereby
>    increase the amount of virtual memory available?  Obviously, this would
>    have an impact on performance.

No, there is no mechanism to change the amount of VM allocated for the
font cache....

>4. Page 260 of the PostScript Language Reference Manual states that there is
>   a limit of 6 open files in the Apple LaserWriter. Since it does not appear
>   possible to open a user-defined file (which I suppose would be buffered in
> memory), and since I can only account for 5 files (%stdin, %stdout, %stderr,
>    %statementedit, %lineedit), can anyone tell me why the limit is 6?

One could exceed the open file limit, for example, by having several
%lineedit files open simultaneously. (There also exist unnamed files
that exist for special purposes, e.g., decryption filters.)

Herein follows the device setup for the A4 paper size:
----------------------- cut here ---------------------
%! 
% device setup for A4 paper size
% MACHINE-DEPENDENT -- works in LaserWriter rev. 0 (PS 23.0) only!!

/a4				% full A4 size (~.25 inch margins all sides)
   [
    [300 72 div		0
     0			-300 72 div
     -72		3436	% 3365 + 71
    ]

    % device width in bytes and height in bits:
    292 3365

    % extra action to take at end of showpage:
    {statusdict /jobstate (printing) put
     0 setblink
     % frametoroket takes: top left.  top is in bits (1/300 of an inch) and
     % left is in bytes (8/300 of an inch).
     margins
     % margins gets us to the top and left edges of the paper; now add
     % default top and left margins to center the image on the paper.
     exch 142 add exch 256 add 8 div round cvi frametoroket
     statusdict /jobstate (busy) put
     1 setblink
    }

    % Now do it:
    /framedevice load

    % halftone screen definition
    % screen frequency; angle; spot function:
    60 45 {dup mul exch dup mul add 1.0 exch sub} /setscreen load
    {} /settransfer load
   
    /initgraphics load
    /erasepage load
    ] cvx
statusdict begin bind end
readonly def



%! 
% device setup for A4 paper size
% MACHINE-DEPENDENT -- works in LaserWriter rev. 2 (PS 38.0) only!!

% args to setpage are:
%   width = width of image in bytes (must be even)
%   height = height of image in scan lines
%   xoffset, yoffset = offset of lower left corner of image from lower
%     left corner of paper, in pixels
%   proc = {topmargin leftmargin //dopage exec}
%     This is the proc passed to framedevice; it encapsulates the nominal
%     margins so as to behave correctly in the face of gsave/grestore.
%     The margin parameters are the nominal margins for the top and left
%     edges of the image, relative to the hardware-defined margins.
%     topmargin is scanlines from vertical sync; leftmargin is pixels from
%     start of scan.

/a4
   {$printerdict begin
    292 3325 72 91 {161 256 $printerdict /dopage get exec} setpage
    end
   } def