class TTFunk::Table::Vorg
Constants
- TAG
Attributes
Public Class Methods
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
Source
# File lib/ttfunk/table/vorg.rb, line 28 def for(glyph_id) @origins.fetch(glyph_id, default_vert_origin_y) end
Private Instance Methods
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