<< . .

. 2
( : 45)



. . >>

Why is the system called ? The ˜- ™ part is easy to
understand, because sets of related characters that are used in typesetting are
traditionally known as fonts of type. The ˜ -™ part is more interesting: It
indicates that we are interested in making high-level descriptions that transcend
any of the individual fonts being described.
Newly coined words beginning with ˜meta-™ generally re¬‚ect our con-
temporary inclination to view things from outside or above, at a more abstract
level than before, with what we feel is a more mature understanding. We now
have metapsychology (the study of how the mind relates to its containing body),
metahistory (the study of principles that control the course of events), meta-
mathematics (the study of mathematical reasoning), meta¬ction (literary works
that explicitly acknowledge their own forms), and so on. A metamathemati-
cian proves metatheorems (theorems about theorems); a computer scientist of-
ten works with metalanguages (languages for describing languages). Similarly,
a meta-font is a schematic description of the shapes in a family of related fonts;
the letterforms change appropriately as their underlying parameters change.
Meta-design is much more di¬cult than design; it™s easier to draw some-
thing than to explain how to draw it. One of the problems is that di¬erent sets
of potential speci¬cations can™t easily be envisioned all at once. Another is that
a computer has to be told absolutely everything. However, once we have suc-
cessfully explained how to draw something in a su¬ciently general manner, the
same explanation will work for related shapes, in di¬erent circumstances; so the
time spent in formulating a precise explanation turns out to be worth it.
Typefaces intended for text are normally seen small, and our eyes can
read them best when the letters have been designed speci¬cally for the size at
which they are actually used. Although it is tempting to get 7-point fonts by
simply making a 70% reduction from the 10-point size, this shortcut leads to a
serious degradation of quality. Much better results can be obtained by incorpo-
rating parametric variations into a meta-design. In fact, there are advantages to
built-in variability even when you want to produce only one font of type in a sin-
gle size, because it allows you to postpone making decisions about many aspects
of your design. If you leave certain things unde¬ned, treating them as parame-
ters instead of “freezing” the speci¬cations at an early stage, the computer will
be able to draw lots of examples with di¬erent settings of the parameters, and
you will be able to see the results of all those experiments at the ¬nal size. This
will greatly increase your ability to edit and ¬ne-tune the font.
If meta-fonts are so much better than plain old ordinary fonts, why
weren™t they developed long ago? The main reason is that computers did not
exist until recently. People ¬nd it di¬cult and dull to carry out calculations
2 Chapter 1: The Name of the Game


with a multiplicity of parameters, while today™s machines do such tasks with interpolate
recipe
ease. The introduction of parameters is a natural outgrowth of automation.
OK, let™s grant that meta-fonts sound good, at least in theory. There™s
still the practical problem about how to achieve them. How can we actually
specify shapes that depend on unspeci¬ed parameters?
If only one parameter is varying, it™s fairly easy to solve the problem
in a visual way, by overlaying a series of drawings that show graphically how
the shape changes. For example, if the parameter varies from 0 to 1, we might
prepare ¬ve sketches, corresponding to the parameter values 0, 1 , 1 , 3 , and 1.
424
If these sketches follow a consistent pattern, we can readily interpolate to ¬nd
the shape for a value like 2 that lies between two of the given ones. We might
3
even try extrapolating to parameter values like 1 1 .4
But if there are two or more independent parameters, a purely visual
solution becomes too cumbersome. We must go to a verbal approach, using some
sort of language to describe the desired drawings. Let™s imagine, for example,
that we want to explain the shape of a certain letter ˜a™ to a friend in a distant
country, using only a telephone for communication; our friend is supposed to be
able to reconstruct exactly the shape we have in mind. Once we ¬gure out a
su¬ciently natural way to do that, for a particular ¬xed shape, it isn™t much of
a trick to go further and make our verbal description more general, by including
variable parameters instead of restricting ourselves to constants.
An analogy to cooking might make this point clearer. Suppose you have
just baked a delicious berry pie, and your friends ask you to tell them the recipe
so that they can bake one too. If you have developed your cooking skills entirely
by intuition, you might ¬nd it di¬cult to record exactly what you did. But there
is a traditional language of recipes in which you could communicate the steps
you followed; and if you take careful measurements, you might ¬nd that you
used, say, 1 1 cups of sugar. The next step, if you were instructing a computer-
4
controlled cooking machine, would be to go to a meta-recipe in which you use,
say, .25x cups of sugar for x cups of berries; or .3x + .2y cups for x cups of
boysenberries and y cups of blackberries.
In other words, going from design to meta-design is essentially like going
from arithmetic to elementary algebra. Numbers are replaced by simple formulas
that involve unknown quantities. We will see many examples of this.
A de¬nition of a complete typeface generally consists of
three main parts. First there is a rather mundane set of subroutines that take
care of necessary administrative details, such as assigning code numbers to indi-
vidual characters; each character must also be positioned properly inside an in-
visible “box,” so that typesetting systems will produce the correct spacing. Next
comes a more interesting collection of subroutines, designed to draw the basic
strokes characteristic of the typeface (e.g., the serifs, bowls, arms, arches, and so
on). These subroutines will typically be described in terms of their own special
parameters, so that they can produce a variety of related strokes; a serif subrou-
tine will, for example, be able to draw serifs of di¬erent lengths, although all of
Chapter 1: The Name of the Game 3


