class TTFunk::Table::Vorg
Constants
- TAG
Attributes
count[R]
default_vert_origin_y[R]
major_version[R]
minor_version[R]
Public Class Methods
encode(vorg)
click to toggle source
# File lib/ttfunk/table/vorg.rb, line 13 def self.encode(vorg) return unless vorg ''.b.tap do |table| table << [ vorg.major_version, vorg.minor_version, vorg.default_vert_origin_y, vorg.count ].pack('n*') vorg.origins.each_pair do |glyph_id, vert_origin_y| table << [glyph_id, vert_origin_y].pack('n*') end end end
Public Instance Methods
for(glyph_id)
click to toggle source
# File lib/ttfunk/table/vorg.rb, line 28 def for(glyph_id) @origins.fetch(glyph_id, default_vert_origin_y) end
origins()
click to toggle source
# File lib/ttfunk/table/vorg.rb, line 36 def origins @origins ||= {} end
tag()
click to toggle source
# File lib/ttfunk/table/vorg.rb, line 32 def tag TAG end
Private Instance Methods
parse!()
click to toggle source
# File lib/ttfunk/table/vorg.rb, line 42 def parse! @major_version, @minor_version = read(4, 'n*') @default_vert_origin_y = read_signed(1).first @count = read(2, 'n').first count.times do glyph_id = read(2, 'n').first origins[glyph_id] = read_signed(1).first end end