version 3.3

VRS::TEXT::FontManager Class Reference

The main manager for the FontRasterisierer. More...

#include <vrs/text/fontmanager.h>

Inheritance diagram for VRS::TEXT::FontManager:

VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

virtual ~FontManager ()
 Destructor.
SO< FontDefinitioncreateFontDefinitionByFilename (const std::string &name, const std::string &absolutefilename, const std::string &style, SO< FontSize > size, unsigned int typeFlags=GTI_ALL, bool searchFont=true, bool usefallback=false)
 Creates a new FontDefinition per filename.
SO< FontDefinitioncreateFontDefinitionByFontname (const std::string &name, const std::string &fontname, const std::string &cstyle, SO< FontSize > size, unsigned int typeFlags=GTI_ALL, bool usefallback=true)
 Creates a new FontDefinition per fontname.
void destroyFontDefinition (const SO< FontDefinition > fd)
 Removes an existing FontDefinition.
void destroyFontDefinitions (void)
 Removes all existing FontDefinitionen.
std::string findFontpathPerFilename (const std::string &searchfilename, bool matchSubstring=true, bool searchDirectories=false, bool compareLowercase=true)
 Find Font-File on system per filename.
std::string findFontpathPerFontname (const std::string &searchfontname, bool matchSubstring=true, bool searchDirectories=false, bool compareLowercase=true)
 Find Font-File on system per fontname.
void addFontDirectory (std::string dir)
 Adds a FontDirectory where missing Fonts may also be searched.
void removeFontDirectory (std::string dir)
 Removes a FontDirectory, but not any loaded Fonts from this Location.
void prefetchFontDirectories (bool clearFontDirectories=true)
 Adds all usable fonts found inside the given FontDirectories to the predefinied fonts for quicker loading, and then clears the FontDirectories.
SO< FontDefinitiongetFontDefinition (const std::string &name) const
 Gets a FontDefinition by its name.
FT_Library _getLibrary () const
 Returns the FT Library.
void setTextureSize (unsigned int dim)
 Sets the TextureSize.
unsigned int getTextureSize () const
 Returns the TextureSize.
void setResolution (unsigned int horiresolution, unsigned int vertresolution)
 Sets the Screen Resolution in DPI.
unsigned int getHoriResolution () const
 Returns the Horizontal Screen Resolution in DPI.
unsigned int getVertResolution () const
 Returns the Vertical Screen Resolution in DPI.
GlyphCharcode getNewLineChar () const
 Return the character which will be used as a newline.
void setNewLineChar (GlyphCharcode gc)
 Sets the character which will be used as a newline.
void setFallBackName (const std::string &name)
 Sets the Fallback font file to be loaded when no Font was found.
std::string getFallBackName () const
 Returns the Fallback font file to be loaded when no Font was found.
bool isCheckFontFileExtensions () const
 Returns wether to check for Font-file extension ( like ttf, fon ...) or not.
void setCheckFontFileExtensions (bool check)
 Sets wether to check for Font-file extension ( like ttf, fon ...) or not.

Static Public Member Functions

static SO< FontManagergetSingleton ()
 Returns the Singleton.

Friends

void FontDefinition::serialize (SerializationManager &doc)


Detailed Description

The main manager for the FontRasterisierer.

In this class FontDefinitions are created, serialized, deleted. Also several global option can be set here.


Constructor & Destructor Documentation

virtual VRS::TEXT::FontManager::~FontManager (  )  [virtual]

Destructor.


Member Function Documentation

static SO<FontManager> VRS::TEXT::FontManager::getSingleton (  )  [static]

Returns the Singleton.

SO<FontDefinition> VRS::TEXT::FontManager::createFontDefinitionByFilename ( const std::string &  name,
const std::string &  absolutefilename,
const std::string &  style,
SO< FontSize size,
unsigned int  typeFlags = GTI_ALL,
bool  searchFont = true,
bool  usefallback = false 
)

Creates a new FontDefinition per filename.

If the given file does not exist and searchFont is set true, the font will be searched in the font-paths. If usefallback is true, a default font will be loaded if even this fails.

Parameters:
name The unique managed name ( for example 'Times 8pt bold' )
filename The font filename ( for example '../fonts/times.ttf' )
style The font-style ( for example 'bold' )
size The font-size ( for example '12px' )
See also:
FontSize
Parameters:
typeFlags The kind of glyphs which should be generated
searchFont Should the font paths be searched
usefallback Should a system-font be used if nothing could be loaded
Returns:
A new FontDefinition
Exceptions:
If the creation fails or the unique name already exists

SO<FontDefinition> VRS::TEXT::FontManager::createFontDefinitionByFontname ( const std::string &  name,
const std::string &  fontname,
const std::string &  cstyle,
SO< FontSize size,
unsigned int  typeFlags = GTI_ALL,
bool  usefallback = true 
)

