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