Python tool for converting all plain English letters in text into various fancy-styled text and back
Project description
Text FanciPy
Text FanciPy is a Python tool for converting plain English letters (A-Za-z) in a text to their Unicode counterparts in various “fancy” styles, and vice versa. It’s perfect for adding a unique, stylistic touch to your text messages, documents, or any other content, where text styling can be applied.
However, note that any “fancy-styled” text is not proper Unicode text, so it’s not searchable, and it’s not guaranteed to be displayed correctly on all devices. It’s best used for decorative purposes only.
Features
- Converts the plain English letters in your text to various fancy styles (which are still plain Unicode text).
- Converts fancy-styled text back to correct text.
- Can be used via a command line interface (CLI) or imported as a Python package.
Text FanciPy supports several “fancy styles” for text conversion:
style | name |
---|---|
bdit |
𝑩𝒐𝒍𝒅 𝑰𝒕𝒂𝒍𝒊𝒄 |
bold |
𝐁𝐨𝐥𝐝 |
bscr |
𝓑𝓸𝓵𝓭 𝓢𝓬𝓻𝓲𝓹𝓽 |
dbst |
𝔻𝕠𝕦𝕓𝕝𝕖-𝕤𝕥𝕣𝕦𝕔𝕜 |
dflt |
Default |
ital |
𝐼𝑡𝑎𝑙𝑖𝑐 |
mono |
𝙼𝚘𝚗𝚘𝚜𝚙𝚊𝚌𝚎 |
sans |
𝖲𝖺𝗇𝗌-𝗌𝖾𝗋𝗂𝖿 |
snbd |
𝗦𝗮𝗻𝘀-𝘀𝗲𝗿𝗶𝗳 𝗕𝗼𝗹𝗱 |
snbi |
𝙎𝙖𝙣𝙨-𝙨𝙚𝙧𝙞𝙛 𝘽𝙤𝙡𝙙 𝙄𝙩𝙖𝙡𝙞𝙘 |
snit |
𝘚𝘢𝘯𝘴-𝘴𝘦𝘳𝘪𝘧 𝘐𝘵𝘢𝘭𝘪𝘤 |
Installation
To install Text FanciPy, run:
python3 -m pip install --upgrade text_fancipy
For the current development version:
python3 -m pip install --upgrade git+https://github.com/twardoch/text_fancipy
Command-line usage
After installation, fancipy
can be used directly from the command line.
With text specified as an argument
Convert text to a fancy style:
fancipy <style> -t "Your text"
For example, to convert to Bold style:
$ fancipy bold -t "Hello World"
𝐇𝐞𝐥𝐥𝐨 𝐖𝐨𝐫𝐥𝐝
Convert text back from a fancy style to plain text:
fancipy undo -t "𝐇𝐞𝐥𝐥𝐨 𝐖𝐨𝐫𝐥𝐝"
With piping
$ echo "Hello World" | fancipy bold | fancipy undo
Hello World
With files
You can also specify input and output files:
fancipy <style> -f input.txt -o output.txt
Python usage
You can use Text FanciPy as a library in your Python scripts.
from text_fancipy.fancipy import fancipy, unfancipy_all
# Convert to fancy text
fancy_text = fancipy("Your Text", "bold")
# Convert back to plain text
plain_text = unfancipy_all(fancy_text)
Development
To contribute to FanciPy, clone the repository from GitHub and install the required development dependencies:
git clone https://github.com/twardoch/text_fancipy
cd text_fancipy
pip install -e .[testing]
Testing
Run tests using pytest:
pytest
Changes
- v1.0: Initial release
License
- Text FanciPy written by Adam Twardoch, with assistance from GPT-4
- Copyright (c) 2023 Adam Twardoch
- Licensed under the Apache-2.0 license
Contact
Open an issue and describe your problem or suggestion.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for text_fancipy-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2142af3d8d5e9726acc0f53a353c9e9c43ea9cc5f79225838ef5b36f770e6f44 |
|
MD5 | 775cce62ebe7ae6dc6401aeab543e6af |
|
BLAKE2b-256 | a0b426813ac7d5eb68cb2fbef0393085b2bca5f986f62884698efdb22a51cc2a |