the serifs it draws should have the same “feeling.” Finally, there are routines for Hobby
Gu
each of the characters. If the subroutines in the ¬rst and second parts have been Chinese characters
chosen well, the routines of the third part will be fairly high-level descriptions Kandinsky
Herbin
that don™t concern themselves unnecessarily with details; for example, it may ´
HULTEN
be possible to substitute a di¬erent serif-drawing subroutine without changing Tinguely
KNUTH
any of the programs that use that subroutine, thereby obtaining a typeface of
quite a di¬erent ¬‚avor. [A particularly striking example of this approach has
been worked out by John D. Hobby and Gu Guoan in “A Chinese Meta-Font,”
TUGboat 5 (1984), 119“136. By changing a set of 13 basic stroke subroutines,
they were able to draw 128 sample Chinese characters in three di¬erent styles
(Song, Long Song, and Bold), using the same programs for the characters.]
A well-written program will express the designer™s intentions
more clearly than mere drawings ever can, because the language of algebra has
simple “idioms” that make it possible to elucidate many visual relationships.
Thus, programs can be used to communicate knowledge about type
design, just as recipes convey the expertise of a chef. But algebraic formulas are
not easy to understand in isolation; descriptions are meant to be
read with an accompanying illustration, just as the constructions in geometry
textbooks are accompanied by diagrams. Nobody is ever expected to read the
text of a program and say, “Ah, what a beautiful letter!” But with
one or more enlarged pictures of the letter, based on one or more settings of the
parameters, a reader of the program should be able to say, “Ah,
I understand how this beautiful letter was drawn!” We shall see that the -
system makes it fairly easy to obtain annotated proof drawings that you
can hold in your hand as you are working with a program.
Although is intended to provide a relatively painless way to
describe meta-fonts, you can, of course, use it also to describe unvarying shapes
that have no “meta-ness” at all. Indeed, you need not even use it to produce
fonts; the system will happily draw geometric designs that have no relation to
the characters or glyphs of any alphabet or script. The author occasionally uses
simply as a pocket calculator, to do elementary arithmetic in an
interactive way. A computer doesn™t mind if its programs are put to purposes
that don™t match their names.

[Tinguely] made some large, brightly coloured open reliefs,
juxtaposing stationary and mobile shapes.
He later gave them names like Meta-Kandinsky and Meta-Herbin,
to clarify the ideas and attitudes that lay at the root of their conception.
´
” K. G. PONTUS HULTEN, Jean Tinguely: M´ta (1972) e

The idea of a meta-font should now be clear. But what good is it?
The ability to manipulate lots of parameters may be interesting and fun,
but does anybody really need a 6 -point font
that is one fourth of the way between Baskerville and Helvetica?
” DONALD E. KNUTH, The Concept of a Meta-Font (1982)
(page 4)




2
Coordinates
Chapter 2: Coordinates 5


