Function GraSetFont() Foundation
Determines font for the display of characters drawn by GraStringAt().
GraSetFont( [<oPS>], [<oXbpFont>] ) --> oXbpCurrentFont
The function GraSetFont() returns the font object currently set. If a new font is specified, the function returns the previous font object.
The function GraSetFont() determines the character font used for the graphic output of characters or character strings within a presentation space. A character font is made available by an XbpFont object (see XbpFont()). The function GraSetFont() installs a XbpFont object, which is then used for the display of characters by the function GraStringAt().
// The example program shows the selection of a font using the
// font dialog. After the font was selected, it is installed with
// GraSetFont() as the current font for the window.
#include "Gra.ch"
#include "Xbp.ch"
PROCEDURE Main
LOCAL oFont, oFontDlg
oFontDlg := XbpFontDialog():New()
oFontDlg:Create() // create font dialog
SetMouse( .T. ) // activate mouse
SetAppWindow():mouseMode := XBPCRT_MOUSEMODE_PM
// graphic mouse coordinates
SetColor( "N/W" ) // fill window with pale gray
CLS
DO WHILE (oFont := oFontDlg:display(XBP_DISP_APPMODAL)) <> NIL
// modal font dialog
GraSetFont( NIL, oFont ) // install font
GraStringAt( NIL, {10,200}, ; // output characters
"The quick brown fox jumps over the lazy dog" )
DO WHILE NextAppEvent() <> 0 // remove all events
AppEvent() // from the queue
ENDDO
AppEvent(,,,0) // wait for next event
oFontDlg:familyName := ; // determine beginning
oFont:familyName // element for combo box
CLS // fill window with pale gray
ENDDO
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.