Class: Ucode::Glyphs::EmbeddedFonts::TraceRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/ucode/glyphs/embedded_fonts/trace_runner.rb

Overview

Thin I/O wrapper around mutool trace <pdf> <page>.

Runs mutool on the given pages, captures the XML output, delegates parsing to TraceParser, and returns a flat Array<TraceGlyph> across all pages.

The only class in the trace pipeline that touches the filesystem / spawns subprocesses. Everything upstream (parser, correlator) is pure.

Instance Method Summary collapse

Constructor Details

#initialize(pdf_path) ⇒ TraceRunner

Returns a new instance of TraceRunner.

Parameters:

  • pdf_path (Pathname, String)


22
23
24
# File 'lib/ucode/glyphs/embedded_fonts/trace_runner.rb', line 22

def initialize(pdf_path)
  @pdf_path = Pathname.new(pdf_path)
end

Instance Method Details

#trace(page_numbers) ⇒ Array<TraceGlyph>

Parameters:

  • page_numbers (Array<Integer>)

    1-based PDF page numbers

Returns:



28
29
30
# File 'lib/ucode/glyphs/embedded_fonts/trace_runner.rb', line 28

def trace(page_numbers)
  page_numbers.flat_map { |page| trace_page(page) }
end