Gel2D - The free/open source game creation suite

Public Member Functions | Public Attributes
gel::GelFont Class Reference

Font class. More...

#include <gelFont.h>

List of all members.

Public Member Functions

 GelFont ()
 Default constructor.
 GelFont (GelString filename, ImageType type)
 Gel2D Bitmap Font constructor.
 GelFont (GelString filename)
 Gel2D Font constructor.
 ~GelFont ()
 Destructor.
bool loadFont (GelString filename, int start, int stop, int height, int padding, int spacing, bool usealpha, bool antialias)
 Loads a TrueType/OpenType font from disk.
bool readBmpFont (GelString filename, ImageType type)
 Reads a bitmap font description file from disk.
bool writeBmpFont (GelString filename, ImageType type)
 Writes a bitmap font description file to disk.
bool readFont (GelString filename)
 Reads a font description file from disk.
bool writeFont (GelString filename, GelString fontname, int start, int stop, int height, int padding, int spacing, bool usealpha, bool antialias)
 Writes a font description file to disk.
GelTexturegetTexture () const
 Gets a pointer to the font's texture.
int getLineHeight () const
 Gets the font's line height in pixels.

Public Attributes

GelFontChar fchar [256]

Detailed Description

Font class.

This class stores font information which can be used by other classes to print text.
GelFont can read and write font information in two ways:
1. A small binary description file containing the name of a TrueType/OpenType font file, and a few paramaters describing how the font should be loaded.
2. A binary description file containing information on each character in the font, and an accompanying bitmap image file of all the characters.


Constructor & Destructor Documentation

gel::GelFont::GelFont ( )

Default constructor.

gel::GelFont::GelFont ( GelString  filename,
ImageType  type 
)

Gel2D Bitmap Font constructor.

See also:
readBmpFont()
gel::GelFont::GelFont ( GelString  filename)

Gel2D Font constructor.

See also:
readFont()
gel::GelFont::~GelFont ( )

Destructor.


Member Function Documentation

bool gel::GelFont::loadFont ( GelString  filename,
int  start,
int  stop,
int  height,
int  padding,
int  spacing,
bool  usealpha,
bool  antialias 
)

Loads a TrueType/OpenType font from disk.

Returns:
True if the font loads successfully, else false.
bool gel::GelFont::readBmpFont ( GelString  filename,
ImageType  type 
)

Reads a bitmap font description file from disk.

This function will load a Gel2D Bitmap Font, and load the image corresponding to the given filename and image type.

Parameters:
filename: The directory / name of the description file.
type: The image type of the corresponding image file.
Returns:
True if the file is a valid Gel2D Bitmap Font, else false.
bool gel::GelFont::writeBmpFont ( GelString  filename,
ImageType  type 
)

Writes a bitmap font description file to disk.

This function will write a Gel2D Bitmap Font, along with an image corresponding to the given filename and image type.

Parameters:
filename: The directory / name of the description file.
type: The image type of the corresponding image file.
Returns:
True if the file was written successfully, else false.
bool gel::GelFont::readFont ( GelString  filename)

Reads a font description file from disk.

This function will read a font description file and load the TrueType/OpenType font specified therein.

Parameters:
filename: The directory / name of the description file.
Returns:
True if the file is a valid Gel2D Font, else false.
bool gel::GelFont::writeFont ( GelString  filename,
GelString  fontname,
int  start,
int  stop,
int  height,
int  padding,
int  spacing,
bool  usealpha,
bool  antialias 
)

Writes a font description file to disk.

This function will write a font description file with the given parameters.

Returns:
True if the file was written successfully, else false.
GelTexture* gel::GelFont::getTexture ( ) const [inline]

Gets a pointer to the font's texture.

Returns:
The object's texture.
int gel::GelFont::getLineHeight ( ) const [inline]

Gets the font's line height in pixels.


Member Data Documentation


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