Class: Fontisan::Stitcher::PartitionStrategy::Partition

Inherits:
Struct
  • Object
show all
Defined in:
lib/fontisan/stitcher/partition_strategy/partition.rb

Overview

One slice of a partitioned codepoint set. Each partition names a target subfont and the codepoints + donor mapping that should land in it.

#apply_to pushes the partition's bindings into a Stitcher via include_codepoints_map (TODO 68). If that API is unavailable (older Stitcher), it falls back to one include_codepoints call per donor — but the preferred path is the map API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cpsObject

Returns the value of attribute cps

Returns:

  • (Object)

    the current value of cps



14
15
16
# File 'lib/fontisan/stitcher/partition_strategy/partition.rb', line 14

def cps
  @cps
end

#donor_mapObject

Returns the value of attribute donor_map

Returns:

  • (Object)

    the current value of donor_map



14
15
16
# File 'lib/fontisan/stitcher/partition_strategy/partition.rb', line 14

def donor_map
  @donor_map
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



14
15
16
# File 'lib/fontisan/stitcher/partition_strategy/partition.rb', line 14

def name
  @name
end

Instance Method Details

#apply_to(stitcher) ⇒ void

This method returns an undefined value.

Parameters:



17
18
19
20
# File 'lib/fontisan/stitcher/partition_strategy/partition.rb', line 17

def apply_to(stitcher)
  slice = cps.to_h { |cp| [cp, donor_map[cp]] }
  stitcher.include_codepoints_map(slice, into: name)
end