enscript: Writing New Highlighting Definitions
8 Writing New Highlighting Definitions
The highlighting works in three separate phases. First, the
"highlighing rules" process the input stream and parse it into logical
components. The components are called "faces". A face presents one
logical component of the input language, for example, a keyword, a
comment, etc.. The enscript's highlighting model defines the following
Hard-coded faces for the bold, italic, and bold-italice text types.
These faces define the exact presentation of the face font, so the
style files have very little power in customizing their outlook.
These faces should be avoided as much as possible.
A comment, normally in a programming language.
A function name. The function names are normally recognized from
function definitions, not from an use of the function.
A variable name. The variable names are normally recognized from
function, type, and variable definitions.
A reserved keyword. Normally, all occurrences of the keywords are
A reference to another location in a file or to another file or
resource. For example, in the C-language, the goto targets are
A string literal.
A builtin function or property. Normally, all occurrences of the
builtins are recognized.
A type specifier. The types are normally recognized from function,
type, and variable definitions.
As the second step, the "output style" specifies how the faces are
presented in the generated output. Each face has the following
The PostScript font name of the the font that is used for the face.
This property is used only for the PostScript outputs.
A boolean flag which tells whether the face should be printed in
bold font. This property is used for all output languages except
for the PostScript which uses the fontname property.
A boolean flag which tells whether the face shuold be printed with
italic font. This property is used for all output languages
except for the PostScript which uses the fontname property.
The foreground color of the face.
The background color of the face. This property is not
implemented on all output languages.
Finally, the "output language" describes how the faces and other
text are presented in the output language. The output language defines
a set of functions which are called to generate the output.