next up previous contents index
Next: Manipulation of Outlines Up: Interface to Outlines Previous: Outline Format   Contents   Index


Using Outlines

t1lib provides three functions for retrieving outlines. The first is

 T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode,
                                float size, T1_TMATRIX *transform)

to 0pt The meaning of the arguments is as in the T1_SetChar()-function. Notice that the size specification is also required here. Outlines are, by their nature in Type 1, generally defined in a grid and then scaled down by the fontmatrix to 1 bp. The space is known as the charspace. The reason for specifying a size at this place, instead of scaling the outline later, is, that hinting is performed according to the scaled outline. The returned outline is then hinted for the given size. If necessary, it may still be scaled later.

The outline for a complete string can be retrieved by

 T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, 
                                  long spaceoff, int modflag,
                                  float size, T1_TMATRIX *transform)

to 0pt The meaning of the arguments is as in T1_SetString().

Finally the ``outline'' for a displacement is available by the function

 T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag,
                                float size, T1_TMATRIX *transform)

to 0pt This function is intended to be used for concatenation of outlines. It needs all the arguments because some quantities which are given on the font level are required for constructing the outline. deltax and deltay are the horizontal and vertical displacement measured in charspace units. From the modflag-argument, especially the underlining parameters are evaluated. Although - and -displacement may be specified, the resulting outline is still subject to scaling with size and transformation according to transform.

Arbitrary outlines may be concatenated by using the function

 T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1,
                                T1_OUTLINE *path2)

to 0pt Notice that this concatenation is done with high precision so that we can expect that visual artefacts are reduced to a minimum (remember figure [*]).

Scaling of outlines is done by the function

 T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale)

to 0pt T1_ScaleOutline does nothing more than linearly scaling the coordinate data with scale and storing the result in fractional pixels. No care is taken for hinting (see above).

An outline may be duplicated using the function

 T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path)

to 0pt This is a direct entrypoint into the rasterizer. It works by allocating and duplicating each segment of path. This function may be useful if one wants to do several things with one outline because the process of filling an outline also consumes that outline.

An outline that that a user decides not to fill can be destroyed by the function

 void T1_FreeOutline( T1_OUTLINE *path)

to 0pt It iterates through the segment list and frees each segment. This must not be done after filling an outline because the filling process consumes the outline!

Finally, there are two functions that produce glyphs from outlines, namely

 GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag)

to 0pt and

 GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag)

to 0pt Their usage does not need any explanation. The value of modflag is required for Right-To-Left typesetting. If the bit T1_RIGHT_TO_LEFT is set, the dimension of the glyph are recomputed accordingly. All other bits from modflag are ignored such that in the usual case of Left-To-Right typesetting simply 0 can be specified. While T1_FillOutline() produces bitmaps of depth 1, T1_AAFillOutline() produces antialiased bytemaps of the current graphics depth. It should be mentioned that Smart Antialiasing (see [*]) does not work with this function. The reason is that t1lib has no notion of the quantity ``size'' when it gets the outline to process. Hence, Smart Antialiasing can't work in this case. As noted above, the outline is consumed by the filling functions so that there is no need to free it explicitly.


next up previous contents index
Next: Manipulation of Outlines Up: Interface to Outlines Previous: Outline Format   Contents   Index
2005-01-12