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

Line height for text widgets.

Accepts three forms:

  - A number (relative multiplier, e.g. `1.5`)
  - `%{relative: n}` for explicit relative line height
  - `%{absolute: n}` for absolute pixel line height

Numbers are passed through as-is (the renderer interprets plain
numbers as relative multipliers). Maps are passed through unchanged
so the renderer can distinguish the two explicit forms.

## Examples

    iex> Plushie.Type.LineHeight.cast(1.5)
    {:ok, 1.5}

    iex> Plushie.Type.LineHeight.cast(%{relative: 1.5})
    {:ok, %{relative: 1.5}}

    iex> Plushie.Type.LineHeight.cast(%{absolute: 20})
    {:ok, %{absolute: 20}}

    iex> Plushie.Type.LineHeight.cast(:bogus)
    :error

# `t`

```elixir
@type t() :: number() | %{relative: number()} | %{absolute: number()}
```

# `cast`

```elixir
@spec cast(term()) :: {:ok, t()} | :error
```

Validates a line height value.

## Examples

    iex> Plushie.Type.LineHeight.cast(1.0)
    {:ok, 1.0}

    iex> Plushie.Type.LineHeight.cast(2)
    {:ok, 2}

    iex> Plushie.Type.LineHeight.cast(%{relative: 1.2})
    {:ok, %{relative: 1.2}}

    iex> Plushie.Type.LineHeight.cast(%{absolute: 24})
    {:ok, %{absolute: 24}}

    iex> Plushie.Type.LineHeight.cast("bad")
    :error

# `encode`

```elixir
@spec encode(line_height :: t()) :: t()
```

Encodes a line height for the wire format.

Numbers and maps pass through unchanged.

## Examples

    iex> Plushie.Type.LineHeight.encode(1.5)
    1.5

    iex> Plushie.Type.LineHeight.encode(%{relative: 1.2})
    %{relative: 1.2}

    iex> Plushie.Type.LineHeight.encode(%{absolute: 20})
    %{absolute: 20}

---

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