Crazy Eddies GUI System  0.6.0
Public Types | Public Member Functions | List of all members
CEGUI::FontManager Class Reference

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

+ Inheritance diagram for CEGUI::FontManager:
+ Collaboration diagram for CEGUI::FontManager:

Public Types

typedef ConstBaseIterator
< FontRegistry > 
FontIterator
 

Public Member Functions

 FontManager (void)
 Constructor for FontManager objects.
 
 ~FontManager (void)
 Destructor for FontManager objects.
 
FontcreateFont (const String &filename, const String &resourceGroup="")
 Creates a new font from a font definition file, and returns a pointer to the new Font object. More...
 
FontcreateFont (const String &type, const String &name, const String &fontname, const String &resourceGroup="")
 Creates a new Font based on a true-type font, and returns a pointer to the new Font object. More...
 
FontcreateFont (const String &type, const XMLAttributes &attributes)
 Create a new font object given its type and the XML attributes. More...
 
void destroyFont (const String &name)
 Destroy's the font with the given name. More...
 
void destroyFont (Font *font)
 Destroys the given Font object. More...
 
void destroyAllFonts (void)
 Destroys all Font objects registered in the system. More...
 
bool isFontPresent (const String &name) const
 Checks the existence of a given font. More...
 
FontgetFont (const String &name) const
 Returns a pointer to the font object with the specified name. More...
 
void notifyScreenResolution (const Size &size)
 Notify the FontManager of the current (usually new) display resolution. More...
 
void writeFontToStream (const String &name, OutStream &out_stream) const
 Writes a full XML font file for the specified Font to the given OutStream. More...
 
FontIterator getIterator (void) const
 Return a FontManager::FontIterator object to iterate over the available Font objects.
 

Additional Inherited Members

- Static Public Member Functions inherited from CEGUI::Singleton< FontManager >
static FontManagergetSingleton (void)
 
static FontManagergetSingletonPtr (void)
 
- Static Protected Attributes inherited from CEGUI::Singleton< FontManager >
static FontManagerms_Singleton
 

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 * CEGUI::FontManager::createFont ( const String filename,
const 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.

References CEGUI::Font_xmlHandler::d_font, destroyFont(), CEGUI::String::empty(), CEGUI::Errors, CEGUI::Font::getDefaultResourceGroup(), CEGUI::PropertySet::getProperty(), CEGUI::System::getSingleton(), CEGUI::System::getXMLParser(), CEGUI::XMLParser::parseXMLFile(), and CEGUI::System::setDefaultFont().

Font * CEGUI::FontManager::createFont ( const String type,
const String name,
const String fontname,
const 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.

References CEGUI::String::empty(), CEGUI::Font::getDefaultResourceGroup(), CEGUI::System::getSingleton(), isFontPresent(), and CEGUI::System::setDefaultFont().

Font * CEGUI::FontManager::createFont ( const String type,
const XMLAttributes attributes 
)

Create a new font object given its type and the XML attributes.

Returns
The new font object or NULL.

References CEGUI::PropertySet::getProperty(), and isFontPresent().

void CEGUI::FontManager::destroyAllFonts ( void  )

Destroys all Font objects registered in the system.

Returns
Nothing

References destroyFont().

Referenced by ~FontManager().

void CEGUI::FontManager::destroyFont ( const 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

Referenced by createFont(), destroyAllFonts(), and destroyFont().

void CEGUI::FontManager::destroyFont ( Font font)

Destroys the given Font object.

Parameters
fontPointer to the Font to be destroyed. If no such Font exists, nothing happens.
Returns
Nothing.

References destroyFont(), and CEGUI::PropertySet::getProperty().

Font * CEGUI::FontManager::getFont ( const String name) const

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.

Referenced by writeFontToStream().

bool CEGUI::FontManager::isFontPresent ( const String name) const

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.

Referenced by createFont().

void CEGUI::FontManager::notifyScreenResolution ( const Size size)

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

Parameters
sizeSize object describing the display resolution
Returns
Nothing
void CEGUI::FontManager::writeFontToStream ( const String name,
OutStream out_stream 
) const

Writes a full XML font file for the specified Font to the given OutStream.

Parameters
nameString holding the name of the Font to be written to the stream.
out_streamOutStream (std::ostream based) object where data is to be sent.
Returns
Nothing.

References getFont(), and CEGUI::Font::writeXMLToStream().