Class: HTMLTextStyle

HTMLTextStyle

Extends

Methods

addOverride (…value) void

Add a style override, this can be any CSS property it will override any built-in style. This is the property and the value as a string (e.g., color: red). This will override any other internal style.

Name Type Description
value string

CSS style(s) to add.

Example
style.addOverride('background-color: red');

removeOverride (…value) void

Remove any overrides that match the value.

Name Type Description
value string

CSS style to remove.

Example
style.removeOverride('background-color: red');

Inherited Properties

From class TextStyle

_fill ConvertedFillStyle inherited

_stroke ConvertedStrokeStyle inherited

align 'left' | 'center' | 'right' | 'justify' inherited overrides

See align

Default Value:
  • "left"

breakWords boolean inherited overrides

See breakWords

Default Value:
  • false

dropShadow inherited overrides

See dropShadow

fill string | Array<string> | number | Array<number> | CanvasGradient | CanvasPattern inherited overrides

See fill

Default Value:
  • "black"

fontFamily string | Array<string> inherited overrides

See fontFamily

Default Value:
  • "Arial"

fontSize number | string inherited overrides

See fontSize

Default Value:
  • 26

fontStyle 'normal' | 'italic' | 'oblique' inherited overrides

See fontStyle

Default Value:
  • "normal"

fontVariant 'normal' | 'small-caps' inherited overrides

See fontVariant

Default Value:
  • "normal"

fontWeight 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' inherited overrides

See fontWeight

Default Value:
  • "normal"

leading number inherited overrides

See leading

Default Value:
  • 0

letterSpacing number inherited overrides

See letterSpacing

Default Value:
  • 0

lineHeight number inherited overrides

See lineHeight

Default Value:
  • 0

padding number inherited overrides

See padding

Default Value:
  • 0

stroke string | number inherited overrides

See stroke

Default Value:
  • undefined

textBaseline 'alphabetic' | 'top' | 'hanging' | 'middle' | 'ideographic' | 'bottom' inherited overrides

See textBaseline

Default Value:
  • "alphabetic"

trim boolean inherited overrides

See trim

Default Value:
  • false

whiteSpace 'normal' | 'pre' | 'pre-line' inherited overrides

See whiteSpace

Default Value:
  • "pre"

wordWrap boolean inherited overrides

See wordWrap

Default Value:
  • false

wordWrapWidth number inherited overrides

See wordWrapWidth

Default Value:
  • 100

Inherited Methods

From class TextStyle

Creates a new TextStyle object with the same values as this one.

Returns:
Type Description
TextStyle New cloned TextStyle object

destroy (options) inherited

Destroys this text style.

Name Type Attributes Default Description
options TypeOrBool<TextureDestroyOptions> false

Options parameter. A boolean will act as if all options have been set to that value

options.texture boolean <optional>
false

Should it destroy the texture of the this style

options.textureSource boolean <optional>
false

Should it destroy the textureSource of the this style