Wrapper around the backend-specific font. All copies of the font will share the same internal font resource.
More...
|
| Font (std::nullptr_t=nullptr) noexcept |
| Default constructor which will set the font to nullptr.
|
|
| Font (const String &id) |
| Constructor to create the font from a string (filename by default)
|
|
| Font (const char *id) |
| Constructor to create the font from a string (filename by default)
|
|
| Font (const void *data, std::size_t sizeInBytes) |
| Constructor to create the font from a byte array.
|
|
| Font (std::shared_ptr< BackendFont > backendFont, String id) |
| Constructor to create the font from an internal backend font.
|
|
const String & | getId () const |
| Returns the id that was used to load the font.
|
|
| operator bool () const |
| Converts the font to a boolean to check if it is a nullptr of not.
|
|
bool | operator== (std::nullptr_t) const |
| Compares the font with a nullptr.
|
|
bool | operator!= (std::nullptr_t) const |
| Compares the font with a nullptr.
|
|
bool | operator== (const Font &right) const |
| Compares the font with another one.
|
|
bool | operator!= (const Font &right) const |
| Compares the font with another one.
|
|
FontGlyph | getGlyph (char32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness=0) const |
| Retrieve a glyph of the font.
|
|
float | getKerning (char32_t first, char32_t second, unsigned int characterSize, bool bold=false) const |
| Returns the kerning offset of two glyphs.
|
|
float | getLineSpacing (unsigned int characterSize) const |
| Returns the line spacing.
|
|
float | getFontHeight (unsigned int characterSize) const |
| Returns the height required to render a line of text.
|
|
void | setSmooth (bool smooth) |
| Enable or disable the smooth filter.
|
|
bool | isSmooth () const |
| Tell whether the smooth filter is enabled or not.
|
|
std::shared_ptr< BackendFont > | getBackendFont () const |
| Returns the internal font.
|
|
Wrapper around the backend-specific font. All copies of the font will share the same internal font resource.
float tgui::Font::getKerning |
( |
char32_t | first, |
|
|
char32_t | second, |
|
|
unsigned int | characterSize, |
|
|
bool | bold = false ) const |
|
nodiscard |
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