SilkMessage
import { SilkMessage } from 'pixi-silk/i18n/pixi';
A prepared message on screen (brief sec. 6.1). Glyphs are instances of one mesh, drawn in one
draw call. Updates take the cheapest tier that can serve them (sec. 6.3). set with a number of
the same length rewrites only that slot’s glyphs (value-fast). Other values lay out again. A
plural change swaps the baked variant. maxWidth, align, size and lineHeight lay out
again without shaping. Tag taps on interactive styles arrive as tagtap. accessibleText holds
the plain text with values filled in, for Pixi’s accessibility system.
Extends#
Container
Constructors#
Constructor#
new SilkMessage(prepared: PreparedMessage): SilkMessage;
Parameters#
| Parameter | Type |
|---|---|
prepared | PreparedMessage |
Returns#
SilkMessage
Overrides#
Container.constructor
Properties#
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
interactiveTags | public | string[] | null | null | Tags that emit tagtap. Default every interactive style. | packages/pixi-silk/src/i18n/pixi/silk.ts:687 |
prepared | readonly | PreparedMessage | undefined | The prepared message. | packages/pixi-silk/src/i18n/pixi/silk.ts:685 |
Accessors#
align#
Get Signature#
get align(): MessageAlign;
Alignment of the lines.
Returns
Set Signature#
set align(v: MessageAlign): void;
Parameters
| Parameter | Type |
|---|---|
v | MessageAlign |
Returns
void
batched#
Set Signature#
set batched(v: boolean): void;
Parameters
| Parameter | Type |
|---|---|
v | boolean |
Returns
void
instanceCount#
Get Signature#
get instanceCount(): number;
Glyph and line instances drawn.
Returns
number
layout#
Get Signature#
get layout(): MessageLayout;
The current layout: lines, boxes, instances.
Returns
lineHeight#
Get Signature#
get lineHeight(): number;
Distance between baselines as a factor of the size.
Returns
number
Set Signature#
set lineHeight(v: number): void;
Parameters
| Parameter | Type |
|---|---|
v | number |
Returns
void
maxWidth#
Get Signature#
get maxWidth(): number;
Widest line in pixels, 0 for none. Changing it re-breaks lines without shaping.
Returns
number
Set Signature#
set maxWidth(v: number): void;
Parameters
| Parameter | Type |
|---|---|
v | number |
Returns
void
size#
Get Signature#
get size(): number;
Font size in pixels. Baked runs are size-independent, so this lays out again without shaping.
Returns
number
Set Signature#
set size(v: number): void;
Parameters
| Parameter | Type |
|---|---|
v | number |
Returns
void
Methods#
destroy()#
destroy(options?: DestroyOptions): void;
Removes all internal references and listeners as well as removes children from the display list.
Do not use a Container after calling destroy.
Parameters#
| Parameter | Type | Description |
|---|---|---|
options? | DestroyOptions | Options parameter. A boolean will act as if all options have been set to that value |
Returns#
void
Example#
container.destroy();
container.destroy(true);
container.destroy({ children: true });
container.destroy({ children: true, texture: true, textureSource: true });
Overrides#
Container.destroy
set()#
set(values: Record<string, number | string>): this;
Changes slot values. A number of the same length as before rewrites only its glyphs. A different plural category swaps the variant. Anything else lays the message out again.
Parameters#
| Parameter | Type |
|---|---|
values | Record<string, number | string> |
Returns#
this