Skip to content
Version 2.32.0
↓ Get the launcher

TextElement record

Themed text. Color Func null (or returns null) = framework default; a Func lets colour animate per-refresh (e.g. delta-flash). Width > 0 fixes the cell width (the text wraps within it) — use to form aligned columns (e.g. a plugin-name column so the version after it starts at a consistent x). Align sets horizontal alignment (Right for numeric columns). Shadow draws a dark outline behind the glyphs — for chrome-less overlays (a borderless HUD with no background) where light text must stay legible over arbitrary world backgrounds. ShadowDistance controls the pixel offset of the shadow (default 1). Increase for large font sizes where a 1-pixel shadow is invisible. NoWrap keeps the text on a single line (any overflow spills/clips at the cell edge rather than wrapping to multiple lines) — use in a fixed-width pane where a long label (e.g. a map name) must read as one row, not a 5-line block.

public record TextElement : IEquatable<HudElement>
name description
TextElement(…) Themed text. Color Func null (or returns null) = framework default; a Func lets colour animate per-refresh (e.g. delta-flash). Width > 0 fixes the cell width (the text wraps within it) — use to form aligned columns (e.g. a plugin-name column so the version after it starts at a consistent x). Align sets horizontal alignment (Right for numeric columns). Shadow draws a dark outline behind the glyphs — for chrome-less overlays (a borderless HUD with no background) where light text must stay legible over arbitrary world backgrounds. ShadowDistance controls the pixel offset of the shadow (default 1). Increase for large font sizes where a 1-pixel shadow is invisible. NoWrap keeps the text on a single line (any overflow spills/clips at the cell edge rather than wrapping to multiple lines) — use in a fixed-width pane where a long label (e.g. a map name) must read as one row, not a 5-line block. (3 constructors)
Align { get; set; }
Bold { get; set; } Render in real bold weight — a designed bold FACE in every script (Latin, Thai, CJK, …), never Unity’s synthetic bold. Window surfaces only (HUD-overlay text ignores the style flags). Emphasis already implies bold at header size; use this for bold at normal size.
CenterGlyphs { get; set; } Vertically centre what is actually DRAWN (the glyphs’ / emoji pictures’ own bounds) in the text’s box, instead of the font’s line box. For icon-only texts — typically a lone RichEmoji<sprite=N> used as a button or grid icon: an emoji sits on the text baseline, so with the default line-box centring it draws visibly ABOVE the middle of its box. Scales with any font size (no fixed offset). Leave it off for running text, where letters and inline emoji must share one baseline. Applies to the TextMeshPro path (styled / RichEmoji text); ignored on plain, Shadow and HUD-overlay text. Default false = unchanged. An init property (binary-compatible).
Color { get; set; }
DynamicFontSize { get; set; } When non-null, overrides FontSize and is re-evaluated each HUD refresh. Use with ScreenHeight to scale text with screen resolution: DynamicFontSize = () => services.Framework.ScreenHeight / 19.
Ellipsize { get; set; } Keep the text on ONE line and, when it is wider than the space the layout gives it, cut it with a trailing “…” so it fits — re-fitted whenever the string or the laid-out width changes (e.g. the window is resized). Use it in a width-constrained slot, typically a CellElement with a Weight in a RowElement next to fixed-width controls: the cell’s width is what the text is fitted to, and nothing spills onto the neighbours. Plain text is cut with “…” and clipped to its rect; styled (Emphasis/Bold/…) and RichEmoji text uses TextMeshPro’s own ellipsis (a hard cut if the face lacks the glyph). Ignored on Shadow and HUD-overlay text. Default false = unchanged. An init property (binary-compatible).
Emphasis { get; set; }
FontSize { get; set; }
Height { get; set; } A hard-fixed text box height in px (framework 2.30.0): the element reports exactly this as its min and preferred height, so it never grows (or shrinks) its row / column whatever its font’s line box measures, and the lines are drawn vertically centred in it (a one-line string sits in the middle of a two-line slot). Content taller than the box overflows it rather than resizing it, so pair it with MaxLines. First user: the launcher tile’s two-line name slot, which grew a tile 4–5 px when a name wrapped. 0 (the default) = the text’s own height, unchanged. Window (Menu) text only. An init property (binary-compatible).
Italic { get; set; } Slant the glyphs (synthetic italic — safe in every script). Window surfaces only.
MaxLines { get; set; } Cap wrapped text at this many lines (framework 2.30.0). When the text wraps to more lines than this at its laid-out width, it shows exactly MaxLines lines and the last one ends in “…” (a cut the framework makes itself, re-fitted when the string, the font size or the width changes). The text always wraps when this is set: NoWrap and Ellipsize are ignored (MaxLines = 1 is the one-line cut). Lines break only at spaces, after hyphens and between CJK characters — never inside a word: a single word wider than the line is cut with “…” on its own line (“CombatMet…”), not split across two lines. Give it a width-constrained slot — a fixed Width or a CellElement — since the cut fits the width the layout hands it. Works with every Align, on plain and styled (Bold/Emphasis/…) text; ignored on Shadow and HUD-overlay text. The element is only as tall as the lines it shows (a one-line string stays one line tall). 0 (the default) = unlimited, unchanged. An init property (binary-compatible).
NoWrap { get; set; }
RichEmoji { get; set; } Render <sprite=N> inline emoji (the game chat’s 1-based N, passed through unchanged) as actual emoji images, by hosting the text in TextMeshPro with rich text on and the GAME’s own chat sprite asset — the same way the game draws chat emoji. Opt-in and additive: off (the default) nothing changes. The text then uses the framework’s TMP faces (as the Bold/Italic/… styles do), and those style flags still apply. Falls back to a plain uGUI Text off-game (Mono sandbox) or if TMP is unavailable — worst case the literal <sprite=N> shows, so text rendering can never break; the literal tag also shows until the game’s sprite asset has been found (resolved lazily once in-world). Window surfaces only; ignored on HUD-overlay and on Shadow text.
Shadow { get; set; }
ShadowDistance { get; set; }
Strikethrough { get; set; } Draw a line through the text (works in every script). Window surfaces only.
Text { get; set; }
Underline { get; set; } Draw an underline beneath the text (works in every script). Window surfaces only.
Width { get; set; }