tbx
0.7.5
|
Class to display and measure text using the current desktop font. More...
#include <font.h>
Public Types | |
enum | PaintFlags { WFPF_NONE, WFPF_VCENTRE = (1<<30), WFPF_RJUSTIFY = (1<<31) } |
Flags used for painting the WimpFont. | |
Public Member Functions | |
void | set_colours (Colour foreground, Colour background) |
Set the foreground and background colour for the WIMP font. More... | |
int | height_os () const |
Return height of the font. More... | |
int | string_width_os (const std::string &text, int num_chars=0) |
Get the width of the text in OS units. More... | |
void | paint (int x, int y, const std::string &text, int flags=WimpFont::WFPF_NONE) const |
Paint the wimp font at the given screen coordinates. More... | |
void | paint (int x, int y, const char *text, int length=-1, int flags=WimpFont::WFPF_NONE) const |
Paint the wimp font at the given screen coordinates. More... | |
Class to display and measure text using the current desktop font.
|
inline |
Return height of the font.
void WimpFont::paint | ( | int | x, |
int | y, | ||
const std::string & | text, | ||
int | flags = WimpFont::WFPF_NONE |
||
) | const |
Paint the wimp font at the given screen coordinates.
Before plotting the colour should be set using Graphics::set_foreground/background(WimpColour) or the set_font_colours member of this class.
The background needs to be set as the it will be needed if the current desktop font is an antialias font.
x | x coordinate |
y | y coordinate |
text | text to plot |
flags | flags to control painting, defaults to WFPF_NONE |
void WimpFont::paint | ( | int | x, |
int | y, | ||
const char * | text, | ||
int | length = -1 , |
||
int | flags = WimpFont::WFPF_NONE |
||
) | const |
Paint the wimp font at the given screen coordinates.
Before plotting the colour should be set using Graphics::set_foreground/background(WimpColour) or the set_font_colours member of this class.
The background needs to be set as the it will be needed if the current desktop font is an antialias font.
x | x coordinate |
y | y coordinate |
text | text to plot |
length | length of text or -1 to plot to end of null terminated text |
flags | flags to control painting, defaults to WFPF_NONE |
Set the foreground and background colour for the WIMP font.
Note: If the current WIMP font is the system font this will change the colours for following graphics methods.
foreground | foreground colour for the font |
background | background colour the font is going to be painted on. |
int WimpFont::string_width_os | ( | const std::string & | text, |
int | num_chars = 0 |
||
) |
Get the width of the text in OS units.
text | to measure |
num_chars | number of characters to measure or 0 for whole string. |