Class: Fontisan::Ufo::Compile::FeatureWriters::Kern
- Defined in:
- lib/fontisan/ufo/compile/feature_writers/kern.rb
Overview
GPOS PairPos (lookup type 2) — kerning pairs.
Reads font.kerning (parsed from kerning.plist) and emits
a FeatureOutput whose data is a structured list of
pairs ready for the GPOS PairPos builder. Returns nil
when the UFO has no kerning data — the compiler then
omits the GPOS table entirely.
Group-based kerning keys (e.g. "@MMK_L_A @MMK_R_B") are
emitted verbatim with group: true; the GPOS builder is
responsible for resolving group references via the UFO's
groups.plist data (TODO: groups.plist support is partial).
Constant Summary collapse
- LOOKUP_TYPE =
GPOS lookup type 2 — PairPos (pair-positioning).
2- FEATURE_TAG =
"kern"- TABLE_TAG =
"GPOS"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Fontisan::Ufo::Compile::FeatureWriters::Base
Instance Method Details
#write ⇒ FeatureOutput?
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fontisan/ufo/compile/feature_writers/kern.rb', line 26 def write return nil if font.kerning.nil? || font.kerning.empty? pairs = font.kerning.pairs.map do |key, value| left, right = key.to_s.split(" ", 2) { left: left, right: right, value: value.to_f, group_left: left.to_s.start_with?("@"), group_right: right.to_s.start_with?("@"), } end FeatureOutput.new( table_tag: TABLE_TAG, feature_tag: FEATURE_TAG, lookup_type: LOOKUP_TYPE, data: { pairs: pairs }, ) end |