groff before CVS: release 1.06
[s-roff.git] / include / printer.h
blobe064ab181c4b0783da133b83969658e752fd1c9b
1 // -*- C++ -*-
2 /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.com)
5 This file is part of groff.
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file COPYING. If not, write to the Free Software
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 struct environment {
22 int fontno;
23 int size;
24 int hpos;
25 int vpos;
26 int height;
27 int slant;
30 struct font;
32 struct font_pointer_list {
33 font *p;
34 font_pointer_list *next;
36 font_pointer_list(font *, font_pointer_list *);
39 class printer {
40 public:
41 printer();
42 virtual ~printer();
43 void load_font(int i, const char *name);
44 void set_ascii_char(unsigned char c, const environment *env,
45 int *widthp = 0);
46 void set_special_char(const char *nm, const environment *env,
47 int *widthp = 0);
48 void set_numbered_char(int n, const environment *env, int *widthp = 0);
49 virtual void draw(int code, int *p, int np, const environment *env);
50 virtual void begin_page(int) = 0;
51 virtual void end_page() = 0;
52 virtual font *make_font(const char *nm);
53 virtual void end_of_line();
54 virtual void special(char *arg, const environment *env);
55 protected:
56 font_pointer_list *font_list;
57 private:
58 font **font_table;
59 int nfonts;
60 font *find_font(const char *);
61 virtual void set_char(int index, font *f, const environment *env,
62 int w) = 0;
65 printer *make_printer();