A class implemented using the Facade pattern used for loading SDL TTF_Font data.
More...
#include <Font.hpp>
|
enum | hinting { h_normal = TTF_HINTING_NORMAL,
h_light = TTF_HINTING_LIGHT,
h_mono = TTF_HINTING_MONO,
h_none = TTF_HINTING_NONE
} |
| From SDL_ttf docs: Hinting Font hinting is the use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid. At small screen sizes, with or without antialiasing, hinting is critical for producing a clear, legible text for human readers. More...
|
|
enum | style {
normal = TTF_STYLE_NORMAL,
bold = TTF_STYLE_BOLD,
italic = TTF_STYLE_ITALIC,
underline = TTF_STYLE_UNDERLINE,
strikethrough = TTF_STYLE_STRIKETHROUGH
} |
| Set the style of the font. More...
|
|
A class implemented using the Facade pattern used for loading SDL TTF_Font data.
◆ hinting
From SDL_ttf docs: Hinting Font hinting is the use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid. At small screen sizes, with or without antialiasing, hinting is critical for producing a clear, legible text for human readers.
Enumerator |
---|
h_normal | |
h_light | |
h_mono | |
h_none | |
◆ style
Set the style of the font.
Enumerator |
---|
normal | |
bold | |
italic | |
underline | |
strikethrough | |
◆ Font()
◆ ~Font()
virtual pk::Font::~Font |
( |
| ) |
|
|
virtual |
◆ getFont()
TTF_Font * pk::Font::getFont |
( |
| ) |
|
|
inline |
Get a pointer to the TTF_Font data.
- Returns
- TTF_Font * - pointer to TTF_Font data.
◆ getHinting()
const Uint32 & pk::Font::getHinting |
( |
| ) |
|
|
inline |
Get the current hinting of the font.
- Returns
- Uint32 - a 32 bit unsigned integer corresponding to an integer mapped to Font::hinting.
◆ getOutline()
void pk::Font::getOutline |
( |
| ) |
|
|
inline |
Get the outline for the font (in pixels).
- Parameters
-
int | - a plain integer value for number of pixels for the outline. |
◆ getStyle()
const int & pk::Font::getStyle |
( |
| ) |
|
|
inline |
Get the current style of the font.
- Returns
- int - a plain integer corresponding to Font::style enum value(s).
◆ loadFont()
pk::Font::loadFont |
( |
char * |
file, |
|
|
int |
fontSize |
|
) |
| |
Load a font from a file.
- Parameters
-
const | char *file - a character constant path to a file |
int | fontSize - the size of the font in points. |
- Returns
- bool - true on success, false on failure.
◆ setFont()
void pk::Font::setFont |
( |
TTF_Font * |
font | ) |
|
|
inline |
Set the internal TTF_Font for the Font.
- Parameters
-
TTF_Font | *font - a pointer to a TTF_Font. |
◆ setFontSize()
void pk::Font::setFontSize |
( |
int |
s | ) |
|
Set the size for the font (in pixels).
- Parameters
-
int | s - a plain integer value for font size (in pixels). |
◆ setFontStyle()
void pk::Font::setFontStyle |
( |
int |
style | ) |
|
|
inline |
Set the style for the font. Use Font::style enum flags to combine styles.
- Parameters
-
int | style - a plain integer used as flag variable for font style. |
◆ setHinting()
void pk::Font::setHinting |
( |
Uint32 |
hinting | ) |
|
|
inline |
Set the hinting of the font (use Font::hinting enum to set valid values).
- Parameters
-
Uint32 | hinting - a 32 bit unsigned integer mapped to Font::hinting. |
◆ setKerning()
void pk::Font::setKerning |
( |
int |
allowed | ) |
|
|
inline |
Turn on/off font kerning (on by default).
◆ setOutline()
void pk::Font::setOutline |
( |
int |
outline | ) |
|
|
inline |
Set the outline for the font (in pixels).
- Parameters
-
int | outline - a plain integer value for number of pixels to outline by. |
◆ m_font
TTF_Font* pk::Font::m_font |
|
private |
Pointer to TTF_Font data - memory managed outside class.
◆ m_hinting
Uint32 pk::Font::m_hinting |
|
private |
◆ m_kerning
Kerning for the font (set to 1, or on, by default.
◆ m_outline
Font outline (set to 0, or off, by default).
◆ m_path
The path to the Font file.
◆ m_style
Font style (defaults to style::normal).
The documentation for this class was generated from the following file: