Font Class Reference

Base class for all Fonts. More...

#include <font.h>

Inherited by FontFTGL, and FontTTF.

Inheritance diagram for Font:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Font ()
 Empty constructor.
virtual ~Font ()
 Empty destructor.
virtual void RenderUTF8 (const std::string &utf8str, float x, float y)=0
 Render UTF-8 encoded string.
virtual int getTextWidth (const std::string &utf8str)=0
 Render some text in 3D.Get With of text in pixels.
virtual int Ascent ()=0
 Get line height.
virtual void cleanCache ()
 Clean the cache.
virtual int getWwidth ()=0
 Get width of W.

Detailed Description

Base class for all Fonts.

The class itself doesn't do anything usefull. It is more like interface. Anyone who need to access font returned from FontManager will have access to this interface. Fonts aren't thread safe and shloud be used only from one thread.

Definition at line 18 of file font.h.


Constructor & Destructor Documentation

Font::Font  ) 
 

Empty constructor.

Definition at line 5 of file font.cpp.

Font::~Font  )  [virtual]
 

Empty destructor.

Definition at line 10 of file font.cpp.


Member Function Documentation

virtual int Font::Ascent  )  [pure virtual]
 

Get line height.

The value is usefull if you want to render multiline text and need to know height of line.

Returns:
Height if line in font.

Implemented in FontFTGL, and FontTTF.

void Font::cleanCache  )  [virtual]
 

Clean the cache.

Check the whole cache and delete members that weren't used for a long time. The exact behaviour is implementation dependent and cache even doesn't have to be implemented.

Reimplemented in FontTTF.

Definition at line 15 of file font.cpp.

virtual int Font::getTextWidth const std::string &  utf8str  )  [pure virtual]
 

Render some text in 3D.Get With of text in pixels.

Get width of utf-8 encoded text.

Returns:
Width of text.

Implemented in FontFTGL, and FontTTF.

virtual int Font::getWwidth  )  [pure virtual]
 

Get width of W.

W is usuallu the most width char in font so you may use this as aproximation.

Returns:
Width of W.

Implemented in FontFTGL, and FontTTF.

virtual void Font::RenderUTF8 const std::string &  utf8str,
float  x,
float  y
[pure virtual]
 

Render UTF-8 encoded string.

Render text to specified position. First call may be slower if implementation use some cache for rendered fonts.

Note:
[0,0] is left bottom corner of screen.
Parameters:
utf8str string that to be rendered
x x coodrinate if text
y y coodrinate if text

Implemented in FontFTGL, and FontTTF.


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:14:08 2006 for bjs by  doxygen 1.4.5