-
Notifications
You must be signed in to change notification settings - Fork 0
Ui XML Text
Ui XML Reference\Text
A text frame, displays simple text. This frame type has a default size of 0 and expands to fit its text.
<Text text="Text Frame" />
This XML produces the following UI:
A text frame
Value type: string
Supports data binding
<Text text="Text Frame" />
Value type: string
Supports data binding
The expression for the text in the text frame. Data bound values can be formatted to specific decimal values by appending the expression such as :F2
.
(You can find more documentation here). DreamEditor also provides an additional specifier :K
to format huge numbers as "xxxK", "xxxM" or "xxxB". The default parameter for :K
is :K2
. When binding units or data, make sure to bind the data before creating the xml frame in lua. When binding units, the following properties are supported:
unit.Info.Icon
unit.Info.Name
unit.Health.Current
unit.Health.Max
unit.Health.Percentage
unit.Health.Fraction
unit.Health.Regeneration
unit.Shield.Current
unit.Shield.Max
unit.Shield.Percentage
unit.Shield.Fraction
unit.Shield.Regeneration
unit.Mana.Current
unit.Mana.Max
unit.Mana.Percentage
unit.Mana.Fraction
unit.Mana.Regeneration
unit.Ability.ability_name.CooldownRatio
unit.Ability.ability_name.MaxCharge
unit.Ability.ability_name.ChargeCount
unit.Expression.some_named_expression
<Text textExpression="{data.text}" />
Where {data.text}
is declared and bound in lua before the text frame is created:
local data = {text = "Text Frame"}
DCEI.BindData("data", data)
local xml = DCEI.NewUiFromXml(DCEI.GetUiRoot(), "text")
Value type: string
Supports data binding
The translation key for the text frame. This uses a translation key declared in the data editor (Localization tab) to display text across different languages.
<Text translationKey="key" />
Value type: number
Supports data binding
The font size for the text frame.
<Text text="Text Frame" fontSize="40" />
Value type: number
Supports data binding
The minimum font size for the text frame. Does not work if there is a set font size.
<Text text="Text Frame" fontSizeMin="40" />
Value type: number
Supports data binding
The maximum font size for the text frame. Does not work if there is a set font size.
<Text text="Text Frame" fontSizeMax="60" />
Value type: color
The font color for the text frame.
<Text text="Text Frame" fontSize="40" color="r: 1, g: 0, b: 0, a: 1" />
Value type: boolean
Supports data binding
The status of the text outline for the text frame, where true
means the outline is enabled. This is true by default.
<Text text="Text Frame" fontSize="40" outline="false" />
Value type: boolean
Supports data binding
The status of the text shadow for the text frame, where true
means the shadow is enabled. This is true by default, disabling the text shadow will also disable the outline (even if otherwise enabled with outline="true"
).
<Text text="Text Frame" fontSize="40" shadow="false" />
Value type: boolean
Supports data binding
The status of the text wrapping for the text frame, where true
means the wrapping is enabled. Wrapping will make the text automatically create new lines if the text would overflow the size of the frame; disabling text wrapping will force the text to display on one line. This is true by default, disabling text wrapping will cause the text to overflow if it is enabled.
<Frame backgroundImageColor="r: 0, g: 0, b: 0, a: 0.6">
<Text width="150" text="Text Frame" fontSize="40" wrapping="false" />
</Frame>
Value type: boolean
Supports data binding
The status of the text RTL support (right to left text) for the text frame, where true
means RTL support is enabled. This property is for text that is written right to left, such as Arabic.
<Text rtlSupport="true" />
Value type: string
Supports data binding
The alignment of the text inside the text frame. Possible values:
start, end, top, bottom, (top|bottom)-(start|end)
<Frame backgroundImageColor="r: 0, g: 0, b: 0, a: 0.6">
<Text width="400" text="Text Frame" fontSize="40" alignment="end" />
</Frame>
Value type: boolean
Supports data binding
The status of the text overflow for the text frame, where true
means the text will overflow the frame. This is true by default. Text will only overflow if it exceeds the height and width for the text frame. If the text size would exceed the frame size in both height and width, then no text will be displayed at all.
<Frame backgroundImageColor="r: 0, g: 0, b: 0, a: 0.6">
<Text height="40" width="150" text="Text Frame" fontSize="40" overflow="false" />
</Frame>
Value type: boolean
Supports data binding
The status of the frame outline for the text frame, where true
means the outline will be shown. This is false by default.
<Text text="Text Frame" fontSize="40" outsideOutline="true" />
Value type: color
The text outline color for the text frame.
<Text text="Text Frame" fontSize="40" outlineColor="r: 1, g: 0, b: 0, a: 1" />
Value type: number
The text outline width for the text frame, scaled from 0-1. A value of -1 will disable the outline.
<Text text="Text Frame" fontSize="40" outlineColor="r: 1, g: 0, b: 0, a: 1" outlineWidth="0.5" />
Value type: number
The text outline softness for the text frame, scaled from 0-1.
<Text text="Text Frame" fontSize="40" outlineColor="r: 1, g: 0, b: 0, a: 1" outlineSoftness="0.3" />
Value type: number
The text shadow width for the text frame, scaled from 0-1. A value of -1 will remove the shadow without removing the outline.
<Text text="Text Frame" fontSize="40" outlineColor="r: 1, g: 0, b: 0, a: 1" shadowWidth="-1" />
Value type: number
The text shadow softness for the text frame, scaled from 0-1.
<Text text="Text Frame" fontSize="40" outline="false" shadowSoftness="0.3" />
Value type: color
The text shadow color for the text frame.
<Text text="Text Frame" fontSize="40" shadowColor="r: 1, g: 0, b: 0, a: 1" outline="false" />
Value type: vector2
The text shadow direction for the text frame. The coordinate's direction is based on the unit circle. The default direction is (0, -1).
<Text text="Text Frame" fontSize="40" outline="false" shadowDirection="x: 1, y: 1" />