Base class for font implementations that depend on the backend.
More...
#include <TGUI/BackendFont.hpp>
|
virtual | ~BackendFontBase ()=default |
| Virtual destructor.
|
|
virtual bool | loadFromFile (const String &filename)=0 |
| Loads a font from a file.
|
|
virtual bool | loadFromMemory (const void *data, std::size_t sizeInBytes)=0 |
| Loads a font from memory.
|
|
virtual FontGlyph | getGlyph (char32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness=0)=0 |
| Retrieve a glyph of the font.
|
|
virtual float | getKerning (char32_t first, char32_t second, unsigned int characterSize) |
| Returns the kerning offset of two glyphs.
|
|
virtual float | getKerning (char32_t first, char32_t second, unsigned int characterSize, bool bold)=0 |
| Returns the kerning offset of two glyphs.
|
|
virtual float | getLineSpacing (unsigned int characterSize)=0 |
| Returns the line spacing.
|
|
Base class for font implementations that depend on the backend.
◆ getGlyph()
virtual FontGlyph tgui::BackendFontBase::getGlyph |
( |
char32_t |
codePoint, |
|
|
unsigned int |
characterSize, |
|
|
bool |
bold, |
|
|
float |
outlineThickness = 0 |
|
) |
| |
|
pure virtual |
Retrieve a glyph of the font.
If the font is a bitmap font, not all character sizes might be available. If the glyph is not available at the requested size, an empty glyph is returned.
- Parameters
-
codePoint | Unicode code point of the character to get |
characterSize | Reference character size |
bold | Retrieve the bold version or the regular one? |
outlineThickness | Thickness of outline (when != 0 the glyph will not be filled) |
- Returns
- The glyph corresponding to codePoint and characterSize
◆ getKerning() [1/2]
virtual float tgui::BackendFontBase::getKerning |
( |
char32_t |
first, |
|
|
char32_t |
second, |
|
|
unsigned int |
characterSize |
|
) |
| |
|
inlinevirtual |
Returns the kerning offset of two glyphs.
The kerning is an extra offset (negative) to apply between two glyphs when rendering them, to make the pair look more "natural". For example, the pair "AV" have a special kerning to make them closer than other characters. Most of the glyphs pairs have a kerning offset of zero, though.
- Parameters
-
first | Unicode code point of the first character |
second | Unicode code point of the second character |
characterSize | Size of the characters |
- Returns
- Kerning value for first and second, in pixels
◆ getKerning() [2/2]
virtual float tgui::BackendFontBase::getKerning |
( |
char32_t |
first, |
|
|
char32_t |
second, |
|
|
unsigned int |
characterSize, |
|
|
bool |
bold |
|
) |
| |
|
pure virtual |
Returns the kerning offset of two glyphs.
The kerning is an extra offset (negative) to apply between two glyphs when rendering them, to make the pair look more "natural". For example, the pair "AV" have a special kerning to make them closer than other characters. Most of the glyphs pairs have a kerning offset of zero, though.
- Parameters
-
first | Unicode code point of the first character |
second | Unicode code point of the second character |
characterSize | Size of the characters |
bold | Are the glyphs bold or regular? |
- Returns
- Kerning value for first and second, in pixels
◆ getLineSpacing()
virtual float tgui::BackendFontBase::getLineSpacing |
( |
unsigned int |
characterSize | ) |
|
|
pure virtual |
Returns the line spacing.
Line spacing is the vertical offset to apply between two consecutive lines of text.
- Parameters
-
characterSize | Size of the characters |
- Returns
- Line spacing, in pixels
◆ loadFromFile()
virtual bool tgui::BackendFontBase::loadFromFile |
( |
const String & |
filename | ) |
|
|
pure virtual |
Loads a font from a file.
- Parameters
-
filename | Filename of the font to load |
- Returns
- True if the font was loaded successfully, false otherwise
◆ loadFromMemory()
virtual bool tgui::BackendFontBase::loadFromMemory |
( |
const void * |
data, |
|
|
std::size_t |
sizeInBytes |
|
) |
| |
|
pure virtual |
Loads a font from memory.
- Parameters
-
data | Pointer to the file data in memory |
sizeInBytes | Size of the data to load, in bytes |
- Returns
- True if the font was loaded successfully, false otherwise
The documentation for this class was generated from the following file: