|
| ~BackendFontFreetype () override |
| Destructor that cleans up the FreeType resources.
|
|
bool | loadFromMemory (std::unique_ptr< std::uint8_t[]> data, std::size_t sizeInBytes) override |
| Loads a font from memory.
|
|
TGUI_NODISCARD bool | hasGlyph (char32_t codePoint) const override |
| Returns whether a font contains a certain glyph.
|
|
TGUI_NODISCARD FontGlyph | getGlyph (char32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness=0) override |
| Retrieve a glyph of the font.
|
|
TGUI_NODISCARD float | getKerning (char32_t first, char32_t second, unsigned int characterSize, bool bold) override |
| Returns the kerning offset of two glyphs.
|
|
TGUI_NODISCARD float | getLineSpacing (unsigned int characterSize) override |
| Returns the line spacing.
|
|
TGUI_NODISCARD float | getFontHeight (unsigned int characterSize) override |
| Returns the height required to render a line of text.
|
|
TGUI_NODISCARD float | getAscent (unsigned int characterSize) override |
| Returns the maximum height of a glyph above the baseline.
|
|
TGUI_NODISCARD float | getDescent (unsigned int characterSize) override |
| Returns the maximum height of a glyph below the baseline.
|
|
TGUI_NODISCARD float | getUnderlinePosition (unsigned int characterSize) override |
| Get the position of the underline.
|
|
TGUI_NODISCARD float | getUnderlineThickness (unsigned int characterSize) override |
| Get the thickness of the underline.
|
|
TGUI_NODISCARD std::shared_ptr< BackendTexture > | getTexture (unsigned int characterSize, unsigned int &textureVersion) override |
| Returns the texture that is used to store glyphs of the given character size.
|
|
TGUI_NODISCARD Vector2u | getTextureSize (unsigned int characterSize) override |
| Returns the size of the texture that is used to store glyphs of the given character size.
|
|
void | setSmooth (bool smooth) override |
| Enable or disable the smooth filter.
|
|
void | setFontScale (float scale) override |
|
bool | loadFromMemory (const void *data, std::size_t sizeInBytes) |
| Loads a font from memory.
|
|
| BackendFont () |
| Default constructor.
|
|
| BackendFont (const BackendFont &) |
| Copy constructor.
|
|
| BackendFont (BackendFont &&other) noexcept |
| Move constructor.
|
|
virtual | ~BackendFont () |
| Virtual destructor.
|
|
BackendFont & | operator= (const BackendFont &other) |
| Copy assignment operator.
|
|
BackendFont & | operator= (BackendFont &&other) noexcept |
| Move assignment operator.
|
|
virtual bool | loadFromFile (const String &filename) |
| Loads a font from a file.
|
|
bool | loadFromMemory (const void *data, std::size_t sizeInBytes) |
| Loads a font from memory.
|
|
TGUI_NODISCARD bool | isSmooth () const |
| Tell whether the smooth filter is enabled or not.
|
|
TGUI_NODISCARD float | getFontScale () const |
| Returns the scale at which glyphs are rendered.
|
|
|
TGUI_NODISCARD Glyph | loadGlyph (char32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness) |
|
TGUI_NODISCARD Glyph | getInternalGlyph (char32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness) |
|
TGUI_NODISCARD UIntRect | findAvailableGlyphRect (unsigned int width, unsigned int height) |
|
bool | setCurrentSize (unsigned int characterSize) |
|
void | cleanup () |
|
TGUI_NODISCARD std::uint64_t | constructGlyphKey (char32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness) const |
| Creates a key for each unique character to render.
|
|
|
FT_Library | m_library = nullptr |
|
FT_Face | m_face = nullptr |
|
FT_Stroker | m_stroker = nullptr |
|
std::unordered_map< unsigned int, float > | m_cachedLineSpacing |
|
std::unordered_map< unsigned int, float > | m_cachedFontHeights |
|
std::unordered_map< unsigned int, float > | m_cachedAscents |
|
std::unordered_map< unsigned int, float > | m_cachedDescents |
|
std::unordered_map< std::uint64_t, Glyph > | m_glyphs |
|
unsigned int | m_nextRow = 3 |
| Y position of the next new row in the texture (first 2 rows contain pixels for underlining)
|
|
std::vector< Row > | m_rows |
|
std::unique_ptr< std::uint8_t[]> | m_fileContents |
|
std::unique_ptr< std::uint8_t[]> | m_pixels |
|
std::shared_ptr< BackendTexture > | m_texture |
|
unsigned int | m_textureSize = 0 |
|
unsigned int | m_textureVersion = 0 |
|
bool | m_isSmooth = true |
|
float | m_fontScale = 1 |
|
Font implementations that uses FreeType directly to load glyphs.
TGUI_NODISCARD float tgui::BackendFontFreetype::getKerning |
( |
char32_t | first, |
|
|
char32_t | second, |
|
|
unsigned int | characterSize, |
|
|
bool | bold ) |
|
overridevirtual |
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
Implements tgui::BackendFont.