version 3.3

VRS::TEXT::FontDefinition Class Reference

A class for managing informations about rasterized font. More...

#include <vrs/text/fontdefinition.h>

Inheritance diagram for VRS::TEXT::FontDefinition:

VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 FontDefinition (const std::string &name, const std::string &fontfile, const std::string &style, SO< FontSize > size, unsigned int typeFlags)
 Constructors.
virtual ~FontDefinition ()
 Destructor.
const std::string & getName () const
 Returns the unique name of this FontDefinition ( for example 'Times 8pt bold' ).
const std::string & getFont () const
 Returns the fonts filename ( for example 'times.ttf' ).
const std::string & getStyle () const
 Returns the style of this font ( for example 'bold' ).
const SO< FontSizegetSize () const
 Returns the font-size.
float getLineHeight () const
 Returns the line-height.
bool hasVerticalMetrics () const
 Returns true if the Font contains Metrics for Vertical Text.
bool hasHorizontalMetrics () const
 Returns true if the Font contains Metrics for Horizontal Text.
float getAscender () const
 MiddleLine to Top.
float getDescender () const
 MiddleLine to Bottom.
unsigned int getTextureSize () const
 The TextureSize.
unsigned int getPixelPerEmY () const
unsigned int getPixelPerEmX () const
std::string toString () const
 Returns a String description of this FontDefinition for debugging purpose.
void loadFontFace ()
 Loads the font-file and searches for the defined style and size.
SO< FontDefinitiongetFallBackFont () const
 The fallback FontDef to be used when a Glyph is not found in this FontDefinition.
void setFallBackFont (SO< FontDefinition > fontdef)
 Sets the fallback FontDef to be used when a Glyph is not found in this FontDefinition.
SO< FontTexturegetFontTexture (unsigned int id) const
 Returns the FontTexture for the given ID.
void addGlyphs (GlyphCharcode *charArray, unsigned int count)
 Adds all glyph, found by the charcodes specified in charArray, to this FontDefinition.
void addGlyphs (const std::string &str)
 Adds all glyph, found by the charcodes specified in str, to this FontDefinition.
void addGlyphs (const char *str, int count)
 Adds all glyph, found by the charcodes specified in str, to this FontDefinition.
void addGlyphs (std::vector< GlyphCharcode > charVec)
 Adds all glyph, found by the charcodes specified in charVec to this FontDefinition.
void addGlyphs (SO< Array< GlyphCharcode > > charArr)
 Adds all glyph, found by the charcodes specified in charArr to this FontDefinition.
void addDefaultGlyphs ()
 Adds a number of default glyphs (ASCII 33 to ASCII 126) to this FontDefinition.
bool hasGlyphForChar (GlyphCharcode cha) const
 Checks if a glyph exists within is this Font.
bool isGlyphForCharLoaded (GlyphCharcode cha) const
 Checks if a glyph is loaded.
SO< FontGlyphgetGlyphForCharcode (GlyphCharcode cha)
 Returns the glyph for a character if it has been loaded If not loaded the char will be added.
void injectFontGlyph (GlyphCharcode cha, SO< FontGlyph > fg)
 Injects a single Glyph as a replacement for a existing for this charcode.
SO< FontGlyphgetInjectedFontGlyph (GlyphCharcode cha)
 Returns the injected FontGlyph for this charcode, if available.
void removeInjectedFontGlyph (GlyphCharcode cha)
 Removes the injected FontGlyph for this charcode, if available.
void clearInjectedFontGlyphs ()
 Removes all injected FontGlyphs.
SO< FontGlyphaddGlyphForChar (GlyphCharcode cha)
 Adds a Glyph for a character.
SO< FontGlyphaddGlyph (unsigned int glyph_index, GlyphCharcode cha=0)
 Adds a glyph for the exact index in this font-file.
void setOutline (float bordersize, SO< FontDefinition > useMetrics=NULL)
 Adds an outline to the Font.
SO< FontDefinitiongetUseMetrics () const
 Returns the fontdefinition whose metrics should be used, for matching Fonts or NULL if none was set .
void applyImageManipulation (SO< ImageManipulator > imageman, unsigned int times=1)
 Applies the given ImageManipulator the number of times given to all textures.
unsigned int getGlpyhSpacing () const
 Returns the spacing between Glyphs on all generated Font-Textures.
void setGlpyhSpacing (unsigned int spacing)
 Sets the spacing between Glyphs on all generated Font-Textures, in pixel.
