Home

class: TextStyle


A TextStyle Object decorates a Text Object. It can be shared between
multiple Text objects. Changing the style will update all text objects using it.

Methods summary


Public methods
public clone(): PIXI.TextStyle
public reset(): void
public clone(): PIXI.TextStyle
public reset(): void

Properties


Name Type Attribute Description
font public

Set all properties of a font as a single string

font public

Set all properties of a font as a single string

Methods


clone(): PIXI.TextStyle

Creates a new TextStyle object with the same values as this one.
Note that the only the properties of the object are cloned.

Returns:

PIXI.TextStyle


reset(): void

Resets all properties to the defaults specified in TextStyle.prototype._default

Returns:

void


clone(): PIXI.TextStyle

Creates a new TextStyle object with the same values as this one.
Note that the only the properties of the object are cloned.

Returns:

PIXI.TextStyle


reset(): void

Resets all properties to the defaults specified in TextStyle.prototype._default

Returns:

void


  {
    "comment": "/**\n * A TextStyle Object decorates a Text Object. It can be shared between\n * multiple Text objects. Changing the style will update all text objects using it.\n *\n * @class\n * @memberof PIXI\n */",
    "meta": {
        "range": [
            1074,
            12623
        ],
        "filename": "TextStyle.js",
        "lineno": 46,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src\\core\\text",
        "code": {
            "id": "astnode100040166",
            "name": "TextStyle",
            "type": "ClassDeclaration",
            "paramnames": [
                "style"
            ]
        }
    },
    "classdesc": "

A TextStyle Object decorates a Text Object. It can be shared between
multiple Text objects. Changing the style will update all text objects using it.

", "kind": "class", "memberof": "PIXI", "name": "TextStyle", "longname": "PIXI.TextStyle", "scope": "static", "params": [ { "type": { "names": [ "object" ] }, "optional": true, "description": "

The style parameters

", "name": "style" }, { "type": { "names": [ "string" ] }, "optional": true, "defaultvalue": "'left'", "description": "

Alignment for multiline text ('left', 'center' or 'right'),
does not affect single line text

", "name": "style.align" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

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

", "name": "style.breakWords" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

Set a drop shadow for the text

", "name": "style.dropShadow" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 1, "description": "

Set alpha for the drop shadow

", "name": "style.dropShadowAlpha" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": "Math.PI/6", "description": "

Set a angle of the drop shadow

", "name": "style.dropShadowAngle" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 0, "description": "

Set a shadow blur radius

", "name": "style.dropShadowBlur" }, { "type": { "names": [ "string" ] }, "optional": true, "defaultvalue": "'#000000'", "description": "

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

", "name": "style.dropShadowColor" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 5, "description": "

Set a distance of the drop shadow

", "name": "style.dropShadowDistance" }, { "type": { "names": [ "string", "Array.", "number", "Array.", "CanvasGradient", "CanvasPattern" ] }, "optional": true, "defaultvalue": "'black'", "description": "

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

", "name": "style.fill" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": "PIXI.TEXT_GRADIENT.LINEAR_VERTICAL", "description": "

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

", "name": "style.fillGradientType" }, { "type": { "names": [ "Array." ] }, "optional": true, "description": "

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.

", "name": "style.fillGradientStops" }, { "type": { "names": [ "string", "Array." ] }, "optional": true, "defaultvalue": "'Arial'", "description": "

The font family

", "name": "style.fontFamily" }, { "type": { "names": [ "number", "string" ] }, "optional": true, "defaultvalue": 26, "description": "

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

", "name": "style.fontSize" }, { "type": { "names": [ "string" ] }, "optional": true, "defaultvalue": "'normal'", "description": "

The font style ('normal', 'italic' or 'oblique')

", "name": "style.fontStyle" }, { "type": { "names": [ "string" ] }, "optional": true, "defaultvalue": "'normal'", "description": "

The font variant ('normal' or 'small-caps')

", "name": "style.fontVariant" }, { "type": { "names": [ "string" ] }, "optional": true, "defaultvalue": "'normal'", "description": "

The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',
'200', '300', '400', '500', '600', '700', 800' or '900')

", "name": "style.fontWeight" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 0, "description": "

The amount of spacing between letters, default is 0

", "name": "style.letterSpacing" }, { "type": { "names": [ "number" ] }, "optional": true, "description": "

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

", "name": "style.lineHeight" }, { "type": { "names": [ "string" ] }, "optional": true, "defaultvalue": "'miter'", "description": "

The lineJoin property sets the type of corner created, it can resolve
spiked text issues. Default is 'miter' (creates a sharp corner).

", "name": "style.lineJoin" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 10, "description": "

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

", "name": "style.miterLimit" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 0, "description": "

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

", "name": "style.padding" }, { "type": { "names": [ "string", "number" ] }, "optional": true, "defaultvalue": "'black'", "description": "

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

", "name": "style.stroke" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 0, "description": "

A number that represents the thickness of the stroke.
Default is 0 (no stroke)

", "name": "style.strokeThickness" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

Trim transparent borders

", "name": "style.trim" }, { "type": { "names": [ "string" ] }, "optional": true, "defaultvalue": "'alphabetic'", "description": "

The baseline of the text that is rendered.

", "name": "style.textBaseline" }, { "type": { "names": [ "boolean" ] }, "optional": true, "defaultvalue": false, "description": "

Indicates if word wrap should be used

", "name": "style.wordWrap" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 100, "description": "

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

", "name": "style.wordWrapWidth" } ], "___id": "T000002R003684", "___s": true, "$methods": [ { "comment": "/**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */", "meta": { "range": [ 5238, 5451 ], "filename": "TextStyle.js", "lineno": 105, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src\\core\\text", "code": { "id": "astnode100040188", "name": "TextStyle#clone", "type": "MethodDefinition", "paramnames": [] }, "vars": { "": null } }, "description": "

