26#ifndef TGUI_BACKEND_TEXT_HPP
27#define TGUI_BACKEND_TEXT_HPP
29#include <TGUI/Text.hpp>
31#include <TGUI/Backend/Font/BackendFont.hpp>
32#include <TGUI/Backend/Renderer/BackendTexture.hpp>
36TGUI_MODULE_EXPORT
namespace tgui
46 using TextVertexData = std::vector<std::pair<std::shared_ptr<BackendTexture>, std::shared_ptr<std::vector<Vertex>>>>;
150 virtual void setFont(
const std::shared_ptr<BackendFont>& font);
157 TGUI_NODISCARD std::shared_ptr<BackendFont>
getFont()
const;
180 void updateVertices();
187 const FontGlyph& glyph,
float fontScale,
float italicShear);
193 void addLine(std::vector<Vertex>& vertices,
float lineLength,
float lineTop,
const Vertex::Color& color,
194 float offset,
float thickness,
float outlineThickness,
float fontScale);
200 std::shared_ptr<BackendFont> m_font;
201 unsigned int m_lastFontTextureVersion = 0;
206 Color m_outlineColor;
207 float m_outlineThickness = 0;
211 std::shared_ptr<std::vector<Vertex>> m_vertices;
212 std::shared_ptr<std::vector<Vertex>> m_outlineVertices;
213 bool m_verticesNeedUpdate =
true;
Base class for text implementations that depend on the backend.
Definition BackendText.hpp:42
TGUI_NODISCARD float getOutlineThickness() const
Returns the text outline thickness.
virtual void setFont(const std::shared_ptr< BackendFont > &font)
Changes the font used by the text.
virtual void setOutlineThickness(float thickness)
Changes the thickness of the text outline.
TGUI_NODISCARD Color getOutlineColor() const
Returns the text outline color.
virtual void setStyle(TextStyles style)
Changes the text style.
virtual void setCharacterSize(unsigned int characterSize)
Sets the size of the characters.
TGUI_NODISCARD unsigned int getCharacterSize() const
Returns the character size of the text.
TGUI_NODISCARD std::shared_ptr< BackendFont > getFont() const
Returns the font of the text.
virtual TGUI_NODISCARD Vector2f findCharacterPos(std::size_t index) const
Returns the top-left position of the character at the provided index.
TGUI_NODISCARD Color getFillColor() const
Returns the text fill color.
virtual void setString(const String &string)
Changes the text.
virtual void setOutlineColor(const Color &color)
Changes the color of the text outline.
TGUI_NODISCARD TextVertexData getVertexData()
Returns the information that is needed to render this text.
virtual void setFillColor(const Color &color)
Changes the color of the text.
virtual TGUI_NODISCARD Vector2f getSize()
Returns the size of the text.
virtual ~BackendText()=default
Virtual destructor.
TGUI_NODISCARD const String & getString() const
Returns the text.
std::vector< std::pair< std::shared_ptr< BackendTexture >, std::shared_ptr< std::vector< Vertex > > > > TextVertexData
Type of the data that is passed to BackendRenderTarget where the actual rendering happens.
Definition BackendText.hpp:46
TGUI_NODISCARD TextStyles getStyle() const
Returns the style of the text.
Wrapper for colors.
Definition Color.hpp:72
Wrapper class to store strings.
Definition String.hpp:101
Wrapper for text styles.
Definition TextStyle.hpp:57
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39
TGUI_NODISCARD TGUI_API unsigned int getGlobalTextSize()
Retrieves the default text size used for all new widgets.
Information about a glyph in the font.
Definition Font.hpp:50