This class implements support for 2D fonts.
More...
#include <CFont.h>
|
| cFont () |
| Constructor of cFont. More...
|
|
virtual | ~cFont () |
| Destructor of cFont. More...
|
|
bool | loadFromFile (const std::string &a_filename) |
| This method loads a font file by passing a path and file name as argument. More...
|
|
std::string | getFilename () const |
| This method returns the filename from which this font was last loaded or saved. More...
|
|
double | getPointSize () const |
| This method returns the current font size. More...
|
|
double | getTextWidth (const std::string &a_text, const double a_letterSpacing) |
| This method returns the width of a particular string using this font. More...
|
|
double | getTextHeight (const std::string &a_text, const double a_lineSpacing) |
| This method returns the heigth of a particular string using this font. More...
|
|
double | renderText (const std::string &a_text, const cColorf &a_color, const double a_fontScale, const double a_letterSpacing, const double a_lineSpacing, cRenderOptions &a_options) |
| This method renders a single string of text. More...
|
|
|
void | parseFont (std::istream &a_stream, cFontCharset &a_charsetDesc) |
| This method parses a font file. More...
|
|
void | cleanup () |
| This method cleans all memory. More...
|
|
This class provides support for font files generated from AngelSoft's Bitmap Font Generator application. This program will allow you to generate bitmap fonts from TrueType fonts. The application generates both image files and character descriptions that can be read by a game for easy rendering of fonts. These files can then be loaded into the cFont class by using the loadFromFile() method.
Constructor of class cFont.
chai3d::cFont::~cFont |
( |
| ) |
|
|
virtual |
Destructor of class cFont.
static cFontPtr chai3d::cFont::create |
( |
| ) |
|
|
inlinestatic |
bool chai3d::cFont::loadFromFile |
( |
const std::string & |
a_filename | ) |
|
This method loads a font from the specified file.
- Parameters
-
std::string chai3d::cFont::getFilename |
( |
| ) |
const |
|
inline |
double chai3d::cFont::getPointSize |
( |
| ) |
const |
|
inline |
double chai3d::cFont::getTextWidth |
( |
const std::string & |
a_text, |
|
|
const double |
a_letterSpacing |
|
) |
| |
This method computes the width of a string a_text
passed as argument.
- Parameters
-
a_text | Input string. |
a_letterSpacing | Letter spacing factor |
- Returns
- Width of input text.
double chai3d::cFont::getTextHeight |
( |
const std::string & |
a_text, |
|
|
const double |
a_lineSpacing |
|
) |
| |
This method returns the heigth of a particular string using this font.
- Parameters
-
a_text | Input string. |
a_lineSpacing | Line spacing. Default value if 1.0 |
- Returns
- Height of input text.
double chai3d::cFont::renderText |
( |
const std::string & |
a_text, |
|
|
const cColorf & |
a_color, |
|
|
const double |
a_fontScale, |
|
|
const double |
a_letterSpacing, |
|
|
const double |
a_lineSpacing, |
|
|
cRenderOptions & |
a_options |
|
) |
| |
This method renders a single string and returns its length.
- Parameters
-
a_text | String to be rendered. |
a_color | Font Color |
a_fontScale | Font scale factor |
a_letterSpacing | Spacing between letters |
a_lineSpacing | Spacing between lines |
a_options | Rendering options. |
- Returns
- Length of string.
void chai3d::cFont::parseFont |
( |
std::istream & |
a_stream, |
|
|
cFontCharset & |
a_charsetDesc |
|
) |
| |
|
protected |
This method parses a font from the specified stream.
- Parameters
-
a_stream | Font filename |
a_charsetDesc | Description of the new charset. |
void chai3d::cFont::cleanup |
( |
| ) |
|
|
protected |
This method cleans up all data structures.
cFontCharset chai3d::cFont::m_charset |
std::string chai3d::cFont::m_filename |
|
protected |
The documentation for this class was generated from the following files: