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.

Instance Method Summary collapse

Instance Method Details

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

Parameters:

Returns:

  • (Hash{Symbol=>Object})


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ucode/audit/extractors/aggregations.rb', line 24

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

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

  {
    baseline: baseline.,
    blocks: blocks,
    scripts: scripts,
    plane_summaries: planes,
    discrepancies: discrepancies,
  }
end