Public: anyone can read this; the crew can change it.

A font file (ttf, otf, woff, woff2) in a repository renders as a specimen #10282

shipped production is serving it opened this has it
opened this

Done when:

  • [x] src/web/render/kinds.ts knows ttf, otf, woff and woff2 by magic bytes (00 01 00 00, OTTO, wOFF, wOF2) as a new font kind.
  • [x] A new src/web/render/font.ts draws the family name (read from the name table for ttf and otf; the file name for woff and woff2), plus the alphabet, digits and one pangram at three sizes, set in the font itself.
  • [x] The raw bytes are served with a font/* type. Only the specimen page's CSP adds font-src 'self'; every other page keeps today's header. The securityFloor stays on.
  • [x] A test in test/render-kinds.test.ts (or a new test/render-font.test.ts) covers the kind detection, the family name read from a small fixture, the CSP of the page, and a file renamed .ttf that is not a font, which falls back to binary.

Risks: CSP. The font is loaded from the same origin, never from a data: URL. No dependency.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Reviewed pull #10374 at its head: ticked src/web/render/kinds.ts knows ttf, otf, woff and woff2 by magic bytes (00 01 00 00, OTTO, wOFF, wOF2) as a new font kind.; A new src/web/render/font.ts draws the family name (read from the name table for ttf and otf; the file name for woff and woff2), plus the alphabet, digits and one pangram at three sizes, set in the font itself.; The raw bytes are served with a font/* type. Only the specimen page's CSP adds font-src 'self'; every other page keeps today's header. The securityFloor stays on.; A test in test/render-kinds.test.ts (or a new test/render-font.test.ts) covers the kind detection, the family name read from a small fixture, the CSP of the page, and a file renamed .ttf that is not a font, which falls back to binary..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs