#include <OpenGUI_Font.h>
Fonts are referenced using the Font object, which contain a reference to a FontSet and the desired size. These handles can be created at will by the user, and are automatically bound to the appropriate FontSet during the constructor. These handles are also capable of referencing the default FontSet at the default size, and this is usually accomplished by creating the object using the default constructor.
Font handles also provide automatic support for delayed binding under certain conditions and uses. If a Font is using delayed binding, the actual binding will occur on first use in a rendering context. If the desired FontSet cannot be found, the Font handle will automatically bind to the default Font. If no default Font is available, an exception will occur. ( The default Font is automatically bound to the first FontSet registered with the FontManager, and can be changed by FontManager::SetDefaultFont(). )
Public Member Functions | |
| Font () | |
| Create a font handle that will either immediate or delayed bind to the default font. | |
| Font (FontSetPtr fontSet, float fontSize) | |
| Create a font handle to the given fontSet at the given fontSize. | |
| Font (const String &fontName, float fontSize) | |
| Create a font handle to the given registered fontName at the given fontSize. | |
| ~Font () | |
| public destructor does nothing special | |
| bool | isBound () const |
Returns true if this handle is bound to a FontSet. | |
| void | bind () |
| Forces immediate binding of this Font, throwing an exception if the binding does not complete. | |
| const String & | getName () const |
| Returns the name of the FontSet this Font is currently or will be bound to. | |
| float | getSize () const |
| Returns the font size of this Font handle. | |
| FontSetPtr | getFontSetPtr () const |
| Returns the FontSetPtr of the Font handle. | |
| FontSet * | operator-> () |
| Provides direct access to the bound FontSet's functions. | |
| bool | operator== (const Font &right) |
| Equality operator. | |
|
|
Create a font handle that will either immediate or delayed bind to the default font. This constructor forces delayed binding to the default Font |
|
||||||||||||
|
Create a font handle to the given fontSet at the given fontSize. This will force an immediate binding to the given FontSet at the given size. If the given fontSet is an empty pointer, the default font will be used. |
|
||||||||||||
|
Create a font handle to the given registered fontName at the given fontSize. This will attempt to bind, but will fall back to delayed binding if the bind fails. |
|
|
public destructor does nothing special
|
|
|
Forces immediate binding of this Font, throwing an exception if the binding does not complete. If the Font is already bound, this function will exit immediately with no ill effect. |
|
|
Returns the FontSetPtr of the Font handle.
|
|
|
Returns the name of the FontSet this Font is currently or will be bound to.
|
|
|
Returns the font size of this Font handle.
|
|
|
Returns
|
|
|
Provides direct access to the bound FontSet's functions. This causes an immediate bind, throwing an exception if the bind fails. |
|
|
Equality operator. Equality for Font handles comes in two stages. If both of the handles are bound, then they are only equal if the two Fonts are bound to the same FontSet at the same size. If either of the Fonts is not bound, then copies of the compared Fonts are created, and a bind on the copies is attempted. The result is then determined by comparison of the fully bound copies. If one of the Fonts binds while the other fails, they are obviously not equal and are returned as such. In extreme cases, where both of the Fonts cannot be bound, they are compared by their stored FontSet name and point size. |