Introduction
WOFF is a wrapper for TrueType and
OpenType fonts, made for loading fonts on web pages. It
was proposed in 2009 and became a W3C Recommendation in 2012. It compresses the font’s
tables and can carry licensing metadata, and browsers load it through CSS
@font-face. WOFF2, which compresses
better, has largely replaced it, but WOFF is still kept as a fallback for older
browsers.
Structure
A WOFF file is big-endian. It starts with a 44-byte header: the signature
wOFF, the flavour of the original font (00 01 00 00 for
TrueType outlines or OTTO for CFF), the file length, the number of tables,
the size of the original font, a version number, and the offsets and lengths of optional
metadata and private data. A table directory follows, 20 bytes per table: the tag, its
offset in the file, its compressed and original lengths and its checksum. Each table is
then stored compressed with zlib, or as it was if compression would not make it
smaller.
0HeaderwOFF, flavour, lengths, table count, version44 bytes44Table directory tag, offset, compressed and original length, checksum20 bytes each…Font tables each compressed with zlib or storedvaries…Extended metadata, private dataoptional
Links
Software
- Every current web browser, through CSS
@font-face - FontForge (Windows, macOS, Linux)
Developers
- fontTools, Python library that reads and writes WOFF
- opentype.js, JavaScript library that parses WOFF fonts
Reference
- WOFF File Format 1.0, W3C Recommendation