Next: , Previous: OpenGL, Up: Top   [Contents][Index]


8 TrueType

Procedure: ttf-init

Initialize the SDL_ttf subsystem.

Procedure: load-font file ptsize

Load a font from file with point size ptsize. Return a handle.

Procedure: font:style font

Return the style of font (see font-style flags). This font style is implemented by modifying the font glyphs, and doesn’t reflect any inherent properties of the truetype font file.

Procedure: font:set-style! font style

Set font style to style (see font-style flags). This font style is implemented by modifying the font glyphs, and doesn’t reflect any inherent properties of the truetype font file.

Procedure: font:height font

Return the total height of font, usually equal to point size.

Procedure: font:ascent font

Return the offset from the baseline to the top of font. This is a positive number.

Procedure: font:descent font

Return the offset from the baseline to the bottom of font. This is a negative number.

Procedure: font:line-skip font

Return the recommended spacing between lines of text for font.

Procedure: font:glyph-xXyYa font ch

Return the metrics (dimensions) of a glyph as five values. The glyph is a font-specific rendering of char ch. Values are: minx, maxx, miny, maxy and advance (all integers).

Procedure: font:glyph-metrics font ch

NB: This procedure is obsoleted by font:glyph-xXyYa and will be removed after 2013-12-31.

Return the metrics (dimensions) of a glyph as an alist. The glyph is a font-specific rendering of char ch. Alist keys are: minx, maxx, miny, maxy and advance. Values are numbers.

Procedure: text-wh font text

Return two values: width and height (both integers) representing the dimensions of the font-specific rendering of the string text.

Procedure: font:size-text font text

NB: This procedure is obsoleted by text-wh and will be removed after 2013-12-31.

Return an alist with keys w and h and corresponding values (numbers) representing the width and height of the font-specific rendering of the string text.

Procedure: utf8-wh font text

Return two values: width and height (both integers) representing the dimensions of the font-specific rendering of the UTF-8 string text.

Procedure: font:size-utf8 font text

NB: This procedure is obsoleted by utf8-wh and will be removed after 2013-12-31.

Return an alist with keys w and h and corresponding values (numbers) representing the width and height of the font-specific rendering of the utf8 string text.

Procedure: render-text font text fg [bg]

Return a new surface containing the font-specific rendering of the text string. Third argument is the foreground color; optional fourth argument is the background color, or #t if the text is to be blended.

Procedure: render-utf8 font text fg [bg]

Return a new surface containing a font-specific rendering of the utf8 string text. Third argument is the foreground color; optional fourth argument is the background color, or #t if the text is to be blended.

Procedure: render-glyph font ch fg [bg]

Return a new surface containing a font-specific rendering of the character ch. Third argument is the foreground color; optional fourth argument is the background color, or #t if the text is to be blended.

Procedure: ttf-quit

Quit the SDL_ttf subsystem.


Next: , Previous: OpenGL, Up: Top   [Contents][Index]