Class: TTFunk::Table::Kern

Inherits:
TTFunk::Table show all
Defined in:
lib/ttfunk/table/kern.rb,
lib/ttfunk/table/kern/format0.rb

Overview

Kerning (kern) table

Defined Under Namespace

Classes: Format0

Instance Attribute Summary collapse

Attributes inherited from TTFunk::Table

#file, #length, #offset

Class Method Summary collapse

Methods inherited from TTFunk::Table

#exists?, #initialize, #raw, #tag

Constructor Details

This class inherits a constructor from TTFunk::Table

Instance Attribute Details

#tablesArray<TTFunk::Table::Kern::Format0> (readonly)

Subtables.

Returns:

Source Code
lib/ttfunk/table/kern.rb, line 15
15
def tables
16
  @tables
17
end

#versionInteger (readonly)

Table version

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/kern.rb, line 11
11
def version
12
  @version
13
end

Class Method Details

.encode(kerning, mapping) ⇒ String?

Encode table.

Parameters:

  • kerning (TTFunk::Table::Kern)
  • mapping (Hash{Integer => Integer})

    keys are new glyph IDs, values are old glyph IDs

Returns:

  • (String, nil)
Source Code
lib/ttfunk/table/kern.rb, line 23
23
def self.encode(kerning, mapping)
24
  return unless kerning.exists? && kerning.tables.any?
25
26
  tables = kerning.tables.filter_map { |table| table.recode(mapping) }
27
  return if tables.empty?
28
29
  [0, tables.length, tables.join].pack('nnA*')
30
end