1 This is enscript.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION Utilities
6 * Enscript: (enscript). GNU Enscript
9 This file documents GNU enscript 1.6.4
11 Copyright (C) 1995-1999 Markku Rossi.
13 Permission is granted to make and distribute verbatim copies of this
14 manual provided the copyright notice and this permission notice are
15 preserved on all copies.
17 Permission is granted to copy and distribute modified versions of
18 this manual under the conditions for verbatim copying, provided that
19 the entire resulting derived work is distributed under the terms of a
20 permission notice identical to this one.
22 Permission is granted to copy and distribute translations of this
23 manual into another language, under the above conditions for modified
24 versions, except that this permission notice may be stated in a
25 translation approved by the Foundation.
28 File: enscript.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
33 This file documents the GNU enscript program. This edition documents
42 * Configuration Files::
44 * The states Program::
45 * Writing New Highlighting Definitions::
49 File: enscript.info, Node: Introduction, Next: Invoking Enscript, Prev: Top, Up: Top
59 File: enscript.info, Node: Invoking Enscript, Next: Basic Printing, Prev: Introduction, Up: Top
65 File: enscript.info, Node: Basic Printing, Next: Advanced Usage, Prev: Invoking Enscript, Up: Top
79 File: enscript.info, Node: Input Encodings, Next: Selecting Fonts, Prev: Basic Printing, Up: Basic Printing
85 File: enscript.info, Node: Selecting Fonts, Next: Page Headers, Prev: Input Encodings, Up: Basic Printing
91 File: enscript.info, Node: Page Headers, Next: Page Handling, Prev: Selecting Fonts, Up: Basic Printing
97 File: enscript.info, Node: Page Handling, Next: Highlighting, Prev: Page Headers, Up: Basic Printing
106 * Fitting Text to Page::
109 File: enscript.info, Node: Page Orientation, Next: N-up Printing, Prev: Page Handling, Up: Page Handling
115 File: enscript.info, Node: N-up Printing, Next: Fitting Text to Page, Prev: Page Orientation, Up: Page Handling
121 File: enscript.info, Node: Fitting Text to Page, Prev: N-up Printing, Up: Page Handling
127 File: enscript.info, Node: Highlighting, Prev: Page Handling, Up: Basic Printing
134 * Different Output Languages::
137 File: enscript.info, Node: Different Output Languages, Prev: Highlighting, Up: Highlighting
139 Different Output Languages
140 --------------------------
143 File: enscript.info, Node: Advanced Usage, Next: Configuration Files, Prev: Basic Printing, Up: Top
154 * PostScript Printer Controlling::
155 * Pass-Through Mode::
158 File: enscript.info, Node: Selecting Pages, Next: Escape Sequences, Prev: Advanced Usage, Up: Advanced Usage
164 File: enscript.info, Node: Escape Sequences, Next: Input Filters, Prev: Selecting Pages, Up: Advanced Usage
170 File: enscript.info, Node: Input Filters, Next: Slice Printing, Prev: Escape Sequences, Up: Advanced Usage
176 File: enscript.info, Node: Slice Printing, Next: PostScript Printer Controlling, Prev: Input Filters, Up: Advanced Usage
182 File: enscript.info, Node: PostScript Printer Controlling, Next: Pass-Through Mode, Prev: Slice Printing, Up: Advanced Usage
184 PostScript Printer Controlling
185 ==============================
188 File: enscript.info, Node: Pass-Through Mode, Prev: PostScript Printer Controlling, Up: Advanced Usage
194 File: enscript.info, Node: Configuration Files, Next: Customization, Prev: Advanced Usage, Up: Top
200 File: enscript.info, Node: Customization, Next: The states Program, Prev: Configuration Files, Up: Top
208 * User-Defined Fancy Headers::
211 File: enscript.info, Node: Output Media, Next: User-Defined Fancy Headers, Prev: Customization, Up: Customization
217 File: enscript.info, Node: User-Defined Fancy Headers, Prev: Output Media, Up: Customization
219 User-Defined Fancy Headers
220 ==========================
223 File: enscript.info, Node: The states Program, Next: Writing New Highlighting Definitions, Prev: Customization, Up: Top
229 File: enscript.info, Node: Writing New Highlighting Definitions, Next: Index, Prev: The states Program, Up: Top
231 Writing New Highlighting Definitions
232 ************************************
234 The highlighting works in three separate phases. First, the
235 "highlighing rules" process the input stream and parse it into logical
236 components. The components are called "faces". A face presents one
237 logical component of the input language, for example, a keyword, a
238 comment, etc.. The enscript's highlighting model defines the following
244 Hard-coded faces for the bold, italic, and bold-italice text types.
245 These faces define the exact presentation of the face font, so the
246 style files have very little power in customizing their outlook.
247 These faces should be avoided as much as possible.
250 A comment, normally in a programming language.
253 A function name. The function names are normally recognized from
254 function definitions, not from an use of the function.
257 A variable name. The variable names are normally recognized from
258 function, type, and variable definitions.
261 A reserved keyword. Normally, all occurrences of the keywords are
265 A reference to another location in a file or to another file or
266 resource. For example, in the C-language, the goto targets are
273 A builtin function or property. Normally, all occurrences of the
274 builtins are recognized.
277 A type specifier. The types are normally recognized from function,
278 type, and variable definitions.
280 As the second step, the "output style" specifies how the faces are
281 presented in the generated output. Each face has the following
285 The PostScript font name of the the font that is used for the face.
286 This property is used only for the PostScript outputs.
289 A boolean flag which tells whether the face should be printed in
290 bold font. This property is used for all output languages except
291 for the PostScript which uses the fontname property.
294 A boolean flag which tells whether the face shuold be printed with
295 italic font. This property is used for all output languages
296 except for the PostScript which uses the fontname property.
299 The foreground color of the face.
302 The background color of the face. This property is not
303 implemented on all output languages.
305 Finally, the "output language" describes how the faces and other
306 text are presented in the output language. The output language defines
307 a set of functions which are called to generate the output.
311 * Highlighting Rules::
316 File: enscript.info, Node: Highlighting Rules, Next: Styles, Prev: Writing New Highlighting Definitions, Up: Writing New Highlighting Definitions
322 File: enscript.info, Node: Styles, Next: Output Languages, Prev: Highlighting Rules, Up: Writing New Highlighting Definitions
328 File: enscript.info, Node: Output Languages, Prev: Styles, Up: Writing New Highlighting Definitions
333 - Function: map_color (r, g, b)
335 - Function: language_print (string)
337 - Function: language_symbol (symbol)
339 - Function: header ()
341 - Function: trailer ()
343 - Function: face_on (face)
345 - Function: face_off (face)
347 - Variable: LANGUAGE_SPECIALS
349 The following example creates a new output language `simple_html'
350 that creates simple HTML outputs. The output language is defined in a
351 file called `lang_simple_html.st'. The file must define a state called
352 `lang_simple_html'. The file can be located in any directory that is
353 in the load path of the states program.
355 The output language definitions are defined in the `BEGIN' block of
356 the `lang_simple_html' state. Please, note that the `BEGIN' block is
357 ended with a `return'-statement. This statement will return the
358 control to the calling state that is the start state of the enscript
359 highlight program. If the `return'-statement was omitted, the states
360 would start processing the input with the `lang_simple_html' state
361 which is obviously a wrong choice.
363 state lang_simple_html
366 sub map_color (r, g, b)
368 return sprintf ("#%02X%02X%02X", r, g, b);
371 sub language_print (str)
373 str = regsuball (str, /\&/, "&");
374 str = regsuball (str, /</, "<");
375 str = regsuball (str, />/, ">");
376 str = regsuball (str, /\"/, """);
380 sub language_symbol (symbol)
387 print ("<html>\n<head>\n<title>Simple HTML Output</title>\n");
388 print ("</head>\n<body>\n");
393 print ("</body>\n</html>\n");
403 print ("<FONT COLOR=\", face[fg_color], "\">");
416 LANGUAGE_SPECIALS = /[<>\&\"]/;
423 File: enscript.info, Node: Index, Prev: Writing New Highlighting Definitions, Up: Top
430 * face_off: Output Languages.
431 * face_on: Output Languages.
432 * header: Output Languages.
433 * language_print: Output Languages.
434 * LANGUAGE_SPECIALS: Output Languages.
435 * language_symbol: Output Languages.
436 * map_color: Output Languages.
437 * trailer: Output Languages.
443 Node: Introduction
\7f1333
444 Node: Invoking Enscript
\7f1479
445 Node: Basic Printing
\7f1619
446 Node: Input Encodings
\7f1857
447 Node: Selecting Fonts
\7f2005
448 Node: Page Headers
\7f2151
449 Node: Page Handling
\7f2289
450 Node: Page Orientation
\7f2500
451 Node: N-up Printing
\7f2647
452 Node: Fitting Text to Page
\7f2795
453 Node: Highlighting
\7f2932
454 Node: Different Output Languages
\7f3087
455 Node: Advanced Usage
\7f3240
456 Node: Selecting Pages
\7f3523
457 Node: Escape Sequences
\7f3672
458 Node: Input Filters
\7f3822
459 Node: Slice Printing
\7f3965
460 Node: PostScript Printer Controlling
\7f4124
461 Node: Pass-Through Mode
\7f4319
462 Node: Configuration Files
\7f4465
463 Node: Customization
\7f4612
464 Node: Output Media
\7f4809
465 Node: User-Defined Fancy Headers
\7f4957
466 Node: The states Program
\7f5111
467 Node: Writing New Highlighting Definitions
\7f5281
468 Node: Highlighting Rules
\7f8119
470 Node: Output Languages
\7f8459