home | ||||
links |
|
|||
developer's mag main page article part 1 part 2 part 3 part 4 part 5 |
2 - The Way of the FONT
After SetFont(), all text drawing commands that specify zero for the font pointer will use this new default. However, you can still use other fonts. For example the following line will display a line of text in the System font, regardless of what is the current default setting:
Although there are quite a few commands for working with fonts, the two commands that will likely find the most use are: GUI_TextWidth(const FONT *font,const char *text,S32 len) - Returns the length in pixels of the specified string. Note that the text doesn't have to be null-terminated as the len value indicates how many characters of the string are used in measuring. GUI_TruncateText(const FONT *font,const char *text,S16 width,BOOL want_ellipsis) - The reverse of GUI_TextWidth(), this function takes a width in pixels, and returns how many of the characters of the text string will fit. The flag 'want_ellipsis' is used to include the ellipsis char at the end; if true, this character width is taken into consideration when calculating the fit. Previous Section Next Section |
|||
Copyright © 2001-2006 ebmDevMag.com - Legal Notice |