View Source Fonticode (fonticode v1.0.0)
Small library that takes a string and reformats it into a pseudofont.
This is accomplished by using Unicode codepoints that resemble a font.
Format mode | Example |
---|---|
:noop | ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 1234567890 |
:sans_serif | ๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น ๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ข |
:cursive | ๐โฌ๐๐โฐโฑ๐ขโโ๐ฅ๐ฆโโณ๐ฉ๐ช๐ซ๐ฌโ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต ๐ถ๐ท๐ธ๐นโฏ๐ปโ๐ฝ๐พ๐ฟ๐๐๐๐โด๐ ๐๐๐๐๐๐๐๐๐๐ 1234567890 |
:blackboard_bold | ๐ธ๐นโ๐ป๐ผ๐ฝ๐พโ๐๐๐๐๐โ๐โโโ๐๐๐๐๐๐๐โค ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ ๐๐๐๐๐๐๐๐ ๐ก๐ |
:block | ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ 1234567890 |
:block_filled | ๐ ฐ๐ ฑ๐ ฒ๐ ณ๐ ด๐ ต๐ ถ๐ ท๐ ธ๐ น๐ บ๐ ป๐ ผ๐ ฝ๐ พ๐ ฟ๐๐๐๐๐๐ ๐๐๐๐ ๐ ฐ๐ ฑ๐ ฒ๐ ณ๐ ด๐ ต๐ ถ๐ ท๐ ธ๐ น๐ บ๐ ป๐ ผ๐ ฝ๐ พ๐ ฟ๐๐๐๐๐๐ ๐๐๐๐ 1234567890 |
:bubble | โถโทโธโนโบโปโผโฝโพโฟโโโโโโ โโโโโโโโโโ โโโโโโโโโโโโโโโโโ โกโขโฃโคโฅโฆโงโจโฉ โ โกโขโฃโคโฅโฆโงโจโช |
:bubble_filled | ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ก๐ ข๐ ฃ๐ ค๐ ฅ๐ ฆ๐ ง๐ จ๐ ฉ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ก๐ ข๐ ฃ๐ ค๐ ฅ๐ ฆ๐ ง๐ จ๐ ฉ โโโโโโโโโโฟ |
:gothic | ๐๐ โญ๐๐๐๐โโ๐๐๐๐๐๐๐๐โ๐๐๐๐๐๐๐โจ ๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท 1234567890 |
:small_caps | ABCDEFGHIJKLMNOPQRSTUVWXYZ แดสแดแด แดาษขสษชแดแดสแดษดแดแดวซสsแดแดแด แดกxสแดข 1234567890 |
:aesthetic | ๏ผก๏ผข๏ผฃ๏ผค๏ผฅ๏ผฆ๏ผง๏ผจ๏ผฉ๏ผช๏ผซ๏ผฌ๏ผญ๏ผฎ๏ผฏ๏ผฐ๏ผฑ๏ผฒ๏ผณ๏ผด๏ผต๏ผถ๏ผท๏ผธ๏ผน๏ผบ ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ ๏ผ๏ผ๏ผ๏ผ๏ผผ๏ผ๏ผ๏ผ๏ผ๏ผ ๏ฝ๏ผ๏ผ ๏ผ๏ผ๏ผ ๏ผพ๏ผ๏ผ๏ผ๏ผ๏ผฟ๏ผ |
:monospace | ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ0 |
:bold | ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ ๐๐๐๐๐๐๐๐๐๐ |
:superscript | แดฌแดฎ๊ฒแดฐแดฑ๊ณแดณแดดแดตแดถแดทแดธแดนแดบแดผแดพ๊ดแดฟหขแตแตโฑฝแตหฃสธแถป แตแตแถแตแตแถ แตสฐแถฆสฒแตหกแตโฟแตแต๐ฅสณหขแตแตแตสทหฃสธแถป ยนยฒยณโดโตโถโทโธโนโฐ |
:italic | ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐โ๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง 1234567890 |
Summary
Functions
Formats a string, replacing codepoints to mimic a pseudostyle.
Gets the available formatting modes.
Given a binary and a map of codepoint replacements, does so.
Types
@type format_mode() ::
:noop
| :sans_serif
| :cursive
| :blackboard_bold
| :block
| :block_filled
| :bubble
| :bubble_filled
| :gothic
| :small_caps
| :aesthetic
| :monospace
| :bold
| :superscript
| :italic
Functions
@spec format(String.t(), format_mode()) :: String.t()
Formats a string, replacing codepoints to mimic a pseudostyle.
Use modes/0
to get available options.
Examples
iex> Fonticode.format("ABC", :noop) "ABC"
iex> Fonticode.format("ABC", :gothic) "๐๐ โญ"
Gets the available formatting modes.
Examples
iex> Fonticode.modes()
[ :noop,
:sans_serif,
:cursive,
:blackboard_bold,
:block,
:block_filled,
:bubble,
:bubble_filled,
:gothic,
:small_caps,
:aesthetic,
:monospace,
:bold,
:superscript,
:italic]
@spec substitute(String.t(), substitution_map()) :: String.t()
Given a binary and a map of codepoint replacements, does so.
Implementation cribbed from here.
Examples
iex> Fonticode.substitute("ABCDE", %{"C" => "X", "D" => "Y"})
"ABXYE"
iex> Fonticode.substitute("ABCDE", %{"C" => "D", "D" => "C"})
"ABDCE"