TweetFollow Us on Twitter

PostScript Print
Volume Number:2
Issue Number:6
Column Tag:PostScript Printing

Place PostScript in MacWrite Documents

By Mike Schuster, Adobe Systems, MacTutor Contributing Editor

Embed PostScript in Fonts and Pictures

When a Macintosh application prints to Apple's LaserWriter printer, the Printing Manager converts the sequence of QuickDraw operations that the application used to image the document on the screen into a PostScript® program that describes the appearance of the document on printed pages. The Printing Manager then transmits this program to the LaserWriter, which contains a PostScript interpreter bundled with a xerographic marking engine. The interpreter executes the page description and produces output on the attached output device.

The PostScript language itself was designed by Adobe Systems, Inc. to be a high-level, device independent page description language with powerful text and graphics capabilities. PostScript includes operators to outline or fill any arbitrary graphical shape constructed from straight lines, arcs, and cubic polynomical curves; to treat any shape as a clipping path to crop any other graphics; and to render text and sampled images of arbitrary resolution at any size or angle on the page.

Quickdraw versus PostScript

Normally, PostScript programs are generated automatically by the Printing Manager when the application's client selects the Print command. Let us briefly review how this is done. On the Mac, all drawing is done through the quickdraw routines. On the Laser, all drawing is done through PostScript. Hence quickdraw calls must be converted to the closest PostScript equivalent. Quickdraw is designed so that all the quickdraw routines reduce down to a dozen or so standard drawing routines. This lets an application designer write his own quickdraw routines by replacing these primary routines or "quickdraw verbs" with his own. The Print Manager converts each of these quickdraw verbs to a call on a PostScript procedure, which closely emulates the quickdraw action using PostScript primitives. The definition of that procedure is contained in Laserprep, which is downloaded into the Laserwriter. The PostScript procedures defined in the Laserprep file in effect re-define the quickdraw verbs in terms of PostScript commands. When you use the command-F key to produce a PostScript file, the Print Manager generates a file of procedure calls into this Laserprep file. So you couldn't use this PostScript file without the Laserprep file being downloaded into the Laserwriter first. Thus in normal printing, the Mac quickdraw environment is completely translated to a PostScript environment automatically through the actions of the Printing Manager and Laserprep. This automatic conversion is very useful, since neither the application's user nor its designer need to understand or worry about the details and concerns of the PostScript environment.

There are several situations, however, when it would be useful to type or paste raw PostScript commands directly into a document, so that the images generated by the commands are integrated on the printed page along with the rest of the document. The reason for this is that neither QuickDraw nor current applications are capable of imaging the full repetoir of PostScript graphics on the screen. Hence, many of the LaserWriter's powerful capabilities remain relatively unexplored and unexploited, at least when using MacWrite, MacDraw and MacPaint. And since the Laserwriter costs some $4800, it would be nice to be able to use all of it's capabilities!

But there is lots of good news on the horizon. Apple's new Printing Manager, version 3.1, contains several useful facilities for including PostScript in a document. Apple is madly documenting its capabilities. As a preview, we'll look at what you can do with them.

The “PostScript Escape” Font

The new Printing Manager treats any text in the font named “PostScript Escape” as PostScript commands and sends the text straight through to the LaserWriter. When the Print Manager sees text displayed in the PostScript Escape font, that text is not converted into a Laserprep text drawing call, but simply inserted into the rest of the PostScript file. In this way, pure postscript is included in this file of Laserprep calls and executed directly by the laserwriter.

Any font may be used as the "PostScript Escape" font, but consider this example using the font I've created (available on source code disk #9 from the MacTutor mail order store). Here is an example. First, type the following PostScript program into the middle of a MacWrite document:

gsave initgraphics
/Times-BoldItalic findfont 27 scalefont setfont
/rays
 { 0 1.5 179
 { gsave rotate 0 0 moveto 108 0 lineto stroke grestore } for
 } def
