# `Plushie.Type.Font`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.6.0/lib/plushie/type/font.ex#L1)

Font specification with family, weight, style, and stretch.

Maps to iced's `Font` struct. Accepts `:default`, `:monospace`, a family
name string, or a `%Font{}` struct with detailed font properties.

# `stretch`

```elixir
@type stretch() ::
  :ultra_expanded
  | :extra_expanded
  | :expanded
  | :semi_expanded
  | :normal
  | :semi_condensed
  | :condensed
  | :extra_condensed
  | :ultra_condensed
```

# `style`

```elixir
@type style() :: :oblique | :italic | :normal
```

# `t`

```elixir
@type t() ::
  :default
  | :monospace
  | String.t()
  | %Plushie.Type.Font{
      family: String.t() | nil,
      stretch: stretch() | nil,
      style: style() | nil,
      weight: weight() | nil
    }
```

# `weight`

```elixir
@type weight() ::
  :black
  | :extra_bold
  | :bold
  | :semi_bold
  | :medium
  | :normal
  | :light
  | :extra_light
  | :thin
```

# `encode`

```elixir
@spec encode(font :: t()) :: String.t() | map()
```

Encodes a font value to the wire format.

## Examples

    iex> Plushie.Type.Font.encode(:default)
    "default"

    iex> Plushie.Type.Font.encode(:monospace)
    "monospace"

    iex> Plushie.Type.Font.encode("Fira Code")
    %{family: "Fira Code"}

    iex> Plushie.Type.Font.encode(%{family: "Inter", weight: :bold, style: :italic})
    %{family: "Inter", weight: "Bold", style: "Italic"}

# `from_opts`

```elixir
@spec from_opts(Keyword.t()) :: %Plushie.Type.Font{
  family: term(),
  stretch: term(),
  style: term(),
  weight: term()
}
```

Constructs a font from a keyword list.

Raises `ArgumentError` if any key is not a valid font field.

---

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