If we want to tell a computer how to draw a particular shape, we need a way to Cartesian
coordinates
explain where the key points of that shape are supposed to be. uses x coordinate
standard Cartesian coordinates for this purpose: The location of a point is de- y coordinate
graph paper
¬ned by specifying its x coordinate, which is the number of units to the right of raster
some reference point, and its y coordinate, which is the number of units upward grid
pixels
from the reference point. First we determine the horizontal (left/right) compo- pel, see pixel
nent of a point™s position, then we determine the vertical (up/down) component.
™s world is two-dimensional, so two coordinates are enough.
For example, let™s consider the following six points:



(Figure 2a will be inserted here; too bad you can™t see it now.)




™s names for the positions of these points are
(x1 , y1 ) = (0, 100); (x2 , y2 ) = (100, 100); (x3 , y3 ) = (200, 100);
(x4 , y4 ) = (0, 0); (x5 , y5 ) = (100, 0); (x6 , y6 ) = (200, 0).
Point 4 is the same as the reference point, since both of its coordinates are zero;
to get to point 3 = (200, 100), you start at the reference point and go 200 steps
right and 100 up; and so on.
EXERCISE 2.1
Which of the six example points is closest to the point (60, 30)?
EXERCISE 2.2
True or false: All points that lie on a given horizontal straight line have the same
x coordinate.
EXERCISE 2.3
Explain where the point (’5, 15) is located.
EXERCISE 2.4
What are the coordinates of a point that lies exactly 60 units below point 6 in
the diagram above? (“Below” means “down the page,” not “under the page.”)
In a typical application of , you prepare a rough sketch of
the shape you plan to de¬ne, on a piece of graph paper, and you label important
points on that sketch with any convenient numbers. Then you write a -
program that explains (i) the coordinates of those key points, and (ii) the
lines or curves that are supposed to go between them.
has its own internal graph paper, which forms a so-called
raster or grid consisting of square “pixels.” The output of will specify
that certain of the pixels are “black” and that the others are “white”; thus,
the computer essentially converts shapes into binary patterns like the designs
a person can make when doing needlepoint with two colors of yarn.
6 Chapter 2: Coordinates


Coordinates are lengths, but we haven™t discussed yet what the units of resolution
Cartesian
length actually are. It™s important to choose convenient units, and ™s Descartes
coordinates are given in units of pixels. The little squares illustrated on the
previous page, which correspond to di¬erences of 10 units in an x coordinate or
a y coordinate, therefore represent 10 — 10 arrays of pixels, and the rectangle
enclosed by our six example points contains 20,000 pixels altogether.*
Coordinates don™t have to be whole numbers. You can refer, for example,
to point (31.5, 42.5), which lies smack in the middle of the pixel whose corners
are at (31, 42), (31, 43), (32, 42), and (32, 43). The computer works internally
with coordinates that are integer multiples of 65536 ≈ 0.00002 of the width of a
1

pixel, so it is capable of making very ¬ne distinctions. But will never
make a pixel half black; it™s all or nothing, as far as the output is concerned.
The ¬neness of a grid is usually called its resolution, and resolution is
usually expressed in pixel units per inch (in America) or pixel units per millimeter
(elsewhere). For example, the type you are now reading was prepared by -
with a resolution of slightly more than 700 pixels to the inch, but with
slightly fewer than 30 pixels per mm. For the time being we shall assume that the
pixels are so tiny that the operation of rounding to whole pixels is unimportant;
later we will consider the important questions that arise when is
producing low-resolution output.
It™s usually desirable to write programs that can manu-
facture fonts at many di¬erent resolutions, so that a variety of low-resolution
printing devices will be able to make proofs that are compatible with a variety
of high-resolution devices. Therefore the key points in programs are
rarely speci¬ed in terms of pure numbers like ˜100™ ; we generally make the co-
ordinates relative to some other resolution-dependent quantity, so that changes
will be easy to make. For example, it would have been better to use a de¬nition
something like the following, for the six points considered earlier:
(x1 , y1 ) = (0, b); (x2 , y2 ) = (a, b); (x3 , y3 ) = (2a, b);
(x4 , y4 ) = (0, 0); (x5 , y5 ) = (a, 0); (x6 , y6 ) = (2a, 0);
then the quantities a and b can be de¬ned in some way appropriate to the desired
resolution. We had a = b = 100 in our previous example, but such constant
values leave us with little or no ¬‚exibility.
Notice the quantity ˜2a™ in the de¬nitions of x3 and x6 ; un-
derstands enough algebra to know that this means twice the value of a, whatever
a is. We observed in Chapter 1 that simple uses of algebra give its
meta-ness. Indeed, it is interesting to note from a historical standpoint that
Cartesian coordinates are named after Ren´ Descartes, not because he invented
e
the idea of coordinates, but because he showed how to get much more out of

