1.0.1 โ€ข Published 3 years ago

convert-unicode-fonts v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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
 * ๏ผจ๏ผฅ๏ผฌ๏ผฌ๏ผฏ ๏ผท๏ผฏ๏ผฒ๏ผฌ๏ผค, ๏ผ๏ผ‘๏ผ’๏ผ“๏ผ”๏ผ•๏ผ–๏ผ—๏ผ–๏ผ˜๏ผ™ : 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.