Menu

A font-license checkpoint for PDF-to-HTML: what fsType can and can't tell you
πŸ“°

A font-license checkpoint for PDF-to-HTML: what fsType can and can't tell you

DEV Community: javascriptΒ·Lank_MΒ·about 3 hours ago
#GF5YCxcB
#devtojavascript#devto#dev#font#fstype
Reading 0:00
15s threshold

If you convert PDFs into web pages, someone eventually asks whether you are allowed to put the PDF's fonts into the HTML. The obvious design is a checkpoint that reads the font's license flag and stops the pipeline when it says no. Looking at what actually arrives at that point changed where I would put the check.

The flag is fsType, a 16-bit field in the font's OS/2 table. Per the OpenType spec (the OS/2 page on learn.microsoft.com, read on 2026-10-28), bits 0–3 hold the usage permission, with valid values 0, 2, 4 and 8. Bit 8 means no subsetting, and bit 9 means bitmap embedding only. I scanned the fonts on my Mac and only found 0, 4 and 8: Pacifico, Liberation Sans, Helvetica and Noto Serif SC report 0, Palatino and PingFang SC report 4, Arial and Georgia report 8. Values 2, 256 and 512 exist only in test copies I made by editing a font file.

The producer has often decided already

I printed the same bilingual page to PDF with Chromium 149, using Pacifico and Liberation Sans copies at each fsType.…

Continue reading β€” create a free account

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