# Class: BitmapFont

Defined in: spryte/dist/bitmap-font.d.ts:37

A pixel font from a sprite sheet. Pass it as `font` to `draw.text` and `draw.measure`: glyphs land
on whole logical pixels after scale and translation, so it stays crisp at any integer scale.
Rotated or skewed glyphs keep their transformed positions. Before 0.12.2, only local positions were rounded.

```ts
// assets/font@6x9.png: glyphs on a 6×9 grid, exported from Aseprite
const font = new BitmapFont({ frames: assets.frames("font"), chars: BitmapFont.ASCII });
draw.text("coins 3", 4, 4, { font, color: "#fbbf24" });
```

## Constructors

### Constructor

> **new BitmapFont**(`o`): `BitmapFont`

Defined in: spryte/dist/bitmap-font.d.ts:46

#### Parameters

##### o

[`BitmapFontOptions`](../interfaces/BitmapFontOptions.md)

#### Returns

`BitmapFont`

## Properties

### height

> `readonly` **height**: `number`

Defined in: spryte/dist/bitmap-font.d.ts:41

Cell height in pixels.

***

### lineHeight

> `readonly` **lineHeight**: `number`

Defined in: spryte/dist/bitmap-font.d.ts:42

***

### spacing

> `readonly` **spacing**: `number`

Defined in: spryte/dist/bitmap-font.d.ts:43

***

### ASCII

> `readonly` `static` **ASCII**: `string`

Defined in: spryte/dist/bitmap-font.d.ts:39

Printable ASCII from space to "~", the order most font sheets use.

## Methods

### glyph()

> **glyph**(`ch`): [`Glyph`](../interfaces/Glyph.md) \| `undefined`

Defined in: spryte/dist/bitmap-font.d.ts:47

#### Parameters

##### ch

`string`

#### Returns

[`Glyph`](../interfaces/Glyph.md) \| `undefined`

***

### lineWidth()

> **lineWidth**(`line`): `number`

Defined in: spryte/dist/bitmap-font.d.ts:54

Width of one line, without trailing spacing.

#### Parameters

##### line

`string`

#### Returns

`number`

***

### measure()

> **measure**(`text`): `object`

Defined in: spryte/dist/bitmap-font.d.ts:49

Size of `text` in pixels. Lines split on "\n".

#### Parameters

##### text

`string`

#### Returns

`object`

##### h

> **h**: `number`

##### w

> **w**: `number`
