message: Use modern canvas2D api for letter-spacing when is available
diff: @@ -18,6 +18,19 @@ const defaultDestroyOptions: IDestroyOptions = {
  baseTexture: true,
  };
  +interface ModernContext2D extends CanvasRenderingContext2D {
  + // for chrome less 94
  + textLetterSpacing?: number;
  + // for chrome greater 94
  + letterSpacing?: number;
  +}
  +
  +// Checking that we can use moddern canvas2D api
  +// https://developer.chrome.com/origintrials/#/view_trial/3585991203293757441
  +// note: this is unstable API, Chrome less 94 use a `textLetterSpacing`, newest use a letterSpacing
  +// eslint-disable-next-line max-len
  +const supportLetterSpacing = 'letterSpacing' in CanvasRenderingContext2D.prototype || 'textLetterSpacing' in CanvasRenderingContext2D.prototype;
  +
  /**
  * A Text Object will create a line or multiple lines of text.
  *
  @@ -53,9 +66,8 @@ export class Text extends Sprite
  /** The canvas element that everything is drawn to. */
  public canvas: HTMLCanvasElement;
  -
  /** The canvas 2d context that everything is drawn with. */
  - public context: CanvasRenderingContext2D;
  + public context: ModernContext2D;
  public localStyleID: number;
  public dirty: boolean;
  @@ -315,8 +327,14 @@ export class Text extends Sprite
  // letterSpacing of 0 means normal
  const letterSpacing = style.letterSpacing;
  - if (letterSpacing === 0)
  + if (letterSpacing === 0 || supportLetterSpacing)
  {
  + if (supportLetterSpacing)
  + {
  + this.context.letterSpacing = letterSpacing;
  + this.context.textLetterSpacing = letterSpacing;
  + }
  +
  if (isStroke)
  {
  this.context.strokeText(text, x, y);
  