Class: Ucode::Audit::Extractors::Aggregations

Inherits:
Base
  • Object
show all
Defined in:
lib/ucode/audit/extractors/aggregations.rb

Overview

Aggregations: UCD block/script coverage driven by ucode's own parsed baseline (not ucd.all.flat.zip), plus OS/2 ulUnicodeRange discrepancies.

Returned fields:

baseline, blocks, scripts, plane_summaries, discrepancies

MECE: this extractor owns UCD-driven aggregations + the OS/2 bit-vs-cmap cross-check. SFNT-driven GSUB/GPOS script/feature coverage lives in OpenTypeLayout.

ucode delta vs fontisan: replaces UCDXML flat-zip lookup with ucode's own SQLite-backed Database. The Database exposes lookup_block, lookup_script, block_ranges_by_name, and script_ranges_by_name — those power every aggregation here.

TODO 25: the BlockAggregator now takes a CoverageReference rather than a raw Database. The Context supplies one — UcdOnlyReference by default, UniversalSetReference when a universal-set manifest is supplied via the CLI (--reference-universal-set=<path>).

Instance Method Summary collapse

Instance Method Details

#extract(context) ⇒ Hash{Symbol=>Object}

Parameters:

Returns:

  • (Hash{Symbol=>Object})


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ucode/audit/extractors/aggregations.rb', line 30

def extract(context)
  baseline = context.baseline
  return empty_with_warning(baseline) unless baseline.available?

  codepoints = context.codepoints
  reference = context.reference
  blocks = BlockAggregator.new(reference).call(codepoints)
  scripts = ScriptAggregator.new(baseline.database).call(codepoints)
  planes = PlaneAggregator.new.call(blocks)
  discrepancies = DiscrepancyDetector.new(**os2_args(context))
    .call

  {
    baseline: (baseline, reference),
    blocks: blocks,
    scripts: scripts,
    plane_summaries: planes,
    discrepancies: discrepancies,
  }
end