# `Drafter.Widget.Digits.Figlet`
[🔗](https://github.com/jaman/drafter/blob/main/lib/drafter/widget/digits/figlet.ex#L1)

Reads FIGlet fonts (`.flf`) into the glyph maps `Drafter.Widget.Digits.Font`
serves.

A parsed font behaves like a built-in one once registered:

    {:ok, font} = Figlet.load("/usr/share/figlet/slant.flf")
    Font.register(:slant, font)
    digits("Vellum", font: :slant)

Glyphs are laid out full width — characters placed side by side with no
kerning or smushing. Hardblanks are rendered as plain spaces.

## Format

The header names a hardblank character, the glyph height, and how many comment
lines follow. Glyphs for the printable ASCII range then appear in code order,
each one `height` lines long, every line closed by a repeated endmark
character.

See the [large text guide](large_text.md) for the layout rules Drafter
applies.

# `bundled`

```elixir
@spec bundled() :: %{required(atom()) =&gt; Drafter.Widget.Digits.Font.font()}
```

Parse every bundled font, keyed by name.

# `bundled_directory`

```elixir
@spec bundled_directory() :: Path.t()
```

The directory of FIGlet fonts shipped with Drafter.

# `load`

```elixir
@spec load(Path.t()) :: {:ok, Drafter.Widget.Digits.Font.font()} | {:error, term()}
```

Reads and parses a `.flf` file.

Returns `{:ok, font}`, `{:error, {:unreadable, reason}}` when the file cannot
be read, or `{:error, {:malformed, detail}}` when its header or glyph data is
not FIGlet.

# `load!`

```elixir
@spec load!(Path.t()) :: Drafter.Widget.Digits.Font.font()
```

Same as `load/1`, but raises `ArgumentError` if the font cannot be loaded.

# `load_directory`

```elixir
@spec load_directory(Path.t()) :: %{
  required(atom()) =&gt; Drafter.Widget.Digits.Font.font()
}
```

Every `.flf` file in a directory, parsed and keyed by its basename.

Files that fail to parse are omitted.

# `parse`

```elixir
@spec parse(binary()) :: {:ok, Drafter.Widget.Digits.Font.font()} | {:error, term()}
```

Parse the contents of a `.flf` file.

# `register_bundled`

```elixir
@spec register_bundled() :: [atom()]
```

Parses every bundled font and registers it under its own name.

Returns the sorted list of names registered, each then usable as
`digits(text, font: name)`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