void setExtraGlpyhBorder (unsigned int border)
 Sets the extra border around all Glyphs which will be used for the uv coordinates.
unsigned int getGlyphRepresentationTypes () const
 Returns Types of Glyphs which are be generated.
 VRS_TYPEINFO (FontDefinition, SharedObj)
 VRS_SERIALIZABLE (FontDefinition)


Detailed Description

A class for managing informations about rasterized font.

Has a unique name and contains size, fontfile and style. Contains a number of FontTextures on which different glyphs can be rendered.


Constructor & Destructor Documentation

VRS::TEXT::FontDefinition::FontDefinition ( const std::string &  name,
const std::string &  fontfile,
const std::string &  style,
SO< FontSize size,
unsigned int  typeFlags 
)

Constructors.

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

Destructor.


Member Function Documentation

const std::string& VRS::TEXT::FontDefinition::getName (  )  const [inline]

Returns the unique name of this FontDefinition ( for example 'Times 8pt bold' ).

const std::string& VRS::TEXT::FontDefinition::getFont (  )  const [inline]

Returns the fonts filename ( for example 'times.ttf' ).

const std::string& VRS::TEXT::FontDefinition::getStyle (  )  const [inline]

Returns the style of this font ( for example 'bold' ).

const SO<FontSize> VRS::TEXT::FontDefinition::getSize ( void   )  const [inline]

Returns the font-size.

float VRS::TEXT::FontDefinition::getLineHeight (  )  const [inline]

Returns the line-height.

bool VRS::TEXT::FontDefinition::hasVerticalMetrics (  )  const [inline]

Returns true if the Font contains Metrics for Vertical Text.

bool VRS::TEXT::FontDefinition::hasHorizontalMetrics (  )  const [inline]

Returns true if the Font contains Metrics for Horizontal Text.

float VRS::TEXT::FontDefinition::getAscender (  )  const [inline]

MiddleLine to Top.

float VRS::TEXT::FontDefinition::getDescender (  )  const [inline]

MiddleLine to Bottom.

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

The TextureSize.

unsigned int VRS::TEXT::FontDefinition::getPixelPerEmY (  )  const [inline]

unsigned int VRS::TEXT::FontDefinition::getPixelPerEmX (  )  const [inline]

std::string VRS::TEXT::FontDefinition::toString (  )  const

Returns a String description of this FontDefinition for debugging purpose.

void VRS::TEXT::FontDefinition::loadFontFace (  ) 

Loads the font-file and searches for the defined style and size.

If style is empty (''), the first found style is used (and saved). Searching for font-size only occurs in fixed size fonts.

Exceptions:
When file not found/readable, style not found or size not found

SO<FontDefinition> VRS::TEXT::FontDefinition::getFallBackFont (  )  const

The fallback FontDef to be used when a Glyph is not found in this FontDefinition.

Returns:
The FontDefinition used as a fallback

void VRS::TEXT::FontDefinition::setFallBackFont ( SO< FontDefinition fontdef  ) 

Sets the fallback FontDef to be used when a Glyph is not found in this FontDefinition.

Parameters:
fontdef The FontDefinition used as a fallback

SO<FontTexture> VRS::TEXT::FontDefinition::getFontTexture ( unsigned int  id  )  const

Returns the FontTexture for the given ID.

Parameters:
id The id for the FontTexture
Exceptions:
If no found is defined for id

void VRS::TEXT::FontDefinition::addGlyphs ( GlyphCharcode charArray,
unsigned int  count 
)

Adds all glyph, found by the charcodes specified in charArray, to this FontDefinition.

Swallows exceptions occuring during rasterization gracefully.

void VRS::TEXT::FontDefinition::addGlyphs ( const std::string &  str  ) 

Adds all glyph, found by the charcodes specified in str, to this FontDefinition.

Swallows exceptions occuring during rasterization gracefully. The std::string containing the characters.

Parameters:
asUnicode Searches for all multibytecharacter and converts those before adding.

void VRS::TEXT::FontDefinition::addGlyphs ( const char *  str,
int  count 
)

Adds all glyph, found by the charcodes specified in str, to this FontDefinition.

Swallows exceptions occuring during rasterization gracefully. The char* containing the characters. The number of characters in str

Parameters:
asUnicode Searches for all multibytecharacter and converts those before adding.

void VRS::TEXT::FontDefinition::addGlyphs ( std::vector< GlyphCharcode charVec  ) 

Adds all glyph, found by the charcodes specified in charVec to this FontDefinition.

Swallows exceptions occuring during rasterization gracefully.

