A basic text.
More...
#include <gf/BasicText.h>
A basic text.
You should use gf::Text instead.
- See also
- gf::Text
◆ BasicText() [1/2]
gf::BasicText::BasicText |
( |
| ) |
|
Default constructor.
Creates an empty text.
◆ BasicText() [2/2]
gf::BasicText::BasicText |
( |
std::string |
string, |
|
|
Font & |
font, |
|
|
unsigned |
characterSize = 30 |
|
) |
| |
Construct the text from a string, font and size.
- Parameters
-
string | Text assigned to the string in UTF-8 format |
font | Font used to draw the string |
characterSize | Base size of characters, in pixels |
◆ getAlignment()
Alignment gf::BasicText::getAlignment |
( |
| ) |
const |
|
inline |
Get the alignment of the text.
- Returns
- Current alignment of the text
- See also
- setAlignment()
◆ getCharacterSize()
unsigned gf::BasicText::getCharacterSize |
( |
| ) |
const |
|
inline |
Get the character size.
- Returns
- Size of the characters, in pixels
- See also
- setCharacterSize()
◆ getFont()
const Font * gf::BasicText::getFont |
( |
| ) |
const |
|
inline |
Get the text's font.
If the text has no font attached, a nullptr
pointer is returned. The returned pointer is const, which means that you cannot modify the font when you get it from this function.
- Returns
- Pointer to the text's font
- See also
- setFont()
◆ getFontTexture()
◆ getLetterSpacing()
float gf::BasicText::getLetterSpacing |
( |
| ) |
const |
|
inline |
Get the size of the letter spacing factor.
- Returns
- The size of the letter spacing factor
- See also
- setLetterSpacing()
◆ getLineSpacing()
float gf::BasicText::getLineSpacing |
( |
| ) |
const |
|
inline |
Get the size of the line spacing factor.
- Returns
- The size of the line spacing factor
- See also
- setLineSpacing
◆ getLocalBounds()
RectF gf::BasicText::getLocalBounds |
( |
| ) |
const |
|
inline |
Get the local bounding rectangle of the entity.
The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
- Returns
- Local bounding rectangle of the entity
◆ getOutlineThickness()
float gf::BasicText::getOutlineThickness |
( |
| ) |
|
|
inline |
Get the outline thickness of the text.
- Returns
- Outline thickness of the text, in pixels
- See also
- setOutlineThickness()
◆ getParagraphWidth()
float gf::BasicText::getParagraphWidth |
( |
| ) |
const |
|
inline |
◆ getString()
const std::string & gf::BasicText::getString |
( |
| ) |
const |
|
inline |
Get the text's string.
The text string is in UTF-8 format.
- Returns
- Text's string
- See also
- setString()
◆ setAlignment()
void gf::BasicText::setAlignment |
( |
Alignment |
align | ) |
|
Set the alignement of the text.
By default, the text is not aligned.
- Parameters
-
- See also
- getAlignment()
◆ setCharacterSize()
void gf::BasicText::setCharacterSize |
( |
unsigned |
characterSize | ) |
|
Set the character size.
The default size is 30.
- Parameters
-
characterSize | New character size, in pixels |
- See also
- getCharacterSize()
◆ setFont()
void gf::BasicText::setFont |
( |
Font & |
font | ) |
|
Set the text's font.
The font
argument refers to a font that must exist as long as the text uses it. Indeed, the text doesn't store its own copy of the font, but rather keeps a pointer to the one that you passed to this function. If the font is destroyed and the text tries to use it, the behavior is undefined.
- Parameters
-
- See also
- getFont()
◆ setLetterSpacing()
void gf::BasicText::setLetterSpacing |
( |
float |
spacingFactor | ) |
|
Set the letter spacing factor.
The default spacing between letters is defined by the font. This factor doesn't directly apply to the existing spacing between each character, it rather adds a fixed space between them which is calculated from the font metrics and the character size. Note that factors below 1 (including negative numbers) bring characters closer to each other. By default the letter spacing factor is 1.
- Parameters
-
spacingFactor | New letter spacing factor |
- See also
- getLetterSpacing()
◆ setLineSpacing()
void gf::BasicText::setLineSpacing |
( |
float |
spacingFactor | ) |
|
Set the line spacing factor.
The default spacing between lines is defined by the font. This method enables you to set a factor for the spacing between lines. By default the line spacing factor is 1.
- Parameters
-
spacingFactor | New line spacing factor |
- See also
- getLineSpacing()
◆ setOutlineThickness()
void gf::BasicText::setOutlineThickness |
( |
float |
thickness | ) |
|
Set the thickness of the text's outline.
By default, the outline thickness is 0.
- Parameters
-
thickness | New outline thickness, in pixels |
- See also
- getOutlineThickness()
◆ setParagraphWidth()
void gf::BasicText::setParagraphWidth |
( |
float |
paragraphWidth | ) |
|
Set the paragraph width for aligned text.
By default, the paragraph width is 0.
- Parameters
-
paragraphWidth | New paragraph width in pixels |
- See also
- getParagraphWidth()
◆ setString()
void gf::BasicText::setString |
( |
std::string |
string | ) |
|
Set the text's string.
The text string is in UTF-8 format. A text's string is empty by default.
- Parameters
-
string | New string in UTF-8 format |
- See also
- getString()
◆ updateGeometry()