npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

convert-unicode-fonts

v1.0.1

Published

transform strings to equivalent unicode characters, and revert

Downloads

1,766

Readme

Transform a string to its equivalent using unicode fonts:

convert-unicode-fonts list
 * 𝐇𝐄𝐋𝐋𝐎 𝐖𝐎𝐑𝐋𝐃, 𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟔𝟖𝟗 : bold
 * 𝐻𝐸𝐿𝐿𝑂 𝑊𝑂𝑅𝐿𝐷, 01234567689 : italic
 * 𝑯𝑬𝑳𝑳𝑶 𝑾𝑶𝑹𝑳𝑫, 01234567689 : boldItalic
 * He𝒧𝒧o 𝒲o𝒭𝒧𝒟, 01234567689 : scriptItalic
 * 𝓗𝓔𝓛𝓛𝓞 𝓦𝓞𝓡𝓛𝓓, 01234567689 : scriptBold
 * H𝔈𝔏𝔏𝔒 𝔚𝔒𝔕𝔏𝔇, 01234567689 : fraktur
 * 𝕳𝕰𝕷𝕷𝕺 𝖂𝕺𝕽𝕷𝕯, 01234567689 : boldFraktur
 * H𝔼𝕃𝕃𝕆 𝕎𝕆𝕉𝕃𝔻, 𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟞𝟠𝟡 : doubleStruck
 * 𝖧𝖤𝖫𝖫𝖮 𝖶𝖮𝖱𝖫𝖣, 𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟨𝟪𝟫 : sansSerif
 * 𝗛𝗘𝗟𝗟𝗢 𝗪𝗢𝗥𝗟𝗗, 𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟲𝟴𝟵 : sansSerifBold
 * 𝘏𝘌𝘓𝘓𝘖 𝘞𝘖𝘙𝘓𝘋, 01234567689 : sansSerifItalic
 * 𝙃𝙀𝙇𝙇𝙊 𝙒𝙊𝙍𝙇𝘿, 01234567689 : sansSerifBoldItalic
 * 𝙷𝙴𝙻𝙻𝙾 𝚆𝙾𝚁𝙻𝙳, 𝟶𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟼𝟾𝟿 : monospace
 * ᴴᴱᴸᴸᴼ ᵂᴼᴿᴸᴰ, ⁰¹²³⁴⁵⁶⁷⁶⁸⁹ : super
 * 🄗🄔🄛🄛🄞 🄦🄞🄡🄛🄓, 0⑴⑵⑶⑷⑸⑹⑺⑹⑻⑼ : parenthesized
 * ⒽⒺⓁⓁⓄ ⓌⓄⓇⓁⒹ, 0①②③④⑤⑥⑦⑥⑧⑨ : circled
 * 🄷🄴🄻🄻🄾 🅆🄾🅁🄻🄳, 01234567689 : squaredCapital
 * 🅗🅔🅛🅛🅞 🅦🅞🅡🅛🅓, 01234567689 : negativeCircledCapital
 * 🅷🅴🅻🅻🅾 🆆🅾🆁🅻🅳, 01234567689 : negativeSquaredCapital
 * 🇭🇪🇱🇱🇴 🇼🇴🇷🇱🇩, 01234567689 : regionalIndicatorSymbol
 * HELLO WORLD, 01234567689 : fullWidth
 * ꓧꓰꓡꓡꓳ ꓪꓳꓣꓡꓓ, 01234567689 : myanmar
 * ᎻᎬᏞᏞᎤ ᏔᎤᎡᏞᎠ, ᎾᏐ23Ꮞ5Ꮾ7Ꮾ8Ꮽ : cherokee
 * Hello World, ⅠⅡⅢⅣⅤⅥⅦⅧⅦⅨⅩ : romanNumerals
 * Hello World, ⅳⅴⅵⅶⅷⅸⅹⅺⅹⅻⅼ : romanNumeralsSmall

Explanation: unicode charset supports extra font families, so we replace normal character 'a' (char code 97) with character '𝓪' (char code 55349). So this are not currently font families or different fonts, it's the same font, that provides this special characters, some of them.

Note: these are not using any ansi escape sequences. We could use those to add colors, bold, underline, etc in the command line.

Some Unicode categories that contain these type of characters are:

  • Mathematical Alphanumeric Symbols

Usage

Install

npm i convert-unicode-fonts
yarn add convert-unicode-fonts

API

import { transform, getFonts, revertTransform } from 'convert-unicode-fonts';
const fonts = getFonts()
const s = transform('Hello', fonts['scriptItalic'])
const normal = revertTransform(s)

Join

The option join will join the characters with given character. Take the following examples with different space characters:

no join

import { transform, getFonts } from 'convert-unicode-fonts';
const fonts = getFonts()
const s = transform('abcdefXZYUPO91234 hello WORLD', fonts['circled'])
// ⒶⒷⒸⒹⒺⒻⓍZⓎⓊⓅⓄ⑨①②③④ ⒽⒺⓁⓁⓄ ⓌⓄⓇⓁⒹ

thin space

import { transform, getFonts } from 'convert-unicode-fonts';
const fonts = getFonts()
const s = transform('abcdefXZYUPO91234 hello WORLD', fonts['circled'], "0x2009")
// Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓧ Z Ⓨ Ⓤ Ⓟ Ⓞ ⑨ ① ② ③ ④   Ⓗ Ⓔ Ⓛ Ⓛ Ⓞ   Ⓦ Ⓞ Ⓡ Ⓛ Ⓓ 

ideographic space

import { transform, getFonts } from 'convert-unicode-fonts';
const fonts = getFonts()
const s = transform('abcdefXZYUPO91234 hello WORLD', fonts['circled'], "0x3000") # hair space
Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓧ Z Ⓨ Ⓤ Ⓟ Ⓞ ⑨ ① ② ③ ④   Ⓗ Ⓔ Ⓛ Ⓛ Ⓞ   Ⓦ Ⓞ Ⓡ Ⓛ Ⓓ

zero width space

import { transform, getFonts } from 'convert-unicode-fonts';
const fonts = getFonts()
const s = transform('abcdefXZYUPO91234 hello WORLD', fonts['circled'], "0x200b") 
// Ⓐ​Ⓑ​Ⓒ​Ⓓ​Ⓔ​Ⓕ​Ⓧ​Z​Ⓨ​Ⓤ​Ⓟ​Ⓞ​⑨​①​②​③​④​ ​Ⓗ​Ⓔ​Ⓛ​Ⓛ​Ⓞ​ ​Ⓦ​Ⓞ​Ⓡ​Ⓛ​Ⓓ

backspace

import { transform, getFonts } from 'convert-unicode-fonts';
const fonts = getFonts()
const s = transform('abcdefXZYUPO91234 hello WORLD', fonts['circled'], "0x0008") 
// Ⓓ

WARNING

In general it's a bad idea to use these characters to store text. The only useful situatoin where you would want to store text using these, is if you want to prevent text searches to find a string.

These characters should be only used to render normal text in mediums with limited fonts, like a terminal.