Creates a new FontDefinition per fontname.

If the given font name is not found and usefallback is true, a default font will be tried to load.

Parameters:
name The unique managed name ( for example 'Times 8pt bold' )
fontname The font name ( for example 'Arial' )
style The font-style ( for example 'bold' )
size The font-size ( for example '12px' )
See also:
FontSize
Parameters:
typeFlags The kind of glyphs which should be generated
usefallback Should a system-font be used if nothing could be loaded
Returns:
A new FontDefinition
Exceptions:
If the creation fails or the unique name already exists

void VRS::TEXT::FontManager::destroyFontDefinition ( const SO< FontDefinition fd  ) 

Removes an existing FontDefinition.

Parameters:
fd Die zu löschende FontDefinition

void VRS::TEXT::FontManager::destroyFontDefinitions ( void   ) 

Removes all existing FontDefinitionen.

std::string VRS::TEXT::FontManager::findFontpathPerFilename ( const std::string &  searchfilename,
bool  matchSubstring = true,
bool  searchDirectories = false,
bool  compareLowercase = true 
)

Find Font-File on system per filename.

Parameters:
searchfilename The stripped name of the fontfile
substring Tries to match with a substring, if searching for Arial "Arial.ttf" will also be found.
searchDirectories Will try to find any matching filename also in user defined Font Directories
compareLowercase All comparisions will be case insensitive
Returns:
The first found full path to the font-file, or "" when nothing was found

std::string VRS::TEXT::FontManager::findFontpathPerFontname ( const std::string &  searchfontname,
bool  matchSubstring = true,
bool  searchDirectories = false,
bool  compareLowercase = true 
)

Find Font-File on system per fontname.

Parameters:
searchfontname The total name of the font
substring Tries to match with a substring, if searching for Arial "Arial Bold" will also be found.
searchDirectories Will try to find any matching filename also in user defined Font Directories
compareLowercase All comparisions will be case insensitive
Returns:
The full path to the font-file, or "" when nothing was found

void VRS::TEXT::FontManager::addFontDirectory ( std::string  dir  ) 

Adds a FontDirectory where missing Fonts may also be searched.

void VRS::TEXT::FontManager::removeFontDirectory ( std::string  dir  ) 

Removes a FontDirectory, but not any loaded Fonts from this Location.

void VRS::TEXT::FontManager::prefetchFontDirectories ( bool  clearFontDirectories = true  ) 

Adds all usable fonts found inside the given FontDirectories to the predefinied fonts for quicker loading, and then clears the FontDirectories.

Parameters:
clearFontDirectories Wether the directories will be removed from m_FontDirectories

SO<FontDefinition> VRS::TEXT::FontManager::getFontDefinition ( const std::string &  name  )  const

Gets a FontDefinition by its name.

Returns:
NULL if no FontDefinítion was found

FT_Library VRS::TEXT::FontManager::_getLibrary (  )  const [inline]

Returns the FT Library.

void VRS::TEXT::FontManager::setTextureSize ( unsigned int  dim  ) 

Sets the TextureSize.

Parameters:
dim An unsigned integer power of two (16,32,64,128,256,512,1024,2048,4096)

unsigned int VRS::TEXT::FontManager::getTextureSize (  )  const [inline]

Returns the TextureSize.

void VRS::TEXT::FontManager::setResolution ( unsigned int  horiresolution,
unsigned int  vertresolution 
)

Sets the Screen Resolution in DPI.

Parameters:
horiresolution Windows 96, Mac OS 72
vertresolution Windows 96, Mac OS 72

unsigned int VRS::TEXT::FontManager::getHoriResolution (  )  const [inline]

Returns the Horizontal Screen Resolution in DPI.

unsigned int VRS::TEXT::FontManager::getVertResolution (  )  const [inline]

Returns the Vertical Screen Resolution in DPI.

GlyphCharcode VRS::TEXT::FontManager::getNewLineChar (  )  const [inline]

Return the character which will be used as a newline.

void VRS::TEXT::FontManager::setNewLineChar ( GlyphCharcode  gc  ) 

Sets the character which will be used as a newline.

void VRS::TEXT::FontManager::setFallBackName ( const std::string &  name  ) 

Sets the Fallback font file to be loaded when no Font was found.

std::string VRS::TEXT::FontManager::getFallBackName (  )  const

Returns the Fallback font file to be loaded when no Font was found.

bool VRS::TEXT::FontManager::isCheckFontFileExtensions (  )  const

Returns wether to check for Font-file extension ( like ttf, fon ...) or not.

void VRS::TEXT::FontManager::setCheckFontFileExtensions ( bool  check  ) 

Sets wether to check for Font-file extension ( like ttf, fon ...) or not.


Friends And Related Function Documentation

void FontDefinition::serialize ( SerializationManager doc  )  [friend]


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

Generated on Sat May 18 06:00:41 2013 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact