class HexaPDF::Font::TrueType::Table::Kern

See: www.microsoft.com/typography/otspec/kern.htm<br><br>* Only subtable format 0 is supported, all other subtables are ignored.
Restrictions:
The ‘kern’ table contains kerning values, i.e. values to control inter-character spacing.

def horizontal_kerning_subtable

if no such subtable exists.
Returns the first subtable that supports horizontal non-cross-stream kerning, or +nil+
def horizontal_kerning_subtable
  @horizontal_kerning_subtable
end

def parse_subtable0(nr_of_subtables)

Parses subtables for kern table version 0.
def parse_subtable0(nr_of_subtables)
  nr_of_subtables.times do
    length, format, coverage = read_formatted(6, 'x2nCC')
    options = {horizontal: (coverage[0] == 1),
               minimum_values: (coverage[1] == 1),
               cross_stream: (coverage[2] == 1)}
    yield(length - 6, format, options)
  end
end

def parse_subtable1(nr_of_subtables)

Parses subtables for kern table version 1.
def parse_subtable1(nr_of_subtables)
  nr_of_subtables.times do
    length, coverage, format = read_formatted(8, 'NCC')
    options = {horizontal: (coverage[7] == 0),
               minimum_values: false,
               cross_stream: (coverage[6] == 1)}
    yield(length - 8, format, options)
  end
end

def parse_table #:nodoc:

:nodoc:
def parse_table #:nodoc:
  @version, nr_of_subtables = read_formatted(4, 'nn')
  subtable_parsing_method = :parse_subtable0
  if @version == 1
    @version = Rational(@version << 16 + nr_of_subtables, 65536)
    nr_of_subtables = read_formatted(4, 'N').first
    subtable_parsing_method = :parse_subtable1
  end
  @subtables = []
  send(subtable_parsing_method, nr_of_subtables) do |length, format, options|
    if format == 0
      pairs = Format0.parse(io, length)
      @subtables << Subtable.new(pairs: pairs, **options)
    elsif font.config['font.true_type.unknown_format'] == :raise
      raise HexaPDF::Error, "Unsupported kern subtable format: #{format}"
    else
      io.pos += length
    end
  end
  @horizontal_kerning_subtable = @subtables.find do |t|
    t.horizontal? && !t.minimum_values? && !t.cross_stream?
  end
end