Skip to main content

fancytextgenie

Turn plain text into 22 fancy Unicode font styles, and turn styled text back into plain text. Styles include bold, italic, cursive, gothic, double-struck, bubble, small caps, fullwidth and upside down.

  • Pure Python, zero dependencies, Python 3.8+
  • to_plain() normalizes styled social-media text before you tokenize, search, deduplicate or moderate it
  • Includes a command-line tool
  • MIT licensed. The same styles are also available as a JavaScript package on npm.

Online version (500+ styles, no install): https://fancytextgenie.com

Install

pip install fancytextgenie

Usage

from fancytextgenie import convert, convert_all, to_plain, measure, list_styles

convert("Hello world", "boldScript")
# '𝓗𝓮𝓵𝓵𝓸 𝔀𝓸𝓻𝓵𝓭'

convert("Hello", "fraktur")
# 'ℌ𝔢𝔩𝔩𝔬'

to_plain("𝓗𝓮𝓵𝓵𝓸 𝔀𝓸𝓻𝓵𝓭")
# 'Hello world'

measure("𝐇𝐢")
# {'code_points': 2, 'utf16_units': 4}

[s["id"] for s in list_styles()][:5]
# ['bold', 'italic', 'boldItalic', 'script', 'boldScript']

Clean styled text in a dataset

from fancytextgenie import to_plain

bios = ["𝓘 𝓵𝓸𝓿𝓮 𝓬𝓸𝓯𝓯𝓮𝓮", "ⓒⓐⓣ ⓛⓐⓓⓨ", "s̶t̶u̶d̶y̶i̶n̶g̶ napping"]
[to_plain(b) for b in bios]
# ['I love coffee', 'cat lady', 'studying napping']

Command line

fancytextgenie "Fancy Text"               # every style
fancytextgenie "Fancy Text" -s circled    # one style
fancytextgenie -p "𝓕𝓪𝓷𝓬𝔂 𝓽𝓮𝔁𝓽"            # back to plain text
fancytextgenie --list                     # all style ids
python -m fancytextgenie "Fancy Text"     # same, without the script

Styles

id Example
bold 𝐅𝐚𝐧𝐜𝐲 𝐓𝐞𝐱𝐭 𝟏𝟐𝟑
italic 𝐹𝑎𝑛𝑐𝑦 𝑇𝑒𝑥𝑡 123
boldItalic 𝑭𝒂𝒏𝒄𝒚 𝑻𝒆𝒙𝒕 123
script ℱ𝒶𝓃𝒸𝓎 𝒯ℯ𝓍𝓉 123
boldScript 𝓕𝓪𝓷𝓬𝔂 𝓣𝓮𝔁𝓽 123
fraktur 𝔉𝔞𝔫𝔠𝔶 𝔗𝔢𝔵𝔱 123
boldFraktur 𝕱𝖆𝖓𝖈𝖞 𝕿𝖊𝖝𝖙 123
doubleStruck 𝔽𝕒𝕟𝕔𝕪 𝕋𝕖𝕩𝕥 𝟙𝟚𝟛
sans 𝖥𝖺𝗇𝖼𝗒 𝖳𝖾𝗑𝗍 𝟣𝟤𝟥
sansBold 𝗙𝗮𝗻𝗰𝘆 𝗧𝗲𝘅𝘁 𝟭𝟮𝟯
sansItalic 𝘍𝘢𝘯𝘤𝘺 𝘛𝘦𝘹𝘵 123
sansBoldItalic 𝙁𝙖𝙣𝙘𝙮 𝙏𝙚𝙭𝙩 123
monospace 𝙵𝚊𝚗𝚌𝚢 𝚃𝚎𝚡𝚝 𝟷𝟸𝟹
fullwidth Fancy Text 123
smallCaps ꜰᴀɴᴄʏ ᴛᴇxᴛ 123
circled Ⓕⓐⓝⓒⓨ Ⓣⓔⓧⓣ ①②③
circledNegative 🅕🅐🅝🅒🅨 🅣🅔🅧🅣 ❶❷❸
squared 🄵🄰🄽🄲🅈 🅃🄴🅇🅃 123
squaredNegative 🅵🅰🅽🅲🆈 🆃🅴🆇🆃 123
upsideDown ƐᄅƖ ʇxǝʇ ʎɔuɐɟ
strikethrough F̶a̶n̶c̶y̶ ̶T̶e̶x̶t̶ ̶1̶2̶3̶
underline F̲a̲n̲c̲y̲ ̲T̲e̲x̲t̲ ̲1̲2̲3̲

How it works

These aren't fonts. Each style swaps letters for look-alike Unicode characters, mostly from the Mathematical Alphanumeric Symbols block (U+1D400–U+1D7FF). Some letters were added to Unicode earlier, in the Letterlike Symbols block, so the math block leaves gaps for them. Examples are script ℬ (U+212C) and double-struck ℝ (U+211D). This package maps those gaps correctly, so you won't get empty boxes.

unicodedata.normalize("NFKC", ...) also flattens many of these characters. It doesn't undo small caps or combining strikethrough, and it changes other text too (for example ™ → TM). to_plain() only reverses the styles listed above.

Things to know

  • Screen readers often read math letters one by one or skip them. Keep names and calls to action in plain text.
  • Older phones may show some styles as empty boxes.
  • Character limits: most styled letters count as 2 toward limits in apps that count UTF-16 units. measure() shows both counts.

License

MIT © FancyTextGenie. Source: https://github.com/fancytextgenie/Fancy-Text-Generator

Metadata

Release files for fancytextgenie 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fancytextgenie 1.0.0
File Size Uploaded Provenance Actions
fancytextgenie-1.0.0.tar.gz 11.7 kB Without provenance Details for fancytextgenie-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fancytextgenie 1.0.0
File Interpreter ABI Platform Actions
fancytextgenie-1.0.0-py3-none-any.whl Python 3 none any Details for fancytextgenie-1.0.0-py3-none-any.whl

Total release size: 21.7 kB

Release files / fancytextgenie-1.0.0.tar.gz

Download URL fancytextgenie-1.0.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e176cf6b5700d779db81eeab3747b3354e80cce9bc3eccc908e861d0f274a333
BLAKE2b-256 checksum
How to use checksums
1073ae81c4699ba3c3f2fef37777a60bcb3f84bb908e0365fc347be6b31b4b5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / fancytextgenie-1.0.0-py3-none-any.whl

Download URL fancytextgenie-1.0.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccbac2737deb3c4ae49624e962fcd8cb32b0f95bfee45b24d448c13ba846ecb6
BLAKE2b-256 checksum
How to use checksums
10d1d6e7c6821983178b4e2629704b035bc24902743d2375e1addb933929ba28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for fancytextgenie 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page