Class: Ucode::Audit::FaceAuditor

Inherits:
Object
  • Object
show all
Defined in:
lib/ucode/audit/face_auditor.rb

Overview

Per-face orchestrator: takes a font path, runs every Extractor in the Registry, and assembles a single Models::Audit::AuditReport.

For standalone fonts (TTF/OTF/WOFF/WOFF2) #call returns one AuditReport. For collections (TTC/OTC/dfont) it returns Array — one per face, in source order.

Extracted as its own class so LibraryAuditor (per-file iteration) and the future CLI AuditCommand (single face) share one orchestration path. Neither caller enumerates extractors directly — they go through this class and the Registry.

Instance Method Summary collapse

Constructor Details

#initialize(font_path, options: {}, mode: :full, font_index: nil, reference: nil) ⇒ FaceAuditor

Returns a new instance of FaceAuditor.

Parameters:

  • font_path (String, Pathname)

    font file to audit

  • options (Hash{Symbol=>Object}) (defaults to: {})

    forwarded to Context (ucd_version, all_codepoints, with_glyphs, audit_brief, …)

  • mode (Symbol) (defaults to: :full)

    :full (default) or :brief

  • font_index (Integer, nil) (defaults to: nil)

    when set and the source is a collection (TTC/OTC/dfong), audit only that face index and return a single AuditReport. Ignored for single-face sources.

  • reference (CoverageReference, nil) (defaults to: nil)

    the baseline the audit compares against. When nil, defaults to UCD-only (TODO 25). Pass a UniversalSetReference to attach per-codepoint provenance to missing-codepoint rows.



30
31
32
33
34
35
36
37
# File 'lib/ucode/audit/face_auditor.rb', line 30

def initialize(font_path, options: {}, mode: :full, font_index: nil,
               reference: nil)
  @font_path = font_path.to_s
  @options = options
  @mode = mode
  @font_index = font_index
  @reference = reference
end

Instance Method Details

#callModels::Audit::AuditReport+



40
41
42
43
44
45
46
# File 'lib/ucode/audit/face_auditor.rb', line 40

def call
  if Fontisan::FontLoader.collection?(@font_path)
    audit_collection
  else
    audit_face(load_face(0), 0, 1)
  end
end