dxSetFont(font%)

Parameters

fontname = string containing font name
height = font height desired
bold = set to TRUE to load font as BOLD
italic = set to TRUE to load font as ITALIC
underlined set to TRUE to load font as UNDERLINED

Description

This activates a TrueType font previously loaded into memory (though the dxLoadFont command) for future use with printing commands such as dxText.

Note: Blitz doesn't work with SYMBOL fonts, like Webdings and WingDings.

Be sure to free the memory used by the font went you are done using the dxFreeFont command.

Example

; dxLoadFont/dxSetFont/dxFreeFont example

; enable graphics mode
Graphics 800,600,16

; Set global on font variables
Global fntArial,fntArialB,fntArialI,fntArialU

;Load fonts to a file handle variables
fntArial=dxLoadFont("Arial",24,False,False,False)
fntArialB=dxLoadFont("Arial",18,True,False,False)
fntArialI=dxLoadFont("Arial",32,False,True,False)
fntArialU=dxLoadFont("Arial",14,False,False,True)

; set the font and dxPrint dxText
dxSetFont fntArial
dxText 400,0,"This is just plain Arial 24 point",True,False

dxSetFont fntArialB
dxText 400,30,"This is bold Arial 18 point",True,False

dxSetFont fntArialI
dxText 400,60,"This is italic Arial 32 point",True,False

dxSetFont fntArialU
dxText 400,90,"This is underlined Arial 14 point",True,False

; Standard 'wait for ESC' from user
While Not dxKeyHit(1)
Wend

; Clear all the fonts from memory!
dxFreeFont fntArial
dxFreeFont fntArialB
dxFreeFont fntArialI
dxFreeFont fntArialU

Index