Menu

How Fancy Text Generators Work: Bold and Italic Letters in Unicode
πŸ“°

How Fancy Text Generators Work: Bold and Italic Letters in Unicode

DEV Community: javascriptΒ·MinhazΒ·6 days ago
#7klk4yfJ
#devtojavascript#devto#dev#bold#letters
Long article (893 words) β€” no AI summary yet.
Reading 0:00
15s threshold

You have seen it on Instagram, X and Discord: a name in bold or cursive letters, even though those apps have no font menu. It looks like a font, but it is not. It is plain text made of different Unicode characters.

In this post I will show how it works, write a tiny JavaScript converter, and cover the gotchas that will bite you if you build one.

The trick: look-alike letters in another Unicode block

Unicode has a block called Mathematical Alphanumeric Symbols. It was added so that mathematicians could write things like a bold A or an italic x as distinct characters. It contains whole alphabets in bold, italic, script, fraktur, double-struck and more.

Because they are separate characters, you can copy and paste them anywhere that handles Unicode text, with no font involved. The bold capital A is U+1D400 , and the rest of the bold capitals follow in order.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.