PaintType
as
By contrast, there are fonts that specify PaintType
as . These are
also known as stroked fonts. Basically, their characters' shapes are
generated by travelling along the mathematically thin defining curves using a
pen with some finite width. The penwidth used here usually is specified in the
font itself by means of the quantity
StrokeWidth
.
Using a somewhat unusual implementation, t1lib can
PaintType
1,
PaintType
0,
The process of stroking in t1lib is treated similar to the process of transformation. Therefore, firstly, a font can be generally switched to be a stroked font. This is achieved using
int T1_StrokeFont( int FontID, int dostroke)
FontID
identifies the font to be switched. The parameter
dostroke
determines the future rastering behavior. If it equals 0, the
font's characters will be filled and for any other value the characters will
be stroked. The function returns 0 in case of success.
T1_StrokeFont()
requires the font FontID
to be loaded. If the
font is not loaded T1_errno
will be set appropriately and the function
returns -1. After switching a font to stroked, its characters are cached
as usual. It is therefore important that, at the time where
T1_StrokeFont()
is called, no size-dependent data does exist. If this
condition is violated, the function will fail too and set T1_errno
to
T1ERR_OP_NOT_PERMITTED
.
The second method to control the rasterizer mode for the font FontID
is
to use the function pair
int T1_SetStrokeFlag( int FontID)
int T1_ClearStrokeFlag( int FontID)
FontID
is not valid, in which case T1_errno
is set to
T1ERR_INVALID_FONTID
. Using these functions, switching the stroking is
hence possible at any time. The netto effect is that caching will be disabled
if the actually selected rasterizer mode does not match the one of the cached
characters. The performance then will degrade for the rasterizer mode that is
not the base mode of the font in question.
If stroked characters and filled characters are required for one particular
font while preserving good performance, using logical fonts is the tool of
choice (see Sec. , page
).
The currently active rasterizer mode for the font FontID
can also be
queried. This is done using
int T1_GetStrokeMode( int FontID)
FontID
is not valid, T1_errno
is set to
T1ERR_INVALID_FONTID
. In any other case, the following values may be
returned:
0
: The rasterizer mode is Fill and filled characters are
cached. For stroked fonts with a PaintType
of 1
: Stroking is enabled, while filled characters are cached. Each
rasterization request is performed on the fly, as for nontrivial
transformations.
2
: Filling is enabled but stroked characters are
cached. Rasterization again is performed on the fly.
3
: Stroking is enabled and stroked characters are cached.
The width of the virtual pen used to trace the character outlines can also be adjusted. The function
int T1_SetStrokeWidth( int FontID, float strokewidth)
strokewidth
as the pen width used to stroke characters from
font FontID
. It is interpreted in charspace units and hence directly
comparable to the StrokeWidth
parameter of stroked fonts.
If this function succeeds, T1_errno
then gives a hint to the reason of the failure. If set to
T1ERR_INVALID_FONTID
, the font was not loaded. The value
T1ERR_INVALID_PARAMETER
indicates that a negative strokewidths has
been specified. Finally, T1ERR_OP_NOT_PERMITTED
may appear if stroked
characters are cached for the font in question, size dependent data exists,
and the requested strokewidth did not equal the one used at the time where
the cache data initially has been built. Allowing to setup an arbitrary
strokewidth under the latter circumstances might fillup the cache for one font
with characters rasterized using inconsistent strokewidths, which has to be
avoided. From this discussion it becomes suggesting not to cache stroked
character at all, if stroking should be done using variable strokewidths.
The pen width for a given font FontID
may be queried at any time using
float T1_GetStrokeWidth( int FontID)
T1_errno
is
also set to T1ERR_INVALID_FONTID
.