#include <Font.h>
Mutators | |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, int pts, unsigned int range=Font::ALL_DEFINED_RANGES) |
void | FreeFont (const std::string &font_filename, int pts) |
Friends | |
FontManager & | GetFontManager () |
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.
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.
FontManager& GetFontManager | ( | ) | [friend] |
Returns the singleton FontManager instance.