Adapt src/pre-html (src/preproc/html)
[s-roff.git] / include / printer.h
blob92d37e0b8d3bac69a2a219866ce63ca61b5e4114
1 /*@ The class `printer' performs the postprocessing. Each postprocessor only
2 *@ needs to implement a derived class of `printer' and a suitable function
3 *@ `make_printer' for the device-dependent tasks. Then the methods of class
4 *@ `printer' are called automatically by `do_file()' in `input.cpp'.
6 * Copyright (c) 2014 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
8 * Copyright (C) 1989 - 1992, 2001 - 2004, 2006
9 * Free Software Foundation, Inc.
11 * Written by James Clark (jjc@jclark.com)
13 * groff is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
18 * groff is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with groff; see the file COPYING. If not, write to the Free
25 * Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA
26 * 02110-1301, USA.
28 #ifndef _PRINTER_H
29 #define _PRINTER_H
31 #include "config.h"
33 #include "color.h"
35 struct environment {
36 int fontno;
37 int size;
38 int hpos;
39 int vpos;
40 int height;
41 int slant;
42 color *col;
43 color *fill;
46 class font;
48 class font_pointer_list
50 public:
51 font *p;
52 font_pointer_list *next;
54 font_pointer_list(font *, font_pointer_list *);
57 class printer
59 public:
60 printer();
61 virtual ~printer();
62 void load_font(int, const char *);
63 void set_ascii_char(unsigned char, const environment *, int * = 0);
64 void set_special_char(const char *, const environment *, int * = 0);
65 virtual void set_numbered_char(int, const environment *, int * = 0);
66 glyph *set_char_and_width(const char *, const environment *,
67 int *, font **);
68 font *get_font_from_index(int);
69 virtual void draw(int, int *, int, const environment *);
70 // perform change of line color (text, outline) in the print-out
71 virtual void change_color(const environment * const);
72 // perform change of fill color in the print-out
73 virtual void change_fill_color(const environment * const);
74 virtual void begin_page(int) = 0;
75 virtual void end_page(int) = 0;
76 virtual font *make_font(const char *);
77 virtual void end_of_line();
78 virtual void special(char *, const environment *, char = 'p');
79 virtual void devtag(char *, const environment *, char = 'p');
81 protected:
82 font_pointer_list *font_list;
83 font **font_table;
84 int nfonts;
86 // information about named characters
87 int is_char_named;
88 int is_named_set;
89 char named_command;
90 const char *named_char_s;
91 int named_char_n;
93 private:
94 font *find_font(const char *);
95 virtual void set_char(glyph *, font *, const environment *, int,
96 const char *) = 0;
99 printer *make_printer();
101 #endif // _PRINTER_H
102 // s-it2-mode