TextWidget
Abstract foundation widget for text rendering components supporting plain strings, RichText, fonts, colors, and gradients.
Overview
TextWidget serves as the base class for Label, Text, TextBlock, and RichTextView. It encapsulates font selection, font pixel size, plain text and RichText models, color gradients, and text layout measurement.
Configuring TextWidget
Label label = new Label("UniGUI")
.font(Fonts.TITLE, 18.0f)
.textGradient(Color.WHITE, Color.CYAN, 90.0f);
API
TextWidget::font(FontFace, float)
Set Font and Size
Configures font face and pixel size.
| Parameter | Type | Description |
|---|---|---|
font |
FontFace |
— |
pixelSize |
float |
— |
Returns TextWidget.
TextWidget::richText(RichText)
RichText Content
Returns or sets styled RichText model.
| Parameter | Type | Description |
|---|---|---|
richText |
RichText |
— |
Returns TextWidget.
TextWidget::text(String)
Text Content
Returns or sets plain string text content.
| Parameter | Type | Description |
|---|---|---|
text |
String |
— |
Returns TextWidget.
TextWidget::textBrush(TextBrush)
Set Text Brush
Applies custom TextBrush for special rendering effects.
| Parameter | Type | Description |
|---|---|---|
brush |
TextBrush |
— |
Returns TextWidget.
TextWidget::textGradient(ColorView, ColorView, float)
Set Text Gradient
Applies two-color linear gradient to rendered text glyphs.
| Parameter | Type | Description |
|---|---|---|
startColor |
ColorView |
— |
endColor |
ColorView |
— |
angleDegrees |
float |
— |
Returns TextWidget.