Class: Tipo::Table::Naming

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

Defined Under Namespace

Classes: Header, NameRecord

Instance Attribute Summary

Attributes inherited from Base

#font, #font_header

Instance Method Summary collapse

Methods inherited from Base

#offset

Constructor Details

#initialize(header, font) ⇒ Naming

Returns a new instance of Naming.



11
12
13
14
# File 'lib/tipo/table/naming.rb', line 11

def initialize header, font
  @name = 'name'
  super
end

Instance Method Details

#family_nameObject



36
37
38
# File 'lib/tipo/table/naming.rb', line 36

def family_name
  stringify_record record_at 1
end

#headerObject



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

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

#nameObject



40
41
42
# File 'lib/tipo/table/naming.rb', line 40

def name
  stringify_record record_at 4
end

#naming_listObject



24
25
26
27
28
# File 'lib/tipo/table/naming.rb', line 24

def naming_list 
  header.count.times.map do
    NameRecord.new *(font.unpack bytes: 12, tmpl: 'n6')
  end
end

#record_at(id) ⇒ Object



30
31
32
33
34
# File 'lib/tipo/table/naming.rb', line 30

def record_at id
  naming_list.select do |n|
    n.name == id && n.platform == 1
  end.first
end

#storage_offsetObject



20
21
22
# File 'lib/tipo/table/naming.rb', line 20

def storage_offset
  header.storage_offset + offset
end

#styleObject



44
45
46
# File 'lib/tipo/table/naming.rb', line 44

def style
  stringify_record record_at 2
end