pixi-jsFunctions
Function: ensureTextOptions()
> ensureTextOptions<TEXT_OPTIONS>(args, name): TEXT_OPTIONS
Defined in: node_modules/pixi.js/lib/scene/text/AbstractText.d.ts:507
Internal
Helper function to ensure consistent handling of text options across different text classes. This function handles both the new options object format and the deprecated parameter format.
Type Parameters
TEXT_OPTIONS
TEXT_OPTIONS extends TextOptions<TextStyle, TextStyleOptions>
The type of the text options
Parameters
args
any[]
Arguments passed to text constructor
name
string
Name of the text class (used in deprecation warning)
Returns
TEXT_OPTIONS
Normalized text options object
Example
// New recommended way:
const options = ensureTextOptions([{
text: "Hello",
style: { fontSize: 20 }
}], "Text");
// Deprecated way (will show warning in debug):
const options = ensureTextOptions(["Hello", { fontSize: 20 }], "Text");