.Setfont Method

Top  Previous  Next

Function:

Selects a font to use for printing text.

Syntax:

lcd.setfont(offset as dword) as ok_ng

Returns:

0- OK: The font was found and the data appears to be valid.

1- NG: There is no valid font data at specified offset.

See Also:

Working with Text

 


Part

Description

offset

Offset within the compiled binary of your application at which the font file is stored.

Details

A valid font file must be selected before you can use the lcd.print, lcd.printaligned, or lcd.getprintwidth methods. Naturally, the font file must be present in your project for this to work (see how to add a font file). To obtain correct offset, open the file using the romfile.open method, then read the offset of this file from the romfile.offset R/O property.

When the font file is successfully selected, the lcd.fontheight and lcd.fontpixelpacking R/O properties will be updated to reflect actual font parameters.