Class: Fontisan::Stitcher::PartitionStrategy::ByPlane
- 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 along the recognized sub-plane block
boundaries (+RECOGNIZED_BLOCKS+), naming partitions
+:plane_<n>_a+, +:plane_<n>_b+, and so on.
If a single ATOMIC_BLOCKS entry alone exceeds cap, raises
PartitionCapExceededError — 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.
CARVE_OUT_BLOCKS entries are chunkable and will be sliced
like :other if they exceed cap.
Constant Summary collapse
- ATOMIC_BLOCKS =
Atomic sub-plane blocks: cannot be sub-split further because no finer-grained Unicode boundary exists inside them. If one alone exceeds
cap, raise PartitionCapExceededError.Labels follow the Unicode Blocks.txt block names with spaces replaced by underscores.
{ "CJK_Ext_B" => 0x2A700..0x2B73F, "CJK_Ext_C" => 0x2B740..0x2B81F, "CJK_Ext_D" => 0x2B820..0x2CEAF, "CJK_Ext_E" => 0x2CEB0..0x2EBEF, "CJK_Ext_F" => 0x2EBF0..0x2EE5F, }.freeze
- CARVE_OUT_BLOCKS =
Carve-out boundaries: sub-plane regions large enough to warrant their own partition bucket when a plane overflows
cap. Unlike atomic blocks, these are chunkable — if one alone exceedscap, it gets sliced into +cap+-sized chunks like:otherdoes, never raised. { "CJK_Unified_Ideographs" => 0x4E00..0x9FFF, "Hangul_Syllables" => 0xAC00..0xD7AF, }.freeze
- RECOGNIZED_BLOCKS =
Every codepoint range recognized as a distinct sub-plane bucket. Atomic blocks first, then carve-out blocks. Used by the bucketing pass to decide what gets its own partition vs. falls into
:other. ATOMIC_BLOCKS.merge(CARVE_OUT_BLOCKS).freeze
Constants inherited from Base
Fontisan::Stitcher::PartitionStrategy::Base::COMPOSITE_HEADROOM, Fontisan::Stitcher::PartitionStrategy::Base::DEFAULT_CAP, Fontisan::Stitcher::PartitionStrategy::Base::NOTDEF_RESERVED
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#call(cp_map, cap: DEFAULT_CAP) ⇒ Blueprint
55 56 57 58 59 60 61 |
# File 'lib/fontisan/stitcher/partition_strategy/by_plane.rb', line 55 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 |