|
 |
CS 3723
Programming Languages
|
Recitation 12. Postscript |
Week 13: Apr 15 - 17
|
Submit following directions at:
submissions
and rules at:
rules.
Deadlines are:
- 2014-04-29 23:59:59 (that's Tues, 29 Apr 2014, 11:59:59 pm)
for full credit.
- No 75% credit deadline.
|
Postscript Programs:
Study pages at the link:
A. Return Address:
You are to write a Postscript program that will create the
return address and "postage paid" announcement exactly
as shown below. (Click on the image to get a PDF file with this
as a portion, exactly as shown and described here except that
it is not at the top of the page.)
Part A: Return Address for a mailing |
 |
For full credit, include the following features:
- the two fields shown must be exactly 0.5 inch
(36 points) from the top of an 8.5-by-11 inch sheet of paper,
- margins must be exactly 0.5 inch (36 points).
- The font on the left should be given by
Times-Bold findfont 14 scalefont setfont
- The font on the right should be the same, except 12 point
- all linewidths should be given by 2 setlinewidth.
- The length of the lines at the left should be the same as
(The University of Texas at San Antonio) stringwidth pop,
that is, by the length of this string.
- lines on the left should be 15 points apart vertically.
- lines on the right should be 12 points apart vertically.
- The box on the right should be 132 points wide.
- Each line of the box on the right should be exactly centered
in the middle of the box. (See the page
Right Justifying Text,
which also mentions centering text, a similar task.)
The image above is an actual image, 8.5 inches wide, taken from
a program that met the requirements above. If you have trouble
meeting the above requirements, just fake it as well as you can,
and try to make your output look as close to the above as possible.
B. Circles: This part is concerned
with drawing circles. To draw circle with center coordinates
x and y, and with radius r you can use
the following (see the Bluebook, pages 53 to 60):
[The above code does paint a circle,
but in general it's a good idea to stick
a newpath in at the beginning.]
You are to write a Postscript program that will draw an array
of n circles, each of radius
r and the centers of these circles
should be arranged around a central point in
a circle of radius s. These parameters
should be variables in your program:
- n: the number of circles
- r: the radius of each circle
- s: the radius of the circle giving the centers
of the circles.
The pictures below give a little more information: In the last 4
pictures the first
circle is drawn wider and in red.
The circle of the centers of circles is drawn in
"CornflowerBlue".
Part B: Circles |
n:10, r:100, s:100 | n: 20, r:100, s:100 | n: 40, r:100, s:100 |
 |
 |
 |
n:40, r:50, s:150 | n: 20, r:150, s:50 | n: 30, r:110, s:90 |
 |
 |
 |
Implementation: There are several simple ways to program
this in Postscript. You should center everything at the origin,
translate to the center of the page, and draw everything.
You can let an angle th take on the necessary
successive values. Then the center of each circle of radius r will
be at the point (s*cos(th), s*sin(th), and you can draw each
circle.
Alternatively, you can draw one circle and keep rotating by
the successive angle: 360/n.
C. Business Card:
For this recitation, you are to write a program in Postscript that
will print a "business card", either for you, or for some fictitious
individual or company. Graphic art often uses a principle of
"less is more", meaning that a simple design is often more
satisfactory than a more complex one. Here are some examples,
some simple, some not so simple.
However, this is not an art assignment, and you are not being graded
on "good graphic design." Instead I want you to experiment with
complicated Postscript code to help learn the language.
Here are items I want you to include in the recitation:
- The initial card should be exactly
4 inches by 7 inches.
(That is, the card should be exactly 288 points by 504 points.)
- The outer 4 inch by 7 inch boundary should be stroked with a
line of width 3 points.
- With one run, translating the card if necessary, print a
single copy of your card on a sheet of paper.
Again, this should be 4 inches by 7 inches.
- In a separate run, using a scale factor of 0.5 in each direction,
produce at least 5 copies of the same card at half size, that is,
of size 2 inches by 3.5 inches.
The Postscript
code that produces these 5 copies should employ a Postscript
loop. (See pages 51-52 and Chapter 7 of the
Blue Book (PDF, 847k).)
- At least one piece of text on the card should
either be centered
or right justified, using the stringwidth function, so that the
text would remain centered or right-justified even if the font
size is changed. (See the Blue Book, pages 42-43 for right justification,
and pages 58-59 for centering. See also my handout with a card on it.)
Here are some additional features that I would like to see you
incorporate into your card:
- The use of some ``graphic object'', e.g., some picture made up
of one or more paths. For example, a recursive structure like
that on pages 73-75 of the Blue Book would be interesting.
- Use some color, although your final printout doesn't
have to be on a color printer.
- The use of an outline around characters in a string. (See the
example on page 98 of the Blue Book.)
- The use of a clipping path. (See the Blue Book, pages 103-104.)
Finally, try to make it look interesting. Be creative.
The card doesn't have to have your real name. Don't
copy the book or one another or my cards below.
(Some students might submit, say, exactly the "Diamond Cafe"
card below with different words stuck it. This would be worth
little or no credit.)
Examples of Cards:
Two cards from the Blue Book plus one of my own:
What to Turn In:
You should include the Postscript source for your return address, your stars,
and your business card programs. You should also
attach a PDF version of the business card and one or more
PDFs of the stars. (Don't attach .ps files, but .pdf ones.)
Revision date: 2014-04-21.
(Please use ISO 8601,
the International Standard Date and Time Notation.)
|