CanvasText
The CanvasText class is a specialized CanvasElement used to render text within a Canvas, supporting configurable properties such as font name, size, scale, style, color, and position. It enables precise control over text layout and appearance, allowing dynamic text updates and styling through the associated FontStyle. Text content can be set directly as a string, and rendering can be optimized using font batches for efficient processing. This class is ideal for displaying scalable, styled, and positioned text in a 2D or 3D canvas context.
#include <interface/TellusimCanvas.h>
Inheritance
- Inherits from CanvasElement
Constructors
CanvasText()
explicit CanvasText(Canvas &canvas)
CanvasText(Canvas &canvas, const char *text)
CanvasText(Canvas &canvas, const String &text)
Methods
Font name.
void setFontName(const char *name)
void setFontName(const String &name)
String getFontName() const
Font color.
void setFontColor(Color color)
const Color getFontColor() const
Font style.
bool setFontSize(uint32_t scale)
uint32_t getFontSize() const
bool setFontScale(uint32_t scale)
uint32_t getFontScale() const
bool setFontStyle(FontStyle style)
const FontStyle getFontStyleConst() const
const FontStyle getFontStyle() const
FontStyle getFontStyle()
Font position.
void setPosition(Vector3f position)
void setPosition(float32_t x, float32_t y, float32_t z = 0.0f)
const Vector3f getPosition() const
Font text.
void setText(const char *text)
void setText(const String &text)
String getText() const
Font batches.
void clearBatches()
void setBatches(Array<FontBatch> batches)
void setBatches(const FontBatch *batches, uint32_t num_batches)