What is a CFF file?
A file with .cff extension is a Compact Font Format and is also known as a PostScript Type 1, or CIDFont. CFF acts as a container to store multiple fonts together in a single unit known as a FontSet. The design of CFF fonts allow embedding PostScript language code that permits additional flexibility and extensibility of the format for usage with printer environments. CFF font files can be opened and converted using APIs such as Aspose.Font.
CFF File Format
CFF files are binary files that contain a structured data layout, has defined data types, a header, glyph organization and table dictionaries. More details about these can be found in the compact font format specifications.
Data Layout
The data layout of CFF file format is as shown below.
Entry | Comments |
---|---|
Header | – |
NameINDEX | – |
Top DICT INDEX | – |
String INDEX | – |
Global Subr INDEX | – |
Encodings–Charsets | – |
FDSelect | CIDFonts only |
CharStrings INDEX | per-font |
Font DICT INDEX | per-font, CIDFonts only |
Private DICT | per-font |
Local Subr INDEX | per-font or per-Private DICT for CIDFonts |
Copyright and Trademark Notices | – |
Data Types
CFF data types are as shown in the following table.
Name | Range | Description |
---|---|---|
Card8 | 0 –255 | 1-byte unsigned number |
Card16 | 0 – 65535 | 2-byte unsigned number |
Offset | varies | 1, 2, 3, or 4 byte offset (specified by OffSize field) |
OffSize | 1–4 | 1-byte unsigned number specifies the size of an Offset field or fields |
SID | 0 – 64999 | 2-byte string identifier |
Header
The binary data begins with a header having the format shown in the following table.
Type | Name | Description |
---|---|---|
Card8 | major | Format major version (starting at 1) |
Card8 | minor | Format minor version (starting at 0) |
Card8 | hdrSize | Header size (bytes) |
OffSize | offSize | Absolute offset (0) size |