String Display FunctionsThe fg_print() function displays a character string relative to the current graphics position. It performs automatic clipping so strings do not extend beyond the edges of the virtual buffer or client area. By default, fg_print() displays strings in the client area. Strings displayed with fg_print() have transparent backgrounds, so if you display one string on top of another, parts of the first string may still be visible beneath the second string. To avoid this, first erase the area where the string will appear. The easiest way to do this is by calling fg_rect() to draw a rectangle in the background color. The fg_print() function displays a character string in the current color, relative to the current graphics position. By default, strings are written directly to the client area, with the lower left corner of the first character at the graphics cursor position. The fg_print() function leaves the graphics cursor just to the right of the last character displayed, making it possible for successive fg_print() calls to display adjacent strings. The first parameter for fg_print() is a character string of arbitrary length, and the second parameter is an integer value that specifies the number of characters to display from that string. For example,
C/C++:
Delphi:
Visual Basic:
displays the string "Hello" in color 20, with the lower left corner of the "H" at the graphics cursor position. The fg_justify() function defines the fg_print() justification. Its two parameters, xjust and yjust, control the string positioning relative to the current graphics position, as summarized in the following table:
Any other justification values produce undefined results. In the context of vertical justification, lower justification means the bottom of each character will be at the current graphics y position. Upper justification means the top of each character will be at the graphics y position, while center justification means characters will be centered about the graphics y position. The default justification settings established by fg_vbinit() are xjust = -1 and yjust = -1, and you can retrieve the current justification settings with the fg_getxjust()fg_getxjust and
|
 
copyright 2001 Ted Gruber Software, Inc.