76#ifndef DOXYGEN_SHOULD_SKIP_THIS
79struct cFontCharDescriptor
82 int m_width, m_height;
83 int m_xOffset, m_yOffset;
87 double m_tu0, m_tu1, m_tu2, m_tu3;
88 double m_tv0, m_tv1, m_tv2, m_tv3;
89 double m_px0, m_px1, m_px2, m_px3;
90 double m_py0, m_py1, m_py2, m_py3;
114 unsigned int m_lineHeight;
116 unsigned int m_width, m_height;
117 unsigned int m_pages;
118 std::string m_fileName;
120 cFontCharDescriptor m_chars[256];
135 for (
int i=0; i<256; i++)
136 m_chars[i].initialize();
205 double getTextWidth(
const std::string& a_text,
const double a_letterSpacing);
208 double getTextHeight(
const std::string& a_text,
const double a_lineSpacing);
220 const double a_fontScale,
221 const double a_letterSpacing,
222 const double a_lineSpacing,
246 void parseFont(std::istream& a_stream, cFontCharset& a_charsetDesc);
Implements option settings for CHAI3D.
This class implements support for 2D fonts.
Definition CFont.h:165
static cFontPtr create()
Shared cFont allocator.
Definition CFont.h:179
cTexture2d * m_texture
Texture image containing the full bitmap representation of the font.
Definition CFont.h:233
double getTextHeight(const std::string &a_text, const double a_lineSpacing)
This method returns the heigth of a particular string using this font.
Definition CFont.cpp:434
bool loadFromFile(const std::string &a_filename)
This method loads a font file by passing a path and file name as argument.
Definition CFont.cpp:102
void parseFont(std::istream &a_stream, cFontCharset &a_charsetDesc)
This method parses a font file.
Definition CFont.cpp:175
void cleanup()
This method cleans all memory.
Definition CFont.cpp:87
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.
Definition CFont.cpp:275
std::string getFilename() const
This method returns the filename from which this font was last loaded or saved.
Definition CFont.h:192
double getTextWidth(const std::string &a_text, const double a_letterSpacing)
This method returns the width of a particular string using this font.
Definition CFont.cpp:393
cFont()
Constructor of cFont.
Definition CFont.cpp:61
cFontCharset m_charset
Information about each character in the set.
Definition CFont.h:236
std::string m_filename
Current font filename loaded into memory.
Definition CFont.h:259
double getPointSize() const
This method returns the current font size.
Definition CFont.h:202
virtual ~cFont()
Destructor of cFont.
Definition CFont.cpp:76
This class implements a 2D texture map.
Definition CTexture2d.h:85
Definition CAudioBuffer.cpp:57
std::shared_ptr< cFont > cFontPtr
Definition CFont.h:72
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83