# FontHandler

Class · extends [`ResourceHandler`](https://api.playcanvas.com/engine/classes/ResourceHandler.md) · category: User Interface

Source: https://github.com/playcanvas/engine/blob/b5b983982a9860d21e0c1dafb2f85f72e2c01afb/src/framework/handlers/font.js#L43

Resource handler used for loading [Font](https://api.playcanvas.com/engine/classes/Font.md) resources.

## Methods

### load

```ts
load(url: any, callback: any, asset: any): void
```

Load a resource from a remote URL. When parsers are registered, the matching parser's `load` is
used; otherwise the base implementation does nothing (subclasses may override).

**Parameters**

- `url` (`any`): Either the URL of the resource to
  load or a structure containing the load URL (used for loading the resource) and the original
  URL (used for identifying the resource format; necessary when loading, for example, from
  a blob URL).
- `callback` (`any`): The callback used when the resource is loaded or
  an error occurs.
- `asset` (`any`): Optional asset that is passed by ResourceLoader.

### open

```ts
open(url: any, data: any, asset: any): Font
```

The open function is passed the raw resource data. The handler can then process the data
into a format that can be used at runtime. When parsers are registered, the matching parser's
`open` is used (if it implements one); otherwise the base implementation simply returns the data.

**Parameters**

- `url` (`any`): The URL of the resource to open.
- `data` (`any`): The raw resource data passed by callback from [load](https://api.playcanvas.com/engine/classes/ResourceHandler.md#load).
- `asset` (`any`): Optional asset that is passed by ResourceLoader.

**Returns** [`Font`](https://api.playcanvas.com/engine/classes/Font.md): The parsed resource data.

### patch

```ts
patch(asset: any, assets: any): void
```

The patch function performs any operations on a resource that requires a dependency on its
asset data or any other asset data. The base implementation does nothing.

**Parameters**

- `asset` (`any`): The asset to patch.
- `assets` (`any`): The asset registry.

## Inherited from [ResourceHandler](https://api.playcanvas.com/engine/classes/ResourceHandler.md)

- `protected _app: AppBase`
- `handlerType: string = ''`
- `get app(): AppBase`
- `get parsers(): ResourceParser[]`
- `addParser(parser: ResourceParser, decider?: any): void`
- `fetch(url: string | { load: string; original: string }, responseType: string, callback: ResourceHandlerCallback, asset?: Asset): void`
- `removeParser(parser: ResourceParser): void`
