(Full code at https://github.com/dahosek/gftopdf2).
I’ve written a first pass of a small library for reading the GF files output by Metafont. What I’m not too crazy about is that for the 11 distinct opcode types that I interpret, each of them is passed
&mut ctx for the context struct that keeps track of what’s been read so far as well as the
Read source of the data, plus, I have to pass
&mut ctx.input to the specialized readers for reading the arguments to opcodes. I’m thinking there’s got to be a way to reduce the overall verbosity of what I’m writing. I’m also not crazy about code like
let d = read2(&mut ctx.input)?; paint(d, &mut ctx)?;
and I’m wondering if there’s a better way to handle this.