Code Monkey home page Code Monkey logo

fancify-text's Introduction

fancify-text

(Thanks to @nottrobin for the original library)

Convert text into a fancier unicode representation, picking from the following fonts:

Standard fonts made with mathematical letters or similar

𝗌𝖺𝗇𝗌𝖲𝖾𝗋𝗂𝖿 - 𝖳𝗁𝖾 𝗊𝗎𝗂𝖼𝗄 𝖻𝗋𝗈𝗐𝗇 𝖿𝗈𝗑 𝗃𝗎𝗆𝗉𝗌 𝗈𝗏𝖾𝗋 𝗍𝗁𝖾 𝗅𝖺𝗓𝗒 𝖽𝗈𝗀. 𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫
𝗯𝗼𝗹𝗱 - 𝗧𝗵𝗲 𝗾𝘂𝗶𝗰𝗸 𝗯𝗿𝗼𝘄𝗻 𝗳𝗼𝘅 𝗷𝘂𝗺𝗽𝘀 𝗼𝘃𝗲𝗿 𝘁𝗵𝗲 𝗹𝗮𝘇𝘆 𝗱𝗼𝗴. 𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵
𝘪𝘵𝘢𝘭𝘪𝘤 - 𝘛𝘩𝘦 𝘲𝘶𝘪𝘤𝘬 𝘣𝘳𝘰𝘸𝘯 𝘧𝘰𝘹 𝘫𝘶𝘮𝘱𝘴 𝘰𝘷𝘦𝘳 𝘵𝘩𝘦 𝘭𝘢𝘻𝘺 𝘥𝘰𝘨. 0123456789
𝙗𝙤𝙡𝙙𝙄𝙩𝙖𝙡𝙞𝙘 - 𝙏𝙝𝙚 𝙦𝙪𝙞𝙘𝙠 𝙗𝙧𝙤𝙬𝙣 𝙛𝙤𝙭 𝙟𝙪𝙢𝙥𝙨 𝙤𝙫𝙚𝙧 𝙩𝙝𝙚 𝙡𝙖𝙯𝙮 𝙙𝙤𝙜. 𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵
𝚖𝚘𝚗𝚘𝚜𝚙𝚊𝚌𝚎𝚍 - 𝚃𝚑𝚎 𝚚𝚞𝚒𝚌𝚔 𝚋𝚛𝚘𝚠𝚗 𝚏𝚘𝚡 𝚓𝚞𝚖𝚙𝚜 𝚘𝚟𝚎𝚛 𝚝𝚑𝚎 𝚕𝚊𝚣𝚢 𝚍𝚘𝚐. 𝟶𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿
wide - The quick brown fox jumps over the lazy dog. 0123456789 (supports all of ASCII)
𝐛𝐨𝐥𝐝𝐒𝐞𝐫𝐢𝐟 - 𝐓𝐡𝐞 𝐪𝐮𝐢𝐜𝐤 𝐛𝐫𝐨𝐰𝐧 𝐟𝐨𝐱 𝐣𝐮𝐦𝐩𝐬 𝐨𝐯𝐞𝐫 𝐭𝐡𝐞 𝐥𝐚𝐳𝐲 𝐝𝐨𝐠. 𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗
𝑖𝑡𝑎𝑙𝑖𝑐𝑆𝑒𝑟𝑖𝑓 - 𝑇𝒉𝑒 𝑞𝑢𝑖𝑐𝑘 𝑏𝑟𝑜𝑤𝑛 𝑓𝑜𝑥 𝑗𝑢𝑚𝑝𝑠 𝑜𝑣𝑒𝑟 𝑡𝒉𝑒 𝑙𝑎𝑧𝑦 𝑑𝑜𝑔. 𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗
𝒃𝒐𝒍𝒅𝑰𝒕𝒂𝒍𝒊𝒄𝑺𝒆𝒓𝒊𝒇 - 𝑻𝒉𝒆 𝒒𝒖𝒊𝒄𝒌 𝒃𝒓𝒐𝒘𝒏 𝒇𝒐𝒙 𝒋𝒖𝒎𝒑𝒔 𝒐𝒗𝒆𝒓 𝒕𝒉𝒆 𝒍𝒂𝒛𝒚 𝒅𝒐𝒈. 𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗
𝕕𝕠𝕦𝕓𝕝𝕖𝕊𝕥𝕣𝕦𝕔𝕜 - 𝕋𝕙𝕖 𝕢𝕦𝕚𝕔𝕜 𝕓𝕣𝕠𝕨𝕟 𝕗𝕠𝕩 𝕛𝕦𝕞𝕡𝕤 𝕠𝕧𝕖𝕣 𝕥𝕙𝕖 𝕝𝕒𝕫𝕪 𝕕𝕠𝕘. 𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡
𝓼𝓬𝓻𝓲𝓹𝓽 - 𝓣𝓱𝓮 𝓺𝓾𝓲𝓬𝓴 𝓫𝓻𝓸𝔀𝓷 𝓯𝓸𝔁 𝓳𝓾𝓶𝓹𝓼 𝓸𝓿𝓮𝓻 𝓽𝓱𝓮 𝓵𝓪𝔃𝔂 𝓭𝓸𝓰. 0123456789
𝔣𝔯𝔞𝔨𝔱𝔲𝔯 - 𝔗𝔥𝔢 𝔮𝔲𝔦𝔠𝔨 𝔟𝔯𝔬𝔴𝔫 𝔣𝔬𝔵 𝔧𝔲𝔪𝔭𝔰 𝔬𝔳𝔢𝔯 𝔱𝔥𝔢 𝔩𝔞𝔷𝔶 𝔡𝔬𝔤. 0123456789
𝖇𝖔𝖑𝖉𝕱𝖗𝖆𝖐𝖙𝖚𝖗 - 𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐 𝖇𝖗𝖔𝖜𝖓 𝖋𝖔𝖝 𝖏𝖚𝖒𝖕𝖘 𝖔𝖛𝖊𝖗 𝖙𝖍𝖊 𝖑𝖆𝖟𝖞 𝖉𝖔𝖌. 0123456789
squared - 🅃🄷🄴 🅀🅄🄸🄲🄺 🄱🅁🄾🅆🄽 🄵🄾🅇 🄹🅄🄼🄿🅂 🄾🅅🄴🅁 🅃🄷🄴 🄻🄰🅉🅈 🄳🄾🄶. 0123456789
ⓒⓘⓡⓒⓛⓔⓓ - Ⓣⓗⓔ ⓠⓤⓘⓒⓚ ⓑⓡⓞⓦⓝ ⓕⓞⓧ ⓙⓤⓜⓟⓢ ⓞⓥⓔⓡ ⓣⓗⓔ ⓛⓐⓩⓨ ⓓⓞⓖ. ⓪①②③④⑤⑥⑦⑧⑨

