Menu

How I Solved the Indic Font “Tofu” Problem in Dockerized Headless Chromium
📰

How I Solved the Indic Font “Tofu” Problem in Dockerized Headless Chromium

DEV Community: docker·Akash Pal·1 day ago
#M0NsBkAn
#devtodocker#devto#dev#fonts#chromium
Reading 0:00
15s threshold

Bundling fonts for 21 Indian languages across 12 scripts with Fastify 5 and Puppeteer

Html2Pdf is officially live in production:

Live Web App & Interactive Demo : html2pdf.akcraft.app

Official TypeScript / ESM SDK : @akcraft/html2pdf-sdk

Live Web API : api.html2pdf.akcraft.app

In my previous post , I introduced Html2Pdf and mentioned one problem I wanted to cover in detail: Indian language text turning into empty square boxes in generated PDFs.

That symptom is often called tofu . The HTML can look correct in your editor and still come out wrong in a PDF generated inside a minimal Linux container. Here is how I fixed it in my Fastify 5 + Puppeteer service.

Why the glyphs disappeared

Headless Chromium can only render a character if it can find a usable font with that glyph. A developer laptop may already have fonts for Hindi, Tamil, Bengali, or Urdu. A slim Docker image usually does not.

When Chromium cannot find a glyph, it may show a replacement box.…

Continue reading — create a free account

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