<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Trent Tompkins</title>
    <description>The latest articles on DEV Community by Trent Tompkins (@trenttompkins).</description>
    <link>https://dev.to/trenttompkins</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3971157%2F6393ede5-72fe-4d69-b64f-1db69e08f2b2.png</url>
      <title>DEV Community: Trent Tompkins</title>
      <link>https://dev.to/trenttompkins</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/trenttompkins"/>
    <language>en</language>
    <item>
      <title>Killing the Tofu Box for Good: Grafting a Star into Noto Color Emoji</title>
      <dc:creator>Trent Tompkins</dc:creator>
      <pubDate>Mon, 08 Jun 2026 13:13:55 +0000</pubDate>
      <link>https://dev.to/trenttompkins/killing-the-tofu-box-for-good-grafting-a-star-into-noto-color-emoji-4ldo</link>
      <guid>https://dev.to/trenttompkins/killing-the-tofu-box-for-good-grafting-a-star-into-noto-color-emoji-4ldo</guid>
      <description>&lt;p&gt;That empty &lt;code&gt;□&lt;/code&gt; box isn't a broken character — it's a missing glyph. Here's how I stopped patching tofu with SVGs and built a font that physically can't tofu.&lt;/p&gt;

&lt;p&gt;You've seen it: a little empty rectangle where a symbol should be. Designers call it &lt;strong&gt;tofu&lt;/strong&gt;. The text is fine — the &lt;em&gt;font&lt;/em&gt; just doesn't contain a shape for that codepoint, so the browser draws a box and moves on.&lt;/p&gt;

&lt;p&gt;It bit me on a tiny "★ wildcard" badge in an admin panel. Instead of a star, I got &lt;code&gt;□ wildcard&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one insight that explains every tofu box
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;font-family&lt;/code&gt; stack is resolved &lt;strong&gt;per character&lt;/strong&gt;. For each codepoint the browser walks your stack until a font &lt;em&gt;has&lt;/em&gt; a glyph for it. If none do — tofu.&lt;/p&gt;

&lt;p&gt;The trap is subtle: &lt;strong&gt;emoji fonts don't contain text dingbats.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;★&lt;/code&gt; is &lt;strong&gt;U+2605 BLACK STAR&lt;/strong&gt; — a &lt;em&gt;text&lt;/em&gt; symbol.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;⭐&lt;/code&gt; is &lt;strong&gt;U+2B50&lt;/strong&gt; — an &lt;em&gt;emoji&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My stack ended in &lt;code&gt;Noto Color Emoji&lt;/code&gt; (self-hosted, so symbols render the same on every OS). Noto has the emoji star but &lt;strong&gt;not&lt;/strong&gt; the text star — so the browser routed &lt;code&gt;★&lt;/code&gt; to the emoji font, found nothing, and boxed it. I confirmed it with a 20-line glyph viewer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DelaGothicOne-Regular:  U+2605 PRESENT
NotoColorEmoji.v2:      U+2605 MISSING
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fix #1: inline SVG (fine for one icon)
&lt;/h2&gt;

&lt;p&gt;Swap the character for an inline &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; star. Zero font dependency, renders everywhere. But you can't SVG &lt;em&gt;every&lt;/em&gt; ★, →, ✓ across a dozen sites. It doesn't scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix #2: just add the glyph to the font
&lt;/h2&gt;

&lt;p&gt;Here's the move almost no one reaches for: a font is editable. If Noto is missing &lt;code&gt;★&lt;/code&gt;, &lt;strong&gt;graft it in&lt;/strong&gt; — borrowed from a font that has it (Dela Gothic One) — using &lt;a href="https://github.com/fonttools/fonttools" rel="noopener noreferrer"&gt;fontTools&lt;/a&gt;. The only wrinkle is unit scaling: Dela is 1000 units/em, Noto is 1024.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;scale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;noto&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;head&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;unitsPerEm&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;dela&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;head&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;unitsPerEm&lt;/span&gt;   &lt;span class="c1"&gt;# 1024/1000
&lt;/span&gt;&lt;span class="n"&gt;pen&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TTGlyphPen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nc"&gt;DecomposingRecordingPen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dela&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getGlyphSet&lt;/span&gt;&lt;span class="p"&gt;())[&lt;/span&gt;&lt;span class="n"&gt;star&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;replay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;TransformPen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;          &lt;span class="c1"&gt;# scaled outline
&lt;/span&gt;
&lt;span class="n"&gt;glyf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;glyphs&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glyph&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;glyf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;glyphOrder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                                &lt;span class="c1"&gt;# keep glyphs + order in sync
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;noto&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;cmap&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;tables&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isUnicode&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mh"&gt;0x2605&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;                               &lt;span class="c1"&gt;# U+2605 now resolves
&lt;/span&gt;&lt;span class="n"&gt;noto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;TrioEmojiStar.woff2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The best part: the star lands in the &lt;code&gt;glyf&lt;/code&gt; table with &lt;strong&gt;no COLR color layer&lt;/strong&gt;, so it renders in &lt;code&gt;currentColor&lt;/code&gt; — a clean, themeable black star — while all 1,485 real emoji keep their color. One font, every emoji &lt;strong&gt;plus&lt;/strong&gt; the star, and it physically cannot tofu that codepoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  The payoff
&lt;/h2&gt;

&lt;p&gt;Tofu is never a mystery. It's a missing glyph — and a glyph is just data you can add.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally posted on &lt;a href="https://trentontompkins.com/killing-tofu-boxes-with-a-custom-font" rel="noopener noreferrer"&gt;trentontompkins.com&lt;/a&gt;. Grab the kit (both fonts + the glyph viewer + the font forge): &lt;a href="https://trentontompkins.com/downloads/never-tofu-font-kit.zip" rel="noopener noreferrer"&gt;never-tofu-font-kit.zip&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>fonts</category>
      <category>python</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