* We sometimes use the term “pixel” to mean a square picture element, but sometimes
we use it to signify a one-dimensional unit of length. A square pixel is one pixel-unit
wide and one pixel-unit tall.
Chapter 2: Coordinates 7


that idea by applying algebraic methods. People had long since been using co- ..
z convention
ordinates for such things as latitudes and longitudes, but Descartes observed draw
that by putting unknown quantities into the coordinates it became possible to Union Jack
hex symbol
describe in¬nite sets of related points, and to deduce properties of curves that
were extremely di¬cult to work out using geometrical methods alone.
So far we have speci¬ed some points, but we haven™t actually done any-
thing with them. Let™s suppose that we want to draw a straight line from point 1
to point 6, obtaining



(Figure 2b will be inserted here; too bad you can™t see it now.)




One way to do this with is to say

draw (x1 , y1 ) . . (x6 , y6 ).

The ˜. .™ here tells the computer to connect two points.
It turns out that we often want to write formulas like ˜(x1 , y1 )™, so it
will be possible to save lots of time if we have a special abbreviation for such
things. Henceforth we shall use the notation z1 to stand for (x1 , y1 ); and in
general, zk with an arbitrary subscript will stand for the point (xk , yk ). The
˜draw™ command above can therefore be written more simply as

draw z1 . . z6 .

Adding two more straight lines by saying, ˜draw z2 . . z5 ™ and ˜draw z3 . . z4 ™,
we obtain a design that is slightly reminiscent of the Union Jack:



(Figure 2c will be inserted here; too bad you can™t see it now.)




We shall call this a hex symbol, because it has six endpoints. Notice that the
straight lines here have some thickness, and they are rounded at the ends as
if they had been drawn with a felt-tip pen having a circular nib.
provides many ways to control the thicknesses of lines and to vary the terminal
shapes, but we shall discuss such things in later chapters because our main
concern right now is to learn about coordinates.
If the hex symbol is scaled down so that its height parameter b is exactly
equal to the height of the letters in this paragraph, it looks like this: ˜ ™. Just
8 Chapter 2: Coordinates


for fun, let™s try to typeset ten of them in a row:



How easy it is to do this!*
Let™s look a bit more closely at this new character. The is a bit too
tall, because it extends above points 1, 2, and 3 when the thickness of the lines
is taken into account; similarly, it sinks a bit too much below the baseline (i.e.,
below the line y = 0 that contains points 4, 5, and 6). In order to correct this,
we want to move the key points slightly. For example, point z1 should not be
exactly at (0, b); we ought to arrange things so that the top of the pen is at (0, b)
when the center of the pen is at z1 . We can express this condition for the top
three points as follows:

top z1 = (0, b); top z2 = (a, b); top z3 = (2a, b);

similarly, the remedy for points 4, 5, and 6 is to specify the equations

bot z4 = (0, 0); bot z5 = (a, 0); bot z6 = (2a, 0).

The resulting squashed-in character is



(Figure 2d will be inserted here; too bad you can™t see it now.)




(shown here with the original weight ˜ ™ and also in a bolder version ˜ ™).

EXERCISE 2.5
Ten of these bold hexes produce ˜ ™; notice that
adjacent symbols overlap each other. The reason is that each character has width
2a, hence point 3 of one character coincides with point 1 of the next. Suppose
that we actually want the characters to be completely con¬ned to a rectan-
gular box of width 2a, so that adjacent characters come just shy of touching
( ). Try to guess how the point-de¬ning equa-
tions above could be modi¬ed to make this happen, assuming that
has operations ˜lft ™ and ˜rt ™ analogous to ˜top ™ and ˜bot ™.

