Metadata-Version: 2.4
Name: fancytextgenie
Version: 1.0.0
Summary: Convert plain text into 22 fancy Unicode font styles (bold, cursive, gothic, bubble, small caps, upside down) and back. Zero dependencies.
Author: FancyTextGenie
License-Expression: MIT
Project-URL: Homepage, https://fancytextgenie.com
Project-URL: Source, https://github.com/fancytextgenie/Fancy-Text-Generator
Project-URL: Issues, https://github.com/fancytextgenie/Fancy-Text-Generator/issues
Project-URL: Demo, https://huggingface.co/spaces/fancytextgenie/Fancy-Text-Generator
Keywords: fancy text,fancy text generator,unicode,fonts,cursive,small caps,upside down text,text normalization,mathematical alphanumeric symbols
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Text Processing
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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

```bash
pip install fancytextgenie
```

## Usage

```python
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

```python
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

```bash
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` | Ｆａｎｃｙ　Ｔｅｘｔ　１２３ |
| `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
