module HexaPDF::Font::TrueType::Table::Kern::Format0
'kern' subtable format 0
Public Class Methods
parse(io, length) → pairs
click to toggle source
Parses the format 0 subtable and returns a hash of the form
{left_char: {right_char: kern_value}}
# File lib/hexapdf/font/true_type/table/kern.rb, line 156 def self.parse(io, _length) number_of_pairs = io.read(8).unpack1('n') pairs = Hash.new {|h, k| h[k] = {} } io.read(number_of_pairs * 6).unpack('n*').each_slice(3) do |left, right, value| pairs[left][right] = (value < 0x8000 ? value : -(value ^ 0xffff) - 1) end pairs end