unicode-text-decorator is a simple library to convert ASCII text to decorated text.
๐๐๐๐๐๐๐-๐๐๐ก๐-๐๐๐๐๐๐๐๐๐ is ๐ฎ ๐๐ถ๐บ๐ฝ๐น๐ฒ ๐น๐ถ๐ฏ๐ฟ๐ฎ๐ฟ๐ to ๐๐ ๐๐ง๐๐ฃ๐ฅ โถโโธโพโพ text to ๐ฉ๐ช๐จ๐ด๐ท๐ฆ๐น๐ช๐ฉ text.
These Unicode characters are basically symbols provided for expressing mathematical formulae and so on. Hence they are not recongnised as Latin alphabet characters and have accessibility problems like text-to-speech. Not only this library but also these "decorated Unicode fonts" are just for hobby and playing use.
npm i unicode-text-decorator
utd.decorate(targetText, fontName)
const utd = require('unicode-text-decorator');
let wildScreen = utd.decorate('wi(l)d-screen', 'bold_italic_serif');
let baroque = utd.decorate('baroque', 'bold_sans_serif');
console.log(wildScreen + ' ' + baroque);
let nanaDaiba = utd.decorate('Nana Daiba / ๅคงๅ ดใชใช (CV: Moeka Koizumi / ๅฐๆณ่้ฆ)', 'bold_script');
console.log(nanaDaiba);
๐๐(๐)๐
-๐๐๐๐๐๐ ๐ฏ๐ฎ๐ฟ๐ผ๐พ๐๐ฒ
๐๐ช๐ท๐ช ๐๐ช๐ฒ๐ซ๐ช / ๅคงๅ ดใชใช (๐๐ฅ: ๐๐ธ๐ฎ๐ด๐ช ๐๐ธ๐ฒ๐๐พ๐ถ๐ฒ / ๅฐๆณ่้ฆ)
Symbols (like space and /
) and non-ASCII characters are ignored.
FYI: wi(l)d-screen baroque is the song appeard in the movie of Revue Starlight. The title of the song is displayed in a mixture of serif and sans-serif in the scene.
font name | Example | Capital Letters | Small Letters | Numbers |
---|---|---|---|---|
bold_serif | ๐๐ง๐ข๐๐จ๐๐ | โ | โ | โ |
italic_serif | ๐๐๐๐๐๐๐ | โ | โ | |
bold_italic_serif | ๐ผ๐๐๐๐๐ ๐ | โ | โ | |
script | ๐ฐ๐๐พ๐ธโด๐นโฏ | โ | โ | |
bold_script | ๐ค๐ท๐ฒ๐ฌ๐ธ๐ญ๐ฎ | โ | โ | |
fraktur | ๐๐ซ๐ฆ๐ ๐ฌ๐ก๐ข | โ | โ | |
bold_fraktur | ๐๐๐๐๐๐๐ | โ | โ | |
double_struck | ๐๐๐๐๐ ๐๐ | โ | โ | โ |
sans_serif | ๐ด๐๐๐ผ๐๐ฝ๐พ | โ | โ | โ |
bold_sans_serif | ๐จ๐ป๐ถ๐ฐ๐ผ๐ฑ๐ฒ | โ | โ | โ |
italic_sans_serif | ๐๐ฏ๐ช๐ค๐ฐ๐ฅ๐ฆ | โ | โ | |
bold_italic_sans_serif | ๐๐ฃ๐๐๐ค๐๐ | โ | โ | |
monospace | ๐๐๐๐๐๐๐ | โ | โ | |
regional_indicator | ๐บ๐ณ๐ฎ๐จ๐ด๐ฉ๐ช | โ | ||
circle | โโโโโโโ | โ | โ | โ |
black_circle | ๐ ค๐ ๐ ๐ ๐ ๐ ๐ | โ | ||
square | ๐ ๐ฝ๐ธ๐ฒ๐พ๐ณ๐ด | โ | ||
parenthesized | ๐คโฉโคโโชโโ | โ | โ | |
fullwidth | ๏ผต๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ๏ฝ | โ | โ | โ |
regional_indicator is the characters that represents national/regional flags. In some environment (like Discord), these characters are basically interpreted as flags emoji. For example, JOIN US
will be shown as JO (Jordan) IN (India) US (United States) like below. This is not a bug of this library.
Some fonts don't have characters for small letters. In that case, if you turn on the fallback option, this returns existing capital letters instead of (unexisting) small ones.
let tokyoTower1 = utd.decorate('Tokyo Tower', 'black_circle'); // default is false
let tokyoTower2 = utd.decorate('Tokyo Tower', 'black_circle', { fallback: true });
let tokyoTower3 = utd.decorate('Torre de Tรณquio','black_circle', { fallback: true });
console.log(tokyoTower1);
console.log(tokyoTower2);
console.log(tokyoTower3);
Even with the fallback mode, unexisting characters (non-ASCII like รณ
) will be ignored.
๐
ฃokyo ๐
ฃower
๐
ฃ๐
๐
๐
จ๐
๐
ฃ๐
๐
ฆ๐
๐
ก
๐
ฃ๐
๐
ก๐
ก๐
๐
๐
๐
ฃรณ๐
๐
ค๐
๐