Class: Tipo::Table::Substitution

Inherits:
Base
  • Object
show all
Defined in:
lib/tipo/table/substitution.rb

Defined Under Namespace

Classes: FeatureRecord, Header

Instance Attribute Summary

Attributes inherited from Base

#font, #font_header, #name

Instance Method Summary collapse

Methods inherited from Base

#offset

Constructor Details

#initialize(header, font) ⇒ Substitution

Returns a new instance of Substitution.



16
17
18
19
# File 'lib/tipo/table/substitution.rb', line 16

def initialize header, font
  @name = "GSUB"
  super
end

Instance Method Details

#feature_listObject



33
34
35
36
37
# File 'lib/tipo/table/substitution.rb', line 33

def feature_list
  feature_list_count.times.map do
    FeatureRecord.new *(font.unpack bytes: 6, tmpl: 'a4n')
  end
end

#feature_list_countObject



29
30
31
# File 'lib/tipo/table/substitution.rb', line 29

def feature_list_count
  font.unpack(seek: feature_list_offset, bytes: 2, tmpl: 'n').first 
end

#feature_list_offsetObject



25
26
27
# File 'lib/tipo/table/substitution.rb', line 25

def feature_list_offset
  header.feature_offset + offset
end

#headerObject



21
22
23
# File 'lib/tipo/table/substitution.rb', line 21

def header
  Header.new *(font.unpack seek: offset, bytes: 10, tmpl: 'n5')
end