Hacky fonts that don't work using screen readers

blue - 🇹​🇭​🇪​ ​🇶​🇺​🇮​🇨​🇰​ ​🇧​🇷​🇴​🇼​🇳​ ​🇫​🇴​🇽​ ​🇯​🇺​🇲​🇵​🇸​ ​🇴​🇻​🇪​🇷​ ​🇹​🇭​🇪​ ​🇱​🇦​🇿​🇾​ ​🇩​🇴​🇬​.​ ​0​1​2​3​4​5​6​7​8​9​
sᴍᴀʟʟCᴀᴘs - Tʜᴇ ǫᴜɪᴄᴋ ʙʀᴏᴡɴ ғᴏx ᴊᴜᴍᴘs ᴏᴠᴇʀ ᴛʜᴇ ʟᴀᴢʏ ᴅᴏɢ. 0123456789
curly - ɬɧɛ զųıƈƙ ცཞơῳŋ ʄơҳ ʝųɱ℘ʂ ơ۷ɛཞ ɬɧɛ Ɩąʑყ ɖơɠ. 0123456789
reversed (reversed_ in python) - 9876543210 .ວOᗡ YZA⅃ ƎHT ЯƎVO ƧꟼMUᒐ XOꟻ ИWOЯᗺ ꓘƆIUϘ ƎHT
upsideDown - 9876543210 ˙ƃop ʎzɐן ǝɥʇ ɹǝʌo sdɯnɾ xoɟ uʍoɹq ʞɔ!nb ǝɥ⊥
boxed - 🆃🅷🅴 🆀🆄🅸🅲🅺 🅱🆁🅾🆆🅽 🅵🅾🆇 🅹🆄🅼🅿🆂 🅾🆅🅴🆁 🆃🅷🅴 🅻🅰🆉🆈 🅳🅾🅶. 0123456789
wiry - ㄒ卄乇 Ɋㄩ丨匚Ҝ 乃尺ㄖ山几 千ㄖ乂 フㄩ爪卩丂 ㄖᐯ乇尺 ㄒ卄乇 ㄥ卂乙ㄚ ᗪㄖᎶ. 0123456789
⒫⒜⒭⒠⒩⒯⒣⒠⒮⒤⒵⒠⒟ - 🄣⒣⒠ ⒬⒰⒤⒞⒦ ⒝⒭⒪⒲⒩ ⒡⒪⒳ ⒥⒰⒨⒫⒮ ⒪⒱⒠⒭ ⒯⒣⒠ ⒧⒜⒵⒴ ⒟⒪⒢. 0123456789
heavyCircled - 🅣🅗🅔 🅠🅤🅘🅒🅚 🅑🅡🅞🅦🅝 🅕🅞🅧 🅙🅤🅜🅟🅢 🅞🅥🅔🅡 🅣🅗🅔 🅛🅐🅩🅨 🅓🅞🅖. 0123456789
currency - ₮H€ QUI¢₭ ₿RO₩₦ ₣OX JU₥₱$ OV€R ₮H€ £₳₴¥ ₫O₲. 0123456789
cool - TᕼE ᑫᑌIᑕK ᗷᖇOᗯᑎ ᖴO᙭ ᒍᑌᗰᑭᔕ OᐯEᖇ TᕼE ᒪᗩᘔY ᗪOG. 0123456789
magic - ƚԋҽ ϙυιƈƙ Ⴆɾσɯɳ ϝσx ʝυɱρʂ σʋҽɾ ƚԋҽ ʅαȥყ ԃσɠ. 0123456789

