<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SocialPanda Blog]]></title><description><![CDATA[Practical social media growth guides, engagement benchmarks and free creator tools from SocialPanda. Learn how to grow on Instagram, TikTok, YouTube, LinkedIn a]]></description><link>https://socialpanda.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6af3c6630101e5873314a393/1e5a4863-a581-45f0-881a-ed2df6f2f0bb.png</url><title>SocialPanda Blog</title><link>https://socialpanda.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 21 Nov 2026 18:00:45 GMT</lastBuildDate><atom:link href="https://socialpanda.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How "Fancy Font" Text Actually Works: Unicode Math Letters in JavaScript]]></title><description><![CDATA[You have seen bios and tweets written in 𝐛𝐨𝐥𝐝, 𝘴𝘭𝘢𝘯𝘵𝘦𝘥 or 𝔣𝔯𝔞𝔨𝔱𝔲𝔯 text on platforms that only allow plain text. There is no font…]]></description><link>https://socialpanda.hashnode.dev/how-fancy-font-text-actually-works-unicode-math-letters-in-javascript</link><guid isPermaLink="true">https://socialpanda.hashnode.dev/how-fancy-font-text-actually-works-unicode-math-letters-in-javascript</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[unicode]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[SocialPanda]]></dc:creator><pubDate>Wed, 11 Nov 2026 02:40:07 GMT</pubDate><content:encoded><![CDATA[<p>You have seen bios and tweets written in 𝐛𝐨𝐥𝐝, 𝘴𝘭𝘢𝘯𝘵𝘦𝘥 or 𝔣𝔯𝔞𝔨𝔱𝔲𝔯 text on platforms that only allow plain text. There is no font involved. Those are ordinary Unicode characters that happen to look like styled Latin letters, and generating them takes about 30 lines of JavaScript, plus a few gotchas that trip up most first attempts.</p>
<h2>Where the characters come from</h2>
<p>Unicode has a block called <strong>Mathematical Alphanumeric Symbols</strong> (U+1D400 to U+1D7FF). It exists so mathematicians can write a bold 𝐱 and an italic 𝑥 as <em>different symbols</em> in plain text, because in maths they can mean different things.</p>
<p>Each style is laid out as a run of 26 capitals followed by 26 small letters, and some styles also have digits 0 to 9. So converting text is mostly offset arithmetic:</p>
<table>
<thead>
<tr>
<th>Style</th>
<th>Capital A</th>
<th>Small a</th>
<th>Digit 0</th>
</tr>
</thead>
<tbody><tr>
<td>Bold</td>
<td>U+1D400</td>
<td>U+1D41A</td>
<td>U+1D7CE</td>
</tr>
<tr>
<td>Italic</td>
<td>U+1D434</td>
<td>U+1D44E</td>
<td>–</td>
</tr>
<tr>
<td>Script</td>
<td>U+1D49C</td>
<td>U+1D4B6</td>
<td>–</td>
</tr>
<tr>
<td>Fraktur</td>
<td>U+1D504</td>
<td>U+1D51E</td>
<td>–</td>
</tr>
<tr>
<td>Double-struck</td>
<td>U+1D538</td>
<td>U+1D552</td>
<td>U+1D7D8</td>
</tr>
<tr>
<td>Sans-serif bold</td>
<td>U+1D5D4</td>
<td>U+1D5EE</td>
<td>U+1D7EC</td>
</tr>
<tr>
<td>Monospace</td>
<td>U+1D670</td>
<td>U+1D68A</td>
<td>U+1D7F6</td>
</tr>
</tbody></table>
<h2>The gotcha: holes in the block</h2>
<p>If you only do the arithmetic, some letters come out as empty boxes. A few styled letters were already in Unicode, in the older <strong>Letterlike Symbols</strong> block, before the maths block was added. To avoid duplicates, their slots in the new block were left unassigned.</p>
<p>For example, italic small h would sit at U+1D455, but that code point is empty. The real character is U+210E, PLANCK CONSTANT (ℎ). Script, Fraktur and double-struck each have several of these holes, such as ℬ, ℭ and ℝ.</p>
<p>So the converter needs an exceptions table:</p>
<pre><code class="language-js">const STYLES = {
  bold:         { upper: 0x1D400, lower: 0x1D41A, digit: 0x1D7CE },
  italic:       { upper: 0x1D434, lower: 0x1D44E },
  script:       { upper: 0x1D49C, lower: 0x1D4B6 },
  fraktur:      { upper: 0x1D504, lower: 0x1D51E },
  doubleStruck: { upper: 0x1D538, lower: 0x1D552, digit: 0x1D7D8 },
  sansBold:     { upper: 0x1D5D4, lower: 0x1D5EE, digit: 0x1D7EC },
  monospace:    { upper: 0x1D670, lower: 0x1D68A, digit: 0x1D7F6 },
};

