A font collection (.ttc) holds several
fonts that share some of their tables, such as the weights of one family sharing a
glyf table. WOFF2, unlike WOFF 1.0, can wrap a collection. The header’s
flavor is then ttcf (0x74746366), and a
collection directory comes straight after the
table directory, before the
compressed data. For a single font there is no collection directory.
Shared tables
The table directory lists each distinct table of the collection once, and its data is in the compressed stream once, however many fonts use it. The collection directory then says which of those tables make up each font, by their position in the table directory, counted from 0.
Collection header
| Type | Name | Description |
|---|---|---|
| UInt32 | version | The version of the TTC header in the original collection: 0x00010000 or 0x00020000. |
| 255UInt16 | numFonts | The number of fonts in the collection. |
font entry × numFonts | fonts | One font entry per font, in the order of the original collection. |
Font entry
| Type | Name | Description |
|---|---|---|
| 255UInt16 | numTables | The number of tables in this font. |
| UInt32 | flavor | This font’s sfntVersion: 0x00010000 for TrueType outlines, OTTO for CFF. |
255UInt16 × numTables | index | For each of the font’s tables, its position in the table directory. |
Every entry is variable in length, so a reader must go through them one by one.
Rules
glyfandlocago together: a font that shares another font’sglyfmust share itslocatoo. An encoder must refuse a collection that shares only one of the two, and a decoder must reject a file whose fonts pair them differently. In the table directory eachlocacomes immediately after itsglyf.- The hmtx transformation may be
used in a collection only if it holds for every combination of
hmtxandglyfthat the fonts share. - A
DSIGdigital signature cannot survive the transformation, so the encoder removes it. Each rebuilt font then has as many tables as in the original, or one fewer where aDSIGwas dropped. - For a version 2.0 TTC header, whose last three fields point to a
DSIGtable for the whole collection, the decoder must either set those fields to zero or write a version 1.0 header instead. - The decoder keeps the fonts in their original order, so a font’s index in the collection does not change.
Rebuilding the collection
The decoder writes a TTC header (ttcf, the version, the number of fonts,
and an offset to each font’s offset table), then one offset table per font with its
flavor and table records sorted by tag, then the decoded tables. A table
that several fonts share is written once, and their table records all point to it.
See TTC for the layout of the result.