29#include <TGUI/Font.hpp>
30#include <TGUI/Color.hpp>
31#include <TGUI/Vector2.hpp>
32#include <TGUI/TextStyle.hpp>
33#include <TGUI/RenderStates.hpp>
37TGUI_MODULE_EXPORT
namespace tgui
43 constexpr unsigned int AutoTextSize = 0xFFFFFFFF;
61 unsigned int characterSize;
139 TGUI_NODISCARD
static std::vector<std::vector<Blueprint>>
wordWrap(
float maxWidth,
const std::vector<std::vector<Blueprint>>& lines,
const Font& font);
170 Text& operator=(
Text&&) noexcept = default;
213 TGUI_NODISCARD const
String& getString() const;
222 void setCharacterSize(
unsigned int size);
231 TGUI_NODISCARD
unsigned int getCharacterSize() const;
249 TGUI_NODISCARD
Color getColor() const;
258 void setOpacity(
float opacity);
267 TGUI_NODISCARD
float getOpacity() const;
276 void setFont(const
Font& font);
285 TGUI_NODISCARD
Font getFont() const;
323 TGUI_NODISCARD
Color getOutlineColor() const;
331 void setOutlineThickness(
float thickness);
339 TGUI_NODISCARD
float getOutlineThickness() const;
354 TGUI_NODISCARD
Vector2f findCharacterPos(std::
size_t index) const;
362 TGUI_NODISCARD
float getExtraHorizontalPadding() const;
370 TGUI_NODISCARD
float getExtraHorizontalOffset() const;
376 TGUI_NODISCARD
float getLineHeight() const;
382 TGUI_NODISCARD
float getLineWidth() const;
389 TGUI_NODISCARD std::shared_ptr<
BackendText> getBackendText() const;
399 Color m_outlineColor;
Base class for text implementations that depend on the backend.
Definition BackendText.hpp:42
Wrapper for colors.
Definition Color.hpp:72
Wrapper around the backend-specific font. All copies of the font will share the same internal font re...
Definition Font.hpp:61
Wrapper class to store strings.
Definition String.hpp:101
Wrapper for text styles.
Definition TextStyle.hpp:57
Backend-independent wrapper around the backend-specific text class.
Definition Text.hpp:50
static TGUI_NODISCARD float getLineHeight(const Font &font, unsigned int characterSize)
Returns the height of a single line of text.
static TGUI_NODISCARD std::vector< std::vector< Blueprint > > wordWrap(float maxWidth, const std::vector< std::vector< Blueprint > > &lines, const Font &font)
static TGUI_NODISCARD float getLineWidth(const String &text, const Font &font, unsigned int characterSize, TextStyles textStyle={})
Returns the width of a single line of text.
static TGUI_NODISCARD String wordWrap(float maxWidth, const String &text, const Font &font, unsigned int textSize, bool bold)
Text()
Default constructor.
static TGUI_NODISCARD float getExtraVerticalPadding(unsigned int characterSize)
Returns the distance that text should be placed from the bottom of the widget as padding.
static TGUI_NODISCARD 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.
static TGUI_NODISCARD 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.
static TGUI_NODISCARD unsigned int findBestTextSize(const Font &font, float height, int fit=0)
Finds the best character size for the text.
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39
Describes a text piece, before turning it into an actual Text object.
Definition Text.hpp:60