Class: Ucode::Glyphs::EmbeddedFonts::TraceRunner
- Inherits:
-
Object
- Object
- Ucode::Glyphs::EmbeddedFonts::TraceRunner
- Defined in:
- lib/ucode/glyphs/embedded_fonts/trace_runner.rb
Overview
Thin I/O wrapper around mutool trace <pdf> <page>.
Delegates the actual subprocess to Mutool::Trace and the XML parsing to TraceParser. Kept for backward compatibility with callers that pre-date the Mutool seam.
Instance Method Summary collapse
-
#initialize(pdf_path, mutool: Mutool::Trace.new) ⇒ TraceRunner
constructor
A new instance of TraceRunner.
- #trace(page_numbers) ⇒ Array<TraceGlyph>
Constructor Details
#initialize(pdf_path, mutool: Mutool::Trace.new) ⇒ TraceRunner
Returns a new instance of TraceRunner.
19 20 21 22 |
# File 'lib/ucode/glyphs/embedded_fonts/trace_runner.rb', line 19 def initialize(pdf_path, mutool: Mutool::Trace.new) @pdf_path = Pathname.new(pdf_path) @mutool = mutool end |
Instance Method Details
#trace(page_numbers) ⇒ Array<TraceGlyph>
26 27 28 29 30 31 32 33 |
# File 'lib/ucode/glyphs/embedded_fonts/trace_runner.rb', line 26 def trace(page_numbers) return [] if page_numbers.empty? page_numbers.flat_map do |page| xml = @mutool.call(@pdf_path, page) TraceParser.parse(xml) end end |