300 400 translate .25 setlinewidth
newpath 0 0 moveto (StarLines) true charpath clip
newpath 54 -15 translate rays
grestore

Then hilight the whole paragraph, and select my PostScript Escape font from MacWrite's Font menu. The paragraph will disappear! Now print the document. The effects of the embeded postscript will appear in the LaserWriter printout.

Invisible Fonts

Whats going on? First, my PostScript Escape font is invisible! Using Apple's ResEdit, I made a copy of the Times 12 point font and called it PostScript Escape. Then I erased all of the black bits in the entire font and set the width of each letter to zero. Then I reduced the ascent and descent so that the font is only 1 point tall. Finally, I pasted the font into my System file. You can do the same thing to create this font if you don't want to wait to get it on a source code disk.

Why bother with an invisible font? If the PostScript Escape font was visible, then any PostScript set in it would leave blank areas on the printed page, since MacWrite assumes that the text will be printed as it appears on the screen. Since only the graphic objects that the PostScript produces are visible on the printed page, we have no choice but to make it invisible, otherwise we would loose screen- page fidelity.

How does one edit invisible text? Easy, just select something that includes the PostScript and change the whole thing to Times, for example. Edit the PostScript, make it invisible again, and print.

PostScript Considerations

When you imbed normal postscript in MacWrite, your postscript image will come out upside down. This is because the coordinate reference system for quickdraw and postscript are opposite. You fix this by adding in front of the postscript two calls:

gsave initgraphics
now add your postscript stuff
grestore

This has the effect of saving the Print Managers coordinate system, initializes the default postscript coordinate system, then it draws the postscript, and finally restores the print manager's coordinate system. In PostScript, (0,0) is at the bottom of the page, while in quickdraw (0,0) is at the top of the page. In our example above we have added these commands so the PostScript has the same orientation as the rest of the Macwrite file.

Another problem is placement. Paste the postscript at the bottom of the page, so the Macwrite stuff does not overwrite the postscript image. Or if you estimate where your figure should be placed on the page, you can leave space in the Macwrite document for the figure, and place your postscript stuff in the blank box, but remember you have to set your postscript coordinates in your postscript commands to match that box area. The Print Manager doesn't tell you where it is on the page!

Pagemaker Doesn't Work!

Pagemaker does not use the default Print Manager routines, which makes calls on Laserprep. Rather it calls it's own RAM based Print Manager in Pagemaker which makes calls on Aldusprep, and this Pagemaker Print Manager does not know about this PostScript escape routine so it will be treated like a regular text font, and hence there still is no way to imbed PostScript into your Pagemaker layout! Pagemaker is supposed to be updating their product to support these new print manager functions sometime this summer. They will add a PostScript place command to place PostScript text files in a manner similar to placing a MacWrite file. A quickdraw picture feature will allow the quickdraw picture to represent the postscript stuff and make placement on the page as easy as placing a MacDraw figure. If they can pull this off in a timely manner, it will greatly increase the sophistication level of Pagemaker in the marketplace.

Get a copy of PostScript Language Reference Manual and PostScript Language Tutorial and Cookbook, by Adobe Systems and published by Addison-Wesley and use this technique to try out some of the examples.

PostScript in Pictures

The new Printing Manager also has some goodies for those of you who use QuickDraw pictures. Try embedding the following C code into a picture or place them between a PrOpenPage and a PrClosePage in your printing loop:

C Code Example

open picture(@rect);
fillrect(@rect, white);
PicComment(190, 0, 0l); /* Begin PostScript mode */

/* Send following Quickdraw text as PostScript */
PicComment(194, 0, 0l); /* this is postscript escape font */
DrawText("/pgsave initgraphics");
DrawText("\p/Times-BoldItalic findfont 27 scalefont setfont");
DrawText("\p/rays");
.../* add postscript commands */
DrawText("\pgrestore");

PicComment(191, 0, 0l); /* End PostScript mode */
close picture;

Print Manager Bug

