Class: Ucode::Glyphs::RealFonts::CoverageAuditor

Inherits:
Object
  • Object
show all
Defined in:
lib/ucode/glyphs/real_fonts/coverage_auditor.rb

Overview

Builds a FontCoverageReport for a font on disk.

Strategy:

1. Walk the font's cmap via fontisan to get the set of
   codepoints the font actually has outlines for.
2. For each Unicode 17 block in {Unicode17Blocks}, intersect
   the block's assigned-codepoint ranges against the cmap
   set. The denominator (`assigned`) comes from our curated
   ranges table — not from fontisan's UCD database, because
   the UCD database is a separate download and its block
   coverage for Unicode 17 is incomplete (it omits several
   new blocks). The numerator (`covered`) and the
   `missing_cps` list both come from the cmap walk.
3. Also call fontisan's {Fontisan::Commands::AuditCommand} in
   brief mode for identity + total counts (no UCD dependency
   in brief mode).

Constant Summary collapse

UCD_VERSION =
"17.0.0"

Instance Method Summary collapse

Instance Method Details

#audit(font_path) ⇒ FontCoverageReport

Parameters:

  • font_path (Pathname, String)

Returns:



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ucode/glyphs/real_fonts/coverage_auditor.rb', line 37

def audit(font_path)
  font_path = Pathname(font_path)
  fontisan_report = run_fontisan_audit(font_path)
  cmap_codepoints = read_cmap_codepoints(font_path)
  blocks = Unicode17Blocks::ALL.map do |block|
    build_block_coverage(block, cmap_codepoints)
  end

  FontCoverageReport.new(**report_kwargs(font_path, fontisan_report,
                                         blocks))
end