math-text-transform 0.1.1

Transform greek letters, latin letters, or decimal digits into certain variants from the mathematical alphanumeric symbols Unicode block (U+1D400–U+1D7FF). For example to bold, italic, script or double-struck.
Documentation

Math Text Transform

Travis build crates.io

A simple crate that provides functions to map a greek letter, latin letter, or a decimal digit to a certain variant from the mathematical alphanumeric symbols Unicode block (U+1D400–U+1D7FF). We also provide convenience string methods that maps each character in a string to the variant (or leaves it alone if there is none).

Supported variants are:

  • 𝐛𝐨đĨ𝐝 (bold)
  • 𝑖𝑡𝑎𝑙𝑖𝑐 (italic)
  • 𝒃𝒐𝒍𝒅 𝒊𝒕𝒂𝒍𝒊𝒄 (bold italic)
  • 𝗌đ–ē𝗇𝗌-𝗌𝖾𝗋𝗂đ–ŋ (sans-serif)
  • 𝘀𝗮đ—ģ𝘀-𝘀𝗲đ—ŋđ—ļđ—ŗ đ—¯đ—ŧ𝗹𝗱 (sans-serif bold)
  • 𝘴đ˜ĸđ˜¯đ˜´-𝘴đ˜Ļđ˜ŗđ˜Ē𝘧 đ˜Ēđ˜ĩđ˜ĸ𝘭đ˜Ē𝘤 (sans-serif italic)
  • 𝙨𝙖đ™Ŗ𝙨-𝙨𝙚𝙧𝙞𝙛 𝙗𝙤𝙡𝙙 𝙞𝙩𝙖𝙡𝙞𝙘 (sans-serif bold italic)
  • 𝓈𝒸𝓇𝒾𝓅𝓉 (script)
  • đ“Ģ𝓸đ“ĩ𝓭 đ“ŧđ“Ŧđ“ģ𝓲𝓹đ“Ŋ (bold script)
  • đ”Ŗđ”¯đ”žđ”¨đ”ąđ”˛đ”¯ (fraktur)
  • 𝖇𝖔𝖑𝖉 𝖋𝖗𝖆𝖐𝖙𝖚𝖗 (bold fraktur)
  • 𝚖𝚘𝚗𝚘𝚜𝚙𝚊𝚌𝚎 (monospace)
  • 𝕕𝕠đ•Ļ𝕓𝕝𝕖-𝕤đ•Ĩđ•Ŗđ•Ļ𝕔𝕜 (double-struck)

Install

Add this to your Cargo.toml:

[dependencies]
math-text-transform = "*"

Usage

extern crate math_text_transform;
use math_text_transform::MathTextTransform;

assert_eq!("Bold".to_math_bold(), "𝐁𝐨đĨ𝐝");
assert_eq!("ÎŖÎąÎŊĪƒ-ÎŖÎĩĪÎšĪ†-ΒÎŋÎģδ".to_math_sans_serif_bold(), "𝝨𝝰đŧ𝞂-𝝨𝝴𝞀𝝸𝞅-𝝗𝝾đēđŗ");
assert_eq!("Double-struck 123".to_math_double_struck(), "đ”ģ𝕠đ•Ļ𝕓𝕝𝕖-𝕤đ•Ĩđ•Ŗđ•Ļ𝕔𝕜 𝟙𝟚𝟛");

Documentation

https://runarberg.github.com/math-text-transform

CLI utility

If you are for some reason only interested in the CLI utility you can install with:

$ git clone https://github.com/runarberg/math-text-transform.git
$ cd math-text-transform
$ cargo build --release
$ [sudo] ln -s $(pwd)/target/release/math-text-transform /usr/local/bin/math-text-transform

And use like so:

math-text-transform <variant> <text>

Text can also be supplied through the standard input.

Examples

$ math-text-transform -bf-it Bold-Italic
𝑩𝒐𝒍𝒅-𝑰𝒕𝒂𝒍𝒊𝒄
$ echo "Double struck" | math-text-transform --double-struck
đ”ģ𝕠đ•Ļ𝕓𝕝𝕖 𝕤đ•Ĩđ•Ŗđ•Ļ𝕔𝕜