Class: Ucode::CodeChart::CoverageGapIndex
- Inherits:
-
Object
- Object
- Ucode::CodeChart::CoverageGapIndex
- Defined in:
- lib/ucode/code_chart/coverage_gap_index.rb
Overview
Lists Unicode blocks that have OFL coverage gaps — assigned
codepoints no Tier 1 donor font covers. REQ R5's
--coverage-gap-only flag.
Inputs
The index takes a coverage_by_block map
({block_id => [covered_codepoints]}) and a blocks lookup.
For each block, it computes the gap (assigned − covered) and
emits a GapAnalyzer::BlockGap when the gap is non-empty.
Reuse
Internally composes GapAnalyzer::Analyzer with a synthetic manifest (covering exactly the donor-supplied codepoints). No duplication of the gap-math; the OCP boundary is at GapAnalyzer.
Coverage source
The actual "is this codepoint covered by any OFL font?" lookup lives outside this class — callers pass in the coverage map. Future work: a Tier 1 CoverageCollector that walks fontist's known OFL sources and emits the coverage_by_block input. Until then, the caller supplies it (typically from a YAML file).
Class Method Summary collapse
Instance Method Summary collapse
- #each_gap_block {|block_gap| ... } ⇒ Enumerator, void
- #gap_blocks ⇒ Array<Ucode::CodeChart::GapAnalyzer::BlockGap>
-
#initialize(coverage_by_block:, blocks:, ucd_version:) ⇒ CoverageGapIndex
constructor
A new instance of CoverageGapIndex.
- #total_missing_codepoints ⇒ Integer
Constructor Details
#initialize(coverage_by_block:, blocks:, ucd_version:) ⇒ CoverageGapIndex
Returns a new instance of CoverageGapIndex.
47 48 49 50 51 |
# File 'lib/ucode/code_chart/coverage_gap_index.rb', line 47 def initialize(coverage_by_block:, blocks:, ucd_version:) @coverage_by_block = coverage_by_block @blocks = blocks @ucd_version = ucd_version end |
Class Method Details
.from_yaml(path, blocks:) ⇒ CoverageGapIndex
104 105 106 107 108 109 110 111 |
# File 'lib/ucode/code_chart/coverage_gap_index.rb', line 104 def from_yaml(path, blocks:) data = YAML.safe_load(Pathname.new(path).read) || {} new( coverage_by_block: data.fetch("coverage", {}), blocks: blocks, ucd_version: data.fetch("ucd_version"), ) end |
Instance Method Details
#each_gap_block {|block_gap| ... } ⇒ Enumerator, void
55 56 57 58 59 |
# File 'lib/ucode/code_chart/coverage_gap_index.rb', line 55 def each_gap_block(&) return enum_for(:each_gap_block) unless block_given? analyzer.each_block_gap(&) end |
#gap_blocks ⇒ Array<Ucode::CodeChart::GapAnalyzer::BlockGap>
62 63 64 |
# File 'lib/ucode/code_chart/coverage_gap_index.rb', line 62 def gap_blocks analyzer.block_gaps end |
#total_missing_codepoints ⇒ Integer
67 68 69 |
# File 'lib/ucode/code_chart/coverage_gap_index.rb', line 67 def total_missing_codepoints analyzer.total_missing_codepoints end |