| |
April
12, 1998
PostScript Line Effects
Here are a few examples of how to use the
PostScript Line effects in FreeHand. I'm not a PostScript expert,
and these examples are ones that I wrote down many years ago for use
in FreeHand 3. I can't remember their origin or the authors, so if someone
knows, send me a line so I can credit them appropriately. To find more
information about programming in PostScript, check out those Real
World FreeHand books from Olav Martin Kvern and the PostScript
Language Reference Manual from Adobe.
I won't go into total detail of how these
work and what some of the elements in the code do, as you can find more
about this in the above books. There will be a couple with adjustable
variables that I'll walk you through in order to get the effect you
want.
Version: 3 and above
|
|
| |
|
Ever wonder how to use the PostScript
option in the Line Inspector? What the heck do you type in there
anyway? Well I'm going to give you a few great examples of how
to create custom PostScript lines.
Although the scripts themselves may
look greek to you and me, they tell FreeHand how to draw
different types of lines. These can be simple dash type effects
or they can make your lines scatter all over the place.
Below are three examples of how powerful
PostScript line effects can be.
|
 |
|
WARNING
|
|
When entering the following PostScript
codes into the Inspector, do NOT press the Return key
to drop to the next line. Just let the code wrap naturally in
the code area. After entering the code just press the Enter
key to apply the code to your line. You can however, use spaces
between each element of the code. To get these codes easily
without retyping them, you can copy and paste the text from
this page to FreeHand.
Also, you will not see the effect
applied to the line in FreeHand itself (which is too bad,
considering we're at version 8 now). You can test your effects
by printing to a PostScript compatible printer. If you don't have
a PostScript printer, you can also export your art as an EPS file
and open it in PhotoShop to view the final results (That is
what I've done to show you the examples below).
If you do not see any effects with
the line using the above methods, or if you get PostScript errors
when printing or opening in PhotoShop, then there is something
wrong with how you entered the code. Make sure you enter it exactly
as below.
|
|
Chain Link
|
|
Enter this code:
1 setlinecap 1 setlinejoin [currentlinewidth dup] 0 setdash
gsave S grestore currentlinewidth 3 div setlinewidth 1 setgray
stroke
|
 |
|
As you can see in the examples above,
this script creates a chain link type of effect to your line.
Once applied to a line, you can create a style in the Style
palette, so you don't lose the code in case you delete the line
later. Once you apply this effect to a line, you are free to change
it's weight and color.
The parts in the code "[currentlinewidth
dup]" and "currentlinewidth
3 div" make sure
that the link holes are the right size and that the links are
joined at the ends.
The links in the chain are actually
created by a thick black dashed line with a smaller white dashed
line overlaying it.
The number before "1
setlinecap" is
how you control the line caps: 0 = butt cap,
1 = round cap, 2 = projecting square cap.
The number before "1
setlinejoin" is
how you control the line join: 0 = miter join,
1 = round join, 2 = bevel join.
You can play with these settings
for various effects.
|
|
Railroad Tracks
|
|
Enter this code:
gsave S grestore [currentlinewidth dup 5 mul] 0 setdash
currentlinewidth 10 mul setlinewidth S
|
 |
|
As you can see in the examples above,
this script creates a railroad track effect often seen in maps.
Once applied to a line, you can create a style in the Style
palette, so you don't lose the code in case you delete the line
later. Once you apply this effect to a line, you are free to change
it's weight and color.
The number in the element "[currentlinewidth
dup 5
mul]" controls
the space between the ties of the track based on the weight
of the line.
The number after "currentlinewidth
10"
is used to control the length of ties (measured perpendicular
to the center line) based on the weight of the line.
Since both of these elements are
based on the weight of the line, the track will automatically
scale itself proportionally.
|
|
Earthquake
|
|
Enter this code:
1 srand flattenpath {newpath moveto} {2 copy 2 {3 dup 2
mul rand exch mod sub add exch} repeat lineto S moveto} {} {closepath}
pathforall
|
 |
|
As you can see in the examples above,
this script scatters your lines all over the place. Once applied
to a line, you can create a style in the Style palette,
so you don't lose the code in case you delete the line later.
Once you apply this effect to a line, you are free to change it's
weight and color. You can even fill the shapes to give it a "retro"
type of look.
The element "1
srand" makes sure
that when you print this effect, it's the same every time. You
can change the number to any number above zero to change the randomness
of the effect. You can also remove this element all together,
which will cause it to change every time you print (not a good
idea if you plan to make color separations).
The first number in the element
"{3
dup 2 mul rand exch mod sub add exch}"
is the virtual Richter scale. It controls the random amount
of space in points that each line shifts. As you can see in the
above examples, the higher the number, the more it shakes around.
|
|
Ink Splotches
submitted
by Joy from Russia
|
|
Enter this code:
1 1 J j /it 9 def /cw {currentlinewidth} def /ra {rand 2e9
div cw mul} def /li {cw 1 it div mul} def cw li neg cw li it 1
sub mul sub{[5{ra ra cw 3 mul mul}repeat]0 d S w}for
|
 |
|
This is a very complex code that
creates the appearance of ink splotches instead of lines.
The way it works, is creates multiple random dashed lines that
vary in thickness and dash spacing.
|
WARNING
|
| This code
is built to be random every time it is output to a
PostScript Printer, even as an EPS file. I would not
recommend this effect if you should have to make film separations. |
Once applied to a line, you can create
a style in the Style palette, so you don't lose the code
in case you delete the line later. Once you apply this effect
to a line, you are free to change it's weight and color. You can
even fill the shapes.
The element "9
def" is how many
lines are applied to the path. This can be changed to whatever
you prefer.
The number in the element "{ra
ra cw 3 mul mul}"
is how much random space is generated between the dashes. Smaller
numbers are good for thicker lines and larger numbers are good
for smaller lines. Look at the example above to see the different
values for the line weights that I used.
|
PostScript editing is not for the faint
of heart and one typo in the code above won't harm your art, it just
won't work. These are just a few examples of how it can really make
your life easier if your looking for quick effects. If anyone has any
others they'd like to add, please feel free to send them to me via the
Feedback page under the Misc. Tab.
|
|