fancytextgenie 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fancytextgenie/__init__.py +94 -0
- fancytextgenie/__main__.py +5 -0
- fancytextgenie/cli.py +45 -0
- fancytextgenie/py.typed +1 -0
- fancytextgenie/styles.py +125 -0
- fancytextgenie-1.0.0.dist-info/METADATA +125 -0
- fancytextgenie-1.0.0.dist-info/RECORD +11 -0
- fancytextgenie-1.0.0.dist-info/WHEEL +5 -0
- fancytextgenie-1.0.0.dist-info/entry_points.txt +2 -0
- fancytextgenie-1.0.0.dist-info/licenses/LICENSE +21 -0
- fancytextgenie-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""fancytextgenie: turn plain text into fancy Unicode font styles, and back.
|
|
2
|
+
|
|
3
|
+
>>> from fancytextgenie import convert, to_plain
|
|
4
|
+
>>> convert("Hello", "boldScript")
|
|
5
|
+
'๐๐ฎ๐ต๐ต๐ธ'
|
|
6
|
+
>>> to_plain("๐๐ฎ๐ต๐ต๐ธ")
|
|
7
|
+
'Hello'
|
|
8
|
+
|
|
9
|
+
Online tool with 500+ styles: https://fancytextgenie.com
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import re
|
|
13
|
+
from typing import Dict, List
|
|
14
|
+
|
|
15
|
+
from .styles import STYLES
|
|
16
|
+
|
|
17
|
+
__all__ = ["convert", "convert_all", "to_plain", "measure", "list_styles", "STYLE_IDS"]
|
|
18
|
+
__version__ = "1.0.0"
|
|
19
|
+
|
|
20
|
+
_STYLE_BY_ID = {style["id"]: style for style in STYLES}
|
|
21
|
+
|
|
22
|
+
#: All style ids, in display order.
|
|
23
|
+
STYLE_IDS: List[str] = [style["id"] for style in STYLES]
|
|
24
|
+
|
|
25
|
+
# Combining marks used by strikethrough / underline styles (and by many other generators).
|
|
26
|
+
_COMBINING_MARKS = re.compile("[ฬฒฬณฬตฬถฬทฬธ]")
|
|
27
|
+
|
|
28
|
+
# Reverse lookup: fancy character -> plain character. The first mapping wins.
|
|
29
|
+
# Upside-down text is skipped because it reuses plain letters (b <-> q, d <-> p, n <-> u),
|
|
30
|
+
# and plain ASCII output is skipped so normal letters are never rewritten.
|
|
31
|
+
_TO_PLAIN: Dict[str, str] = {}
|
|
32
|
+
for _style in STYLES:
|
|
33
|
+
if "map" not in _style or _style.get("reverse"):
|
|
34
|
+
continue
|
|
35
|
+
for _plain, _fancy in _style["map"].items():
|
|
36
|
+
if _fancy == _plain or ord(_fancy[0]) < 0x80 or _fancy in _TO_PLAIN:
|
|
37
|
+
continue
|
|
38
|
+
_TO_PLAIN[_fancy] = _plain
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def list_styles() -> List[Dict[str, str]]:
|
|
42
|
+
"""Return ``[{"id": ..., "name": ...}, ...]`` for every style."""
|
|
43
|
+
return [{"id": s["id"], "name": s["name"]} for s in STYLES]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def convert(text: str, style_id: str) -> str:
|
|
47
|
+
"""Convert ``text`` into one style.
|
|
48
|
+
|
|
49
|
+
Characters a style doesn't cover (punctuation, accented letters, emoji)
|
|
50
|
+
are kept as they are. Raises ``ValueError`` for an unknown style id.
|
|
51
|
+
"""
|
|
52
|
+
style = _STYLE_BY_ID.get(style_id)
|
|
53
|
+
if style is None:
|
|
54
|
+
raise ValueError(
|
|
55
|
+
'Unknown style "{}". Available styles: {}'.format(style_id, ", ".join(STYLE_IDS))
|
|
56
|
+
)
|
|
57
|
+
text = "" if text is None else str(text)
|
|
58
|
+
|
|
59
|
+
if "combining" in style:
|
|
60
|
+
mark = style["combining"]
|
|
61
|
+
out = [ch if ch in "\r\n" else ch + mark for ch in text]
|
|
62
|
+
else:
|
|
63
|
+
mapping = style["map"]
|
|
64
|
+
out = [mapping.get(ch, ch) for ch in text]
|
|
65
|
+
|
|
66
|
+
if style.get("reverse"):
|
|
67
|
+
out.reverse()
|
|
68
|
+
return "".join(out)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def convert_all(text: str) -> List[Dict[str, str]]:
|
|
72
|
+
"""Convert ``text`` into every style: ``[{"id", "name", "text"}, ...]``."""
|
|
73
|
+
return [{"id": s["id"], "name": s["name"], "text": convert(text, s["id"])} for s in STYLES]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def to_plain(text: str) -> str:
|
|
77
|
+
"""Turn fancy text back into plain text (all styles except ``upsideDown``).
|
|
78
|
+
|
|
79
|
+
Useful for cleaning social media text before tokenizing, searching,
|
|
80
|
+
deduplicating or moderating it.
|
|
81
|
+
"""
|
|
82
|
+
text = "" if text is None else str(text)
|
|
83
|
+
text = _COMBINING_MARKS.sub("", text)
|
|
84
|
+
return "".join(_TO_PLAIN.get(ch, ch) for ch in text)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def measure(text: str) -> Dict[str, int]:
|
|
88
|
+
"""Count characters two ways.
|
|
89
|
+
|
|
90
|
+
``code_points`` is what Python's ``len()`` returns. ``utf16_units`` is how most
|
|
91
|
+
apps (JavaScript, Instagram, X) count, and many fancy letters count as 2 there.
|
|
92
|
+
"""
|
|
93
|
+
text = "" if text is None else str(text)
|
|
94
|
+
return {"code_points": len(text), "utf16_units": len(text.encode("utf-16-le")) // 2}
|
fancytextgenie/cli.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Command-line interface: ``fancytextgenie "Your text"``."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import sys
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
|
|
7
|
+
from . import STYLE_IDS, convert, convert_all, list_styles, to_plain
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main(argv: Optional[List[str]] = None) -> int:
|
|
11
|
+
parser = argparse.ArgumentParser(
|
|
12
|
+
prog="fancytextgenie",
|
|
13
|
+
description="Turn plain text into fancy Unicode font styles, and back.",
|
|
14
|
+
epilog="Try every style in your browser: https://fancytextgenie.com",
|
|
15
|
+
)
|
|
16
|
+
parser.add_argument("text", nargs="*", help="text to convert (reads stdin if empty)")
|
|
17
|
+
parser.add_argument("-s", "--style", choices=STYLE_IDS, metavar="ID", help="one style id (see --list)")
|
|
18
|
+
parser.add_argument("-p", "--plain", action="store_true", help="convert fancy text back to plain text")
|
|
19
|
+
parser.add_argument("-l", "--list", action="store_true", help="list all style ids")
|
|
20
|
+
args = parser.parse_args(argv)
|
|
21
|
+
|
|
22
|
+
if args.list:
|
|
23
|
+
for style in list_styles():
|
|
24
|
+
print("{:<16} {}".format(style["id"], style["name"]))
|
|
25
|
+
return 0
|
|
26
|
+
|
|
27
|
+
text = " ".join(args.text)
|
|
28
|
+
if not text and not sys.stdin.isatty():
|
|
29
|
+
text = sys.stdin.read().rstrip("\n")
|
|
30
|
+
if not text:
|
|
31
|
+
parser.print_help()
|
|
32
|
+
return 1
|
|
33
|
+
|
|
34
|
+
if args.plain:
|
|
35
|
+
print(to_plain(text))
|
|
36
|
+
elif args.style:
|
|
37
|
+
print(convert(text, args.style))
|
|
38
|
+
else:
|
|
39
|
+
for item in convert_all(text):
|
|
40
|
+
print("{:<16} {}".format(item["id"], item["text"]))
|
|
41
|
+
return 0
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
sys.exit(main())
|
fancytextgenie/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
fancytextgenie/styles.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""Style definitions for fancytextgenie.
|
|
2
|
+
|
|
3
|
+
Most styles come from the Unicode "Mathematical Alphanumeric Symbols" block
|
|
4
|
+
(U+1D400-U+1D7FF). A few letters in that block were encoded earlier in the
|
|
5
|
+
"Letterlike Symbols" block (U+2100-U+214F), so their math code points are
|
|
6
|
+
reserved and must be mapped by hand. The ``exceptions`` below fill those gaps.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Dict, List, Optional
|
|
10
|
+
|
|
11
|
+
UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
12
|
+
LOWER = "abcdefghijklmnopqrstuvwxyz"
|
|
13
|
+
DIGITS = "0123456789"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _range_map(
|
|
17
|
+
upper: Optional[int] = None,
|
|
18
|
+
lower: Optional[int] = None,
|
|
19
|
+
digits: Optional[int] = None,
|
|
20
|
+
exceptions: Optional[Dict[str, str]] = None,
|
|
21
|
+
) -> Dict[str, str]:
|
|
22
|
+
mapping: Dict[str, str] = {}
|
|
23
|
+
if upper is not None:
|
|
24
|
+
for i, ch in enumerate(UPPER):
|
|
25
|
+
mapping[ch] = chr(upper + i)
|
|
26
|
+
if lower is not None:
|
|
27
|
+
for i, ch in enumerate(LOWER):
|
|
28
|
+
mapping[ch] = chr(lower + i)
|
|
29
|
+
if digits is not None:
|
|
30
|
+
for i, ch in enumerate(DIGITS):
|
|
31
|
+
mapping[ch] = chr(digits + i)
|
|
32
|
+
if exceptions:
|
|
33
|
+
mapping.update(exceptions)
|
|
34
|
+
return mapping
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _caseless_map(upper_start: int) -> Dict[str, str]:
|
|
38
|
+
"""Map both cases of each letter to one set of characters."""
|
|
39
|
+
mapping: Dict[str, str] = {}
|
|
40
|
+
for i, ch in enumerate(UPPER):
|
|
41
|
+
out = chr(upper_start + i)
|
|
42
|
+
mapping[ch] = out
|
|
43
|
+
mapping[ch.lower()] = out
|
|
44
|
+
return mapping
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _pairs(src: str, dst: str) -> Dict[str, str]:
|
|
48
|
+
return dict(zip(src, dst))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
_small_caps_letters = _pairs(LOWER, "แดสแดแด
แด๊ฐษขสษชแดแดสแดษดแดแดวซส๊ฑแดแดแด แดกxสแดข")
|
|
52
|
+
SMALL_CAPS = dict(_small_caps_letters)
|
|
53
|
+
for _ch in UPPER:
|
|
54
|
+
SMALL_CAPS[_ch] = _small_caps_letters[_ch.lower()]
|
|
55
|
+
|
|
56
|
+
_upside_down_lower = _pairs(LOWER, "ษqษpวษฦษฅแดษพสlษฏuodbษนsสnสสxสz")
|
|
57
|
+
UPSIDE_DOWN = dict(_upside_down_lower)
|
|
58
|
+
UPSIDE_DOWN.update(_pairs(DIGITS, "0ฦแ
ฦใฃฯ9ใฅ86"))
|
|
59
|
+
UPSIDE_DOWN.update({
|
|
60
|
+
".": "ห", ",": "'", "'": ",", "?": "ยฟ", "!": "ยก",
|
|
61
|
+
"(": ")", ")": "(", "[": "]", "]": "[", "{": "}", "}": "{",
|
|
62
|
+
"<": ">", ">": "<", "_": "โพ", "&": "โ
",
|
|
63
|
+
})
|
|
64
|
+
for _ch in UPPER:
|
|
65
|
+
UPSIDE_DOWN[_ch] = _upside_down_lower[_ch.lower()]
|
|
66
|
+
|
|
67
|
+
FULLWIDTH = {chr(cp): chr(cp + 0xFEE0) for cp in range(0x21, 0x7F)}
|
|
68
|
+
FULLWIDTH[" "] = "ใ" # ideographic space keeps the wide rhythm
|
|
69
|
+
|
|
70
|
+
CIRCLED = _range_map(
|
|
71
|
+
upper=0x24B6,
|
|
72
|
+
lower=0x24D0,
|
|
73
|
+
exceptions={"0": "โช", **_pairs("123456789", "โ โกโขโฃโคโฅโฆโงโจ")},
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
CIRCLED_NEGATIVE = _caseless_map(0x1F150)
|
|
77
|
+
CIRCLED_NEGATIVE.update({"0": "โฟ", **_pairs("123456789", "โถโทโธโนโบโปโผโฝโพ")})
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
#: Every style: id, human-readable name, and either a character ``map``
|
|
81
|
+
#: or a ``combining`` mark. ``reverse`` flips the order (upside-down text).
|
|
82
|
+
STYLES: List[dict] = [
|
|
83
|
+
{"id": "bold", "name": "Bold (serif)",
|
|
84
|
+
"map": _range_map(upper=0x1D400, lower=0x1D41A, digits=0x1D7CE)},
|
|
85
|
+
{"id": "italic", "name": "Italic (serif)",
|
|
86
|
+
"map": _range_map(upper=0x1D434, lower=0x1D44E, exceptions={"h": "โ"})},
|
|
87
|
+
{"id": "boldItalic", "name": "Bold italic (serif)",
|
|
88
|
+
"map": _range_map(upper=0x1D468, lower=0x1D482)},
|
|
89
|
+
{"id": "script", "name": "Script / cursive",
|
|
90
|
+
"map": _range_map(upper=0x1D49C, lower=0x1D4B6, exceptions={
|
|
91
|
+
"B": "โฌ", "E": "โฐ", "F": "โฑ", "H": "โ", "I": "โ", "L": "โ", "M": "โณ", "R": "โ",
|
|
92
|
+
"e": "โฏ", "g": "โ", "o": "โด",
|
|
93
|
+
})},
|
|
94
|
+
{"id": "boldScript", "name": "Bold script / cursive",
|
|
95
|
+
"map": _range_map(upper=0x1D4D0, lower=0x1D4EA)},
|
|
96
|
+
{"id": "fraktur", "name": "Gothic (Fraktur)",
|
|
97
|
+
"map": _range_map(upper=0x1D504, lower=0x1D51E, exceptions={
|
|
98
|
+
"C": "โญ", "H": "โ", "I": "โ", "R": "โ", "Z": "โจ",
|
|
99
|
+
})},
|
|
100
|
+
{"id": "boldFraktur", "name": "Bold gothic (Fraktur)",
|
|
101
|
+
"map": _range_map(upper=0x1D56C, lower=0x1D586)},
|
|
102
|
+
{"id": "doubleStruck", "name": "Double-struck / outline",
|
|
103
|
+
"map": _range_map(upper=0x1D538, lower=0x1D552, digits=0x1D7D8, exceptions={
|
|
104
|
+
"C": "โ", "H": "โ", "N": "โ", "P": "โ", "Q": "โ", "R": "โ", "Z": "โค",
|
|
105
|
+
})},
|
|
106
|
+
{"id": "sans", "name": "Sans-serif",
|
|
107
|
+
"map": _range_map(upper=0x1D5A0, lower=0x1D5BA, digits=0x1D7E2)},
|
|
108
|
+
{"id": "sansBold", "name": "Sans-serif bold",
|
|
109
|
+
"map": _range_map(upper=0x1D5D4, lower=0x1D5EE, digits=0x1D7EC)},
|
|
110
|
+
{"id": "sansItalic", "name": "Sans-serif italic",
|
|
111
|
+
"map": _range_map(upper=0x1D608, lower=0x1D622)},
|
|
112
|
+
{"id": "sansBoldItalic", "name": "Sans-serif bold italic",
|
|
113
|
+
"map": _range_map(upper=0x1D63C, lower=0x1D656)},
|
|
114
|
+
{"id": "monospace", "name": "Monospace / typewriter",
|
|
115
|
+
"map": _range_map(upper=0x1D670, lower=0x1D68A, digits=0x1D7F6)},
|
|
116
|
+
{"id": "fullwidth", "name": "Fullwidth / vaporwave", "map": FULLWIDTH},
|
|
117
|
+
{"id": "smallCaps", "name": "Small caps", "map": SMALL_CAPS},
|
|
118
|
+
{"id": "circled", "name": "Bubble (circled)", "map": CIRCLED},
|
|
119
|
+
{"id": "circledNegative", "name": "Bubble filled (negative circled)", "map": CIRCLED_NEGATIVE},
|
|
120
|
+
{"id": "squared", "name": "Squared", "map": _caseless_map(0x1F130)},
|
|
121
|
+
{"id": "squaredNegative", "name": "Squared filled (negative squared)", "map": _caseless_map(0x1F170)},
|
|
122
|
+
{"id": "upsideDown", "name": "Upside down", "map": UPSIDE_DOWN, "reverse": True},
|
|
123
|
+
{"id": "strikethrough", "name": "Strikethrough", "combining": "ฬถ"},
|
|
124
|
+
{"id": "underline", "name": "Underline", "combining": "ฬฒ"},
|
|
125
|
+
]
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fancytextgenie
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Convert plain text into 22 fancy Unicode font styles (bold, cursive, gothic, bubble, small caps, upside down) and back. Zero dependencies.
|
|
5
|
+
Author: FancyTextGenie
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://fancytextgenie.com
|
|
8
|
+
Project-URL: Source, https://github.com/fancytextgenie/Fancy-Text-Generator
|
|
9
|
+
Project-URL: Issues, https://github.com/fancytextgenie/Fancy-Text-Generator/issues
|
|
10
|
+
Project-URL: Demo, https://huggingface.co/spaces/fancytextgenie/Fancy-Text-Generator
|
|
11
|
+
Keywords: fancy text,fancy text generator,unicode,fonts,cursive,small caps,upside down text,text normalization,mathematical alphanumeric symbols
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Text Processing
|
|
18
|
+
Classifier: Topic :: Text Processing :: Filters
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# fancytextgenie
|
|
27
|
+
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
- Pure Python, zero dependencies, Python 3.8+
|
|
31
|
+
- `to_plain()` normalizes styled social-media text before you tokenize, search, deduplicate or moderate it
|
|
32
|
+
- Includes a command-line tool
|
|
33
|
+
- MIT licensed. The same styles are also available as a JavaScript package on npm.
|
|
34
|
+
|
|
35
|
+
**Online version (500+ styles, no install):** https://fancytextgenie.com
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install fancytextgenie
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from fancytextgenie import convert, convert_all, to_plain, measure, list_styles
|
|
47
|
+
|
|
48
|
+
convert("Hello world", "boldScript")
|
|
49
|
+
# '๐๐ฎ๐ต๐ต๐ธ ๐๐ธ๐ป๐ต๐ญ'
|
|
50
|
+
|
|
51
|
+
convert("Hello", "fraktur")
|
|
52
|
+
# 'โ๐ข๐ฉ๐ฉ๐ฌ'
|
|
53
|
+
|
|
54
|
+
to_plain("๐๐ฎ๐ต๐ต๐ธ ๐๐ธ๐ป๐ต๐ญ")
|
|
55
|
+
# 'Hello world'
|
|
56
|
+
|
|
57
|
+
measure("๐๐ข")
|
|
58
|
+
# {'code_points': 2, 'utf16_units': 4}
|
|
59
|
+
|
|
60
|
+
[s["id"] for s in list_styles()][:5]
|
|
61
|
+
# ['bold', 'italic', 'boldItalic', 'script', 'boldScript']
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Clean styled text in a dataset
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from fancytextgenie import to_plain
|
|
68
|
+
|
|
69
|
+
bios = ["๐ ๐ต๐ธ๐ฟ๐ฎ ๐ฌ๐ธ๐ฏ๐ฏ๐ฎ๐ฎ", "โโโฃ โโโโจ", "sฬถtฬถuฬถdฬถyฬถiฬถnฬถgฬถ napping"]
|
|
70
|
+
[to_plain(b) for b in bios]
|
|
71
|
+
# ['I love coffee', 'cat lady', 'studying napping']
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Command line
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
fancytextgenie "Fancy Text" # every style
|
|
78
|
+
fancytextgenie "Fancy Text" -s circled # one style
|
|
79
|
+
fancytextgenie -p "๐๐ช๐ท๐ฌ๐ ๐ฝ๐ฎ๐๐ฝ" # back to plain text
|
|
80
|
+
fancytextgenie --list # all style ids
|
|
81
|
+
python -m fancytextgenie "Fancy Text" # same, without the script
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Styles
|
|
85
|
+
|
|
86
|
+
| id | Example |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `bold` | ๐
๐๐ง๐๐ฒ ๐๐๐ฑ๐ญ ๐๐๐ |
|
|
89
|
+
| `italic` | ๐น๐๐๐๐ฆ ๐๐๐ฅ๐ก 123 |
|
|
90
|
+
| `boldItalic` | ๐ญ๐๐๐๐ ๐ป๐๐๐ 123 |
|
|
91
|
+
| `script` | โฑ๐ถ๐๐ธ๐ ๐ฏโฏ๐๐ 123 |
|
|
92
|
+
| `boldScript` | ๐๐ช๐ท๐ฌ๐ ๐ฃ๐ฎ๐๐ฝ 123 |
|
|
93
|
+
| `fraktur` | ๐๐๐ซ๐ ๐ถ ๐๐ข๐ต๐ฑ 123 |
|
|
94
|
+
| `boldFraktur` | ๐ฑ๐๐๐๐ ๐ฟ๐๐๐ 123 |
|
|
95
|
+
| `doubleStruck` | ๐ฝ๐๐๐๐ช ๐๐๐ฉ๐ฅ ๐๐๐ |
|
|
96
|
+
| `sans` | ๐ฅ๐บ๐๐ผ๐ ๐ณ๐พ๐๐ ๐ฃ๐ค๐ฅ |
|
|
97
|
+
| `sansBold` | ๐๐ฎ๐ป๐ฐ๐ ๐ง๐ฒ๐
๐ ๐ญ๐ฎ๐ฏ |
|
|
98
|
+
| `sansItalic` | ๐๐ข๐ฏ๐ค๐บ ๐๐ฆ๐น๐ต 123 |
|
|
99
|
+
| `sansBoldItalic` | ๐๐๐ฃ๐๐ฎ ๐๐๐ญ๐ฉ 123 |
|
|
100
|
+
| `monospace` | ๐ต๐๐๐๐ข ๐๐๐ก๐ ๐ท๐ธ๐น |
|
|
101
|
+
| `fullwidth` | ๏ผฆ๏ฝ๏ฝ๏ฝ๏ฝใ๏ผด๏ฝ
๏ฝ๏ฝใ๏ผ๏ผ๏ผ |
|
|
102
|
+
| `smallCaps` | ๊ฐแดษดแดส แดแดxแด 123 |
|
|
103
|
+
| `circled` | โปโโโโจ โโโงโฃ โ โกโข |
|
|
104
|
+
| `circledNegative` | ๐
๐
๐
๐
๐
จ ๐
ฃ๐
๐
ง๐
ฃ โถโทโธ |
|
|
105
|
+
| `squared` | ๐ต๐ฐ๐ฝ๐ฒ๐
๐
๐ด๐
๐
123 |
|
|
106
|
+
| `squaredNegative` | ๐
ต๐
ฐ๐
ฝ๐
ฒ๐ ๐๐
ด๐๐ 123 |
|
|
107
|
+
| `upsideDown` | ฦแ
ฦ สxวส สษuษษ |
|
|
108
|
+
| `strikethrough` | Fฬถaฬถnฬถcฬถyฬถ ฬถTฬถeฬถxฬถtฬถ ฬถ1ฬถ2ฬถ3ฬถ |
|
|
109
|
+
| `underline` | Fฬฒaฬฒnฬฒcฬฒyฬฒ ฬฒTฬฒeฬฒxฬฒtฬฒ ฬฒ1ฬฒ2ฬฒ3ฬฒ |
|
|
110
|
+
|
|
111
|
+
## How it works
|
|
112
|
+
|
|
113
|
+
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.
|
|
114
|
+
|
|
115
|
+
`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.
|
|
116
|
+
|
|
117
|
+
## Things to know
|
|
118
|
+
|
|
119
|
+
- **Screen readers** often read math letters one by one or skip them. Keep names and calls to action in plain text.
|
|
120
|
+
- **Older phones** may show some styles as empty boxes.
|
|
121
|
+
- **Character limits:** most styled letters count as 2 toward limits in apps that count UTF-16 units. `measure()` shows both counts.
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT ยฉ FancyTextGenie. Source: https://github.com/fancytextgenie/Fancy-Text-Generator
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
fancytextgenie/__init__.py,sha256=W4396UEQ1ZpoAH0gmTB5oiN96iw8VT_x3uHmzPW45QQ,3265
|
|
2
|
+
fancytextgenie/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
|
|
3
|
+
fancytextgenie/cli.py,sha256=MhPGisgkkswPribtjjlxU5yTFGCxKeFy_NXf0C4woe8,1519
|
|
4
|
+
fancytextgenie/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
|
+
fancytextgenie/styles.py,sha256=la3tFtdWTcpd5ubzpOgF8ps6gLZoBK4-w3_Ob7jhHoA,5344
|
|
6
|
+
fancytextgenie-1.0.0.dist-info/licenses/LICENSE,sha256=mJv8SrmQHnJP-lyLP9B1rFtHl_skDz1kbPxwFez0w18,1071
|
|
7
|
+
fancytextgenie-1.0.0.dist-info/METADATA,sha256=x-uGcU7pvEdsXe3_nok5MCDm6Z_oLHWb1L2E4BM3wfo,5461
|
|
8
|
+
fancytextgenie-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
9
|
+
fancytextgenie-1.0.0.dist-info/entry_points.txt,sha256=IhoMHAN8zR74opMy-AvXpVRvt7pMaTQ7b-u_CCKxNac,59
|
|
10
|
+
fancytextgenie-1.0.0.dist-info/top_level.txt,sha256=RD0NlQVVzVUQ3sTnPrMSRO1Zqj2kA1Zdz1QHde_hAic,15
|
|
11
|
+
fancytextgenie-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FancyTextGenie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fancytextgenie
|