Next: Vector Paths, Previous: Sprites, Up: Graphics [Contents][Index]
Printing text to the screen is quite easy:
(draw-text "Hello, world" (vec2 100.0 100.0))
Chickadee supports OpenType/TrueType fonts (via the FreeType library), bitmap fonts in Angel Code bmfont format, and simple sprite sheet bitmap fonts. A default font named Inconsolata 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 graphics
text)
module:
Load the scalable (OpenType, TrueType, etc.) font in the file file-name and display it at the given point-size. By default, all the characters in the ASCII character set are loaded. This can be changed by passing a different character set (see Character Sets in GNU Guile Reference Manual) using the char-set keyword argument.
If smooth? is #t
(the default), text rendered with this
font will have a smoother appearance when text is rotated or scaled,
otherwise non-smooth scaling will be used.
Load the Angel Code font (in either XML or FNT format) in file and return a new font object.
Return #t
if obj is a font object.
Return the name of font.
Return the line height of font.
Return the line height of font.
Return #t
if font is a bold font.
Return #t
if font is an italicized font.
[#:font] [#:color] [#: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.
Next: Vector Paths, Previous: Sprites, Up: Graphics [Contents][Index]