SLUDGE

setFont


Syntax:

setFont (spriteBank, charactersSupported, height);

Purpose:

Changes to a new font. The font must be contained in a sprite bank, and the spriteBank parameter should be a file handle for this file - that is, the name of the file in single quotes. The charactersSupported parameter must be a string made up of - in order - each of the characters which are supported in this font. Therefore, if the fifth character in the charactersSupported string is A, the character A will be drawn on the screen using the fifth image in the sprite bank file.

Characters which are not present in the charactersSupported string are drawn as the first sprite in the sprite bank. It is therefore wise to have the first character in the font be a symbol used to represent this fact, such as an empty box or a question mark. The function inFont can be used to check if a character exists in the current font.

The height value must be numerical, and will be used as the gap between rows of text when using multiple status bars (created by the addStatus command) and when spoken text (created by the say and think commands) wraps onto more than one line.

Return value:

No return value.

Example:

# Load a font which only contains a question mark and numbers

# Numbers will be drawn as the second to 11th sprites in the file
# All other characters will be displayed as question marks

setFont ('numbers.duc', "?0123456789", 32);

See also:

inFont

pasteString and burnString

setFontSpacing