Mutators |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts) |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts, const std::vector< unsigned char > &file_contents) |
template<class CharSetIter > |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts, CharSetIter first, CharSetIter last) |
template<class CharSetIter > |
boost::shared_ptr< Font > | GetFont (const std::string &font_filename, unsigned int pts, const std::vector< unsigned char > &file_contents, CharSetIter first, CharSetIter last) |
void | FreeFont (const std::string &font_filename, unsigned int pts) |
A singleton that loads and stores fonts for use by GG.
This 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 code point 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 released. 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 597 of file Font.h.
template<class CharSetIter >
boost::shared_ptr< GG::Font > GG::FontManager::GetFont |
( |
const std::string & |
font_filename, |
|
|
unsigned int |
pts, |
|
|
const std::vector< unsigned char > & |
file_contents, |
|
|
CharSetIter |
first, |
|
|
CharSetIter |
last |
|
) |
| |
Returns a shared_ptr to the requested font, supporting all the code points in the UnicodeCharsets in the range [first, last), from the in-memory contents file_contents.
- Note:
- May load font if unavailable at time of request.
Definition at line 777 of file Font.h.