2 /* Copyright (C) 1989-2018 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 3 of the License, or
10 (at your option) any later 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
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 class mark_box : public pointer_box {
26 int compute_metrics(int);
31 // we push down marks so that they don't interfere with spacing
33 box *make_mark_box(box *p)
35 list_box *b = p->to_list_box();
37 b->list.p[0] = make_mark_box(b->list.p[0]);
41 return new mark_box(p);
44 mark_box::mark_box(box *pp) : pointer_box(pp)
48 void mark_box::output()
53 int mark_box::compute_metrics(int style)
55 int res = p->compute_metrics(style);
57 error("multiple marks and lineups");
58 printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid);
59 printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid);
60 printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid);
61 printf(".nr " MARK_REG " 0\n");
65 void mark_box::debug_print()
67 fprintf(stderr, "mark { ");
69 fprintf(stderr, " }");
73 class lineup_box : public pointer_box {
77 int compute_metrics(int style);
81 // we push down lineups so that they don't interfere with spacing
83 box *make_lineup_box(box *p)
85 list_box *b = p->to_list_box();
87 b->list.p[0] = make_lineup_box(b->list.p[0]);
91 return new lineup_box(p);
94 lineup_box::lineup_box(box *pp) : pointer_box(pp)
98 void lineup_box::output()
103 int lineup_box::compute_metrics(int style)
105 int res = p->compute_metrics(style);
107 error("multiple marks and lineups");
108 printf(".nr " WIDTH_FORMAT " 0\\n[" WIDTH_FORMAT "]\n", uid, p->uid);
109 printf(".nr " HEIGHT_FORMAT " \\n[" HEIGHT_FORMAT "]\n", uid, p->uid);
110 printf(".nr " DEPTH_FORMAT " \\n[" DEPTH_FORMAT "]\n", uid, p->uid);
111 printf(".nr " MARK_REG " 0\n");
115 void lineup_box::debug_print()
117 fprintf(stderr, "lineup { ");
119 fprintf(stderr, " }");