T1_PATHTYPE_MOVE
): These are straight
segments which cause the current position to be displaced by some offset.
Since the starting point of a segment is always implicitly the current
point, only one argument is needed, , the destination point. In
the figure, - and - are Move-segments. In this
simple case they displace from the characters origin to some starting point
of the outline and from the ending point of the outline to the point where
the next character would have to be placed (the horizontal escapement).
T1_PATHTYPE_LINE
): These are part of the
path to be filled later. In analogy to the Move-segment, one argument,
, is required for Line-segments. In the figure, - is
a Line-segment.
T1_PATHTYPE_BEZIER
): These are curve
segments. Their shape is defined by a starting point (always the current
point here), an ending point and two control points ,
. These four points are the parameters of what is called a third order
Bezier spline.13 The resulting curve has the following
properties:
long
and
describes the location in th fractions of a pixel. To convert from
pixel to fractional pixel and vice versa, the macros
T1_TOPATHPOINT(p)
and
T1_NEARESTPOINT(fp)
are provided.
Before describing the functions for retrieving outlines the format in which outlines are presented in C will be described. A point specification is done in the following structure:
typedef struct { long x; long y; } T1_PATHPOINT;
x
and y
are fractional pixels as described above.
An outline is represented by a linked list of structures which describe path segments of the type described above. Line- and Move-segments are described by the following structure:
typedef struct pathsegment { char type; unsigned char flag; short references; unsigned char size; unsigned char context; struct pathsegment *link; struct pathsegment *last; T1_PATHPOINT dest; } T1_PATHSEGMENT;
type
is either T1_PATHTYPE_MOVE
or
T1_PATHTYPE_LINE
. flag
, references
, size
and
context
are internally used by the rasterizer. link
is a pointer
to the next segment structure or NULL
in case it is the last structure
in the list. Finally, the last
-entry is a pointer to
the last structure in the linked list. last
is only set in the first
segment and is reset to NULL
in the remaining segment structures.
A Bezier-segment is described by the following structure:
typedef struct bezierpathsegment { char type; unsigned char flag; short references; unsigned char size; unsigned char context; T1_PATHSEGMENT *link; T1_PATHSEGMENT *last; T1_PATHPOINT dest; T1_PATHPOINT B; T1_PATHPOINT C; } T1_BEZIERSEGMENT;Obviously, the format is identical to that for straight path segments, extended by the entries
B
and C
which specify the control points as
described earlier in this subsection.
The common return type for the outline retrieving functions is a pointer to
T1_OUTLINE
, which is in fact identical to T1_PATHSEGMENT
. This
purely for convention. Although it is quite unlikely, an outline might start
with a Bezier-segment. To access Bezier-segment elements, a cast must be used.