# `EgdTextPanel`
[🔗](https://github.com/fhunleth/egd_text_panel/blob/v0.1.0/lib/egd_text_panel.ex#L5)

Simple text panel for use with EGD

This text panel implements the Erlang I/O server protocol so write text to
it with `IO.puts` and the like.

Example:

    {:ok, io} = EgdTextPanel.start_link(your_options)
    IO.puts(io, "Hello")

# `margins`

```elixir
@type margins() ::
  {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()}
```

Text panel margins within the image dimensions

Fields are left, top, right, bottom margins in pixels

# `options`

```elixir
@type options() :: [
  renderer: module(),
  renderer_state: term(),
  margins: margins(),
  font_path: Path.t(),
  width: pos_integer(),
  height: pos_integer(),
  font_color: atom() | {byte(), byte(), byte()},
  name: GenServer.name()
]
```

Options for `start_link/1`

* `:font_color` - a supported EGD font color atom or a 3-tuple with RGB values. Defaults to `:black`
* `:font_path` - path to the font to use. Defaults to EGD's built-in font
* `:height` - image height. Defaults to 200.
* `:margins` - margins as a 4-tuple. Defaults to `{0, 0, 0, 0}`
* `:name` - a name for the `GenServer`
* `:renderer` - the module that implements the `EgdTextPanel.Renderer`. Required.
* `:renderer_state` - the initial state for the behaviour. Defaults to `%{}`
* `:width` - image width. Defaults to 320.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

```elixir
@spec start_link(options()) :: GenServer.on_start()
```

Starts an EGD text panel

See `t:options/0` for options. `:renderer` is the only required option.

---

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