25 #include <yaml-cpp/yaml.h> 35 int width, height, spacing;
48 std::vector<FontImage> _images;
49 std::map< wchar_t, std::pair<size_t, SDL_Rect> > _chars;
52 void init(
size_t index,
const std::wstring &str);
59 static inline bool isLinebreak(
wchar_t c) {
return (c == L
'\n' || c == L
'\x02'); }
61 static inline bool isSpace(
wchar_t c) {
return (c == L
' ' || c == L
'\xA0'); }
63 static inline bool isSeparator(
wchar_t c) {
return (c == L
'-' || c ==
'/'); }
67 void load(
const YAML::Node& node);
83 void setPalette(SDL_Color *colors,
int firstcolor,
int ncolors);
static bool isNonBreakableSpace(wchar_t c)
Checks if a character is a non-breaking space.
Definition: Font.h:65
void setPalette(SDL_Color *colors, int firstcolor, int ncolors)
Sets the font's palette.
Definition: Font.cpp:255
~Font()
Cleans up the font.
Definition: Font.cpp:38
static bool isSeparator(wchar_t c)
Checks if a character is a word separator.
Definition: Font.h:63
int getHeight() const
Gets the font's character height.
Definition: Font.cpp:194
static bool isSpace(wchar_t c)
Checks if a character is a blank space (includes non-breaking spaces).
Definition: Font.h:61
static bool isLinebreak(wchar_t c)
Checks if a character is a linebreak.
Definition: Font.h:59
SDL_Color * getPalette() const
Gets the font's palette.
Definition: Font.cpp:244
void loadTerminal()
Generate the terminal font.
Definition: Font.cpp:74
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:45
Surface * getChar(wchar_t c)
Gets a particular character from the font, with its real size.
Definition: Font.cpp:170
int getWidth() const
Gets the font's character width.
Definition: Font.cpp:185
SDL_Rect getCharSize(wchar_t c)
Gets the size of a particular character;.
Definition: Font.cpp:215
Element that is blit (rendered) onto the screen.
Definition: Surface.h:36
int getSpacing() const
Gets the spacing between characters.
Definition: Font.cpp:205
Font()
Creates a blank font.
Definition: Font.cpp:31
void load(const YAML::Node &node)
Loads the font from YAML.
Definition: Font.cpp:50
Definition: BaseInfoState.cpp:40