GameKit
0.0.1a
C++ gamedev tools
|
Class for loading and manipulating character fonts. More...
#include <Font.hpp>
Public Member Functions | |
Font ()=default | |
Default constructor. More... | |
Font (const std::string &filename) | |
Construct the font from a file. More... | |
void | loadFromFile (const std::string &filename) |
Load the font from a file. More... | |
void | setFontKerning (int kerning) |
Set font kerning. More... | |
void | setFontHinting (int hinting) |
Set font hinting. More... | |
void | setFontOutline (int outline) |
Set font outline. More... | |
void | loadFont (int ptsize) const |
Load a new font size into this font. More... | |
TTF_Font * | getFont (int ptsize) const |
Get the SDL font for a specific font size. More... | |
Private Types | |
using | TTF_FontPtr = std::unique_ptr< TTF_Font, decltype(&TTF_CloseFont)> |
Private Member Functions | |
void | update () |
Update kerning, hinting and outline of all font sizes. More... | |
Private Attributes | |
std::string | m_filename |
Font filename. More... | |
int | m_kerning = 1 |
Kerning value. More... | |
int | m_hinting = TTF_HINTING_NORMAL |
Hinting value. More... | |
int | m_outline = 0 |
Outline value. More... | |
std::unordered_map< int, TTF_FontPtr > | m_fonts |
SDL font container. More... | |
Additional Inherited Members | |
![]() | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
const NonCopyable & | operator= (const NonCopyable &)=delete |
Class for loading and manipulating character fonts.
gk::Font is a class that allows loading a font from a file.
This class can't display anything on its own and has to be used with gk::Text.
/warning Each different font size will result in another SDL object loaded, please avoid using a lot of different sizes for the same font.
|
private |
|
default |
Default constructor.
This constructor defines an empty font
|
inline |
TTF_Font * gk::Font::getFont | ( | int | ptsize | ) | const |
void gk::Font::loadFont | ( | int | ptsize | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
mutableprivate |
|
private |