Class: TTFunk::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/ttfunk/directory.rb

Overview

SFNT table directory.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, offset = 0) ⇒ Directory

Returns a new instance of Directory.

Source Code
lib/ttfunk/directory.rb, line 14
14
def initialize(io, offset = 0)
15
  io.seek(offset)
16
17
  # https://www.microsoft.com/typography/otspec/otff.htm#offsetTable
18
  # We're ignoring searchRange, entrySelector, and rangeShift here, but
19
  # skipping past them to get to the table information.
20
  @scaler_type, table_count = io.read(12).unpack('Nn')
21
22
  @tables = {}
23
  table_count.times do
24
    tag, checksum, offset, length = io.read(16).unpack('a4N*')
25
    @tables[tag] = {
26
      tag: tag,
27
      checksum: checksum,
28
      offset: offset,
29
      length: length,
30
    }
31
  end
32
end

Instance Attribute Details

#scaler_typeInteger (readonly)

Scaler type

Returns:

  • (Integer)
Source Code
lib/ttfunk/directory.rb, line 12
12
def scaler_type
13
  @scaler_type
14
end

#tablesHash{String => Hash} (readonly)

Table descriptors

Returns:

  • (Hash{String => Hash})
Source Code
lib/ttfunk/directory.rb, line 8
8
def tables
9
  @tables
10
end