xoreos
0.0.5
|
The global Aurora font manager. More...
#include <fontman.h>
Public Member Functions | |
FontManager () | |
~FontManager () | |
void | setFormat (FontFormat format) |
Load fonts in this format by default. More... | |
void | addAlias (const Common::UString &alias, const Common::UString &realName) |
Add an alias for a specific font name. More... | |
void | clear () |
Remove and delete all managed fonts. More... | |
bool | hasFont (const Common::UString &name, int height=0) |
Does this named managed font exist? More... | |
FontHandle | add (Font *font, const Common::UString &name) |
Add this font to the FontManager. More... | |
FontHandle | get (FontFormat format, const Common::UString &name, int height=0) |
Retrieve this named font in this format, loading it if it's not yet managed. More... | |
FontHandle | get (const Common::UString &name, int height=0) |
Retrieve this named font in the default format, loading it if it's not yet managed. More... | |
FontHandle | getIfExist (const Common::UString &name, int height=0) |
Retrieve this named font, returning an empty handle if it's not managed. More... | |
Private Member Functions | |
Common::UString | getAliasName (const Common::UString &name) |
Common::UString | getIndexName (Common::UString name, int height) |
void | assign (FontHandle &font, const FontHandle &from) |
void | release (FontHandle &handle) |
Static Private Member Functions | |
static ManagedFont * | createFont (FontFormat format, const Common::UString &name, int height) |
Private Attributes | |
FontFormat | _format |
std::map< Common::UString, Common::UString > | _aliases |
FontMap | _fonts |
Common::Mutex | _mutex |
Friends | |
class | FontHandle |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< FontManager > | |
static FontManager & | instance () |
static void | destroy () |
Protected Types inherited from Common::Singleton< FontManager > | |
typedef FontManager | SingletonBaseType |
Protected Member Functions inherited from Common::Singleton< FontManager > | |
Singleton () | |
virtual | ~Singleton () |
Graphics::Aurora::FontManager::FontManager | ( | ) |
Definition at line 43 of file fontman.cpp.
Graphics::Aurora::FontManager::~FontManager | ( | ) |
Definition at line 46 of file fontman.cpp.
References clear().
FontHandle Graphics::Aurora::FontManager::add | ( | Font * | font, |
const Common::UString & | name | ||
) |
Add this font to the FontManager.
Definition at line 79 of file fontman.cpp.
References _fonts, _mutex, Common::UString::c_str(), FontHandle, Common::ScopedPtrBase< T, Deallocator >::get(), and Common::ScopedPtrBase< T, Deallocator >::release().
void Graphics::Aurora::FontManager::addAlias | ( | const Common::UString & | alias, |
const Common::UString & | realName | ||
) |
Add an alias for a specific font name.
Definition at line 65 of file fontman.cpp.
|
private |
Definition at line 147 of file fontman.cpp.
References Graphics::Aurora::FontHandle::_empty, Graphics::Aurora::FontHandle::_it, and _mutex.
void Graphics::Aurora::FontManager::clear | ( | ) |
Remove and delete all managed fonts.
Definition at line 50 of file fontman.cpp.
References _aliases, _fonts, _format, _mutex, Common::PtrMap< Key, T, Compare, Deallocator >::clear(), and Graphics::Aurora::kFontFormatUnknown.
Referenced by ~FontManager().
|
staticprivate |
Definition at line 168 of file fontman.cpp.
References Common::StackException::add(), Common::UString::c_str(), Common::getSystemFontMono(), Graphics::Aurora::kFontFormatABC, Graphics::Aurora::kFontFormatNFTR, Graphics::Aurora::kFontFormatTexture, Graphics::Aurora::kFontFormatTTF, Graphics::Aurora::kFontFormatUnknown, and Graphics::Aurora::kSystemFontMono.
Referenced by get().
FontHandle Graphics::Aurora::FontManager::get | ( | FontFormat | format, |
const Common::UString & | name, | ||
int | height = 0 |
||
) |
Retrieve this named font in this format, loading it if it's not yet managed.
Definition at line 98 of file fontman.cpp.
References _fonts, _mutex, createFont(), FontHandle, getAliasName(), and getIndexName().
FontHandle Graphics::Aurora::FontManager::get | ( | const Common::UString & | name, |
int | height = 0 |
||
) |
Retrieve this named font in the default format, loading it if it's not yet managed.
Definition at line 94 of file fontman.cpp.
References _format.
|
private |
Definition at line 128 of file fontman.cpp.
References _aliases.
Referenced by get(), and getIndexName().
FontHandle Graphics::Aurora::FontManager::getIfExist | ( | const Common::UString & | name, |
int | height = 0 |
||
) |
Retrieve this named font, returning an empty handle if it's not managed.
Definition at line 118 of file fontman.cpp.
References _fonts, _mutex, FontHandle, and getIndexName().
|
private |
Definition at line 136 of file fontman.cpp.
References Common::UString::c_str(), Common::UString::format(), and getAliasName().
Referenced by get(), getIfExist(), and hasFont().
bool Graphics::Aurora::FontManager::hasFont | ( | const Common::UString & | name, |
int | height = 0 |
||
) |
Does this named managed font exist?
Definition at line 71 of file fontman.cpp.
References _fonts, _mutex, and getIndexName().
|
private |
Definition at line 157 of file fontman.cpp.
References Graphics::Aurora::FontHandle::_empty, _fonts, Graphics::Aurora::FontHandle::_it, _mutex, and Common::PtrMap< Key, T, Compare, Deallocator >::erase().
void Graphics::Aurora::FontManager::setFormat | ( | FontFormat | format | ) |
Load fonts in this format by default.
Definition at line 59 of file fontman.cpp.
|
friend |
Definition at line 97 of file fontman.h.
Referenced by add(), get(), and getIfExist().
|
private |
Definition at line 83 of file fontman.h.
Referenced by addAlias(), clear(), and getAliasName().
|
private |
|
private |
Definition at line 81 of file fontman.h.
Referenced by clear(), get(), and setFormat().
|
private |
Definition at line 87 of file fontman.h.
Referenced by add(), addAlias(), assign(), clear(), get(), getIfExist(), hasFont(), release(), and setFormat().