Previous: , Up: Designing PostScript Prologues   [Contents][Index]


8.6.3 A step by step example

We strongly suggest our readers not to start from scratch, but to copy one of the available styles (see the result of ‘a2ps --list=prologues’), to drop it in one of a2ps directories (say ‘$HOME/.a2ps’, and to patch it until you like it.

Here, we will start from color.pro, trying to give it a funky look.

Say you want the keywords to be in Helvetica, drawn in a flashy pink on a light green. And strong keywords, in Times Bold Italic in brown on a soft Hawaiian sea green (you are definitely a fine art amateur).

Then you need to look for ‘k’ and ‘K’:

/k {
  false BG
  0 0 0.9 FG
%Face: Keyword Courier bfs
  Show
} bind def

/K {
  false BG
  0 0 0.8 FG
%Face: Keyword_strong Courier-Bold bfs
  Show
} bind def

and turn it into:

/k {
  0.2 1 0.2 true BG
  1 0.2 1 FG
%Face: Keyword Helvetica bfs
  Show
} bind def

/K {
  0.4 0.2 0 true BG
  0.5 1 1 FG
%Face: Keyword_strong Times-BoldItalic bfs
  Show
} bind def

Waouh! It looks great!

A bit trickier: let change the way the line numbers are printed.

First, let’s look for the font definition:

%%BeginSetup
% The font for line numbering
/f# /Helvetica findfont bfs .6 mul scalefont def
%%EndSetup

Let it be in Times, twice bigger than the body font.

%%BeginSetup
% The font for line numbering
/f# /Times-Roman findfont bfs 2 mul scalefont def
%%EndSetup

How about its foreground color?

% Function print line number (<string> # -)
/# {
  gsave
    sx cw mul 2 div neg 0 rmoveto
    f# setfont
    0.8 0.1 0.1 FG
    c-show
  grestore
} bind def

Let it be blue. Now you know the process: just put ‘0 0 1’ as FG arguments.


Previous: Prologue File Format, Up: Designing PostScript Prologues   [Contents][Index]