Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cancerberosgx/unicode-fonts
transform strings to equivalent unicode characters
https://github.com/cancerberosgx/unicode-fonts
Last synced: about 1 month ago
JSON representation
transform strings to equivalent unicode characters
- Host: GitHub
- URL: https://github.com/cancerberosgx/unicode-fonts
- Owner: cancerberoSgx
- License: mit
- Created: 2019-04-20T11:50:12.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-15T04:10:02.000Z (almost 3 years ago)
- Last Synced: 2024-10-31T19:49:03.775Z (about 2 months ago)
- Language: TypeScript
- Size: 67.4 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
Transform a string to its equivalent using unicode fonts:
```
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 -g unicode-fonts
```## CLI
```
unicode-fonts --list
unicode-fonts --font scriptItalic --input "My name is Sebastian Gurin"
cat package.json | unicode-fonts --font boldItalic
cat package.json | unicode-fonts --font circled --join "0x3000" --outputFile package-boldItalic.json
```## API
```ts
const fonts = getFonts()
const s = transform('Hello', fonts['scriptItalic'])
```## Options
Both CLI and API supports the same options
* if no `input` is given, then it will read from stdin
* if no `outputFile` is given then it will write to stdout
* `font` is required. use `list` to see the available fonts# Join
The option `join` will join the characters with given character. Take the following examples with different space characters:
## no join
```
unicode-fonts --input "abcdefXZYUPO91234 hello WORLD" --font circled
โถโทโธโนโบโปโZโโโ โโจโ โกโขโฃ โฝโบโโโ โโโโโน
```
## thin space
```
unicode-font --input "abcdefXZYUPO91234 hello WORLD" --font circled --join "0x2009"
โถโโทโโธโโนโโบโโปโโโZโโโโโโ โโโโจโโ โโกโโขโโฃโ โโฝโโบโโโโโโโ โโโโโโโโโโน
```
## ideographic space
```
unicode-fonts --input "abcdefXZYUPO91234 hello WORLD" --font circled --join "0x3000" # hair space
โถใโทใโธใโนใโบใโปใโใZใโใโใโ ใโใโจใโ ใโกใโขใโฃใ ใโฝใโบใโใโใโใ ใโใโใโใโใโน
```
## zero width space
```
unicode-fonts --input "abcdefXZYUPO91234 hello WORLD" --font circled --join "0x200b"
โถโโทโโธโโนโโบโโปโโโZโโโโโโ โโโโจโโ โโกโโขโโฃโ โโฝโโบโโโโโโโ โโโโโโโโโโน
```## backspace
```
unicode-fonts --input "abcdefXZYUPO91234 hello WORLD" --font circled --join "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.
# TODO
[TODO.md](TODO.md)