# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CFontManager Class Reference

Font manager The font manager manages CMaterial pointers through a list of CSmartPtr. More...

#include <font_manager.h>

Collaboration diagram for NL3D::CFontManager:

Collaboration graph
[legend]
List of all members.

Public Methods

 CFontManager ()
 Default constructor. More...

void setMaxMemory (uint32 mem)
 define maximum memory allowed. More...

uint32 getMaxMemory () const
 gives maximum memory allowed. More...

NLMISC::CSmartPtr<CMaterialgetFontMaterial (CFontDescriptor desc)
 manages fonts in memory using CSmartPtr. More...

void computeString (const std::string& s, CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, IDriver *driver, CComputedString& output, bool keep800x600Ratio= true)
 Compute primitive blocks and materials of each character of the string. More...

void computeString (const ucstring &s, CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, IDriver *driver, CComputedString &output, bool keep800x600Ratio= true)
 Same as computeString but works with a unicode string (ucstring). More...

std::string getCacheInformation () const
 return a string given information about the cache. More...


Private Attributes

uint32 _MemSize
uint32 _MaxMemory
uint32 _NbChar
mapFontDec _Letters
std::list<NLMISC::CSmartPtr<
CMaterial> > 
_MaterialFontList

Detailed Description

Font manager The font manager manages CMaterial pointers through a list of CSmartPtr.

When the user asks for the texture font representing a character(font/size), it generates and stores this pointer in the list. If this character has already been generated, and lies in the list, it increments its reference count. If the memory used by generated textures exceeds the max memory, then the useless character/pointer is erased from the list. Max memory is set to 0 by default, so this value should be set to non-zero before generating textures to prevent immediate memory deletion.

Author(s):
Stephane Coutelas , Nevrax France
Date:
2000

Definition at line 76 of file font_manager.h.


Constructor & Destructor Documentation

NL3D::CFontManager::CFontManager ( ) [inline]
 

Default constructor.

Definition at line 89 of file font_manager.h.


Member Function Documentation

void NL3D::CFontManager::computeString ( const ucstring & s,
CFontGenerator * fontGen,
const NLMISC::CRGBA & color,
uint32 fontSize,
IDriver * driver,
CComputedString & output,
bool keep800x600Ratio = true )
 

Same as computeString but works with a unicode string (ucstring).

Definition at line 264 of file font_manager.cpp.

void NL3D::CFontManager::computeString ( const std::string & s,
CFontGenerator * fontGen,
const NLMISC::CRGBA & color,
uint32 fontSize,
IDriver * driver,
CComputedString & output,
bool keep800x600Ratio = true )
 

Compute primitive blocks and materials of each character of the string.

Parameters:
s   string to compute
fontGen   font generator
color   primitive blocks color
fontSize   font size
desc   display descriptor (screen size, font ratio)
output   computed string
keep800x600Ratio   true if you want that CFontManager look at Driver window size, and resize fontSize so it keeps same size...

Definition at line 249 of file font_manager.cpp.

Referenced by NL3D::CTextContext::computeString(), NL3D::CTextContext::printAt(), NL3D::CTextContext::printfAt(), and NL3D::CTextContext::textPush().

string NL3D::CFontManager::getCacheInformation ( ) const
 

return a string given information about the cache.

Definition at line 276 of file font_manager.cpp.

NLMISC::CSmartPtr< CMaterial > NL3D::CFontManager::getFontMaterial ( CFontDescriptor desc )
 

manages fonts in memory using CSmartPtr.

Parameters:
character   descriptor
Returns:
CSmartPtr to a font texture

Definition at line 49 of file font_manager.cpp.

uint32 NL3D::CFontManager::getMaxMemory ( ) const [inline]
 

gives maximum memory allowed.

Returns:
maximum memory

Definition at line 108 of file font_manager.h.

void NL3D::CFontManager::setMaxMemory ( uint32 mem ) [inline]
 

define maximum memory allowed.

Parameters:
maximum   memory

Definition at line 101 of file font_manager.h.


Member Data Documentation

mapFontDec NL3D::CFontManager::_Letters [private]
 

Definition at line 81 of file font_manager.h.

std::list< NLMISC::CSmartPtr< CMaterial > > NL3D::CFontManager::_MaterialFontList [private]
 

Definition at line 82 of file font_manager.h.

uint32 NL3D::CFontManager::_MaxMemory [private]
 

Definition at line 79 of file font_manager.h.

uint32 NL3D::CFontManager::_MemSize [private]
 

Definition at line 78 of file font_manager.h.

uint32 NL3D::CFontManager::_NbChar [private]
 

Definition at line 80 of file font_manager.h.


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