# 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>

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

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

void computeStringInfo (const ucstring &s, CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, IDriver *driver, CComputedString &output, bool keep800x600Ratio=true)
 Same as computeString but do not make vertex buffers and primitives. More...

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

void dumpCache (const char *filename)

Private Attributes

uint32 _MemSize
uint32 _MaxMemory
uint32 _NbChar
CMaterial_MatFont
CTextureFont_TexFont


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:
Stephane Coutelas , Nevrax France
Date:
2000

Definition at line 62 of file font_manager.h.


Constructor & Destructor Documentation

NL3D::CFontManager::CFontManager   [inline]
 

Default constructor.

Definition at line 76 of file font_manager.h.

References _MatFont, _MaxMemory, _MemSize, _NbChar, and _TexFont.


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 88 of file font_manager.cpp.

References getFontMaterial, height, s, and width.

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 72 of file font_manager.cpp.

References s.

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

void NL3D::CFontManager::computeStringInfo const ucstring   s,
CFontGenerator   fontGen,
const NLMISC::CRGBA   color,
uint32    fontSize,
IDriver   driver,
CComputedString   output,
bool    keep800x600Ratio = true
 

Same as computeString but do not make vertex buffers and primitives.

Definition at line 213 of file font_manager.cpp.

References getFontMaterial, height, s, and width.

Referenced by NL3D::CTextContext::computeStringInfo.

void NL3D::CFontManager::dumpCache const char *    filename [inline]
 

Definition at line 154 of file font_manager.h.

References _TexFont.

Referenced by NL3D::CTextContext::dumpCache.

string NL3D::CFontManager::getCacheInformation   const
 

return a string given information about the cache.

Definition at line 283 of file font_manager.cpp.

References _MaxMemory, _MemSize, and _NbChar.

CMaterial * NL3D::CFontManager::getFontMaterial   [inline]
 

manages fonts in memory using CSmartPtr.

Parameters:
character  descriptor
Returns:
CSmartPtr to a font texture

Definition at line 49 of file font_manager.cpp.

References _MatFont, and _TexFont.

Referenced by computeString, and computeStringInfo.

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

gives maximum memory allowed.

Returns:
maximum memory

Definition at line 97 of file font_manager.h.

References _MaxMemory.

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

define maximum memory allowed.

Parameters:
maximum  memory

Definition at line 90 of file font_manager.h.

References _MaxMemory.


Member Data Documentation

CMaterial* NL3D::CFontManager::_MatFont [private]
 

Definition at line 68 of file font_manager.h.

Referenced by CFontManager, and getFontMaterial.

uint32 NL3D::CFontManager::_MaxMemory [private]
 

Definition at line 65 of file font_manager.h.

Referenced by CFontManager, getCacheInformation, getMaxMemory, and setMaxMemory.

uint32 NL3D::CFontManager::_MemSize [private]
 

Definition at line 64 of file font_manager.h.

Referenced by CFontManager, and getCacheInformation.

uint32 NL3D::CFontManager::_NbChar [private]
 

Definition at line 66 of file font_manager.h.

Referenced by CFontManager, and getCacheInformation.

CTextureFont* NL3D::CFontManager::_TexFont [private]
 

Definition at line 69 of file font_manager.h.

Referenced by CFontManager, dumpCache, and getFontMaterial.


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