GG::FontManager Class Reference

This singleton class is essentially a very thin wrapper around a map of Font smart pointers, keyed on font filename/point size pairs. More...

#include <Font.h>

List of all members.

Mutators

boost::shared_ptr< FontGetFont (const std::string &font_filename, int pts, unsigned int range=Font::ALL_DEFINED_RANGES)
void FreeFont (const std::string &font_filename, int pts)

Friends

FontManagerGetFontManager ()


Detailed Description

This singleton class is essentially a very thin wrapper around a map of Font smart pointers, keyed on font filename/point size pairs.

The user need only request a font through GetFont(); if the font at the requested size needs to be created, the font is created at the requestd size, a shared_ptr to it is kept, and a copy of the shared_ptr is returned. If the font has been created at the desired size, but the request includes character range(s) not already created, the font at the requested size is created with the union of the reqested and existing ranges, stored, and returned as above; the only difference is that the original shared_ptr is destroyed. Due to the shared_ptr semantics, the object pointed to by the shared_ptr is deleted if and only if the last shared_ptr that refers to it is deleted. So any requested font can be used as long as the caller desires, even when another caller tells the FontManager to free the font.

Definition at line 359 of file Font.h.


Member Function Documentation

boost::shared_ptr<Font> GG::FontManager::GetFont ( const std::string &  font_filename,
int  pts,
unsigned int  range = Font::ALL_DEFINED_RANGES 
)

returns a shared_ptr to the requested font. May load font if unavailable at time of request.

void GG::FontManager::FreeFont ( const std::string &  font_filename,
int  pts 
)

removes the indicated font from the font manager. Due to shared_ptr semantics, the font may not be deleted until much later.


Friends And Related Function Documentation

FontManager& GetFontManager (  )  [friend]

Returns the singleton FontManager instance.


The documentation for this class was generated from the following file:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2