* Now that authors have for the ¬rst time the power to invent new symbols with great
ease, and to have those characters printed in their manuscripts on a wide variety
of typesetting devices, we must face the question of how much experimentation is
desirable. Will font freaks abuse this toy by overdoing it? Is it wise to introduce new
symbols by the thousands? Such questions are beyond the scope of this book; but
it is easy to imagine an epidemic of fontomania occurring, once people realize how
much fun it is to design their own characters, hence it may be necessary to perform
fontal lobotomies.
Chapter 2: Coordinates 9


Pairs of coordinates can be thought of as “vectors” or “displacements” vectors
addition of vectors
as well as points. For example, (15, 8) can be regarded as a command to go multiplication of vector by scalar
right 15 and up 8; then point (15, 8) is the position we get to after starting at negation of vectors
vector subtraction principle
the reference point and obeying the command (15, 8). This interpretation works subtraction of vectors
out nicely when we consider addition of vectors: If we move according to the bracket notation
vector (15, 8) and then move according to (7, ’3), the result is the same as if mediation
of-the-way function
we move (15, 8) + (7, ’3) = (15 + 7, 8 ’ 3) = (22, 5). The sum of two vectors
z1 = (x1 , y1 ) and z2 = (x2 , y2 ) is the vector z1 + z2 = (x1 + x2 , y1 + y2 ) obtained
by adding x and y components separately. This vector represents the result
of moving by vector z1 and then moving by vector z2 ; alternatively, z1 + z2
represents the point you get to by starting at point z1 and moving by vector z2 .
EXERCISE 2.6
Consider the four fundamental vectors (0, 1), (1, 0), (0, ’1), and (’1, 0). Which
of them corresponds to moving one pixel unit (a) to the right? (b) to the left?
(c) down? (d) up?
Vectors can be subtracted as well as added; the value of z1 ’ z2 is simply
(x1 ’ x2 , y1 ’ y2 ). Furthermore it is natural to multiply a vector by a single
number c: The quantity c times (x, y), which is written c(x, y), equals (cx, cy).
Thus, for example, 2z = 2(x, y) = (2x, 2y) turns out to be equal to z + z. In the
special case c = ’1, we write ’(x, y) = (’x, ’y).
Now we come to an important notion, based on the fact that subtraction
is the opposite of addition. If z1 and z2 are any two points, then z2 ’ z1 is the
vector that corresponds to moving from z1 to z2 . The reason is simply that z2 ’z1
is what we must add to z1 in order to get z2 : i.e., z1 + (z2 ’ z1 ) = z2 . We shall
call this the vector subtraction principle. It is used frequently in
programs when the designer wants to specify the direction and/or distance of
one point from another.
programs often use another idea to express relations be-
tween points. Suppose we start at point z1 and travel in a straight line from
there in the direction of point z2 , but we don™t go all the way. There™s a special
notation for this, using square brackets:
1
3 [z1 , z2 ] is the point one-third of the way from z1 to z2 ,
1
2 [z1 , z2 ] is the point midway between z1 and z2 ,
.8[z1 , z2 ] is the point eight-tenths of the way from z1 to z2 ,
and, in general, t[z1 , z2 ] stands for the point that lies a fraction t of the way from
z1 to z2 . We call this the operation of mediation between points, or (informally)
the “of-the-way function.” If the fraction t increases from 0 to 1, the expression
t[z1 , z2 ] traces out a straight line from z1 to z2 . According to the vector subtrac-
tion principle, we must move z2 ’ z1 in order to go all the way from z1 to z2 ,
hence the point t of the way between them is
t[z1 , z2 ] = z1 + t(z2 ’ z1 ).
10 Chapter 2: Coordinates


This is a general formula by which we can calculate t[z1 , z2 ] for any given values sidebar
of t, z1 , and z2 . But has this formula built in, so we can use the
bracket notation explicitly.
For example, let™s go back to our ¬rst six example points, and suppose
that we want to refer to the point that™s 2/5 of the way from z2 = (100, 100) to

<< . .

. 2
( : 45)



. . >>