Class: Fontisan::Ufo::Compile::FeatureWriters::MarkFamilyBase
- Defined in:
- lib/fontisan/ufo/compile/feature_writers/mark_family_base.rb
Overview
Shared base for feature writers that pair "mark" glyphs with
"base" glyphs via a paired-anchor convention (Mark uses
_<name> ↔ <name>; Mkmk uses _<name>mkmk ↔
<name>mkmk). Concrete subclasses plug in the lookup
convention + the lookup type + the feature tag.
Reduces duplication between Mark and Mkmk: both walk every glyph, collect its anchor classes (with the convention's prefix + suffix), then pair each class with matching bases.
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?
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fontisan/ufo/compile/feature_writers/mark_family_base.rb', line 18 def write marks = collect_marks return nil if marks.empty? = {} marks.each do |(mark_name, classes)| classes.each do |class_name, mark_anchor| bases = collect_bases_for(class_name) next if bases.empty? [class_name] ||= new_class_entry [class_name][:marks][mark_name] = mark_anchor bases.each { |n, a| [class_name][base_bucket_key][n] = a } end end return nil if .empty? FeatureOutput.new( table_tag: table_tag, feature_tag: feature_tag, lookup_type: lookup_type, data: { attachments: }, ) end |