Installation

pip3 install fancify-text

Usage

In Python

>>> from fancify_text import bold, reversed_, heavyCircled, smallCaps  # Or any of the listed names above, or * to get all of them
>>> print(bold("hello world"))
𝗵𝗲𝗹𝗹𝗼 𝘄𝗼𝗿𝗹𝗱
>>> print(reversed_("hello world"))
ЯOW O⅃⅃ƎH
>>> print(heavyCircled("hello world"))
🅗🅔🅛🅛🅞 🅦🅞🅡🅛🅓
>>> print(smallCaps("Hello World")
Hᴇʟʟᴏ Wᴏʀʟᴅ

From CLI

$ fancify bold "hello world"  # type the font with keeping uppercase letters!
𝗵𝗲𝗹𝗹𝗼 𝘄𝗼𝗿𝗹𝗱
$ fancify reversed "hello world"
ᗡ⅃ЯOW O⅃⅃ƎH
$ fancify heavyCircled "hello world"
🅗🅔🅛🅛🅞 🅦🅞🅡🅛🅓
$ fancify smallCaps "hello world"
Hᴇʟʟᴏ Wᴏʀʟᴅ

You can also use all to print text in all available fonts:

$ fancify all "hello world"
sansSerif - 𝗁𝖾𝗅𝗅𝗈 𝗐𝗈𝗋𝗅𝖽
bold - 𝗵𝗲𝗹𝗹𝗼 𝘄𝗼𝗿𝗹𝗱
italic - 𝘩𝘦𝘭𝘭𝘰 𝘸𝘰𝘳𝘭𝘥
boldItalic - 𝙝𝙚𝙡𝙡𝙤 𝙬𝙤𝙧𝙡𝙙
boldSerif - 𝐡𝐞𝐥𝐥𝐨 𝐰𝐨𝐫𝐥𝐝
italicSerif - 𝒉𝑒𝑙𝑙𝑜 𝑤𝑜𝑟𝑙𝑑
boldItalicSerif - 𝒉𝒆𝒍𝒍𝒐 𝒘𝒐𝒓𝒍𝒅
doubleStruck - 𝕙𝕖𝕝𝕝𝕠 𝕨𝕠𝕣𝕝𝕕
monospaced - 𝚑𝚎𝚕𝚕𝚘 𝚠𝚘𝚛𝚕𝚍
wide - hello world
fraktur - 𝔥𝔢𝔩𝔩𝔬 𝔴𝔬𝔯𝔩𝔡
boldFraktur - 𝖍𝖊𝖑𝖑𝖔 𝖜𝖔𝖗𝖑𝖉
script - 𝓱𝓮𝓵𝓵𝓸 𝔀𝓸𝓻𝓵𝓭
smallCaps - ʜᴇʟʟᴏ ᴡᴏʀʟᴅ
squared - 🄷🄴🄻🄻🄾 🅆🄾🅁🄻🄳
circled - ⓗⓔⓛⓛⓞ ⓦⓞⓡⓛⓓ
parenthesized - ⒣⒠⒧⒧⒪ ⒲⒪⒭⒧⒟
boxed - 🅷🅴🅻🅻🅾 🆆🅾🆁🅻🅳
blue - 🇭​🇪​🇱​🇱​🇴​ ​🇼​🇴​🇷​🇱​🇩​
heavyCircled - 🅗🅔🅛🅛🅞 🅦🅞🅡🅛🅓
curly - ɧɛƖƖơ ῳơཞƖɖ
currency - H€££O ₩OR£₫
cool - ᕼEᒪᒪO ᗯOᖇᒪᗪ
magic - ԋҽʅʅσ ɯσɾʅԃ
wiry - 卄乇ㄥㄥㄖ 山ㄖ尺ㄥᗪ
reversed_ - ᗡ⅃ЯOW O⅃⅃ƎH
upsideDown - pןɹoʍ oןןǝɥ
superscript - ʰᵉˡˡᵒ ʷᵒʳˡᵈ

TODO: support modifiers from fontData.py

fancify-text's People

Contributors

ftdot avatar nottrobin avatar secret-chest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fancify-text's Issues

License this code

@nottrobin would you license this code? I was completely stupid when I accepted your contributions lol. Currently there's no licence, can you apply one?

Mention accessibility concerns somewhere

Accessibility is a problem with these "fonts", as they are actually Unicode characters with different meanings and screen readers read them out with those meanings, not the letters they look like.

Installation error (with mitigation)

Issue

When I tried to install this library, I got the error:

$ pip install fancify-text
Collecting fancify-text
  Downloading fancify-text-0.2.3.tar.gz (14 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "...\AppData\Local\Temp\pip-install-d0k0_gwn\fancify-text_aa471b6c6f9948aca78bb58de9ab44b1\setup.py", line 14, in <module>
          long_description=open("README.md").read(),
                           ^^^^^^^^^^^^^^^^^^^^^^^^
        File "...\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1251.py", line 23, in decode
          return codecs.charmap_decode(input,self.errors,decoding_table)[0]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 424: character maps to <undefined>
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

OS: Windows
Python version: 3.11

Note

setup.py "scripts" idea is cool and lightweight, but this is doesn't work on Windows.
You can use "entry-points" instead of "scripts". If you continue development of this
library, you may take look at this issue

But, thanks, this library was useful!

Mitigtation

File setup.py, line 14. Default encoding is charmap, change it to utf8 with adding encoding=:

    ...
    long_description=open("README.md", encoding="utf8").read(),
    ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.