From acorn!pcolmer Wed Jul  1 17:56:23 1992
Path: acorn!pcolmer
From: pcolmer@acorn.co.uk (Philip Colmer)
Newsgroups: acorn.technical
Subject: 1st Word+ files and printing them
Message-ID: <16425@acorn.co.uk>
Date: 1 Jul 92 12:32:39 GMT
Sender: pcolmer@acorn.co.uk
Distribution: acorn
Organization: Acorn Computers Ltd, Cambridge, England
Lines: 112

The following is a document I've put together which tries to detail as much
of the 1st Word+ file format that:

 * !Printers understands

 * I can determine by reverse-engineering the !Printers (and !PrinterDP)
   code

Any comments?

--Fil.

1st Word+ text file definition
==============================

 ... as understood by !Printers - an important caveat!

 Apart from the formatting information detailed below, a 1st Word+ file is
plain text, with each line ending in LF, and a paragraph in LF/LF.

 Please note the following points:

 * when creating files to be printed by !Printers, it is advisable that the
   line length is kept below 160 bytes.
 * footnotes should be avoided if possible. The !Printers support of this
   feature is not particularly good, mainly because we don't know the full
   definition of the 1st Word+ file format.
 * do not try and use any other features of the 1st Word+ file format that
   you know about. Only the features documented below are sure to work with
   !Printers.

Escape sequences
----------------

 <&1B><n>       causes style change.
                If <n> is not &C0 then the bits have the following meanings:
                 bit 0 - if set, turn bold on otherwise off
                 bit 1 - if set, turn light on otherwise off
                 bit 2 - if set, turn italic on otherwise off
                 bit 3 - if set, turn underline on otherwise off
                 bit 4 - if set, turn superscript on otherwise off
                 bit 5 - if set, turn subscript on otherwise off
                otherwise, !Printers loops reading the chars one by one. If
                the character read is <ESC><&20> then the loop is ended and
                the system returns to normal processing. Otherwise, the
                characters are sent to the printer one by one unless the
                character is a "|" in which case the next character is
                turned into the appropriate control code (ie |A -> control
                A) except for |? which translates to ASCII 127. This
                facility should NOT be used as the application really
                doesn't know what sort of printer is being used.

 <&0C>          causes a new page to be started.

 <&0B><n>       causes a new page to be started if there are less than n
                lines left on the current page.

 <&1F>"9"       indicates the start of a ruler. A ruler is made up of a
                sequence of characters, with the following characters having
                special meanings (based of their offset from the start of
                the ruler):

                [ specifies the left margin is at this offset
                ] specifies the right margin is at this offset

                The last three characters of the ruler specify the font
                used:

                000     pica
                001     elite
                002     condensed
                003     expanded

 <&1F>"0"       indicates the start of a layout line (MUST be first line).
                This consists of several concatenated digits, abcdefghij:

                ab      specifies the height of the page in lines
                cd+ef   specifies the top margin of the page
                gh+ij   specifies the bottom margin of the page

 <&1F>"N"       indicates the start of a footnote. The next three characters
                are the footnote number. When the next line starts, all the
                text up to the end of footnote sequence is printed out as a
                footnote.

 <&1F>"E"       indicates the end of a footnote

 <&18><n>","<m> indicates that a footnote number should appear in the text.
                The number n is ignored by !Printers. The number m is the
                footnote number.

 <&09>          moves to the next tab position. These are fixed by !Printers
                to be every 8 characters.

 <&19>          causes a hyphen to be output if there is not enough space
                left on the line to continue printing.

 <&08>          causes the "print head" to go back to the previous
                character, thus allowing overprinting.

1st Word+ also defines the following varieties of spaces:

 <&1C>          Stretch space
 <&1D>          Indent space
 <&1E>          Soft space

These are treated identically by !Printers, which is that they get discarded
if the are following by a line or page break, otherwise they are treated
just like ordinary spaces.

------------------------------------------------------------------------------
   Recommended reading: Jurassic Park by Michael Crichton (*not* Richard!)

