gfx::Font Class Reference

Font class to draw fonts from bitmaps. More...

#include <gfx_font_opengl.hh>

Inheritance diagram for gfx::Font:

gfx::FontBase

List of all members.

Public Member Functions

 Font (const FontDesc &desc, SafePtr< Gui > gui)
 ~Font ()
void SetZoom (fp z)
void Print (const string &text, fp x, fp y, eFontMode mode)
 Print(): Print a text string in the window using a bitmapped font.
void Print (const string &text, fp x, fp y, eFontMode mode, const RGBA rgba)
void Print (const char *text, uint textLen, fp x, fp y, eFontMode mode)
void Print (const char *text, uint textLen, fp x, fp y, eFontMode mode, const RGBA rgba)
void PrintBuildArgs (PrintArgs &args, const char *text, uint textLen, fp x, fp y, eFontMode fontMode)
void Print (PrintArgs &args, bool draw=true)

Private Types

enum  eFontPad { eFontPad_DEFAULT = 4 }
typedef FontBase Parent

Private Member Functions

void PostProcess (Targa &targa)
bool IsPixel (const Targa &targa, int x, int y)
void ExtractLetters (const Targa &targa)
void SetPadding (int padding)

Private Attributes

SafePtr< GuimGui
int mPadding
 padding (in pixels)
int mHeight
 fixed line height in the texture (should be maximum letter height)
char mStart
 starting character
fp mZoom
 zoom factor for output
int mLetters
 number of letters
vector< short > mLetterx
 starting x coordinate in the texture
vector< short > mLettery
 starting y coordinate in the texture
vector< short > mLetterw
 width in the texture
shptr< TexturemTexture
 font's texture

Friends

class GuiButton

Classes

class  PrintArgs


Detailed Description

Font class to draw fonts from bitmaps.

See description at gfx_font.hh.


Member Typedef Documentation

typedef FontBase gfx::Font::Parent [private]


Member Enumeration Documentation

enum gfx::Font::eFontPad [private]

Enumerator:
eFontPad_DEFAULT 


Constructor & Destructor Documentation

gfx::Font::Font ( const FontDesc desc,
SafePtr< Gui gui 
)

gfx::Font::~Font (  ) 


Member Function Documentation

void gfx::Font::SetZoom ( fp  z  )  [virtual]

Set font zoom (size).

Implements gfx::FontBase.

void gfx::Font::Print ( const string &  text,
fp  x,
fp  y,
eFontMode  mode 
) [virtual]

Print(): Print a text string in the window using a bitmapped font.

Returns:
0 if successful or Font::ERROR_* bits.
Parameters:
text String should NOT contain newlines nor tabs (unlike GL-117).
x,y Font cell coords (sort of like VGA text mode). For corner-justification, absolute values of coords are used.
mode Bitmask for justification (relative to a window corner).
rgba (optional)
	/// For example:
	/// Print( 0, 0, FONT_CENTER, "HI" );
	/// Print( 2, 1, FONT_SE,     "HELLO );
	/// Print( 0, 0, FONT_NW,     "BYE" );
	///
	///     +-------------------+
	///     |BYE                |
	///     |                   |
	///     |                   |
	///     |                   |
	///     |                   |
	///     |         HI        |
	///     |                   |
	///     |                   |
	///     |                   |
	///     |            HELLO  | (2,1)
	///     |                   |
	///     +-------------------+
	/// 

Implements gfx::FontBase.

void gfx::Font::Print ( const string &  text,
fp  x,
fp  y,
eFontMode  mode,
const RGBA  rgba 
) [virtual]

This function is described at gfx_font.hh.

Implements gfx::FontBase.

void gfx::Font::Print ( const char *  text,
uint  textLen,
fp  x,
fp  y,
eFontMode  mode 
) [virtual]

Implements gfx::FontBase.

void gfx::Font::Print ( const char *  text,
uint  textLen,
fp  x,
fp  y,
eFontMode  mode,
const RGBA  rgba 
) [virtual]

Implements gfx::FontBase.

void gfx::Font::PrintBuildArgs ( PrintArgs args,
const char *  text,
uint  textLen,
fp  x,
fp  y,
eFontMode  fontMode 
)

The internal args for Print() and the operation of Print() are separated in order to be alble to get the rectangle where Print() would draw to without actually drawing. Button drawing uses this capability.

void gfx::Font::Print ( PrintArgs args,
bool  draw = true 
)

void gfx::Font::PostProcess ( Targa targa  )  [private]

Post-process font image (vestige from GL-117).

bool gfx::Font::IsPixel ( const Targa targa,
int  x,
int  y 
) [private]

T. Drexl: Each font is stored in one bitmap, width=height=2^n! Use GIMP or equiv and put the ASCII letters of your favourite font there, ascending order, start whereever you want. Write as many letters as possible per line, each separated by at least one whitespace. Look at the font*.tga files for examples. The max letter height is fixed.

void gfx::Font::ExtractLetters ( const Targa targa  )  [private]

Extract letters.

void gfx::Font::SetPadding ( int  padding  )  [inline, private]


Friends And Related Function Documentation

friend class GuiButton [friend]


Member Data Documentation

SafePtr<Gui> gfx::Font::mGui [private]

int gfx::Font::mPadding [private]

padding (in pixels)

int gfx::Font::mHeight [private]

fixed line height in the texture (should be maximum letter height)

char gfx::Font::mStart [private]

starting character

fp gfx::Font::mZoom [private]

zoom factor for output

int gfx::Font::mLetters [private]

number of letters

vector<short> gfx::Font::mLetterx [private]

starting x coordinate in the texture

vector<short> gfx::Font::mLettery [private]

starting y coordinate in the texture

vector<short> gfx::Font::mLetterw [private]

width in the texture

shptr<Texture> gfx::Font::mTexture [private]

font's texture


The documentation for this class was generated from the following files: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:26 2007