Figlet.Linebreaker (figlet v0.2.0) View Source

This module contains the logic that determines where to put linebreaks when converting a charlist to a specific FIGlet font representation.

It relies on lists of integer codepoints (a.k.a. charlists) instead of utf8 encoded string binaries (a.k.a. strings) to bypass any encoding related confusion.

Link to this section Summary

Functions

'this is a test' -> ['this', 'is', 'a', 'test'] String.split("this is a big-old test", ~r/ |-/) ["this", "is", "a", "big", "old", "test"] ["this", "is", "a", "big-", "old", "test"]

Any newlines included in the input charlist will cause a hard break.

Link to this section Functions

Link to this function

chunkify(charlist, breakables)

View Source

'this is a test' -> ['this', 'is', 'a', 'test'] String.split("this is a big-old test", ~r/ |-/) ["this", "is", "a", "big", "old", "test"] ["this", "is", "a", "big-", "old", "test"]

Link to this function

split(charlist, font, width, opts \\ [])

View Source

Specs

split(
  charlist(),
  font :: Figlet.Font.t(),
  width :: integer(),
  opts :: keyword()
) :: {:ok, list()} | {:error, any()}

Any newlines included in the input charlist will cause a hard break.

  • charlist is a character list containing integer codepoints
  • font a %Figlet.Font{} struct
  • width an integer representing the character width of the terminal
  • opts is a keyword list of options.

Options

:overflow - :trim, :break

Examples

iex> Figlet.Linebreaker.split('this is a test', font, 4)
['this', 'is a', 'test']