Painting Curve Characters

Curve characters are defined in terms of mathematical curves, arcs, lines, and movements. On printing, these are typically painted filled (i.e. the space between outlines becomes grey or black according to the user specification) or stroked (i.e. each curve or line is painted in a certain style). The following figure shows the digit zero filled, stroked, and stroked/filled.

A curve character painted in several paint modes
 A curve character painted in several paint modes


The following ways of painting are supported in TYPO:

Outline
Close up and draw the (unfilled) outlines
Even-odd fill
Fill using the even-odd rule
Wrap count fill
Fill using the wrap-count rule; this is the default
Stroke
Stroke the outlines
Even-odd fill/Stroke
Fill using the even-odd rule and stroke the outlines; this is often used for filling an outline in grey and stroking it in black
Wrap count fill/Stroke
Fill using the wrap count rule and stroke the outlines; this is often used for filling an outline in grey and stroking it in black
Elliptic pen
Use an elliptic pen for stroking the outlines
Rectangular pen
Use a rectangular pen for stroking the outlines

Character filling/stroking can be determined once for a whole font from within the File->Font Edit->Properties command, or for specific curve sequences within any character with the Edit->Paint/Fill command.

Even-odd Fill and Wrap Count Fill

TYPO provides the same two methods of filling a character as does the PostScript language; even-odd or wrap-count fill. If the character consists of a single contour, such as for the letter E, both methods yield the same result; the contour gets filled. If the character consists of an outer and an inner contour, such as the character O, the filling methods behave as follows: For even-odd fill, the area between the two contours gets filled. For wrap count fill, the area between the two contours gets always filled; The inner contour gets filled only if its sense of rotation (clockwise or counter-clockwise) is opposite to that of the outer contour.

To exactly understand how these methods work, we imagine, for each area surrounded by a closed curve contour, a straight line segment beginning inside that area and ending outside the outermost contour. The even-odd rule determines that this area gets filled if the line segment crosses an odd number of contours; otherwise the area stays white. The wrap count method determines that this area gets filled if the number of clockwise contours crossed differs from the number of counter-clockwise contours crossed. This rule explains why the inside of the letter O stays white if the contours have opposite sense of rotation; any line from the inside of the inner contour to the outside of the character will cross both a clockwise and a counter-clockwise contour. An in-depth discussion of the differences between these two filling strategies appears in the PostScript Reference Manual, page 172:

The PostScript Reference Manual, Second Edition, Addison-Wesley, Reading, MA (1990).

For both filling methods, the user can specify the grey tone of the fill, in percents, from 0 (white) to 100 (black), with Area grey.

Stroke

As an alternative to filling, a character can be stroked. For stroking, each curve is traced with an imaginary (circular) pen of a given thickness. The pen thickness can be specified with Stroke width, and its grey tone with Contour grey (in percents; white is zero and black is 100).

In addition, the user can determine the shape of stroke ends with the Stroke cap menu. This menu corresponds to the PostScript option linecap, with the same possible choices; Butt, Round, or Square. The effect of each of these menu choices is shown in below:

Stroke caps: (1) Butt; (2) Round; (3) Square
 Stroke caps


If a stroke contains two adjacent curves which are not smoothly connected, a corner is obtained. This corner can be drawn in three different ways as determined by the menu Stroke join. This menu corresponds to the PostScript option linejoin, with the same possible choices; Miter, Round, or Bevel. The effect of each of these choices is shown in the following figure.

Stroke joins: (1) Miter; (2) Round; (3) Bevel
 Stroke joins


Round joins are the result of applying a round pen to corners. Miter joins are obtained by continuing both strokes along a straight line, until the stroke outsides meet. Bevel joins are used if a sharp corner is not desired; the peak of the corner gets cut off. Very small angles yield very long miter joins. Bevel joins are automatically used instead of miter joins if the angle is smaller than the Miter limit angle as specified by the user. This angle corresponds to the PostScript option miterlimit. Unlike the PostScript option, the value of the TYPO option Miter limit angle is expressed in degrees, for ease of use.

Even-odd fill/Stroke and Wrap count fill/Stroke

Filling and stroking can be combined with these two fill methods. A typical usage is a grey area surrounded by a black stroked contour (obtained by setting Area grey to some value and leaving Contour grey as 100%).

Elliptic pen

Elliptic or rectangular pens can be used for stroking with the fill methods Elliptic pen and Rectangular pen. In both cases, the pen width, height, and angle can be specified with Pen width, Pen height, and Pen angle. For these two modes, the line ends and line joins will reflect the shape of the pen. These two methods are primarily useful for creating METAFONT character definitions.

The following figure shows the digit zero filled, stroked, filled/stroked, painted with an elliptic pen, and painted with a regular pen.

(1) Filled; (2) Stroked; (3) Filled/Stroked; (4) Elliptic pen; (5) Rectangular pen
 Paint Modes


Paint Option Summary

Paint mode
Outline, Even-odd fill, Wrap count fill, Stroke, Even-odd fill/Stroke, Wrap count fill/Stroke, Elliptic pen, Rectangular pen
Area grey
Numeric value between 0-100% (applies to all Fill paint modes)
Contour grey
Numeric value between 0-100% (applies to all Stroke and Pen paint modes)
Stroke cap
Butt, Round, Square (applies to all Stroke paint modes)
Stroke join
Miter, Round, Bevel (applies to all Stroke paint modes)
Miter limit angle
Numeric value between 0-180 degrees (applies to all Stroke paint modes)
Stroke width
Positive numeric value (applies to all Stroke paint modes)
Pen width
Positive numeric value (applies to all Pen paint modes)
Pen height
Positive numeric value (applies to all Pen paint modes)
Pen angle
Numeric value between 0-360 degrees (applies to all Pen paint modes)