void VRS::TEXT::FontDefinition::addGlyphs ( SO< Array< GlyphCharcode > >  charArr  ) 

Adds all glyph, found by the charcodes specified in charArr to this FontDefinition.

Swallows exceptions occuring during rasterization gracefully.

void VRS::TEXT::FontDefinition::addDefaultGlyphs (  ) 

Adds a number of default glyphs (ASCII 33 to ASCII 126) to this FontDefinition.

Swallows exceptions occuring during rasterization gracefully.

bool VRS::TEXT::FontDefinition::hasGlyphForChar ( GlyphCharcode  cha  )  const

Checks if a glyph exists within is this Font.

Parameters:
cha The character to check for
Exceptions:
If fontfile has not been loaded

bool VRS::TEXT::FontDefinition::isGlyphForCharLoaded ( GlyphCharcode  cha  )  const

Checks if a glyph is loaded.

Parameters:
cha The character to check for
Exceptions:
If fontfile has not been loaded

SO<FontGlyph> VRS::TEXT::FontDefinition::getGlyphForCharcode ( GlyphCharcode  cha  ) 

Returns the glyph for a character if it has been loaded If not loaded the char will be added.

Returns:
NULL if not found
Exceptions:
If fontfile has not been loaded

void VRS::TEXT::FontDefinition::injectFontGlyph ( GlyphCharcode  cha,
SO< FontGlyph fg 
)

Injects a single Glyph as a replacement for a existing for this charcode.

The injected Glyph will always be used first.

Parameters:
cha The charcode to be replaced
fg The FontGlyph to be injected

SO<FontGlyph> VRS::TEXT::FontDefinition::getInjectedFontGlyph ( GlyphCharcode  cha  ) 

Returns the injected FontGlyph for this charcode, if available.

Parameters:
cha The charcode
Returns:
NULL when no injected FontGlyph was found

void VRS::TEXT::FontDefinition::removeInjectedFontGlyph ( GlyphCharcode  cha  ) 

Removes the injected FontGlyph for this charcode, if available.

Parameters:
cha The charcode

void VRS::TEXT::FontDefinition::clearInjectedFontGlyphs (  ) 

Removes all injected FontGlyphs.

SO<FontGlyph> VRS::TEXT::FontDefinition::addGlyphForChar ( GlyphCharcode  cha  ) 

Adds a Glyph for a character.

Parameters:
cha The character
Returns:
NULL if no glyph could be created, otherwise the glyph
Exceptions:
If fontfile has not been loaded or rasterization failed

SO<FontGlyph> VRS::TEXT::FontDefinition::addGlyph ( unsigned int  glyph_index,
GlyphCharcode  cha = 0 
)

Adds a glyph for the exact index in this font-file.

Parameters:
glyph_index The index
cha The character
Returns:
NULL if no glyph could be created, otherwise the glyph
Exceptions:
If fontfile has not been loaded or rasterization failed

void VRS::TEXT::FontDefinition::setOutline ( float  bordersize,
SO< FontDefinition useMetrics = NULL 
)

Adds an outline to the Font.

Parameters:
bordersize The size of the border in pixels
useMetrics A fontdefinition whose metrics should be used, for matching Fonts

SO<FontDefinition> VRS::TEXT::FontDefinition::getUseMetrics (  )  const

Returns the fontdefinition whose metrics should be used, for matching Fonts or NULL if none was set .

void VRS::TEXT::FontDefinition::applyImageManipulation ( SO< ImageManipulator imageman,
unsigned int  times = 1 
)

Applies the given ImageManipulator the number of times given to all textures.

unsigned int VRS::TEXT::FontDefinition::getGlpyhSpacing (  )  const [inline]

Returns the spacing between Glyphs on all generated Font-Textures.

void VRS::TEXT::FontDefinition::setGlpyhSpacing ( unsigned int  spacing  ) 

Sets the spacing between Glyphs on all generated Font-Textures, in pixel.

void VRS::TEXT::FontDefinition::setExtraGlpyhBorder ( unsigned int  border  ) 

Sets the extra border around all Glyphs which will be used for the uv coordinates.

unsigned int VRS::TEXT::FontDefinition::getGlyphRepresentationTypes (  )  const

Returns Types of Glyphs which are be generated.

VRS::TEXT::FontDefinition::VRS_TYPEINFO ( FontDefinition  ,
SharedObj   
)

VRS::TEXT::FontDefinition::VRS_SERIALIZABLE ( FontDefinition   ) 


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

Generated on Wed May 23 06:00:34 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact