Public Member Functions
GUI::FontManager Class Reference

Class providing a shared library of Font objects to the system. More...

List of all members.

Public Member Functions

Font createFont (string filename, string resourceGroup="")
 Creates a new font from a font definition file, and returns a pointer to the new Font object.
Font createFont (string type, string name, string fontname, string resourceGroup="")
 Creates a new Font based on a true-type font, and returns a pointer to the new Font object.
void destroyFont (string name)
 Destroy's the font with the given name.
void destroyFont (Font font)
 Destroys the given Font object.
void destroyAllFonts ()
 Destroys all Font objects registered in the system.
bool isFontPresent (string name)
 Checks the existence of a given font.
Font getFont (string name)
 Returns a pointer to the font object with the specified name.
void notifyScreenResolution (Size size)
 Notify the FontManager of the current (usually new) display resolution.

Qualified Iterators

Font Font
 Can be used to iterate over the available Font objects.

Detailed Description

Class providing a shared library of Font objects to the system.

The FontManager is used to create, access, and destroy Font objects. The idea is that the FontManager will function as a central repository for Font objects used within the GUI system, and that those Font objects can be accessed, via a unique name, by any interested party within the system.


Member Function Documentation

Font GUI::FontManager::createFont ( string  filename,
string  resourceGroup = "" 
)

Creates a new font from a font definition file, and returns a pointer to the new Font object.

Parameters:
filenameString object containing the filename of a 'font definition file' what will be used to create the new font
resourceGroupResource group identifier to pass to the resource provider when loading the font definition file.
Returns:
Pointer the the newly created Font object
Exceptions:
FileIOExceptionthrown if there was some problem accessing or parsing the file filename
InvalidRequestExceptionthrown if an invalid filename was provided.
AlreadyExistsExceptionthrown if a Font already exists with the name specified, or if a font Imageset clashes with one already defined in the system.
GenericExceptionthrown if something goes wrong while accessing a true-type font referenced in file filename.
RendererExceptionthrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
MemoryExceptionthrown if allocation of imagery construction buffer fails.
Font GUI::FontManager::createFont ( string  type,
string  name,
string  fontname,
string  resourceGroup = "" 
)

Creates a new Font based on a true-type font, and returns a pointer to the new Font object.

Parameters:
typeString object containing the type of the font to be created (same as in the "Type" attribute of the font XML).
nameString object containing a unique name for the new font.
fontnameString object containing the name and path of the true-type font to access.
resourceGroupResource group identifier to be passed to the resource provider when loading the font definition file.
Returns:
Pointer to the newly created Font object.
Exceptions:
AlreadyExistsExceptionthrown if a Font already exists with the name specified, or if a font Imageset clashes with one already defined in the system.
GenericExceptionthrown if something goes wrong while accessing a true-type font referenced in file fontname.
RendererExceptionthrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
MemoryExceptionthrown if allocation of imagery construction buffer fails.
void GUI::FontManager::destroyFont ( string  name)

Destroy's the font with the given name.

Parameters:
nameString object containing the name of the font to be destroyed. If the specified font does not exist, nothing happens.
Returns:
Nothing
void GUI::FontManager::destroyFont ( Font  font)

Destroys the given Font object.

Parameters:
fontFont to be destroyed. If no such Font exists, nothing happens.
Returns:
Nothing.
void GUI::FontManager::destroyAllFonts ( )

Destroys all Font objects registered in the system.

Returns:
Nothing
bool GUI::FontManager::isFontPresent ( string  name)

Checks the existence of a given font.

Parameters:
nameString object holding the name of the Font object to look for.
Returns:
true if a Font object named name exists in the system, false if no such font exists.
Font GUI::FontManager::getFont ( string  name)

Returns a pointer to the font object with the specified name.

Parameters:
nameString object containing the name of the Font object to be returned
Returns:
Pointer to the requested Font object
Exceptions:
UnknownObjectExceptionThrown if no font with the given name exists.
void GUI::FontManager::notifyScreenResolution ( Size  size)

Notify the FontManager of the current (usually new) display resolution.

Parameters:
sizeSize object describing the display resolution
Returns:
Nothing

Member Data Documentation

Font GUI::FontManager::Font

Can be used to iterate over the available Font objects.

for each Font f in GUI.FontManager {
trace(f.getLineSpacing());
}