Loading...
Searching...
No Matches
Text.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef SFML_TEXT_H
26#define SFML_TEXT_H
27
29// Headers
32#include <SFML/Graphics/Color.h>
33#include <SFML/Graphics/Rect.h>
34#include <SFML/Graphics/Types.h>
36#include <SFML/System/Vector2.h>
37#include <stddef.h>
38
39
43typedef enum
44{
46 sfTextBold = 1 << 0,
47 sfTextItalic = 1 << 1,
49 sfTextStrikeThrough = 1 << 3
51
52
60
70
78
91
104
117
133
143
155
165
175
187
198CSFML_GRAPHICS_API void sfText_rotate(sfText* text, float angle);
199
211
221
231
241CSFML_GRAPHICS_API void sfText_setString(sfText* text, const char* string);
242
251
267
277CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size);
278
292CSFML_GRAPHICS_API void sfText_setLineSpacing(sfText* text, float spacingFactor);
293
312CSFML_GRAPHICS_API void sfText_setLetterSpacing(sfText* text, float spacingFactor);
313
326
342
355
366
381
391
401
415
425
437
449
459
472
482
492
502
520
536
552
553
554#endif // SFML_TEXT_H
unsigned int sfUint32
Definition Config.h:176
#define CSFML_GRAPHICS_API
struct sfText sfText
struct sfFont sfFont
const sfFont * sfText_getFont(const sfText *text)
Get the font used by a text.
float sfText_getLetterSpacing(const sfText *text)
Get the size of the letter spacing factor.
sfTransform sfText_getInverseTransform(const sfText *text)
Get the inverse of the combined transform of a text.
void sfText_setColor(sfText *text, sfColor color)
Set the fill color of a text.
const char * sfText_getString(const sfText *text)
Get the string of a text (returns an ANSI string)
void sfText_setOutlineColor(sfText *text, sfColor color)
Set the outline color of the text.
const sfUint32 * sfText_getUnicodeString(const sfText *text)
Get the string of a text (returns a unicode string)
void sfText_scale(sfText *text, sfVector2f factors)
Scale a text.
void sfText_setCharacterSize(sfText *text, unsigned int size)
Set the character size of a text.
sfVector2f sfText_getPosition(const sfText *text)
Get the position of a text.
void sfText_setPosition(sfText *text, sfVector2f position)
Set the position of a text.
void sfText_setFont(sfText *text, const sfFont *font)
Set the font of a text.
sfFloatRect sfText_getLocalBounds(const sfText *text)
Get the local bounding rectangle of a text.
sfTextStyle
sfText styles
Definition Text.h:44
@ sfTextRegular
Regular characters, no style.
Definition Text.h:45
@ sfTextBold
Bold characters.
Definition Text.h:46
@ sfTextStrikeThrough
Strike through characters.
Definition Text.h:49
@ sfTextUnderlined
Underlined characters.
Definition Text.h:48
@ sfTextItalic
Italic characters.
Definition Text.h:47
float sfText_getRotation(const sfText *text)
Get the orientation of a text.
sfUint32 sfText_getStyle(const sfText *text)
Get the style of a text.
sfColor sfText_getColor(const sfText *text)
Get the fill color of a text.
float sfText_getOutlineThickness(const sfText *text)
Get the outline thickness of a text.
void sfText_move(sfText *text, sfVector2f offset)
Move a text by a given offset.
sfVector2f sfText_getScale(const sfText *text)
Get the current scale of a text.
void sfText_setLineSpacing(sfText *text, float spacingFactor)
Set the line spacing factor.
unsigned int sfText_getCharacterSize(const sfText *text)
Get the size of the characters of a text.
void sfText_setString(sfText *text, const char *string)
Set the string of a text (from an ANSI string)
sfColor sfText_getOutlineColor(const sfText *text)
Get the outline color of a text.
sfColor sfText_getFillColor(const sfText *text)
Get the fill color of a text.
void sfText_setScale(sfText *text, sfVector2f scale)
Set the scale factors of a text.
void sfText_setRotation(sfText *text, float angle)
Set the orientation of a text.
float sfText_getLineSpacing(const sfText *text)
Get the size of the line spacing factor.
void sfText_setStyle(sfText *text, sfUint32 style)
Set the style of a text.
sfVector2f sfText_findCharacterPos(const sfText *text, size_t index)
Return the position of the index-th character in a text.
void sfText_setOrigin(sfText *text, sfVector2f origin)
Set the local origin of a text.
void sfText_rotate(sfText *text, float angle)
Rotate a text.
sfVector2f sfText_getOrigin(const sfText *text)
Get the local origin of a text.
void sfText_setLetterSpacing(sfText *text, float spacingFactor)
Set the letter spacing factor.
void sfText_setFillColor(sfText *text, sfColor color)
Set the fill color of a text.
sfFloatRect sfText_getGlobalBounds(const sfText *text)
Get the global bounding rectangle of a text.
void sfText_setOutlineThickness(sfText *text, float thickness)
Set the thickness of the text's outline.
sfText * sfText_create(void)
Create a new text.
sfText * sfText_copy(const sfText *text)
Copy an existing text.
sfTransform sfText_getTransform(const sfText *text)
Get the combined transform of a text.
void sfText_setUnicodeString(sfText *text, const sfUint32 *string)
Set the string of a text (from a unicode string)
void sfText_destroy(sfText *text)
Destroy an existing text.
Utility class for manpulating RGBA colors.
Definition Color.h:39
sfFloatRect and sfIntRect are utility classes for manipulating rectangles.
Definition Rect.h:41
Encapsulate a 3x3 transform matrix.
Definition Transform.h:43
2-component vector of floats
Definition Vector2.h:61