# `Toddy.Iced.Font`
[🔗](https://github.com/toddy-ui/toddy-elixir/blob/v0.3.0/lib/toddy/iced/font.ex#L1)

Font descriptor for the text widget `font` prop and Settings `default_font`.

Maps to iced's `Font` struct. Accepts `:default`, `:monospace`, a family
name string, or a map with `:family`, `:weight`, `:style`, and `:stretch`.

# `font_map`

```elixir
@type font_map() :: %{
  optional(:family) =&gt; String.t(),
  optional(:weight) =&gt; weight(),
  optional(:style) =&gt; style(),
  optional(:stretch) =&gt; stretch()
}
```

# `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() | font_map()
```

# `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> Toddy.Iced.Font.encode(:default)
    "default"

    iex> Toddy.Iced.Font.encode(:monospace)
    "monospace"

    iex> Toddy.Iced.Font.encode("Fira Code")
    %{"family" => "Fira Code"}

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

---

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