The Xerox Metacode format is fed directly to Xerox Enterprise Printing Systems (EPS) for large volumn print jobs. The format is unpublished and this module only handles part of the decoding task. You will have to continue the reverse engineering effort if you want to get positional or drawing characters to appear.

The output from this function should be further massaged into whatever format is convenient for you.

Pass in a scalar reference to the binary Metacode record, the current offset into the Metacode file and a fonts array. The file position is used for error reporting in case any problems show up. The fonts array is used for when DJDE records set the current operational fonts so further translate_record() calls can use the font names.

The output consists of a single string. Internally each metacode command is ended by a single newline. Each record is also further ended by another newline. I used this non-traditional format to avoid costs associated with array allocation. The most natural format for this would have been to return a single array for the entire file where each element is an array ref for each metacode record. So... It's a comprimise. The newline character itself is not valid text so there is no concern about embedded newlines altering the parse.

A metacode file is separated into a series of contiguous records. Each record consists of a two byte length value and the remainder is Metacode. The first part of the Metacode is typically a font setting (to zero) and then a control character. This can be ignored for most work. The following string demonstrates the record format. Note that the two byte length value includes itself so a record with length 3 is likely to simply be "\00\03\01".

The actual printer codes aren't fully understood yet though if you need more detail just examine this module's source code.