Sha256: 2a6850225b9bc45c99c71766794c38a439dd2a154f0ebf4aa7d6317dbae9eddb

Contents?: true

Size: 721 Bytes

Versions: 5

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module TTFunk
  class Directory
    attr_reader :tables
    attr_reader :scaler_type

    def initialize(io, offset = 0)
      io.seek(offset)

      # https://www.microsoft.com/typography/otspec/otff.htm#offsetTable
      # We're ignoring searchRange, entrySelector, and rangeShift here, but
      # skipping past them to get to the table information.
      @scaler_type, table_count = io.read(12).unpack('Nn')

      @tables = {}
      table_count.times do
        tag, checksum, offset, length = io.read(16).unpack('a4N*')
        @tables[tag] = {
          tag: tag,
          checksum: checksum,
          offset: offset,
          length: length
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ttfunk-1.7.0 lib/ttfunk/directory.rb
ttfunk-1.6.2.1 lib/ttfunk/directory.rb
ttfunk-1.6.2 lib/ttfunk/directory.rb
ttfunk-1.6.1 lib/ttfunk/directory.rb
ttfunk-1.6.0 lib/ttfunk/directory.rb