setDefaultFont() |
Previous Top Next |
setDefaultFont( fontFace, size [, fgColor] [, flags])
The setDefaultFont() function was introduced in EFS2 and is designed to work in conjunction with the drawText() function. It allows you to set a default font to be used in all drawing operations.
Parameters
fontFace |
the fontFace to use as the default |
size |
the desired size of the font |
fgColor |
optional. the foreground color to use |
flags |
optional. see Text Flags below |
Text Flags
Text.BOLD |
display the text in bold |
Text.ITALIC |
display the text in italics |
Text.UNDERLINE |
underline the text |
Text.LEFT |
display plain text
Note: Text flags can be ORed together to combine various attributes (e.g., Text.ITALIC | Text.BOLD | Text.UNDERLINE)
Usage
//set the default font to Arial 14-pt, use magenta a the color and apply
//bold and underline attributes
setDefaultFont( "Arial", 14, Color.magenta, Text.BOLD | Text.UNDERLINE );
//set the default font to Courier New 10-pt
setDefaultFont( "Courier New", 10 );