Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Created August 22, 2019 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugnburn/99c33e47549623722eb6f3d288c8ffde to your computer and use it in GitHub Desktop.
Save plugnburn/99c33e47549623722eb6f3d288c8ffde to your computer and use it in GitHub Desktop.
Frakturize: a small ES6 one-liner to generate Fraktur Unicode strings from a normal Latin
frakturize=s=>s.split('').map((c,i,h)=>/[a-zA-Z]/.test(c)?String.fromCodePoint((i=c.charCodeAt(0))>90?119997+i:((h='CHIRZ'.indexOf(c))>-1?8460+[33,0,5,16,28][h]:120003+i)):c).join('')
// Example: frakturize('ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz') => '๐”„๐”…โ„ญ๐”‡๐”ˆ๐”‰๐”Šโ„Œโ„‘๐”๐”Ž๐”๐”๐”‘๐”’๐”“๐””โ„œ๐”–๐”—๐”˜๐”™๐”š๐”›๐”œโ„จ ๐”ž๐”Ÿ๐” ๐”ก๐”ข๐”ฃ๐”ค๐”ฅ๐”ฆ๐”ง๐”จ๐”ฉ๐”ช๐”ซ๐”ฌ๐”ญ๐”ฎ๐”ฏ๐”ฐ๐”ฑ๐”ฒ๐”ณ๐”ด๐”ต๐”ถ๐”ท'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment