OpenXcom
1.0
Open-source clone of the original X-Com
|
Takes care of loading and storing each character in a sprite font. More...
#include <Font.h>
Public Member Functions | |
Font () | |
Creates a blank font. More... | |
~Font () | |
Cleans up the font. More... | |
void | load (const YAML::Node &node) |
Loads the font from YAML. More... | |
void | loadTerminal () |
Generate the terminal font. More... | |
void | init () |
Determines the size and position of each character in the font. More... | |
Surface * | getChar (wchar_t c) |
Gets a particular character from the font, with its real size. More... | |
int | getWidth () const |
Gets the font's character width. More... | |
int | getHeight () const |
Gets the font's character height. More... | |
int | getSpacing () const |
Gets the spacing between characters. More... | |
SDL_Rect | getCharSize (wchar_t c) |
Gets the size of a particular character;. More... | |
Surface * | getSurface () const |
Gets the font's surface. More... | |
Static Public Member Functions | |
static bool | isLinebreak (wchar_t c) |
Checks if a character is a linebreak. | |
static bool | isSpace (wchar_t c) |
Checks if a character is a blank space (includes non-breaking spaces). | |
static bool | isSeparator (wchar_t c) |
Checks if a character is a word separator. | |
static bool | isNonBreakableSpace (wchar_t c) |
Checks if a character is a non-breaking space. | |
static void | setIndex (const std::wstring &index) |
Sets the character index for every font. More... | |
Takes care of loading and storing each character in a sprite font.
Sprite fonts consist of a set of fixed-size characters all lined up in one column in a surface.
OpenXcom::Font::Font | ( | ) |
Creates a blank font.
Initializes the font with a blank surface.
OpenXcom::Font::~Font | ( | ) |
Cleans up the font.
Deletes the font's surface.
Surface * OpenXcom::Font::getChar | ( | wchar_t | c | ) |
Gets a particular character from the font, with its real size.
Returns a particular character from the set stored in the font.
c | Character to use for size/position. |
SDL_Rect OpenXcom::Font::getCharSize | ( | wchar_t | c | ) |
Gets the size of a particular character;.
Returns the dimensions of a particular character in the font.
c | Font character. |
int OpenXcom::Font::getHeight | ( | ) | const |
Gets the font's character height.
Returns the maximum height for any character in the font.
int OpenXcom::Font::getSpacing | ( | ) | const |
Gets the spacing between characters.
Returns the spacing for any character in the font.
Surface * OpenXcom::Font::getSurface | ( | ) | const |
Gets the font's surface.
Returns the surface stored within the font.
Used for loading the actual graphic into the font.
int OpenXcom::Font::getWidth | ( | ) | const |
Gets the font's character width.
Returns the maximum width for any character in the font.
void OpenXcom::Font::init | ( | ) |
Determines the size and position of each character in the font.
Calculates the real size and position of each character in the surface and stores them in SDL_Rect's for future use by other classes.
void OpenXcom::Font::load | ( | const YAML::Node & | node | ) |
Loads the font from YAML.
Loads the font from a YAML file.
node | YAML node. |
void OpenXcom::Font::loadTerminal | ( | ) |
Generate the terminal font.
Generates a pre-defined Codepage 437 (MS-DOS terminal) font.
|
static |
Sets the character index for every font.
Loads the characters contained in each font from a UTF-8 string to use as the index.
index | String of characters. |