Next: , Previous: , Up: Graphics   [Contents][Index]


2.3.6 Fonts

Printing text to the screen is quite easy:

(draw-text "Hello, world" (vec2 100.0 100.0))

Chickadee loads and renders bitmap fonts in the Angel Code format. A default font named “Good Neighbors” is built-in to Chickadee and is used for all text rendering operations where a font is not specified, as is the case in the above example.

The following procedures can be found in the (chickadee render font) module:

Procedure: load-font file

Load the Angel Code font (in either XML or FNT format) in file and return a new font object.

Procedure: font? obj

Return #t if obj is a font object.

Procedure: font-face font

Return the name of font.

Procedure: font-line-height font

Return the line height of font.

Procedure: font-line-height font

Return the line height of font.

Procedure: font-bold? font

Return #t if font is a bold font.

Procedure: font-italic? font

Return #t if font is an italicized font.

Procedure: draw-text text position

[#:font] [#:origin] [#:scale] [#:rotation] [#:blend-mode] [#:start 0] [#:end (string-length text)]

Draw the string text with the first character starting at position using font. If font is not specified, a built-in font is used.

(draw-text "Hello, world!" (vec2 128.0 128.0))

To render a substring of text, use the start and end arguments.

Refer to draw-sprite (see Sprites) for information about the other arguments.