xoreos  0.0.5
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Graphics::Aurora::FontManager Class Reference

The global Aurora font manager. More...

#include <fontman.h>

Inheritance diagram for Graphics::Aurora::FontManager:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Aurora::FontManager:
Collaboration graph
[legend]

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 ManagedFontcreateFont (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 ()
 

Detailed Description

The global Aurora font manager.

Definition at line 54 of file fontman.h.

Constructor & Destructor Documentation

◆ FontManager()

Graphics::Aurora::FontManager::FontManager ( )

Definition at line 43 of file fontman.cpp.

◆ ~FontManager()

Graphics::Aurora::FontManager::~FontManager ( )

Definition at line 46 of file fontman.cpp.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ add()

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().

Here is the call graph for this function:

◆ addAlias()

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.

References _aliases, and _mutex.

◆ assign()

void Graphics::Aurora::FontManager::assign ( FontHandle font,
const FontHandle from 
)
private

◆ clear()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createFont()

ManagedFont * Graphics::Aurora::FontManager::createFont ( FontFormat  format,
const Common::UString name,
int  height 
)
staticprivate

◆ get() [1/2]

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().

Here is the call graph for this function:

◆ get() [2/2]

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.

◆ getAliasName()

Common::UString Graphics::Aurora::FontManager::getAliasName ( const Common::UString name)
private

Definition at line 128 of file fontman.cpp.

References _aliases.

Referenced by get(), and getIndexName().

Here is the caller graph for this function:

◆ getIfExist()

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().

Here is the call graph for this function:

◆ getIndexName()

Common::UString Graphics::Aurora::FontManager::getIndexName ( Common::UString  name,
int  height 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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().

Here is the call graph for this function:

◆ release()

void Graphics::Aurora::FontManager::release ( FontHandle handle)
private

◆ setFormat()

void Graphics::Aurora::FontManager::setFormat ( FontFormat  format)

Load fonts in this format by default.

Definition at line 59 of file fontman.cpp.

References _format, and _mutex.

Friends And Related Function Documentation

◆ FontHandle

friend class FontHandle
friend

Definition at line 97 of file fontman.h.

Referenced by add(), get(), and getIfExist().

Member Data Documentation

◆ _aliases

std::map<Common::UString, Common::UString> Graphics::Aurora::FontManager::_aliases
private

Definition at line 83 of file fontman.h.

Referenced by addAlias(), clear(), and getAliasName().

◆ _fonts

FontMap Graphics::Aurora::FontManager::_fonts
private

Definition at line 85 of file fontman.h.

Referenced by add(), clear(), get(), getIfExist(), hasFont(), and release().

◆ _format

FontFormat Graphics::Aurora::FontManager::_format
private

Definition at line 81 of file fontman.h.

Referenced by clear(), get(), and setFormat().

◆ _mutex

Common::Mutex Graphics::Aurora::FontManager::_mutex
private

Definition at line 87 of file fontman.h.

Referenced by add(), addAlias(), assign(), clear(), get(), getIfExist(), hasFont(), release(), and setFormat().


The documentation for this class was generated from the following files: