Module: Fontisan::Tables::Cff2::Header

Defined in:
lib/fontisan/tables/cff2/header.rb

Overview

The CFF2 table header: 5 bytes at the start of every CFF2 table.

majorVersion  (uint8) = 2
minorVersion  (uint8) = 0
headerSize    (uint8) = 5
topDictSize   (uint16) length of the TopDICT that follows

The TopDICT starts immediately after the header (at offset 5). The GlobalSubrINDEX starts at headerSize + topDictSize.

Constant Summary collapse

MAJOR_VERSION =
2
MINOR_VERSION =
0
HEADER_SIZE =
5
BYTESIZE =
5

Class Method Summary collapse

Class Method Details

.build(top_dict_size:) ⇒ String

Returns 5-byte header.

Parameters:

  • top_dict_size (Integer)

    length of the TopDICT subtable

Returns:

  • (String)

    5-byte header



23
24
25
26
27
28
29
30
# File 'lib/fontisan/tables/cff2/header.rb', line 23

def self.build(top_dict_size:)
  [
    MAJOR_VERSION,
    MINOR_VERSION,
    HEADER_SIZE,
    top_dict_size,
  ].pack("CCCn")
end