void ttfblit(TTBitmap *dst, int dstx, int dsty, TTBitmap *src,
int srcx, int srcy, int w, int h);
void ttffreebitmap(TTBitmap *);
.SH DESCRIPTION
.PP
.I Libttf
is a parser and renderer of TrueType fonts.
Given a \fLttf\fR font file it can produce the rendered versions of characters at a given size.
.PP
.I Ttfopen
opens the font at
.I filename
and initialises it for rendering at size
.I size
(specified in pixels per em).
.I Flags
is reserved for future use and should be zero.
If rendering at multiple sizes is desired,
.I ttfscale
reopens the font at a different size (internally the size-independent data is shared).
.I TTfclose
closes an opened font.
Each instance of a font created by
.I ttfopen
and
.I ttfscale
must be closed separately.
.PP
A character in a TrueType font is called a glyph.
Glyphs are numbered starting from 0 and the glyph indices do not need to follow any established coding scheme.
.I Ttffindchar
finds the glyph number of a given rune (Unicode codepoint).
If the character does not exist in the font, zero is returned.
Note that, in TrueType fonts, glyph 0 conventionally contains the "glyph not found" character.
.I Ttfenumchar
is like
.I ttffindchar
but will continue searching if the character is not in the font, returning the rune number for which it found a glyph in
.BR *rp .
It returns character in ascending Unicode order and it can be used to enumerate the characters in a font.
Zero is returned if there are no further characters.
.PP
.I Ttfgetglyph
interprets the actual data for a glyph specified by its index
.IR glyphidx .
With
.I render
set to zero, the data is left uninterpreted; currently its only use is
.I ttfgetcontour.
With
.I render
set to one, the glyph is also rendered, i.e. a pixel representation is produced and stored in the
.I TTBitmap
embedded in the
.I TTGlyph
structure it returns.
Although TrueType uses a right handed coordinate system (y increases going up), the bitmap data returns follows Plan 9 conventions (and is compatible with the
.IR draw (3)
mask argument).
The bottom left hand corner is at position (\fIxmin\fR, \fIymin\fR) in the TrueType coordinate system.
.I Ttfputglyph
should be used to return
.I TTGlyph
structures for cleanup.
.PP
.I Ttfgetcontour
can be used to obtain raw contour data for a glyph.
Given an index
.I i
it returns the corresponding contour (counting from zero), storing a pointer to a list of (\fIx\fR, \fIy\fR) pairs in