Remove no longer needed catman periodic via 'make upgrade'.
[dragonfly.git] / contrib / groff / src / include / printer.h
1 // -*- C++ -*-
2
3 // <groff_src_dir>/src/include/printer.h
4
5 /* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2006,
6                  2009
7    Free Software Foundation, Inc.
8
9    Written by James Clark (jjc@jclark.com)
10
11    Last update: 5 Jan 2009
12
13    This file is part of groff.
14
15    groff is free software; you can redistribute it and/or modify it
16    under the terms of the GNU General Public License as published by
17    the Free Software Foundation, either version 3 of the License, or
18    (at your option) any later version.
19
20    groff is distributed in the hope that it will be useful, but
21    WITHOUT ANY WARRANTY; without even the implied warranty of
22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23    General Public License for more details.
24
25    You should have received a copy of the GNU General Public License
26    along with this program. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29 /* Description
30
31    The class `printer' performs the postprocessing.  Each
32    postprocessor only needs to implement a derived class of `printer' and
33    a suitable function `make_printer' for the device-dependent tasks.
34    Then the methods of class `printer' are called automatically by
35    `do_file()' in `input.cpp'.
36 */
37
38 #include "color.h"
39
40 struct environment {
41   int fontno;
42   int size;
43   int hpos;
44   int vpos;
45   int height;
46   int slant;
47   color *col;
48   color *fill;
49 };
50
51 class font;
52
53 struct font_pointer_list {
54   font *p;
55   font_pointer_list *next;
56
57   font_pointer_list(font *, font_pointer_list *);
58 };
59
60 class printer {
61 public:
62   printer();
63   virtual ~printer();
64   void load_font(int, const char *);
65   void set_ascii_char(unsigned char, const environment *, int * = 0);
66   void set_special_char(const char *, const environment *, int * = 0);
67   virtual void set_numbered_char(int, const environment *, int * = 0);
68   glyph *set_char_and_width(const char *, const environment *,
69                             int *, font **);
70   font *get_font_from_index(int);
71   virtual void draw(int, int *, int, const environment *);
72   // perform change of line color (text, outline) in the print-out 
73   virtual void change_color(const environment * const);
74   // perform change of fill color in the print-out 
75   virtual void change_fill_color(const environment * const);
76   virtual void begin_page(int) = 0;
77   virtual void end_page(int) = 0;
78   virtual font *make_font(const char *);
79   virtual void end_of_line();
80   virtual void special(char *, const environment *, char = 'p');
81   virtual void devtag(char *, const environment *, char = 'p');
82
83 protected:
84   font_pointer_list *font_list;
85   font **font_table;
86   int nfonts;
87
88   // information about named characters
89   int is_char_named;
90   int is_named_set;
91   char named_command;
92   const char *named_char_s;
93   int named_char_n;
94
95 private:
96   font *find_font(const char *);
97   virtual void set_char(glyph *, font *, const environment *, int,
98                         const char *) = 0;
99 };
100
101 printer *make_printer();