28#include <TGUI/Font.hpp>
29#include <TGUI/Color.hpp>
30#include <TGUI/Vector2.hpp>
31#include <TGUI/TextStyle.hpp>
32#include <TGUI/RenderStates.hpp>
36TGUI_MODULE_EXPORT
namespace tgui
42 constexpr unsigned int AutoTextSize = 0xFFFFFFFF;
59 unsigned int characterSize;
128 TGUI_NODISCARD
static std::vector<std::vector<Blueprint>>
wordWrap(
float maxWidth,
const std::vector<std::vector<Blueprint>>& lines,
const Font& font);
156 Text& operator=(
Text&&) noexcept = default;
345 Color m_outlineColor;
Base class for text implementations that depend on the backend.
Definition BackendText.hpp:41
Wrapper for colors.
Definition Color.hpp:73
Wrapper around the backend-specific font. All copies of the font will share the same internal font re...
Definition Font.hpp:58
Wrapper class to store strings.
Definition String.hpp:96
Wrapper for text styles.
Definition TextStyle.hpp:55
Vector2f getPosition() const
Returns the position of the text.
float getOutlineThickness() const
Returns the text outline thickness.
void setCharacterSize(unsigned int size)
Changes the character size of the text.
Color getColor() const
Returns the text fill color.
Font getFont() const
Returns the font of the text.
void setColor(Color color)
Changes the text fill color.
void setOutlineThickness(float thickness)
Changes the text outline thickness.
void setPosition(Vector2f position)
Sets the position of the text.
static float getExtraHorizontalOffset(const Font &font, unsigned int characterSize)
Returns an extra distance that text should be placed from the side of a widget as padding.
TextStyles getStyle() const
Returns the style of the text.
static float getLineWidth(const String &text, const Font &font, unsigned int characterSize, TextStyles textStyle={})
Returns the width of a single line of text.
Text()
Default constructor.
static float getExtraVerticalPadding(unsigned int characterSize)
Returns the distance that text should be placed from the bottom of the widget as padding.
static float getLineHeight(const Font &font, unsigned int characterSize)
Returns the height of a single line of text.
unsigned int getCharacterSize() const
Returns the character size of the text.
void setString(const String &string)
Changes the text.
static std::vector< std::vector< Blueprint > > wordWrap(float maxWidth, const std::vector< std::vector< Blueprint > > &lines, const Font &font)
static String wordWrap(float maxWidth, const String &text, const Font &font, unsigned int textSize, bool bold)
static float getExtraHorizontalPadding(const Font &font, unsigned int characterSize)
Returns a small distance that text should be placed from the side of a widget as padding.
const String & getString() const
Returns the text.
void setOutlineColor(Color color)
Changes the text outline color.
void setFont(const Font &font)
Changes the font used for the text.
Vector2f findCharacterPos(std::size_t index) const
Return the position of the index-th character.
Color getOutlineColor() const
Returns the text outline color.
Vector2f getSize() const
Returns the size of the text.
static unsigned int findBestTextSize(const Font &font, float height, int fit=0)
Finds the best character size for the text.
float getOpacity() const
Returns the opacity of the text.
void setOpacity(float opacity)
Changes the opacity of the text.
std::shared_ptr< BackendText > getBackendText() const
Returns the internal text.
void setStyle(TextStyles style)
Changes the style of the text.
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
Describes a text piece, before turning it into an actual Text object.
Definition Text.hpp:58