Class: HexaPDF::Font::TrueType::Table::Kern::Subtable

Inherits:
Object
  • Object
show all
Defined in:
lib/hexapdf/font/true_type/table/kern.rb

Overview

A kerning subtable containing the actual information to do kerning.

Instance Method Summary collapse

Constructor Details

#initialize(pairs:, horizontal:, minimum_values:, cross_stream:) ⇒ Subtable

Creates a new subtable.



57
58
59
60
61
62
# File 'lib/hexapdf/font/true_type/table/kern.rb', line 57

def initialize(pairs:, horizontal:, minimum_values:, cross_stream:)
  @pairs = pairs
  @horizontal = horizontal
  @minimum_values = minimum_values
  @cross_stream = cross_stream
end

Instance Method Details

#cross_stream?Boolean

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

Returns:

  • (Boolean)


82
83
84
# File 'lib/hexapdf/font/true_type/table/kern.rb', line 82

def cross_stream?
  @cross_stream
end

#horizontal?Boolean

Returns true if this subtable is used for horizontal kerning.

Returns:

  • (Boolean)


71
72
73
# File 'lib/hexapdf/font/true_type/table/kern.rb', line 71

def horizontal?
  @horizontal
end

#kern(left, right) ⇒ Object

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



66
67
68
# File 'lib/hexapdf/font/true_type/table/kern.rb', line 66

def kern(left, right)
  @pairs.fetch(left, nil)&.fetch(right, nil)
end

#minimum_values?Boolean

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

Returns:

  • (Boolean)


76
77
78
# File 'lib/hexapdf/font/true_type/table/kern.rb', line 76

def minimum_values?
  @minimum_values
end