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

A kerning subtable containing the actual information to do kerning.

Public Class Methods

new(pairs:, horizontal:, minimum_values:, cross_stream:) click to toggle source

Creates a new subtable.

# File lib/hexapdf/font/true_type/table/kern.rb, line 56
def initialize(pairs:, horizontal:, minimum_values:, cross_stream:)
  @pairs = pairs
  @horizontal = horizontal
  @minimum_values = minimum_values
  @cross_stream = cross_stream
end

Public Instance Methods

cross_stream?() click to toggle source

Returns true if this subtable contains cross-stream values, i.e. values that are applied perpendicular to the writing direction.

# File lib/hexapdf/font/true_type/table/kern.rb, line 81
def cross_stream?
  @cross_stream
end
horizontal?() click to toggle source

Returns true if this subtable is used for horizontal kerning.

# File lib/hexapdf/font/true_type/table/kern.rb, line 70
def horizontal?
  @horizontal
end
kern(left, right) click to toggle source

Returns the kerning value between the two glyphs, or nil if there is no kerning value.

# File lib/hexapdf/font/true_type/table/kern.rb, line 65
def kern(left, right)
  @pairs.fetch(left, nil)&.fetch(right, nil)
end
minimum_values?() click to toggle source

Returns true if this subtable contains minimum values and not kerning values.

# File lib/hexapdf/font/true_type/table/kern.rb, line 75
def minimum_values?
  @minimum_values
end