The fillrect simply draws a white rectangle to get around a bug in the print manager which causes it to think this is a blank page unless it sees at least one quickdraw drawing command. The white rectangle on white obviously won't do anything we can see, but it will force the Print Manager to then show our postscript stuff rather than a blank page.

These PicComment calls are intercepted by the Printing Manager. Comments 190 and 191 bracket the PostScript, and comment 194 tells the Printing Manger that the following text is set in the PostScript Escape font, so the Printing Manager simply forwards all of the text to the Laserwriter.

The Parkhurst Picture

What else does the Printing Manager do? A while back Bill Parkhurst, author of the T/Maker's ClickArt Effects package, argued that each QuickDraw Picture should have two forks - a QuickDraw fork and a PostScript fork. When such a picture is drawn on the screen or printed on the ImageWriter, only the QuickDraw fork is used. When it is printed on a PostScript printer, only the PostScript is used. You get the best of both worlds, good looking printed documents and good screen approximations without the need for a PostScript interpreter resident on the Macintosh. Apparently, version 3.1 has some support for the Parkhurst Picture, but details have yet to be documented, and there is some doubt whether the implementation will work in the current version. It is not known if Apple is planning to support this untested code features.

Downloadable font problems: With this implementation of PostScript escape, a needed downloaded font will not be donwloaded unless the font is used in the regular quickdraw portion of the file.

Laserwriter Plus RAM memory problems: One of the great mysteries is why Apple did not increase the RAM memory in the Laserwriter Plus so that downloadable fonts could be supported. As it is now, only one small font can be downloaded at a time due to the fact that only about 50K of RAM is left. Application programs could be designed to get around this problem by imaging the page one font at a time, rather than composing all the page at once. The page should be reorganzied by the application by font, so that each font component is sent only once to the printer. An ascii postscript file sort program that sorts the postscript by font and sends it to the printer in the sorted order, using one font at a time on a page basis would be a great utility program. It also would be great to design this abilitiy into existing page makeup software.

Another fix is to use the note operator which allows drawing in a smaller area on the page in one of three page sizes: letter, note and legal. Using note size, the RAM previously allocated for the whole page area is now smaller by 100K, which can be used by fonts so up to 4 downloadable fonts can be supported, but you have to use the note operator in your own postscript file. The Print Manager uses the note operator automatically. The Page Setup allows you select between note size (7.7 by 10.2 on a page 8.5 by 11) and legal size (6.7 by 13 on an 8.5 by 14 inch page). Letter size (8 by 11 on a 8.5 by 11 inch page is not supported by the Print Manager, which is why you can't print to the edge of the page. The note operator can select letter size in a custom postscript file however. Aldus prep does not use the note operator. Because there is not enough RAM memory in the Laserwriter Plus or the Laserwriter, you can't have both a full size page and downloadable fonts.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Fresh From the Land Down Under – The Tou...
After a two week hiatus, we are back with another episode of The TouchArcade Show. Eli is fresh off his trip to Australia, which according to him is very similar to America but more upside down. Also kangaroos all over. Other topics this week... | Read more »
TouchArcade Game of the Week: ‘Dungeon T...
I’m a little conflicted on this week’s pick. Pretty much everyone knows the legend of Dungeon Raid, the match-3 RPG hybrid that took the world by storm way back in 2011. Everyone at the time was obsessed with it, but for whatever reason the... | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for July 19th, 2024. In today’s article, we finish up the week with the unusual appearance of a review. I’ve spent my time with Hot Lap Racing, and I’m ready to give my verdict. After... | Read more »
Draknek Interview: Alan Hazelden on Thin...
Ever since I played my first release from Draknek & Friends years ago, I knew I wanted to sit down with Alan Hazelden and chat about the team, puzzle games, and much more. | Read more »
The Latest ‘Marvel Snap’ OTA Update Buff...
I don’t know about all of you, my fellow Marvel Snap (Free) players, but these days when I see a balance update I find myself clenching my… teeth and bracing for the impact to my decks. They’ve been pretty spicy of late, after all. How will the... | Read more »
‘Honkai Star Rail’ Version 2.4 “Finest D...
HoYoverse just announced the Honkai Star Rail (Free) version 2.4 “Finest Duel Under the Pristine Blue" update alongside a surprising collaboration. Honkai Star Rail 2.4 follows the 2.3 “Farewell, Penacony" update. Read about that here. | Read more »
‘Vampire Survivors+’ on Apple Arcade Wil...
Earlier this month, Apple revealed that poncle’s excellent Vampire Survivors+ () would be heading to Apple Arcade as a new App Store Great. I reached out to poncle to check in on the DLC for Vampire Survivors+ because only the first two DLCs were... | Read more »
Homerun Clash 2: Legends Derby opens for...
Since launching in 2018, Homerun Clash has performed admirably for HAEGIN, racking up 12 million players all eager to prove they could be the next baseball champions. Well, the title will soon be up for grabs again, as Homerun Clash 2: Legends... | Read more »
‘Neverness to Everness’ Is a Free To Pla...
Perfect World Games and Hotta Studio (Tower of Fantasy) announced a new free to play open world RPG in the form of Neverness to Everness a few days ago (via Gematsu). Neverness to Everness has an urban setting, and the two reveal trailers for it... | Read more »
Meditative Puzzler ‘Ouros’ Coming to iOS...
Ouros is a mediative puzzle game from developer Michael Kamm that launched on PC just a couple of months back, and today it has been revealed that the title is now heading to iOS and Android devices next month. Which is good news I say because this... | Read more »

Price Scanner via MacPrices.net

Amazon is still selling 16-inch MacBook Pros...
Prime Day in July is over, but Amazon is still selling 16-inch Apple MacBook Pros for $500-$600 off MSRP. Shipping is free. These are the lowest prices available this weekend for new 16″ Apple... Read more
Walmart continues to sell clearance 13-inch M...
Walmart continues to offer clearance, but new, Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBooks... Read more
Apple is offering steep discounts, up to $600...
Apple has standard-configuration 16″ M3 Max MacBook Pros available, Certified Refurbished, starting at $2969 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free,... Read more
Save up to $480 with these 14-inch M3 Pro/M3...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
Amazon has clearance 9th-generation WiFi iPad...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Apple is offering a $50 discount on 2nd-gener...
Apple has Certified Refurbished White and Midnight HomePods available for $249, Certified Refurbished. That’s $50 off MSRP and the lowest price currently available for a full-size Apple HomePod today... Read more
The latest MacBook Pro sale at Amazon: 16-inc...
Amazon is offering instant discounts on 16″ M3 Pro and 16″ M3 Max MacBook Pros ranging up to $400 off MSRP as part of their early July 4th sale. Shipping is free. These are the lowest prices... Read more
14-inch M3 Pro MacBook Pros with 36GB of RAM...
B&H Photo has 14″ M3 Pro MacBook Pros with 36GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 Pro MacBook Pro (... Read more
14-inch M3 MacBook Pros with 16GB of RAM on s...
B&H Photo has 14″ M3 MacBook Pros with 16GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $150-$200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 MacBook Pro (... Read more
Amazon is offering $170-$200 discounts on new...
Amazon is offering a $170-$200 discount on every configuration and color of Apple’s M3-powered 15″ MacBook Airs. Prices start at $1129 for models with 8GB of RAM and 256GB of storage: – 15″ M3... Read more

Jobs Board

*Apple* Systems Engineer - Chenega Corporati...
…LLC,** a **Chenega Professional Services** ' company, is looking for a ** Apple Systems Engineer** to support the Information Technology Operations and Maintenance Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
*Apple* / Mac Administrator - JAMF Pro - Ame...
Amentum is seeking an ** Apple / Mac Administrator - JAMF Pro** to provide support with the Apple Ecosystem to include hardware and software to join our team and Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.