Documentation

    Table of Content
    • 3D File Formats
      • 3D File Formats
      • 3D2
      • 3DS
      • 3MF
      • AMF
      • ASE
      • DAE
      • DRC
      • FBX
      • GLB
      • GLTF
      • IPT
      • JRXML
      • JT
      • OBJ
      • PLY
      • PRC
      • RVM
      • STEP
      • U3D
      • USD
      • USDZ
      • VRML
      • X
      • X3D
    • Audio File Formats
      • Audio File Formats
      • AAC
      • AC3
      • FLAC
      • M3U
      • MID
      • MKA
      • MP3
      • OGG
      • OPUS
      • RA
      • SDT
      • STAP
      • WAV
      • WMA
    • CAD File Formats
      • CAD File Formats
      • CF2
      • DC3
      • DGN
      • DWF
      • DWFX
      • DWG
      • DWT
      • DXF
      • HPGL
      • IFC
      • IGES
      • IGS
      • JVSG
      • NWC
      • NWD
      • NWF
      • PAT
      • PHJ
      • PLT
      • PSM
      • PSS
      • RVT
      • STL
    • Compression File Formats
      • Compression File Formats
      • 7Z
      • ARC
      • ARJ
      • BZ2
      • DAA
      • GZ
      • RAR
      • TAR
      • ZIM
      • ZIP
    • Database
      • Database File Formats
      • ACCDB
      • ACCDE
      • ACCDT
      • ACCFT
      • BAK
      • BCP
      • DDL
      • DTSX
      • LDF
      • MDB
      • MDF
      • MYI
      • NDF
      • NSF
      • SQL
      • SQLITE
    • EBook File Formats
      • EBook File Formats
      • AZW
      • AZW3
      • CBC
      • CBR
      • CBZ
      • EPUB
      • FB2
      • KFX
      • LRF
      • LRS
      • LRX
      • MOBI
      • TR
    • Email File Formats
      • Email File Formats
      • EDB
      • EML
      • EMLX
      • ICS
      • MBOX
      • MSG
      • OFT
      • OLM
      • OST
      • PST
      • TNEF
      • VCF - Virtual Contact File
    • Font
      • Font File Formats
      • CFF
      • CFF2
      • EOT
      • FNT
      • FON
      • JFPROJ
      • OTF
      • PFA
      • PFB
      • PFM
      • SFD
      • TTC
      • TTF
      • Type1
      • WOFF
    • GIS File Formats
      • GIS File Formats
      • E00
      • FileGDB
      • GeoJSON
      • GML
      • GPX
      • KML
      • KMZ
      • OSM
      • SHP
    • Image File Formats
      • Image File Formats
      • AI
      • APNG
      • AVIF
      • BMP
      • BPG
      • CDR
      • CMX
      • CPC
      • DCM
      • DIB
      • DICOM
      • DJVU
      • DNG
      • EMF
      • EMZ
      • EXIF
      • FLIF
      • FODG
      • GIF
      • ICO
      • J2C
      • J2K
      • JFIF
      • JP2
      • JPEG
      • JPF
      • JPM
      • JPX
      • JXR
      • ODG
      • OTG
      • PNG
      • PSB
      • PSD
      • SVGZ
      • TGA
      • TIFF
      • VDX
      • VSD
      • VSDM
      • VSDX
      • VSS
      • VSSM
      • VSSX
      • VST
      • VSTM
      • VSTX
      • VSX
      • VTX
      • WEBP
      • WMF
      • WMZ
    • Note Taking File Formats
      • Note Taking File Formats
      • ONE
      • ONETOC2
    • Page Description Language
      • Page Description Language
      • CGM
      • EPS
      • PCL
      • PS
      • SVG
      • SWF
      • TEX
      • XPS
      • XSLFO
    • PDF
      • PDF
      • PDF/A
      • PDF/E
      • PDF/UA
      • PDF/VT
      • PDF/X
    • Presentation File Formats
      • Presentation File Formats
      • ODP
      • OTP
      • POT
      • POTM
      • POTX
      • PPS
      • PPSM
      • PPSX
      • PPT
      • PPTM
      • PPTX
    • Programming
      • Programming
      • C
      • Class
      • CPP
      • CS
      • CSPROJ
      • Dart
      • H
      • JAR
      • Java
      • KT
      • MF
      • PDB
      • PHP
      • PY
      • SH
      • SLN
      • SWIFT
      • TOML
      • VB
      • VBPROJ
      • VCXPROJ
      • YAML
    • Project Management File Formats
      • Project Management File Formats
      • MPP
      • MPT
      • MPX
      • XER
    • Spreadsheet File Formats
      • Spreadsheet File Formats
      • CSV
      • DIF
      • FODS
      • NUMBERS
      • NUMBERS-TEF
      • ODS
      • OTS
      • SXC
      • TSV
      • XLA
      • XLAM
      • XLM
      • XLS
      • XLSB
      • XLSM
      • XLSX
      • XLT
      • XLTM
      • XLTX
    • Video File Formats
      • Video File Formats
      • 3G2
      • 3GP
      • ASF
      • AVI
      • F4V
      • FLV
      • M4V
      • MJPEG
      • MK3D
      • MKS
      • MKV
      • MOV
      • MP4
      • MXF
      • QT
      • RM
      • RMVB
      • RV
      • SRT
      • VOB
      • VP6
      • WEBM
      • WMV
      • Xvid
    • Web File Formats
      • Web File Formats
      • ASP
      • ASPX
      • CHM
      • CSS
      • HTM
      • HTML
      • IXBRL
      • JS
      • JSON
      • MHT
      • MHTML
      • Sass
      • SCSS
      • VDW
      • XAML
      • XBRL
      • XHTML
      • XML
      • XOML
      • XSLT
    • Word Processing File Formats
      • Word Processing File Formats
      • DOC
      • DOCM
      • DOCX
      • DOT
      • DOTM
      • DOTX
      • MD
      • ODT
      • OTT
      • RTF
      • TXT
    • Reporting
      • RDL
      • RDLC
      • RPL
    1. Home
    2. Font File Formats
    3. CFF2

    What's on this Page

      • What is a CFF2 file?
      • CFF2 File Format
        • Data Layout
        • Data Types
        • DICT Data
        • Header
      • References

    What is a CFF2 file?

    CFF2 file format is the version 2.0 of the CFF file format and allows efficient storage of glyph outlines and metadata similar to the CFF file format. CFF2 differs from CFF in that it is intended to be used in the context of an OpenType font as a ‘sfnt’ table with the tag CFF2. It can’t be used as a stand-alone program and depends on data in other OpenType tables.

    CFF2 File Format

    The CFF2 file format specifications contains details about internal data layout, data types, tables and other internal information about the file format. It can be referred for developer’s reference. Some of the details about these are as follow.

    Data Layout

    The binary data of CFF2 file format is logically organized as a number of separate data structures. The layout within the binary data is as shown in the following table.

    EntryComments
    HeaderFixed location
    Top DICTFixed location
    Global Subr INDEXFixed location
    VariationStore
    FDSelectPresent only if there is more than one Font DICT in the Font DICT INDEX.
    Font DICT INDEX
    Array of Font DICTIncluded in Font DICT INDEX.
    Private DICTOne per Font DICT.

    Only the first three structures are based on fixed locations. Remaining are reached via offsets, and their ordering can be changed.

    Data Types

    The CFF2 file format uses the following data types.

    NameRangeDescription
    uint80 to 2558-bit unsigned number
    uint160 to 6553516-bit unsigned number
    uint320 to 429496729532-bit unsigned number
    Offsetvaries1, 2, 3, or 4 byte offsets (specified by OffSize field in an Index table)
    OffSize1 to 41-byte unsigned number specifies the size of an Offset field or fields

    It stores all the multi-byte numeric data and offset fields in big-endian byte order. CFF2 format is free from padding bytes as it doesn’t honour any alignment restrictions.

    DICT Data

    CFF2 files contain the font dictionary data as key-value pairs in a compact tokenized format. Dictionary keys are encoded as 1 or 2 byte operators and dictionary values are encoded as variable-size numeric operands. There are three structures that use the DICT Data format: Top DICT, Font DICT and Private DICT. A number of integer operand types of varying sizes are defined and are encoded as shown in the following table (first byte of operand is b0, second is b1, and so on).

    Sizeb0 rangeValue rangeValue calculation
    132 to 246-107 to +107b0 - 139
    2247 to 250+108 to +1131(b0 - 247) * 256 + b1 + 108
    2251 to 254-1131 to -108-(b0 - 251) * 256 - b1 - 108
    328-32768 to +32767b1 « 8
    529-(2^31) to +(2^31 - 1)b1 « 24 | b2 « 16 | b3 « 8 | b4

    Header

    The binary data begins with a header having the format shown in Table below.

    TypeNameDescription
    uint8majorVersionFormat major version. Set to 2.
    uint8minorVersionFormat minor version. Set to zero.
    uint8headerSizeHeader size (bytes).
    uint16topDictLengthLength of Top DICT structure in bytes.

    References

    • CFF File Format
    • CFF2 File Format
    • Adobe Technical Note - Type2 Charstring Format