// Letters that live in the Letterlike Symbols block instead
const HOLES = {
  italic:       { h: 0x210E },
  script:       { B: 0x212C, E: 0x2130, F: 0x2131, H: 0x210B, I: 0x2110,
                  L: 0x2112, M: 0x2133, R: 0x211B, e: 0x212F, g: 0x210A, o: 0x2134 },
  fraktur:      { C: 0x212D, H: 0x210C, I: 0x2111, R: 0x211C, Z: 0x2128 },
  doubleStruck: { C: 0x2102, H: 0x210D, N: 0x2115, P: 0x2119, Q: 0x211A,
                  R: 0x211D, Z: 0x2124 },
};

function stylize(text, style) {
  const s = STYLES[style];
  const holes = HOLES[style] || {};
  return [...text].map(ch =&gt; {
    if (holes[ch]) return String.fromCodePoint(holes[ch]);
    const c = ch.codePointAt(0);
    if (c &gt;= 65 &amp;&amp; c &lt;= 90)  return String.fromCodePoint(s.upper + c - 65);
    if (c &gt;= 97 &amp;&amp; c &lt;= 122) return String.fromCodePoint(s.lower + c - 97);
    if (c &gt;= 48 &amp;&amp; c &lt;= 57 &amp;&amp; s.digit) return String.fromCodePoint(s.digit + c - 48);
    return ch; // spaces, punctuation, emoji pass through
  }).join('');
}

stylize('Hello World', 'fraktur'); // "ℌ𝔢𝔩𝔩𝔬 𝔚𝔬𝔯𝔩𝔡"
</code></pre>
<p>We checked every output code point for all seven styles against the Unicode character names. With the holes table, none of them land on an unassigned code point.</p>
<h2>Gotcha 2: <code>.length</code> lies</h2>
<p>Everything in the maths block is above U+FFFF, so in JavaScript each character is a surrogate pair:</p>
<pre><code class="language-js">const t = stylize('Hello', 'bold');
t.length;        // 10
[...t].length;   // 5
</code></pre>
<p>That is why the code above iterates with <code>[...text]</code> and uses <code>codePointAt</code> / <code>fromCodePoint</code> rather than <code>charCodeAt</code>. If you enforce a character limit (a 150-character bio, for example), decide whether you count code points or UTF-16 units. Platforms don't all agree, and styled text can use up a UTF-16 limit twice as fast.</p>
<h2>Gotcha 3: you can turn it back into plain text</h2>
<p>These characters have <em>compatibility decompositions</em> to plain Latin letters, so NFKC normalisation reverses the styling:</p>
<pre><code class="language-js">stylize('Hello 2026', 'bold').normalize('NFKC'); // "Hello 2026"
</code></pre>
<p>This is handy if you are building search or moderation. Normalise user input with NFKC before matching, or 𝐬𝐩𝐚𝐦 will slip past a filter looking for "spam".</p>
<h2>Gotcha 4: accessibility and search</h2>
<p>Screen readers handle these characters badly. Many skip them or read each one out by its full name, so a bold name can be announced as a string of "mathematical bold capital…" labels. Search is similar: a platform that doesn't normalise won't match 𝐁𝐨𝐥𝐝 when someone searches for "bold".</p>
<p>The practical rule is to use styled text for a word or two of decoration, never for information people need to find or hear: names, usernames, prices, links.</p>
<h2>Try it</h2>
<p>Live, this ends up as a text box and a list of rendered previews with copy buttons. We built one as an <a href="https://socialpanda.io/free-tools/instagram-font-generator/">Instagram font generator</a> if you want to see the output for every style side by side, but the snippet above is the whole engine. Small-caps, circled and upside-down text work the same way with lookup tables, just from different Unicode blocks.</p>
]]></content:encoded></item></channel></rss>