# `MingaEditor.UI.FontRegistry`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/ui/font_registry.ex#L1)

Maps font family names to protocol font IDs (0-255).

Font ID 0 is always the primary font (configured via `:font_family`).
IDs 1-255 are assigned on demand when a Face with a non-nil `font_family`
is first rendered. The registry sends `register_font` protocol commands
to the GUI frontend so it can load the corresponding FontFace instances.

The registry is process-local state stored in the Editor GenServer's state.
It resets when the editor restarts or the font config changes.

# `t`

```elixir
@type t() :: %MingaEditor.UI.FontRegistry{
  families: %{required(String.t()) =&gt; non_neg_integer()},
  next_id: non_neg_integer()
}
```

# `get_or_register`

```elixir
@spec get_or_register(t(), String.t()) :: {non_neg_integer(), t(), boolean()}
```

Returns the font_id for a font family, allocating a new ID if needed.

Returns `{font_id, updated_registry, new?}` where `new?` is true if
a new ID was allocated (caller should send `register_font` to the GUI).

The primary font (ID 0) is never registered here; it's set via `set_font`.

# `lookup`

```elixir
@spec lookup(t(), String.t()) :: non_neg_integer()
```

Returns the font_id for a family, or 0 if not registered.

# `new`

```elixir
@spec new() :: t()
```

Creates a new empty font registry.

---

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