Displaying text

The Graphics classes in the last section can be used to display text. However if you only want to display text you may want to paint it using either of the two font classes provided. The tbx::WimpFont class provides a simple way of painting text using the current desktop font. The tbx::Font class allows you to use any outline font installed on your system. Both classes provide a paint method to paint a given string on the screen.

The tbx::WimpFont class only has a few simple operations that can be done with it other than painting. This should be adequate for most simple text painting requirements. If you need to use some of the more advanced methods available in the tbx::Font class then you can create a tbx::Font that uses the desktop font by calling its desktop_font method.

The tbx::Font class needs to be constructed with a font name and size or the find_font method has to be called to initialise the font. In both cases you can check if the font was found on the system by calling the is_valid method.