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)
Add this to your Cargo.toml:
[dependencies]
math-text-transform = "*"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(), "๐ป๐ ๐ฆ๐๐๐-๐ค๐ฅ๐ฃ๐ฆ๐๐ ๐๐๐");https://runarberg.github.com/math-text-transform
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-transformAnd use like so:
math-text-transform <variant> <text>Text can also be supplied through the standard input.
$ math-text-transform -bf-it Bold-Italic
๐ฉ๐๐๐
-๐ฐ๐๐๐๐๐
$ echo "Double struck" | math-text-transform --double-struck
๐ป๐ ๐ฆ๐๐๐ ๐ค๐ฅ๐ฃ๐ฆ๐๐