A wrapper around SDL_ttf for allowing the use of TrueType fonts.
More...
#include <truetypefont.h>
|
| TrueTypeFont (const std::string &filename, int size, int style=0) |
| Constructor.
|
|
| ~TrueTypeFont () override |
|
const std::string & | filename () const |
|
int | pointSize () const |
|
int | style () const |
|
int | getWidth (const std::string &text) const override |
|
int | getHeight () const override |
|
int | getLineHeight () const |
| Returns the height of a line of text.
|
|
void | drawString (gcn::Graphics *graphics, const std::string &text, int x, int y) override |
|
void | drawString (Graphics *graphics, const std::string &text, int x, int y, const std::optional< gcn::Color > &outlineColor, const std::optional< gcn::Color > &shadowColor) |
| Extended version of drawString that allows for rendering text with outline and/or shadow.
|
|
A wrapper around SDL_ttf for allowing the use of TrueType fonts.
NOTE: This class initializes SDL_ttf as necessary.
Definition at line 42 of file truetypefont.h.
◆ TrueTypeFont()
TrueTypeFont::TrueTypeFont |
( |
const std::string & |
filename, |
|
|
int |
size, |
|
|
int |
style = 0 |
|
) |
| |
Constructor.
- Parameters
-
filename | Font filename. |
size | Font size. |
Definition at line 103 of file truetypefont.cpp.
◆ ~TrueTypeFont()
TrueTypeFont::~TrueTypeFont |
( |
| ) |
|
|
override |
◆ drawString() [1/2]
void TrueTypeFont::drawString |
( |
gcn::Graphics * |
graphics, |
|
|
const std::string & |
text, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
|
override |
◆ drawString() [2/2]
void TrueTypeFont::drawString |
( |
Graphics * |
graphics, |
|
|
const std::string & |
text, |
|
|
int |
x, |
|
|
int |
y, |
|
|
const std::optional< gcn::Color > & |
outlineColor, |
|
|
const std::optional< gcn::Color > & |
shadowColor |
|
) |
| |
Extended version of drawString that allows for rendering text with outline and/or shadow.
Definition at line 157 of file truetypefont.cpp.
◆ filename()
const std::string & TrueTypeFont::filename |
( |
| ) |
const |
|
inline |
◆ getChunk()
TextChunk & TrueTypeFont::getChunk |
( |
const std::string & |
text | ) |
const |
|
private |
◆ getHeight()
int TrueTypeFont::getHeight |
( |
| ) |
const |
|
override |
◆ getLineHeight()
int TrueTypeFont::getLineHeight |
( |
| ) |
const |
Returns the height of a line of text.
This is not the visual height as returned by getHeight() but the recommended spacing between lines of text.
Definition at line 233 of file truetypefont.cpp.
◆ getWidth()
int TrueTypeFont::getWidth |
( |
const std::string & |
text | ) |
const |
|
override |
◆ pointSize()
int TrueTypeFont::pointSize |
( |
| ) |
const |
|
inline |
◆ style()
int TrueTypeFont::style |
( |
| ) |
const |
|
inline |
◆ updateFontScale()
void TrueTypeFont::updateFontScale |
( |
float |
scale | ) |
|
|
static |
◆ mCache
◆ mFilename
const std::string TrueTypeFont::mFilename |
|
private |
◆ mFont
TTF_Font* TrueTypeFont::mFont = nullptr |
|
private |
◆ mFontOutline
TTF_Font* TrueTypeFont::mFontOutline = nullptr |
|
private |
◆ mFonts
◆ mPointSize
const int TrueTypeFont::mPointSize |
|
private |
◆ mScale
float TrueTypeFont::mScale = 1.0f |
|
staticprivate |
◆ mStyle
const int TrueTypeFont::mStyle |
|
private |
The documentation for this class was generated from the following files: