Crate math_text_transform

Source
Expand description

Transform text from standard alphanumerical characters to it’s unicode equivalents of a certain variant in the mathematical alphanumeric symbols block (code block U+1D400–U+1D7FF).

use math_text_transform::math_italic;
use math_text_transform::MathTextTransform;

assert_eq!(math_italic('f'), Some('𝑓'));
assert_eq!("Bold".to_math_bold(), "𝐁𝐨𝐥𝐝");

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)

§References

  • https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols

Traits§

  • Convenience trait that allows you to call the the transformation straight on a string slice. If a variant doesn’t exist for a given character, it is left as is.

Functions§

  • Transform a character to it’s mathematical bold equivalent.
  • Transform a character to it’s mathematical bold fraktur equivalent.
  • Transform a character to it’s mathematical bold italic equivalent.
  • Transform a character to it’s mathematical bold script equivalent.
  • Transform a character to it’s mathematical double-struck equivalent.
  • Transform a character to it’s mathematical fraktur equivalent.
  • Transform a character to it’s mathematical italic equivalent.
  • Transform a character to it’s mathematical monospace equivalent.
  • Transform a character to it’s mathematical sans-serif equivalent.
  • Transform a character to it’s mathematical sans-serif bold equivalent.
  • Transform a character to it’s mathematical sans-serif bold italic equivalent.
  • Transform a character to it’s mathematical sans-serif italic equivalent.
  • Transform a character to it’s mathematical script equivalent.