Packaging PostScript CFF (.otf) Fonts into WOFF2 Without Transcoding Curves
How WOFF2 Handles OTTO Flavors and Compact Font Format Charstrings
Foundry OpenType .otf files store cubic Bezier outlines inside a Compact Font Format (CFF) table rather than quadratic TrueType glyf tables. Older webfont generators forced an OTF-to-TTF conversion step before compression, approximating cubic curves with extra quadratic off-curve points and discarding Adobe Type 2 stem hints—often making small body copy look fuzzy on Windows monitors.
The WOFF2 specification natively supports 0x4F54544F (OTTO) flavors. Instead of glyf/loca transformation, the encoder leaves the CFF table’s internal binary charstring subroutines untouched and compresses CFF alongside GPOS, GSUB, cmap, and hmtx inside the unified Brotli dictionary, shrinking payload size dramatically with zero outline distortion.
- Preserves 0x4F54544F (OTTO) flavor signature inside bytes 4..7 of the WOFF2 header.
- Retains cubic Bezier charstrings, subroutines, and PostScript BlueValues hinting.
- Supports HarfBuzz CFF charstring desubroutinization and closure during subsetting.
- Emits valid format("woff2") @font-face declarations identical in syntax to TrueType WOFF2.
- Avoids bloated node counts caused by lossy cubic-to-quadratic spline conversion tools.
- Validates reconstructed SFNT directory alignment and table lengths before writing output bytes.