This section contains routines used to create and
destroy scalable glyph images known as
`outlines'. These can also be measured,
transformed, and converted into bitmaps and
pixmaps.
typedef struct FT_Outline_
{
short n_contours; /* number of contours in glyph */
short n_points; /* number of points in the glyph */
FT_Vector* points; /* the outline's points */
char* tags; /* the points flags */
short* contours; /* the contour end points */
int flags; /* outline masks */
} FT_Outline;
This structure is used to describe an outline to
the scan-line converter.
fields
n_contours
The number of contours in the outline.
n_points
The number of points in the outline.
points
A pointer to an array of `n_points' FT_Vector
elements, giving the outline's point coordinates.
tags
A pointer to an array of `n_points' chars, giving
each outline point's type. If bit 0 is unset, the
point is `off' the curve, i.e. a Bezier control
point, while it is `on' when set.
Bit 1 is meaningful for `off' points only. If
set, it indicates a third-order Bezier arc
control point; and a second-order control point
if unset.
contours
An array of `n_contours' shorts, giving the end
point of each contour within the outline. For
example, the first contour is defined by the
points `0' to `contours[0]', the second one is
defined by the points `contours[0]+1' to
`contours[1]', etc.
flags
A set of bit flags used to characterize the
outline and give hints to the scan-converter and
hinter on how to convert/grid-fit it. See
FT_Outline_Flags.
A simple type used to enumerates the flags in an
outline's `outline_flags' field.
fields
ft_outline_owner
If set, this flag indicates that the outline's
field arrays (i.e. `points', `flags' &
`contours') are `owned' by the outline object,
and should thus be freed when it is destroyed.
ft_outline_even_odd_fill
By default, outlines are filled using the
non-zero winding rule. If set to 1, the outline
will be filled using the even-odd fill rule (only
works with the smooth raster).
ft_outline_reverse_fill
By default, outside contours of an outline are
oriented in clock-wise direction, as defined in
the TrueType specification. This flag is set if
the outline uses the opposite direction
(typically for Type 1 fonts). This flag is
ignored by the scan-converter. However, it is
very important for the auto-hinter.
ft_outline_ignore_dropouts
By default, the scan converter will try to detect
drop-outs in an outline and correct the glyph
bitmap to ensure consistent shape continuity. If
set, this flag hints the scan-line converter to
ignore such cases.
ft_outline_high_precision
This flag indicates that the scan-line converter
should try to convert this outline to bitmaps
with the highest possible quality. It is
typically set for small character sizes. Note
that this is only a hint, that might be
completely ignored by a given scan-converter.
ft_outline_single_pass
This flag is set to force a given scan-converter
to only use a single pass over the outline to
render a bitmap glyph image. Normally, it is set
for very large character sizes. It is only a
hint, that might be completely ignored by a given
scan-converter.
A handle to the library object from where the
outline is allocated. Note however that the new
outline will NOT necessarily be FREED, when
destroying the library, by FT_Done_FreeType().
numPoints
The maximal number of points within the outline.
numContours
The maximal number of contours within the
outline.
output
anoutline
A handle to the new outline. NULL in case of
error.
return
FreeType error code. 0 means success.
note
The reason why this function takes a `library'
parameter is simply to use the library's memory
allocator.
Returns an outline's `control box'. The control
box encloses all the outline's points, including
Bezier control points. Though it coincides with
the exact bounding box for most glyphs, it can be
slightly larger in some situations (like when
rotating an outline which contains Bezier outside
arcs).
Computing the control box is very fast, while
getting the bounding box can take much more time
as it needs to walk over all segments and arcs in
the outline. To get the latter, you can use the
`ftbbox' component which is dedicated to this
single task.
Computes the exact bounding box of an outline.
This is slower than computing the control box.
However, it uses an advanced algorithm which
returns _very_ quickly when the two boxes
coincide. Otherwise, the outline Bezier arcs are
walked over to extract their extrema.
Renders an outline within a bitmap using the
current scan-convert. This functions uses an
FT_Raster_Params structure as an argument,
allowing advanced features like direct
composition, translucency, etc.
input
library
A handle to a FreeType library object.
outline
A pointer to the source outline descriptor.
inout
params
A pointer to a FT_Raster_Params structure used to
describe the rendering operation.
return
FreeType error code. 0 means success.
note
You should know what you are doing and how
FT_Raster_Params works to use this function.
The field `params.source' will be set to
`outline' before the scan converter is called,
which means that the value you give to it is
actually ignored.
Walks over an outline's structure to decompose it
into individual segments and Bezier arcs. This
function is also able to emit `move to' and
`close to' operations to indicate the start and
end of new contours in the outline.
input
outline
A pointer to the source target.
func_interface
A table of `emitters', i.e,. function pointers
called during decomposition to indicate path
operations.
inout
user
A typeless pointer which is passed to each
emitter during the decomposition. It can be used
to store the state during the decomposition.
A structure to hold various function pointers
used during outline decomposition in order to
emit segments, conic, and cubic Beziers, as well
as `move to' and `close to' operations.
fields
move_to
The `move to' emitter.
line_to
The segment emitter.
conic_to
The second-order Bezier arc emitter.
cubic_to
The third-order Bezier arc emitter.
shift
The shift that is applied to coordinates before
they are sent to the emitter.
delta
The delta that is applied to coordinates before
they are sent to the emitter, but after the
shift.
note
The point coordinates sent to the emitters are
the transformed version of the original
coordinates (this is important for high accuracy
during scan-conversion). The transformation is
simple: