25#ifndef TGUI_BACKEND_FONT_SFML_HPP
26#define TGUI_BACKEND_FONT_SFML_HPP
28#include <SFML/Graphics/Font.hpp>
30#include <TGUI/Config.hpp>
31#if !TGUI_BUILD_AS_CXX_MODULE
32 #include <TGUI/Backend/Font/BackendFont.hpp>
35#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
36 #include <unordered_set>
43TGUI_MODULE_EXPORT
namespace tgui
60 bool loadFromMemory(std::unique_ptr<std::uint8_t[]> data, std::size_t sizeInBytes)
override;
61 using BackendFont::loadFromMemory;
70 TGUI_NODISCARD
bool hasGlyph(
char32_t codePoint)
const override;
85 TGUI_NODISCARD
FontGlyph getGlyph(
char32_t codePoint,
unsigned int characterSize,
bool bold,
float outlineThickness = 0)
override;
101 TGUI_NODISCARD
float getKerning(
char32_t first,
char32_t second,
unsigned int characterSize,
bool bold)
override;
130 TGUI_NODISCARD
float getAscent(
unsigned int characterSize)
override;
139 TGUI_NODISCARD
float getDescent(
unsigned int characterSize)
override;
171 TGUI_NODISCARD std::shared_ptr<BackendTexture>
getTexture(
unsigned int characterSize,
unsigned int& textureVersion)
override;
200 void setFontScale(
float scale)
override;
207 TGUI_NODISCARD sf::Font* getInternalFont();
212 std::unique_ptr<sf::Font> m_font;
213 std::unique_ptr<std::uint8_t[]> m_fileContents;
215 std::unordered_set<std::uint64_t> m_loadedGlyphKeys;
219 std::map<unsigned int, std::shared_ptr<BackendTexture>> m_textures;
220 std::map<unsigned int, unsigned int> m_textureVersions;
Font implementation that makes use of SFML.
Definition BackendFontSFML.hpp:49
float getFontHeight(unsigned int characterSize) override
Returns the height required to render a line of text.
float getUnderlinePosition(unsigned int characterSize) override
Get the position of the underline.
bool hasGlyph(char32_t codePoint) const override
Returns whether a font contains a certain glyph.
FontGlyph getGlyph(char32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness=0) override
Retrieve a glyph of the font.
float getUnderlineThickness(unsigned int characterSize) override
Get the thickness of the underline.
bool loadFromMemory(std::unique_ptr< std::uint8_t[]> data, std::size_t sizeInBytes) override
Loads a font from memory.
void setSmooth(bool smooth) override
Enable or disable the smooth filter.
float getLineSpacing(unsigned int characterSize) override
Returns the line spacing.
float getKerning(char32_t first, char32_t second, unsigned int characterSize, bool bold) override
Returns the kerning offset of two glyphs.
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.
Vector2u getTextureSize(unsigned int characterSize) override
Returns the size of the texture that is used to store glyphs of the given character size.
float getDescent(unsigned int characterSize) override
Returns the maximum height of a glyph below the baseline.
float getAscent(unsigned int characterSize) override
Returns the maximum height of a glyph above the baseline.
Base class for font implementations that depend on the backend.
Definition BackendFont.hpp:45
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
Information about a glyph in the font.
Definition Font.hpp:48