Interface ITextStyle

Generic interface for TextStyle options.

Memberof

PIXI

interface ITextStyle {
    align: TextStyleAlign;
    breakWords: boolean;
    dropShadow: boolean;
    dropShadowAlpha: number;
    dropShadowAngle: number;
    dropShadowBlur: number;
    dropShadowColor: string | number;
    dropShadowDistance: number;
    fill: TextStyleFill;
    fillGradientStops: number[];
    fillGradientType: TEXT_GRADIENT;
    fontFamily: string | string[];
    fontSize: string | number;
    fontStyle: TextStyleFontStyle;
    fontVariant: TextStyleFontVariant;
    fontWeight: TextStyleFontWeight;
    leading: number;
    letterSpacing: number;
    lineHeight: number;
    lineJoin: TextStyleLineJoin;
    miterLimit: number;
    padding: number;
    stroke: string | number;
    strokeThickness: number;
    textBaseline: TextStyleTextBaseline;
    trim: boolean;
    whiteSpace: TextStyleWhiteSpace;
    wordWrap: boolean;
    wordWrapWidth: number;
}

Implemented by

Properties

Alignment for multiline text, does not affect single line text

breakWords: boolean

Indicates if lines can be wrapped within words, it needs wordWrap to be set to true

dropShadow: boolean

Set a drop shadow for the text

dropShadowAlpha: number

Set alpha for the drop shadow

dropShadowAngle: number

Set a angle of the drop shadow

dropShadowBlur: number

Set a shadow blur radius

dropShadowColor: string | number

A fill style to be used on the dropshadow e.g., 'red', '#00FF00'

dropShadowDistance: number

Set a distance of the drop shadow

A canvas fillstyle that will be used on the text e.g., 'red', '#00FF00'. Can be an array to create a gradient, e.g., ['#000000','#FFFFFF'] https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN

fillGradientStops: number[]

If fill is an array of colours to create a gradient, this array can set the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.

fillGradientType: TEXT_GRADIENT

If fill is an array of colours to create a gradient, this can change the type/direction of the gradient. See PIXI.TEXT_GRADIENT

fontFamily: string | string[]

The font family, can be a single font name, or a list of names where the first is the preferred font.

fontSize: string | number

The font size (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')

The font style.

The font variant.

The font weight.

leading: number

The height of the line, a number that represents the vertical space that a letter uses.

letterSpacing: number

The amount of spacing between letters, default is 0

lineHeight: number

The line height, a number that represents the vertical space that a letter uses

The lineJoin property sets the type of corner created, it can resolve spiked text issues. Possible values "miter" (creates a sharp corner), "round" (creates a round corner) or "bevel" (creates a squared corner).

miterLimit: number

The miter limit to use when using the 'miter' lineJoin mode. This can reduce or increase the spikiness of rendered text.

padding: number

Occasionally some fonts are cropped. Adding some padding will prevent this from happening by adding padding to all sides of the text.

stroke: string | number

A canvas fillstyle that will be used on the text stroke, e.g., 'blue', '#FCFF00'

strokeThickness: number

A number that represents the thickness of the stroke. A value of 0 will disable stroke.

textBaseline: TextStyleTextBaseline

The baseline of the text that is rendered.

trim: boolean

Trim transparent borders

Determines whether newlines & spaces are collapsed or preserved "normal" (collapse, collapse), "pre" (preserve, preserve) | "pre-line" (preserve, collapse). It needs wordWrap to be set to true.

wordWrap: boolean

Indicates if word wrap should be used

wordWrapWidth: number

The width at which text will wrap, it needs wordWrap to be set to true

Generated using TypeDoc