Class: Fontisan::Stitcher::PartitionStrategy::ByPlane

Inherits:
Base
  • Object
show all
Defined in:
lib/fontisan/stitcher/partition_strategy/by_plane.rb

Overview

Partition codepoints by Unicode plane (BMP, SMP, SIP, …).

For each plane with codepoints:

- if the count fits under +cap+, emit one partition named
+:plane_<n>+ (e.g. +:plane_0+, +:plane_2+);
- otherwise sub-split using the large CJK extension block
boundaries, naming partitions +:plane_<n>_a+, +:plane_<n>_b+,
and so on.

If a single CJK extension block alone exceeds cap, raises GlyphLimitExceededError — the partitioner cannot satisfy the cap and the caller must use a smaller cap, split manually, or switch to a format with a higher glyph limit.

Constant Summary

Constants inherited from Base

Fontisan::Stitcher::PartitionStrategy::Base::DEFAULT_CAP

Instance Method Summary collapse

Instance Method Details

#call(cp_map, cap: DEFAULT_CAP) ⇒ Blueprint

Parameters:

  • cp_map (Hash{Integer=>Object})

    codepoint → donor label

  • cap (Integer) (defaults to: DEFAULT_CAP)

    max codepoints per partition

Returns:



23
24
25
26
27
28
29
# File 'lib/fontisan/stitcher/partition_strategy/by_plane.rb', line 23

def call(cp_map, cap: DEFAULT_CAP)
  grouped = group_by_plane(cp_map)
  partitions = grouped.flat_map do |plane_num, entries|
    build_partitions_for_plane(plane_num, entries, cap)
  end
  Blueprint.new(partitions: partitions)
end