Creates a new TextStyle object with the same values as this one.
Note that the only the properties of the object are cloned.

", "returns": [ { "type": { "names": [ "PIXI.TextStyle" ] }, "description": "

New cloned TextStyle object

" } ], "name": "clone", "longname": "PIXI.TextStyle#clone", "kind": "function", "memberof": "PIXI.TextStyle", "scope": "instance", "params": [], "___id": "T000002R003687", "___s": true, "skip": true, "slug": "PIXI.TextStyleclone", "filepath": "core\\text\\TextStyle.js" }, { "comment": "/**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */", "meta": { "range": [ 5560, 5622 ], "filename": "TextStyle.js", "lineno": 120, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src\\core\\text", "code": { "id": "astnode100040214", "name": "TextStyle#reset", "type": "MethodDefinition", "paramnames": [] }, "vars": { "": null } }, "description": "

Resets all properties to the defaults specified in TextStyle.prototype._default

", "name": "reset", "longname": "PIXI.TextStyle#reset", "kind": "function", "memberof": "PIXI.TextStyle", "scope": "instance", "params": [], "___id": "T000002R003691", "___s": true, "skip": true, "slug": "PIXI.TextStylereset", "filepath": "core\\text\\TextStyle.js" }, { "comment": "/**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */", "meta": { "range": [ 5238, 5451 ], "filename": "TextStyle.js", "lineno": 105, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src\\core\\text", "code": { "id": "astnode100114867", "name": "TextStyle#clone", "type": "MethodDefinition", "paramnames": [] }, "vars": { "": null } }, "description": "

Creates a new TextStyle object with the same values as this one.
Note that the only the properties of the object are cloned.

", "returns": [ { "type": { "names": [ "PIXI.TextStyle" ] }, "description": "

New cloned TextStyle object

" } ], "name": "clone", "longname": "PIXI.TextStyle#clone", "kind": "function", "memberof": "PIXI.TextStyle", "scope": "instance", "params": [], "___id": "T000002R010621", "___s": true, "skip": true, "slug": "PIXI.TextStyleclone", "filepath": "core\\text\\TextStyle.js" }, { "comment": "/**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */", "meta": { "range": [ 5560, 5622 ], "filename": "TextStyle.js", "lineno": 120, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src\\core\\text", "code": { "id": "astnode100114893", "name": "TextStyle#reset", "type": "MethodDefinition", "paramnames": [] }, "vars": { "": null } }, "description": "

Resets all properties to the defaults specified in TextStyle.prototype._default

", "name": "reset", "longname": "PIXI.TextStyle#reset", "kind": "function", "memberof": "PIXI.TextStyle", "scope": "instance", "params": [], "___id": "T000002R010625", "___s": true, "skip": true, "slug": "PIXI.TextStylereset", "filepath": "core\\text\\TextStyle.js" } ], "$attributes": [ { "comment": "/**\n * Set all properties of a font as a single string\n *\n * @name PIXI.TextStyle#font\n * @deprecated since version 4.0.0\n */", "meta": { "range": [ 18946, 19091 ], "filename": "deprecation.js", "lineno": 728, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src", "code": {} }, "description": "

Set all properties of a font as a single string

", "name": "font", "deprecated": "since version 4.0.0", "memberof": "PIXI.TextStyle", "longname": "PIXI.TextStyle#font", "scope": "instance", "kind": "member", "___id": "T000002R004659", "___s": true, "skip": true, "slug": "PIXI.TextStylefont", "filepath": "deprecation.js" }, { "comment": "/**\n * Set all properties of a font as a single string\n *\n * @name PIXI.TextStyle#font\n * @deprecated since version 4.0.0\n */", "meta": { "range": [ 18946, 19091 ], "filename": "deprecation.js", "lineno": 728, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\pixi.js\\pixi.js-repo\\src", "code": {} }, "description": "

Set all properties of a font as a single string

", "name": "font", "deprecated": "since version 4.0.0", "memberof": "PIXI.TextStyle", "longname": "PIXI.TextStyle#font", "scope": "instance", "kind": "member", "___id": "T000002R011593", "___s": true, "skip": true, "slug": "PIXI.TextStylefont", "filepath": "deprecation.js" } ], "$staticmethods": [], "$staticproperties": [], "$augments": [], "$augmentedBy": [], "filepath": "core\\text\\TextStyle.js" }