FontManager Class Reference

Singleton that creates and manages fonts. More...

#include <font_manager.h>

Inherits UniversalManager< Font, FontManager >, and Task.

Inheritance diagram for FontManager:

Inheritance graph
[legend]
Collaboration diagram for FontManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

TRef get (const char *font_name, int size)
 Get some font.
virtual void update (int dtime, int atime)
 Font's cache cleanup.

Protected Member Functions

 FontManager ()
 ~FontManager ()

Private Attributes

int mNextCleanup
 Miliseconds until next cleanup.

Friends

class Singleton< FontManager >
 Singleton if a friend of mine! (stupid solution...).

Detailed Description

Singleton that creates and manages fonts.

Usage:

FontRef font; // create font = FontManager::getRef().get("FreeMono.ttf", 20); .. font->RenderUTF8("Hello World!", 30, 30); // usage .. font = 0; // destroy

The manager is derived from Task becasue fonts need to clean cache sometimes so regular call to FontManager is needed. You may run out of memory if you don't call update :-) The manager isn't thread safe.

Definition at line 33 of file font_manager.h.


Constructor & Destructor Documentation

FontManager::FontManager  )  [protected]
 

Definition at line 30 of file font_manager.cpp.

References mNextCleanup.

FontManager::~FontManager  )  [protected]
 

Definition at line 35 of file font_manager.cpp.


Member Function Documentation

FontManager::TUniversalManager::TRef FontManager::get const char *  font_name,
int  size
 

Get some font.

Same font (reference) may be returned in mutiple calls.

Parameters:
font_name Filename with font. The file is located.
size Size of font in some font points.
Returns:
Reference to font.

Definition at line 40 of file font_manager.cpp.

References UniversalManager< Font, FontManager >::createAndRegister(), DIE(), UniversalManager< Font, FontManager >::find(), locateFile(), LOGE, and xtos().

Here is the call graph for this function:

void FontManager::update int  dtime,
int  atime
[virtual]
 

Font's cache cleanup.

We need this because font's caches must be regullary cleaned. Should be called from task.

Reimplemented from Task.

Definition at line 63 of file font_manager.cpp.

References LOGT, mNextCleanup, and UniversalManager< Font, FontManager >::mRegister.


Friends And Related Function Documentation

friend class Singleton< FontManager > [friend]
 

Singleton if a friend of mine! (stupid solution...).

Definition at line 36 of file font_manager.h.


Member Data Documentation

int FontManager::mNextCleanup [private]
 

Miliseconds until next cleanup.

Definition at line 63 of file font_manager.h.

Referenced by FontManager(), and update().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:14:26 2006 for bjs by  doxygen 1.4.5