Update to groff 1.19.2.
[dragonfly.git] / contrib / groff-1.19 / src / include / printer.h
blobfb39f48965ff48d73bd846f5772f376a14b5395b
1 // -*- C++ -*-
3 // <groff_src_dir>/src/include/printer.h
5 /* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004
6 Free Software Foundation, Inc.
8 Written by James Clark (jjc@jclark.com)
10 Last update: 15 Dec 2004
12 This file is part of groff.
14 groff is free software; you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2, or (at your option)
17 any later version.
19 groff is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with groff; see the file COPYING. If not, write to the Free
26 Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA
27 02110-1301, USA.
30 /* Description
32 The class `printer' performs the postprocessing. Each
33 postprocessor only needs to implement a derived class of `printer' and
34 a suitable function `make_printer' for the device-dependent tasks.
35 Then the methods of class `printer' are called automatically by
36 `do_file()' in `input.cpp'.
39 #include "color.h"
41 struct environment {
42 int fontno;
43 int size;
44 int hpos;
45 int vpos;
46 int height;
47 int slant;
48 color *col;
49 color *fill;
52 class font;
54 struct font_pointer_list {
55 font *p;
56 font_pointer_list *next;
58 font_pointer_list(font *, font_pointer_list *);
61 class printer {
62 public:
63 printer();
64 virtual ~printer();
65 void load_font(int i, const char *name);
66 void set_ascii_char(unsigned char c, const environment *env,
67 int *widthp = 0);
68 void set_special_char(const char *nm, const environment *env,
69 int *widthp = 0);
70 virtual void set_numbered_char(int n, const environment *env,
71 int *widthp = 0);
72 int set_char_and_width(const char *nm, const environment *env,
73 int *widthp, font **f);
74 font *get_font_from_index(int fontno);
75 virtual void draw(int code, int *p, int np, const environment *env);
76 // perform change of line color (text, outline) in the print-out
77 virtual void change_color(const environment * const env);
78 // perform change of fill color in the print-out
79 virtual void change_fill_color(const environment * const env);
80 virtual void begin_page(int) = 0;
81 virtual void end_page(int page_length) = 0;
82 virtual font *make_font(const char *nm);
83 virtual void end_of_line();
84 virtual void special(char *arg, const environment *env,
85 char type = 'p');
86 virtual void devtag(char *arg, const environment *env,
87 char type = 'p');
89 protected:
90 font_pointer_list *font_list;
91 font **font_table;
92 int nfonts;
94 // information about named characters
95 int is_char_named;
96 int is_named_set;
97 char named_command;
98 const char *named_char_s;
99 int named_char_n;
101 private:
102 font *find_font(const char *);
103 virtual void set_char(int index, font *f, const environment *env,
104 int w, const char *name) = 0;
107 printer *make_printer();