vivid v0.4.2 Vivid.Font View Source

This module takes characters generated by the Hershey module and converts them into groups of shapes using the character’s specified left and right padding.

Specifically this module only knows about the rowmans Hershey font, because it’s all I needed. We need a real font layout system. PR’s gratefully accepted.

Link to this section Summary

Functions

Convert a String containing one or more characters into a shape

Convert the rowmans font into a map with the codepoints (characters) as the index, and the font character as the value

Link to this section Functions

Link to this function line(str, scale \\ 1.0) View Source
line(String.t, number) :: Vivid.Shape.t

Convert a String containing one or more characters into a shape.

Can only handle characters defined in the rowmans Hershey font. Carriage returns and line feeds are also not supported.

The second argument is a scale factor. Defaults to 1.0.

Example

iex> use Vivid
...> Font.line("hello world", 0.75)
...> |> to_string
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" <>
"@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @\n" <>
"@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @\n" <>
"@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @\n" <>
"@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @\n" <>
"@ @@@@@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
"@ @@@@@@@@ @@@@@ @@@@@@@@@@@@@ @@@@@ @@@@@ @@@@@@@@ @@@@@@@@@@@@@@@@@@ @ @@@ @ @@@@@@ @@@@@@@@ @@@@@ @@@@@@@@@ @@@@@ @@@@@@@@ @\n" <>
"@ @@@@@@@@ @@@@@ @@@@@@@@ @@@@ @@@@@ @@@@@ @@@@@@@@ @@@@@@@@@@@@@@@@@@ @ @@@ @ @@@@@@ @@@@@@@@ @@@@@ @@@@@@@@@ @@@@@ @@@@@@@@ @\n" <>
"@ @@@@@@@@ @@@@@@ @@@@@@ @@@@@ @@@@@ @@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@@ @ @@@ @ @@@@@@@ @@@@@@ @@@@@@ @@@@@@@@@ @@@@@@ @@@@@@  @\n" <>
"@ @@@@@@@@ @@@@@@@ @@@@ @@@@@@ @@@@@ @@@@@@@ @@@@ @@@@@@@@@@@@@@@@@@@@@ @@@@@ @@@@@@@@@ @@@@ @@@@@@@ @@@@@@@@@ @@@@@@@ @@@@ @ @\n" <>
"@ @@@@@@@@ @@@@@@@@    @@@@@@@ @@@@@ @@@@@@@@    @@@@@@@@@@@@@@@@@@@@@@ @@@@@ @@@@@@@@@@    @@@@@@@@ @@@@@@@@@ @@@@@@@@    @@ @\n" <>
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
Link to this function rowmans() View Source
rowmans() :: map

Convert the rowmans font into a map with the codepoints (characters) as the index, and the font character as the value.