OpenGUI::Font Class Reference

#include <OpenGUI_Font.h>

List of all members.


Detailed Description

A handle representing font type and size.

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(). )

Note:
You'll notice there are no methods for changing the size or FontSet of a Font object. That is because it is intended that a new Font object be created whenever the size or font type needs to be changed. Enough information about a Font handle can be retrieved to provide an avenue for changing only a single attribute.
Warning:
Font sizes that are less than or equal to 0.0f are not legal for bound Font handles, and will automatically be interpretted as a request for the default font size.


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 StringgetName () 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.
FontSetoperator-> ()
 Provides direct access to the bound FontSet's functions.
bool operator== (const Font &right)
 Equality operator.


Constructor & Destructor Documentation

OpenGUI::Font::Font  ) 
 

Create a font handle that will either immediate or delayed bind to the default font.

This constructor forces delayed binding to the default Font

OpenGUI::Font::Font FontSetPtr  fontSet,
float  fontSize
 

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.

OpenGUI::Font::Font const String fontName,
float  fontSize
 

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.

OpenGUI::Font::~Font  )  [inline]
 

public destructor does nothing special


Member Function Documentation

void OpenGUI::Font::bind  ) 
 

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.

FontSetPtr OpenGUI::Font::getFontSetPtr  )  const [inline]
 

Returns the FontSetPtr of the Font handle.

const String& OpenGUI::Font::getName  )  const [inline]
 

Returns the name of the FontSet this Font is currently or will be bound to.

float OpenGUI::Font::getSize  )  const [inline]
 

Returns the font size of this Font handle.

bool OpenGUI::Font::isBound  )  const [inline]
 

Returns true if this handle is bound to a FontSet.

FontSet* OpenGUI::Font::operator->  )  [inline]
 

Provides direct access to the bound FontSet's functions.

This causes an immediate bind, throwing an exception if the bind fails.

bool OpenGUI::Font::operator== const Font right  ) 
 

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.


The documentation for this class was generated from the following files:
Copyright © 2006 OpenGUI | OpenGUI.SF.net
Generated: Sun Sep 9 02:00:21 2007