Skip to content

0.29.0-alpha.930+a981c5d

@mattjennings mattjennings tagged this 17 Feb 04:56
## Changes:

- Added `ex.FontSource` resource type
  ```typescript
  const fontSource = new ex.FontSource('/my-font.ttf', 'My Font')
  loader.addResource(fontSource)

  game.start(loader).then(() => {
    const font = fontSource.toFont() // returns ex.Font
  })
  ```

  Font options can be defined either at the source or at the `toFont()` call. If defined in both, `toFont(options)` will
  override the options in the `FontSource`.

  ```typescript
  const fontSource = new ex.FontSource('/my-font.ttf', 'My Font', { 
    filtering: ex.ImageFiltering.Pixel,
    size: 16, // set a default size
  })
  const font = fontSource.toFont({
    // override just the size
    size: 20,
  })
  ```
- adds `"dom.iterable"` to  `lib` in tsconfig.json as it was needed to get the correct types for `document.fonts`
Assets 2
Loading