Class: Ucode::Audit::Formatters::AuditText

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

Overview

Human-readable, sectioned view of an Models::Audit::AuditReport.

The text formatter is the default output for ucode audit. Every section is nil-safe so the same renderer covers full OpenType / TrueType faces, Type 1 fonts (no OS/2, no metrics, no layout), and partial reports where the UCD baseline could not be resolved.

ucode deltas vs fontisan's AuditTextRenderer:

  • Reads report.baseline.unicode_version instead of ucd_version.
  • Renders report.scripts (ScriptSummary) as a coverage table.
  • Renders report.blocks (BlockSummary) with explicit status and coverage_percent columns.
  • Adds plane_summaries and discrepancies sections (no fontisan equivalent).
  • Drops CLDR language coverage (out of scope).
  • Honors ENV["NO_COLOR"] via Color.

Constant Summary collapse

SEPARATOR =
"=" * 80
LIST_LIMIT =
10
WIDTH_NAMES =

Map OS/2 width class → human label.

{
  1 => "Ultra-condensed", 2 => "Extra-condensed", 3 => "Condensed",
  4 => "Semi-condensed",  5 => "Medium (normal)", 6 => "Semi-expanded",
  7 => "Expanded",        8 => "Extra-expanded",  9 => "Ultra-expanded"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ AuditText

Returns a new instance of AuditText.

Parameters:



35
36
37
38
39
# File 'lib/ucode/audit/formatters/audit_text.rb', line 35

def initialize(report)
  @report = report
  @lines = []
  @helper = TextFormatter.new
end

Instance Method Details

#renderString

Returns:

  • (String)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ucode/audit/formatters/audit_text.rb', line 42

def render
  render_header
  render_identity
  render_style
  render_metrics
  render_coverage
  render_planes
  render_blocks
  render_scripts
  render_licensing
  render_hinting
  render_color
  render_variation
  render_opentype_layout
  render_discrepancies
  render_warnings
  @lines.join("\n")
end