- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::UFont Class Reference

This class is a controller class for abstract font renderers. More...

#include <ufont.hpp>

Inheritance diagram for ufo::UFont:

ufo::UObject ufo::UCollectable List of all members.

Public Member Functions

 UFont ()
 UFont (UFontInfo::Family family, float pointSize, int weight=UFontInfo::Normal, int style=UFontInfo::Plain, UFontInfo::Encoding encoding=UFontInfo::Encoding_Default)
 UFont (const std::string &face, float pointSize, int weight=UFontInfo::Normal, int style=UFontInfo::Plain, UFontInfo::Encoding encoding=UFontInfo::Encoding_Default)
 UFont (const UFontInfo &fontInfo)
 UFont (UFontRenderer *renderer)
 UFont (const UFont &font)
UFont & operator= (const UFont &font)
UFontRenderer * getRenderer () const
const UFontMetrics * getFontMetrics () const
void setFamiliy (UFontInfo::Family family)
void setFontFace (const std::string &face)
std::string getFontFace () const
void setPointSize (float pointSize)
float getPointSize () const
void setWeight (int weight)
int getWeight () const
void setStyle (int flag)
int getStyle () const
void setEncoding (UFontInfo::Encoding encoding)
UFontInfo::Encoding getEncoding () const

Static Public Member Functions

void clearCache ()

Protected Member Functions

void queryAndLoad (const UFontInfo &info)
void dispose ()

Detailed Description

This class is a controller class for abstract font renderers.

It uses the active font plugin to create new font renderers according to its attributes. The preferred way to create font with a specific font face is to use one of the predefined font faces. Alternatively, you may use an explicit string literal defining your font face This class may use caching of already existing font renderers.

Author:
Johannes Schmidt


Constructor & Destructor Documentation

ufo::UFont::UFont (   ) 
 

Creates a new font object using the default font renderer.

ufo::UFont::UFont (  UFontInfo::Family  family,
float  pointSize,
int  weight = UFontInfo::Normal,
int  style = UFontInfo::Plain,
UFontInfo::Encoding  encoding = UFontInfo::Encoding_Default
) 
 

Creates a new font and chooses an appropriate font renderer. The font renderer may be internally cached.

Parameters:
family One of the predefined font families
pointSize The point size as float value
weight The font weight as described by enum Weight
style The font style as described by enum Style
encoding The character encoding used to interpret the chars

ufo::UFont::UFont (  const std::string &  face,
float  pointSize,
int  weight = UFontInfo::Normal,
int  style = UFontInfo::Plain,
UFontInfo::Encoding  encoding = UFontInfo::Encoding_Default
) 
 

Creates a new font and chooses an appropriate font renderer. The font renderer may be internally cached.

Parameters:
face A custom font face name
pointSize The point size as float value
weight The font weight as described by enum Weight
encoding The character encoding used to interpret the chars

ufo::UFont::UFont (  const UFontInfo &  fontInfo  ) 
 

Creates a new font and chooses an appropriate font renderer. The font renderer may be internally cached.

Parameters:
fontInfo The font info struct describing the desired font

ufo::UFont::UFont (  UFontRenderer *  renderer  ) 
 

Constructs a font object with the given font renderer. The font renderer will not be registered at the cache.

ufo::UFont::UFont (  const UFont &  font  ) 
 

Explicit copy constructor


Member Function Documentation

void ufo::UFont::dispose (   )  [protected]
 

Disposes the font renderer.

std::string ufo::UFont::getFontFace (   )  const
 

Returns the font face name for this font

Returns:
The font face for this font.

const UFontMetrics* ufo::UFont::getFontMetrics (   )  const
 

Returns a font metrics object which describes the font extents.

float ufo::UFont::getPointSize (   )  const
 

Returns the point size rounded to integer

UFontRenderer* ufo::UFont::getRenderer (   )  const
 

Returns the font renderer used to draw the character strings.

int ufo::UFont::getStyle (   )  const
 

The font style is described by an integer

See also:
setStyle(int)
Returns:
the current font style

void ufo::UFont::queryAndLoad (  const UFontInfo &  info  )  [protected]
 

Queries the toolkit for the font info struct, searches in the font cache and creates a new font renderer on no results.

void ufo::UFont::setEncoding (  UFontInfo::Encoding  encoding  ) 
 

Sets the character encoding which should be used to interpret character strings.

See also:
Encoding

void ufo::UFont::setFamiliy (  UFontInfo::Family  family  ) 
 

Sets the font family. May create a new font renderer.

void ufo::UFont::setPointSize (  float  pointSize  ) 
 

Sets the point size of this font. May create a new font renderer object


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt