PostScript ON THE SINCLAIR
------------------------
John Pazmino
NYSkies Astronomy Inc
www.nyskies.org
nyskies@nyskies.org
1991 January 1 initial
1997 January 1 current
[This set of four articles are placed together here as a history
piece. They illustrate in this 21st century one example of the
vigorous experiment and experience in the earlier years of home
computers, The home computer was the Sinclair Spectrum. It runs off
the Z80 CPU, 8MHz clock speed, 64kb RAM, BASIC operating system An
American veriosn of this machine was the Timex-Sinclair. The dates
of issue span the initial composition and the latest revision, based
on clues within the articles.]
= = = =
[I came onto some old issues of 'LISTing', newsletter of the Long
Island Sinclaiar-Timex computer club, with a series of articles I
wrote about running PostScript on a Sinclair computer. Being that they
were written before Internet pervaded into common use and that
PostScript programming is an intriguing application for Sinclair, I
pass them along to you now in the COMP.SYS.SINCLAIR newsgroup. I did
minor editing to clean up wording. There are four articles in the
series but your local Internet service may split each into several
pieces. Be sure to capture each of them. Have fun!]
POSTSCRIPT ON THE SINCLAIR
------------------------
Oy!, you noticed! How pretty and lovely this article looks! Oh!, the
letters are so sharp and crisp and neat! What's with that Pazmino, already?
[Original article was printed in a fancy typestyle in 'LISTing'.]
Did he get attitude and turn to one of those other computers?
No, I'm still in the Sinclair flock. I merely typed this out on my
SInclair in a new language. The language PostScript.
PostScript on a Sinclair? What is PostScript?
You probably surmised already that it has something to do with the
appearance of this article. You don't get such beautiful typography out of
a Sinclair, right?
A little history. In 1985 a group of computer companies teamed up to
sic PostScript on the world: Adobe, Aldus, and Apple, These firms assembled
Adobe's vector character system, Aldus's PageMaker program, and Apple's
LaserWriter printer into a magical engine for typography. By a secret
process the mouseclicks and keystrokes on the computer were turned
into finished pages from the printer. Pages so good they substituted
for those produced by orthodox type setting and graphic rendering.
Thus was born the present gigantic industry of desktop publishing.
Because the three companies kept their internal workings tightly to
themselves, no one could dope out what happened between the key and mouse
action and the spitout of the finished page. Never the less, a major
feature of PostScript is the manner of handling characters.
You, a Sinclair enthusiast, will find it easy to appreciate. For
there is a strong parallel to Sinclair's graphics functions. Key in,
save, and run the 'A' program here.
10> REM 'A' program 28> DRAW -12*x,18*y
12> LET x=1; LET y=1 30> DRAW -46*x,0
14> PLOT 0,0 32> DRAW -12*x,-18*y
16> DRAW 10*x,5*y 34> DRAW 10*x,-5*y
18> DRAW 40*x,60*y 36> DRAW -25*x,0
20> DRAW 40*x,-60*y 38> DRAW 29*x,27*y
22> DRAW 10*x,-5*y 40> DRAW 42*x,0
24> DRAW -2*x,0 42> DRAW -21*x,32*y
26> DRAW 10*x,5*y 44> DRAW -21*x,-32*y
You get a [sort of] neat capital letter 'A' on the screen. It is made
of PLOT and DRAW operations. Fundamentally, there is no difference between
this 'A' and a shape made from the same PLOT/DRAW functions. From your
immersion in the Latin environment you say that this is a letter 'A' and
not a tree or a goat.
With the 'A' still printed on the screen do a screensave of it. You
just captured a block of the memory containing the image of the 'A'. Each
pixel on the screen is mapped one-to-one to a bit in the memory. You in
truth created a bitmapped file of the 'A'. The original 'A' program is a
vector or outline file of the same letter 'A'.
Do NEW. Now you want to restore the 'A' to the screen. You can load
and run the 'A' program or you can load the 'A' screen. The 'A' screen --
the bitmapped file -- is way the longer of the two at several kilobytes.
The vector program is only a few hundred bytes long. Hence, one
distinction between bitmapped files and the outline file is the greatly
larger size of the former.
There's more. Edit line 12 so x=0.6 and y=1.2, then run the program.
You get a slimmer and taller 'A'. Try other values for x and y and get all
sorts of stretched and sized 'A's. You may hit against an 'out of range'
error if the letter spills off of the screen. But apart from that you can
make any 'A' you like.
Not so in the bitmapped scheme. You got to have a new and other
file for each variety of 'A' you want. If your text calls for eight sizes
of 'A' you need eight bitmapped files of that 'A'. Yet each variety of
'A'is generated by a simple edit of the one and same 'A' outline program.
Ergo, in the place of a battery of bitmap files you have but a one vector
file.
There is a further and momumental difference between the two systems
of character. The bitmapped character must be designed to coordinate with
the peculiar printer you got. An 'A' made to look good on a 9-pin Epson
may look lousy on a 9-pin Citizen or a 24-pin Panasonic. This is due to
the diverse shape, size, and spacing of the pixels among the printers.
The vector method employs a phantom mathematical coordinate system,
unattached to any particular output device; it is 'device independent'.
The drawing instructions are sent to the printer, which does what ever is
necessary to reproduce the character the way it's supposed to look. You
glimpsed this already in the 'A' program. You plugged in x and y
values in full disregard of the pixel grid. The coordinate of any
point in the 'A' can well be a noninteger number of pixels. Yet the
'A' looks rather nice anyway. (By the way, did you know that Sinclair
does round off noninteger coordinates?)
PostScript uses the outline or vector scheme of character generation.
It is device independent. That is, once you work out the drawing
instructions for the 'A' you can apply them to any printer and get a fair
and proper realization of the 'A'.
In the outline system you can -- no kidding -- code the entire
Algonquin pubesence oath onto a pinpoint. Or an 'SOS' from Earth large
enough to read from Jupiter. Try it with the 'A' program. Let x = 1e-10,
y = 1e-10. See? A [very] miniature 'A'. Uh, wait a minute; that's just a dot
there. Go and look closer. Yep, it is a dot.
Yet Sinclair really did carry out mathematicly the scaling and that dot
just happens to be a set of individual coordinates all rounded to (0,0).
If you send that program to a microphotoetcher, used for inscribing computer
chips, and look at the output thru a microscope, lo!, there before your eyes
is a perfectly formed 'A'. And this is a good thing.
Such microscopic size of character is impossible in the bitmap system.
There is no way to form a recognizable letter out of a single pixel! At
the other extreme there is no (at least for a year or so) computer big
enough to hold the squillions of bits for the 'SOS'.
Now the 'A' program has one style of 'A'. You can redefine the basic
shape with PLOT/DRAW statements. This new 'A' shape is a new file, named
appropriately. You build up a suite of character sets, or fonts, and load
in the one you want. In PostScript, the fonts are stored on disc or
cartridge and you feed them to the printer (or, in some cases, to the
computer) so you have onboard the stable of fonts your text calls for.
Yes, yes, yes, but how does all this PostScript shtik work? One bright
and sunny day ...
= = = = =
A BOWL OF ASCII SALAD
-------------------
... some grunts tapped into the cable connecting the computer to
the LaserWriter. What before their wondering eyes spilled out? Out
gushed letters! Numbers! A few symbols! And nothing else. They were
all pure and simple ASCII characters.
What the hell was this junk? It was a veritable program. A stream
of code. All in a fullblown mature sophisticated language. This was
the PostScript language!
The desktop publisher running on the computer took all the
keystrokes and mouseclicks and turned them into a PostScript program
in unmitigated ASCII text. It then piped this code to the printer,
where it was digested into finished pages. The publisher was an early
-- and most successful - example of CASE, Computer Assisted Software
Engineering, a program that writes programs to satisfy your desires.
In this situation the desire is a page of true typographic quality and
the output program is the PostScript code.
Now, if the printer sees only this stream of ASCII chars piping
into it, can you not set the publisher aside and write the code
yourself with a wordproc or by typing directly to the printer on the
keyboard?
Yes!, you can!!
When the intermedium of the PostScript ASCII textfile was
discovered, in 1987, the monopoly of Aldus PageMaker was broken and
the LaserWriter lost its aura. In 1988 Adobe threw open the entire
specification and many of the internal technica of PostScript for
public enjoyment. Today there are hundreds of applications that can
output their design and text as a PostScript ASCII textfile.
You don't need any of these; you can type in your own textfile.
It'll look the same to the printer. Just make sure the file is truly
pure ASCII, with no funny characters mixed in. On Sinclair, Tasword
and Mscript, for example, produce pure ASCII textfiles. This is an
excellent vehicle for writing PostScript code. The text within LPRINT
statements in BASIC are pure ASCII (provided you do not deliberately
insert any hidden characters like BRIGHT or INK).
['Tasword', 'Mascript' and other proper names in this series are
software and hadware for the Sinclair conmputer. With Sinclair long
retired into history, they are no longer available in the 21st
century. Much Sinclair software was eventually converted and some
hardware is simulated in emulators on modern computers.]
In examining sample PostScript code you notice s strong
resemblance to Forth. If you be versed in, say, Aberforth or White
Lightning, you'll catch on to PostScript very easily. (A hushhush
feature of White Lightning is that it can be tweaked into a subset of
PostScript!) PostScript is essentially a stack-based scheme. Parms and
args are pushed onto a stack and the commands work on them. The result
of the command is pushed on the stack in the place of the original
parms. PostScript, like Forth, has a fistful of commands to manipulate
the stack and query it. You need these because you must at every
instant be aware of the stack's contents.
Along with the stack system is the postfix notation. The parms
come first, left to right, followed by the command that works on them.
PostScript says "130 30 MOVETO" to set the 'pen' to the coord point
(130, 30); compare with "PLOT 130,30".
There are no discrete statements or records in PostScript. The
code can run on and on in one entrainment with linebreaks for your own
convenience. However, spaces are critical. Where a space is required
between words of code it must be at least one blank or a newline. You
may insert many blanks, as to indent or group logical segments, but
PostScript counts all these blanks as one 'whitespace'.
You can make up allnew commands and refer to them in your program
somewhat like subroutines. "/LIST {20 300 MOVETO /Helvetica FINDFONT
30 SCALEFONT SETFONT (LONG ISLAND SINCLAIR TIMEX) SHOW SHOWPAGE} DEF"
captures the stuff "20 ... SHOWPAGE" into a new command called "LIST".
When you do "LIST" within a PostScript code the name of America's
premier Sinclair advocate is printed.
Case is important in that once a command is defined with one
spelling it must thereafter be refered by that exact same spelling.
Attempting to do "List" or "list" in the above example earns you an
nothing; the new command is "LIST". Also, the names of fonts must be
exactly as they are spelled. For the 'AdvantagePrestige Bold' font,
you must say "AdvantagePrestige Bold" just like that.
PostScript is truly a general purpose language, the equal of BASIC
or Pascal, It has maths, booleans, conditionals, arrays, files, loops,
strings, and so on. The emphasis on graphics and text functions makes
PostScript a lingua franca for CADs, publishers, wordprocs, artists,
illustrators, and other kindred programs. It is the basis of Carousel
and Acrobat, schemes for audio and video handling in a manner
analogous to the massaaging of text and graphics.
In fact, the character sets themselves, being merely a set of
graphics instructions like the 'A' program, are written in PostScript.
And, what's more, you can make up your own sets by coding them in
PostScript.
I can not give here even a cursory tuition in PostScript. I do, in
the stead, offer a bibliography. You can chew on this until we set out
into PostScript territory two sessions from now.
The litterature of PostScript, quite thoro and rigorous, is still
small enough to fit within a ha'meter of bookshelf. The pressruns of
the early titles were short, due to the circumscribed world of
PostScript enforced during the Adobe-Aldus-Apple regime. Hence, the
older books may be tough to acquire nowadays.
Adobe Systems Inc, "Adobe Type-1 Font Format", 1990
Adobe Systems Inc, "PostScript Language Program Design", 1986
Adobe Systems Inc, "PostScript Language Reference Manual", 1990
Adobe Systems Inc, "PostScript Language Tutorial and Cookbook", 1985
Braswell, "Inside PostScript", 1989
Campione & McGilton, "PostScript by Example", 1992
Dubin & Spring, "Hands-On PoatScript", 1992
Glover, "Running PostScript from DOS", 1989
Holzgang, "DIsplay PostScript Programming", 1990
Holzgang, "PostScript Programming Reference Manual", 1989
Holzgang, "Understanding PostScript Programming", 1987
Kunkel, "Graphic Design in PostScript", 1990
Reid, "Thinking in PostScript", 1990
Roth, "Real World PostScript", 1988
Smith, "Learning PostScript", 1990
Thomas, "A PostScript Cookbook", 1988
Wollenweider, "Encapsulated PostScript", 1990
There are one or two new titles yearly, as opposed to dozens in
just about any other computer topic. The paucity of new offerings is
largely the result of the completeness and tightness of the original
language and the dominion that Adobe still exerts over it. To maintain
the absolute portability of PostScript programs, off-Adobe products
observe fielty before the specs & regs handed down by Adobe.
Ah, there's a catch here. Like with duck stew, you need ...
= = = = =
EAST OF THE PARALLEL, WEST OF THE SERIAL
--------------------------------------
... a duck. You see, to speak PostScript with the Sinclair, you do
need a printer that understands PostScript. You just knew there was
some vital & fatal gotcha, didn't you! A 'PostScript printer' is a
printer that has within it the animus of PostScript, the wherewithall
to turn the PostScript ASCII code into those lucious pages you want.
Some models, like the original LaserWriter, have PostScript welded
shut inside; it can't get out. Others, like the HP LaserJet, take on
the PostScript demeanor by a plugin cartridge. Still others have a
socket to accept a ROM inscribed with PostScript. In all cases, the
printer also functions in some native mode, typically IBM Graphics or
HP LaserJet. It is set to PostScript by however means the printer
instructions tell you. Make sure the printer is de acto atque facto in
PostScript mode. In native mode you get only a regular printout of the
very code you send to it. After all, that code is nothing but a stream
of ASCII charactrs.
The printer will almost always be a laser printer, which produces
its output much like a photocopier. The image is first deployed in the
onboard memory and then splatted in one blow onto the paper. For
curiosity's sake, the minimum memory for PostScript to compose and
store a letter page is 1-1/2Mb; it's 2Mb for a legal page. If the
printer at hand does function properly in PostScript mode it already
got enough memory, at least for letter pages.
The base standard resolution of the laser printer is 120 pixels or
'dots' per centimeter. You must look closely under a loupe to see any
jagged edges in the output. The newer models offer 180 or 240 d/cm.
This approaches the quality of orthodox typesetting. The best printers
deliver 960 or 1,000 d/cm, which is practicly indistinguishable from
true typesetting.
I understand fully well that you are unlikely to have at home a
PostScript printer. And it is improbable you are fixing to get one
soon. They still are rather pricey as home appliances. On the other
hand, it is quite probable that you have or can get cheaply an
ordinary laserjet printer. Since 1990 a laserjet fell so precipitously
in price that it almost completely displaced dot-matrix printers on
the store shelfs. You can get a laserjet for under $400 [in the United
States].
Now, with such a printer in hand (or within ready reach) you can
scout around for a PostScript upgrade. This may be a board or
cartridge fitted into the printer. Check with the manufacturer of your
printer being that such accesories are peculiar to each brand of
printer.
Adobe offers cartridgs that work with printers truly a clone of
the Hewlett-Packard LaserJet while Pacific makes them fro a variety of
printer systems. Cost, in 1996, range from $100 to $200; this reflects
the number and variety of embedded fonts.
Once in a while you'll find a bargain like I did in 1995. Panasonic
issued a compact tower printer that has both LaserJet and PostScript
engines built in. They are selectable from the front panel or by
sending a control code from the computer. Price? $270. Yes, it was a
bargain.
However, PostScript printers are common at work or school and you
may be allowed to play with one of them. Let's be considerate. What
ever you do with the printer, make very sure you restore it to its
original settings before you release it for others to use. You really
don't want angry associates, do you? For the record, I myself use at
work an HP LaserJet II fitted with an Adobe PostScript cartridge. The
printer is part of the office equipage but the cartridge is my own
item. I got it from a computer bazaar for $90 in 1988.
In any manner you get entree to a PostScript printer, you can
drive the muddah thru a Sinclair. And this is a good thing.
Naively you bring your Sinclair to the printer and cable the two
together. You'll earn a lot of condolence lunches for sure. Because
the stock Sinclair has no printer port you need an interface. Get one
that matches the cable already attached to the printer, be it serial
or parallel. ByteBack and Gray & Clifford are good brands of serial
interface. Aerco and Tasman are standard parallel interfaces. You may
also need a 9/25-pin adaptor for the serial port cable.
Serial ports normally expect a telcomms program to talk thru them.
Use Mterm or Specterm in their 'terminal' mode. Due to the slow speed
of the Sinclair, you must set the parms on both the computer and the
printer to 1200bps, 8-N-1 xon/xoff. Serial printers are usually set to
9600bps. To send code to the printer, either type it in at the
keyboard or upload it as a prepared file by a 'text' or 'ASCII'
transfer.
When a telcomms application is the vehicle to talk to the printer
you have an added potential. Most PostScript printers can act like a
'remote' or 'host'. You type in the commands and the printer kicks
back a response at the instant, much like when you talk to a regular
remote computer.
Parallel ports do better with wordprocs or plain BASIC. Write the
code into a document and do a 'print' on it within the wordproc. No
printer driver is needed because you are sending only ASCII characters
with no hidden codes. In BASIC put the code into LPRINT statements and
then run the program.
Where it is impractical or impossible to get the Sinclair and the
printer together, there is a way out. Write the code at home on the
Sinclair and upload it to a BBS or email service as a private file
addressed to you. At the printer's computer download the file to disc,
where it behaves like a natively written file. Send this file, by the
normal DOS "COPY <file> <port>", or "PRINT <file>", to the printer.
The Sinclair and the other computer, obviously, must be fitted out for
telcomms in the first place.
This up & down loading is the only way to meld the Sinclair to a
PostScript implemented in the computer rather than in the printer.
Such is accomplished by plugin cards or software on disc. Because in
this scheme there is no PostScript animus in the printer, tying the
Sinclair to it will not get you any PostScript capability. You must
get your Sinclair ASCII file into the computer itself via the up &
down loading trick.
[Sinclair was built to store its files on audio cassettes. It never
devloped its own disc system. Third party devices were offered which
didn't interoperate among themselfs or with other systems, like IBM.
Else the PostScript code typed on SInclair could be saved to disc and
then opened by the other computer.]
Can't the printer's computer run a Sinclair emulator and produce
PostScript code thru it? Of course, but there is no point to it. You
may as well go and write PostScript with that computer's native
wordproc in the first place. We want to demonstrate that the real
McCoy machine can produce genuine PostScript code saved on cassette.
An other reason is that some emulators embed codes in the output text
so it looks like the Sinclair printer produced it, with all the little
dotty bits. This may be misinterpreted by PostScript and you get no
output at all.
You're drumming your fingers, eh? What's the matter? Oh? The
fonts? What about them? Where are they? Ah!, the fonts! Yes, yes, yes,
the fonts. Erm, the fonts.
Not a worry here. All PostScript printers come with a selection of
fonts, a dozen to a few score. These are onboard and ready to call up
as you need. There's nothing special to do. You do not need fonts from
other sources, at least not for the initial experiments. The onboard
fonts are Times-Roman, Helvetica, and Courier, plus some others which
vary from printer to printer. Times-Roman looks like newspaper type.
Helvetica looks like the signs for highways and transport depots.
Courier mimics a typewriter style.
Well, are you ready for PostScript? All systems are go. Countdown
for launch. 9, 8, 7, 6. We got ignition! 5, 4, 3, ...
= = = = =
THE OUTLAND OF POSTSCRIPT
-----------------------
... 2, 1, liftoff! Good burn! Trajectory insertion! You're looking
good up there. PostScript, we come in peace for all mankind.
What a land this is! Vast! Immense! I can't ever show any but the
merest part of it! For starts, PostScript is an interpreted language,
like BASIC. The code is digested en train as it reaches the printer.
There is no compilation or translation into a low-level code. Much
like the BASIC interpreter in Sinclair, that of PostScript is a
sanctum. You don't have to understand it to appreciate it and use it
well. As long as you feed it the [correct!] code, the PostScript
interpreter will do what you want it to do.
There are a few considerations in exploring PostScript. It is
slow. The drag comes from the interpreter's work and also the
preparation within the printer of the image. It has to be fully formed
before it's printed onto the paper. You may wait many seconds or
minutes to see the output.
PostScript is pretty brutal about correct syntax and grammar. It
has crummy error checking and reporting. Ever so slight a mistake will
get you ridiculous output. Or no output at all. A fatal error will
bomb the program and reset the printer to its ready state.
It offers no progress or status reports. You must wait until the
paper is ejected from the printer to see what happened. This you can
simulate by attaching the Sinclair printer to your rig and editing the
"A" program in the firstof these articles. Add '11> INK 7: PAPER 7:
CLS' and '46> COPY'. You'll see nothing on the screen. You must judge
your results only from the printout.
All this is mighty infuriating, being that you are so comfortable
with Sinclair BASIC! You just have to stay awake and alert and pay
attention to your coding.
Let's move on. I assume for now that you are tied to the printer
thru a parallel port and you use BASIC to convey the code. Check that
the printer was previously set to PostScript, not native, mode. Key in
the 'B' program here. Double- check your typing, paying particular
attention to the case and spacing. (The gap in linenumbers belongs
there.) OK? Now save and run it.
10> REM 'B' program 20> LPRINT "0.5 setgray"
12> LPRINT "/Times-Roman findfont" 22> LPRINT "(B) show"
14> LPRINT "600 scalefont" 30> LPRINT "showpage"
16> LPRINT "setfont" 32> LPRINT "quit"
18> LPRINT "100 100 moveto"
Man!, that's arpsly fairblus! A letter 'B' in muted gray over the
whole page!! It's, it's, beautiful!!! How did I do that?!?! You can
probably hack out what's going on if you know Forth. We take a closer
look anyway.
Line 10 is a REM statement, ignored by BASIC. In a PostScript file
written as ASCII text, comments are preceded by a "%" instead.
Line 12 fetches the character set called "Times-Roman" from the
stable of sets onboard the printer. The name must be spelled exactly
as listed in the printer's manual, including caps and puncts.
Line 14 scales the font to 600 points. PostScript works on the
typographer's point. Nearly enough there are 28-1/2 points per
centimeter (actually 28.45756). The size is taken from the top of the
acendent to the bottom of the descendent in the alphabet. Individual
letters are proportionately smaller. In this case the 'B' comes out
about 14cm tall, not the full 21cm height answering to 600 points.
[A very good approcimation is that 100 points equals 35mm. The point
system comes from Mediaeval typograhy long before a uniform
measurement system was extablished, making for irrational equivalents
between points and metric, or even oldstyle, length units.]
Line 16 arms the fetched and scaled font for service, like
installing a daisy wheel or cartidge. The font is now ready for use.
Line 18 moves the 'pen' to coordinate (100,100). The origin is the
lowerleft corner of the page. Up and right are positive. The units are
points, so the pen is moved about 35mm up and right from the origin.
Line 20 sets the darkness of the pen to 0.5 gray. '0' is black and
'1' is white. How the gray turns out is up to the printer. The HP
LaserJet renders it as a stipple that looks quite smooth and even all
over at reading distance.
Line 22 offers the litteral string 'B' and deploys it in the
virtual image. The 'B' starts at coordinate (100,100) and extends up
and right over the page. Each letter has a homepoint near the
lowerleft corner of it by which it is positioned in the page.
Line 30 finally, finally, transfers the virtual image onto the
paper and ejects the paper from the printer. Until and unless you
issue the SHOWPAGE command everything remains in the phantom space.
Line 32 terminates the PostScript session and reverts the printer
to its ready state. It remains in PostScript mode; you must separately
reset it to native mode.
Aren't you just tingling? Of course you are. This is a very
elementary PostScript program, yet it is amazingly versatile. Run it
several times, each time with line 22 edited so the 'B' is 'S', 'I',
'N', 'C', &c. Put all the pages together, with some overlap, and you
got a smashing banner! Try small letters, other scales, other starting
coords. Try entire phrases, other character sets (look them up in the
printer instructions). You'll get some awfully unexpected results
sometimes, but that's part of the exploration process.
By adding more MOVETO and SHOW commands you can actually lay out a
sign, poster, or flyer. Be careful. Once a font is fetched, scaled,
and set, it remains in force until you deliberately change it. So if
you start with 150 point size for a title, change to a smaller size
for running text. Do this by a set of FINDFONT/SCALEFONT/SETFONT
commands before you offer text to the new font.
Note that the pen stands at the end of the last text written, like
"PRINT ;". Do MOVETO to reset it to the start of the new text. MOVETO
resembles "PRINT AT". When you write several lines of text, leave at
least as many points between the rows as the size of the font. Else
you'll get overlapping text. PostScript does not by itself wordwrap or
linefeed. You have to insert the linebreaks and then move the pen to
the next row.
Further to the parallel between PostScript and Sinclair, you can
freely put text anywhere on the page in any sequence you like. Only
the ultimate image is printed by SHOWPAGE, just like the entire
finished screen is printed by COPY. This makes it easy to lay out all
the stuff in one font & scale first, then go back and fill in the
stuff in an other font & scale, and so on.
To stretch or squash the text there's "x y SCALE". The x and y are
the ratios for the x and y direction, like in the 'A' program. These
stay in force until you change them on purpose. Moreover, each scaling
compounds with all earlier ones. To get things back to unity scale you
must undo the scaling. That is, if you do '1.5 .75 SCALE', and then
want to return to unity scale, you must do '.667 1.333 SCALE'. Doing
'1 1 SCALE' will merely assert the instant scaling as unity!
In your giddiness you probably saw what happens when you write on
top of previous writing. The new oblitterates the old. You can exploit
this overlaying or superposition of PostScript. Add these lines to the
'B' program (now you know why I had a linenumber gap):
24> LPRINT "120 110 moveto"
26> LPRINT "0 setgray"
28> LPRINT "(B) show"
Run this. You just lurve the purritty shadow effect! To enforce
the notion of superposition, change the "0" to "1" in line 26 and run
the program again. Hmmm, very very interesting.
I have to let you go, now. You can roam around on your own. To set
you on your way, key in and run the program below. I willn't tell you
what it does, but the result will look, ugh!, so gorgeous on the wall
over your Sinclair rig. You can substitute Times-Roman, available on
all PostScript printers, in line 44 if you don't got Times-Bold.
What's the problem? The what symbols? Oh, the "{" and "}"? They're
right over here, under the "F" and "G" keys. Watch me. "{". And "}".
[The sinclair keyboard waspeculiarly laid out. The alphanumberic chars
were in the QWERTY locations but
10> REM on your own 60> LPRINT "360 mul"
12> LPRINT "/roundtext {" 62> LPRINT "rotate"
14> LPRINT "/points exch def" 64> LPRINT "text"
16> LPRINT "/radius exch def" 66> LPRINT "{"
18> LPRINT "/text exch def" 68> LPRINT "/char exch def"
20> LPRINT "/char 0 def" 70> LPRINT "0 radius moveto"
22> LPRINT "/str 1 string def" 72> LPRINT "str 0 char put"
24> LPRINT "/circum radius 2 mul" 74> LPRINT "str stringwidth"
26> LPRINT "3.14159 mul def" 76> LPRINT "pop"
28> LPRINT "/outline {" 78> LPRINT "circum div"
30> LPRINT "true charpath" 80> LPRINT "360 mul"
32> LPRINT "gsave" 82> LPRINT "/charot exch def"
34> LPRINT "0.8 setgray" 84> LPRINT "gsave"
36> LPRINT "fill" 86> LPRINT "0 radius translate"
38> LPRINT "grestore" 88> LPRINT "charot 2 div"
40> LPRINT "stroke" 90> LPRINT "neg rotate"
42> LPRINT "} def" 92> LPRINT "str outline"
44> LPRINT "/Times-Bold findfont" 94> LPRINT "grestore"
46> LPRINT "points scalefont" 96> LPRINT "charot neg rotate"
48> LPRINT "setfont" 98> LPRINT "} forall"
50> LPRINT "306 396 translate" 100> LPRINT "} def"
52> LPRINT "text stringwidth" 102> LPRINT "( My Sinclair can
really speak PostScript )"
54> LPRINT "pop" 104> LPRINT "200 63 roundtext"
56> LPRINT "2 div" 106> LPRINT "showpage"
58> LPRINT "circum div" 108> LPRINT "quit"
= = = = =