Color Selection, Underlining, and Kerning

Normally, fgf_print() and fgf_printc() display a character string in the current color (that is, the color specified in the most recent call to the fg_setcolor() function). If you want to display part of a string in one color and part in another color, insert the option prefix character (ASCII decimal 127, hex 7F) in the string. When fgf_print() or fgf_printc() find this character, they treat the byte that follows as a color value and make that color the current color (for direct color virtual buffers, the color value serves as an index into the virtual palette). This means that subsequent characters appear in the new color, as will all graphics output that relies on the current color value.

The option prefix character is also used for underlining characters displayed with fgf_print() and fgf_printc(). If an underscore character (ASCII decimal 95, hex 5F) follows the option prefix character, characters that follow are underlined. The underlining continues until another option prefix/underscore combination is specified. The underlining is done in the color in effect at the point of the "underline off" sequence and is drawn two pixels beneath the character base (that is, the bottom of non-descending characters). You can change the vertical position of the underlining with fgf_under(). As you might expect, fgf_printc() performs underlining only within the clipping region, while fgf_print() underlines all requested characters regardless of their location.

The horizontal space between characters, called kerning, is included on the right side of the actual font bitmaps. The fgf_kerning() function provides additional kerning controls. It expects an integer parameter specifying the number of additional pixels between characters displayed with fgf_print() and fgf_printc(). By default, there is no additional space inserted between characters -- this is equivalent to calling fgf_kerning(0). Note that the value passed to fgf_kerning() can be negative to reduce the space between characters. Kerning values set with fgf_kerning() remain in effect across font changes.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.