File: directory.rb

package info (click to toggle)
ruby-ttfunk 1.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 916 kB
  • sloc: ruby: 1,719; makefile: 16
file content (17 lines) | stat: -rw-r--r-- 468 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module TTFunk
  class Directory
    attr_reader :tables
    attr_reader :scaler_type

    def initialize(io)
      @scaler_type, table_count, search_range,
        entry_selector, range_shift = 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