Component.Text namespace handles text processing, macro encoding/decoding, and localization in FFXIV.
Overview
The text system provides:- Macro encoding/decoding - SeString format processing
- Localization - Multi-language text support
- Text formatting - Parameter substitution and sheet values
- Text checking - Validation and filtering
TextModule
Main text processing module.Structure
Formatting Strings
Formatting Sheet Values
MacroEncoder
Encodes text into FFXIV’s macro/SeString format.Structure
Encoding Text
Encoding Parameters
Macro Code Description
Describes macro code structure:Parameter Types
Parameter type codes:n/N- Numerics/S- Stringx- Null byte/terminator.- Auto-detect (string/number/conditional)*- Repeat last param type
Getting Macro Info
MacroDecoder
Decodes FFXIV’s macro/SeString format into readable text.Purpose
Converts encoded SeString bytes into:- Plain text
- Macro expressions
- Parameter values
- Conditional logic
TextParameter
Represents a parameter in text formatting.Structure
Parameter Types
Creating Parameters
Localize
Handles localization and language-specific text.Structure
Purpose
Provides:- Language selection
- Text lookup by language
- Fallback handling
- Character encoding
TextChecker
Validates and filters text input.Purpose
Checks text for:- Prohibited words
- Invalid characters
- Length limits
- Format compliance
TextModuleInterface
Interface for accessing TextModule functionality.Structure
ReferencedUtf8String
Reference-counted UTF-8 string.Structure
Purpose
Provides:- Automatic memory management
- Reference counting
- Safe string sharing
Common Macros
Sheet References
Conditionals
Player Parameters
Colors
Links
Example: Encoding a Message
Example: Formatting with Parameters
Example: Reading Localized Text
SeString Format
FFXIV uses SeString (Server String) format:- Binary encoded text
- Embedded macros and commands
- Payload-based structure
- Type-length-value encoding
Structure
Common Payloads
- 0x13 - UI foreground color
- 0x14 - UI glow color
- 0x19 - Emphasis (italics)
- 0x1A - Emphasis end
- 0x27 - Click handler (links)
- 0x48 - Text/String
- 0x49 - Integer
Best Practices
- Cache TextModule: Get instance once, reuse it
- Handle errors: Check EncoderError after encoding
- Set language: Configure ClientLanguage before encoding
- Clean up: Dispose Utf8String instances properly
- Validate macros: Ensure correct parameter counts
Performance Tips
- Batch operations: Format multiple strings together
- Reuse buffers: Reuse Utf8String output buffers
- Avoid encoding: Use pre-encoded strings when possible
- Cache parameters: Reuse TextParameter collections
Common Pitfalls
- Missing language: Not setting ClientLanguage
- Invalid syntax: Incorrect macro format
- Wrong param count: Macro expects different parameter count
- Unclosed tags: Missing closing tags in conditionals
- Memory leaks: Not disposing Utf8String instances
See Also
- Component.Excel - Excel sheet data access
- Component.GUI - UI text display
- Dalamud.Game.Text.SeStringHandling - External SeString library