diff options
author | wlemb <wlemb> | 2003-10-27 08:10:56 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2003-10-27 08:10:56 +0000 |
commit | 1b6b1ae675b4df397807631699464f3fa77a9727 (patch) | |
tree | de6b1f45eac38e007f6e064a65e99fc704850fe0 /src/preproc/pic | |
parent | 0d9c97fbaff9fbf2ea216951b9608ad5e8859c18 (diff) | |
download | groff-1b6b1ae675b4df397807631699464f3fa77a9727.tar.gz |
* src/preproc/pic/troff.cpp (troff_output::simple_circle,
troff_output::simple_ellipse, troff_output::simple_arc,
troff_output::simple_line, troff_output::simple_spline,
troff_output::simple_polygon): Insert a space before arguments.
(troff_output::set_fill): Emit `\&' before `\D'Fg...' since the
latter doesn't produce a node, so the following `.sp -1' would do
the wrong thing.
Don't emit `.sp -1' after \M. This also doesn't produce a token
(and we don't have to care about compatibility mode).
(troff_output::set_color, troff_output::reset_color): Don't emit
`.sp -1' after \M and \m.
* src/roff/troff/input.cpp (old_have_input): New global variable.
(input_stack::get): Handle `old_have_input'.
(process_input_stack) <token::TOKEN_NEWLINE>: Call
`trapping_blank_line' depending on `old_have_input', not
`have_input'.
Diffstat (limited to 'src/preproc/pic')
-rw-r--r-- | src/preproc/pic/troff.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/preproc/pic/troff.cpp b/src/preproc/pic/troff.cpp index ddda45db..22bf897d 100644 --- a/src/preproc/pic/troff.cpp +++ b/src/preproc/pic/troff.cpp @@ -324,7 +324,7 @@ void troff_output::simple_circle(int filled, const position ¢, double rad) position c = transform(cent); printf("\\h'%.3fi'" "\\v'%.3fi'" - "\\D'%c%.3fi'" + "\\D'%c %.3fi'" "\n.sp -1\n", c.x - rad/scale, c.y, @@ -338,7 +338,7 @@ void troff_output::simple_ellipse(int filled, const position ¢, position c = transform(cent); printf("\\h'%.3fi'" "\\v'%.3fi'" - "\\D'%c%.3fi %.3fi'" + "\\D'%c %.3fi %.3fi'" "\n.sp -1\n", c.x - dim.x/(2.0*scale), c.y, @@ -355,7 +355,7 @@ void troff_output::simple_arc(const position &start, const distance ¢, distance ev = transform(end) - c; printf("\\h'%.3fi'" "\\v'%.3fi'" - "\\D'a%.3fi %.3fi %.3fi %.3fi'" + "\\D'a %.3fi %.3fi %.3fi %.3fi'" "\n.sp -1\n", s.x, s.y, cv.x, cv.y, ev.x, ev.y); } @@ -366,7 +366,7 @@ void troff_output::simple_line(const position &start, const position &end) distance ev = transform(end) - s; printf("\\h'%.3fi'" "\\v'%.3fi'" - "\\D'l%.3fi %.3fi'" + "\\D'l %.3fi %.3fi'" "\n.sp -1\n", s.x, s.y, ev.x, ev.y); } @@ -378,7 +378,7 @@ void troff_output::simple_spline(const position &start, printf("\\h'%.3fi'" "\\v'%.3fi'", pos.x, pos.y); - fputs("\\D'~", stdout); + fputs("\\D'~ ", stdout); for (int i = 0; i < n; i++) { position temp = transform(v[i]); distance d = temp - pos; @@ -398,7 +398,7 @@ void troff_output::simple_polygon(int filled, const position *v, int n) printf("\\h'%.3fi'" "\\v'%.3fi'", pos.x, pos.y); - printf("\\D'%c", (filled ? 'P' : 'p')); + printf("\\D'%c ", (filled ? 'P' : 'p')); for (int i = 1; i < n; i++) { position temp = transform(v[i]); distance d = temp - pos; @@ -480,13 +480,15 @@ void troff_output::line_thickness(double p) void troff_output::set_fill(double f) { if (driver_extension_flag && f != last_fill) { - printf("\\D'Fg %.3f'\n.sp -1\n", 1.0 - f); + // \D'Fg ...' emits a node only in compatibility mode, + // thus we add a dummy node + printf("\\&\\D'Fg %.3f'\n.sp -1\n", 1.0 - f); last_fill = f; } if (last_filled) { free(last_filled); last_filled = 0; - printf("\\M[]\n.sp -1\n"); + printf("\\M[]\n"); } } @@ -496,12 +498,14 @@ void troff_output::set_color(char *color_fill, char *color_outlined) if (last_filled || last_outlined) { reset_color(); } + // \m and \M emit a node in compatibility mode only, + // but that won't work anyway if (color_fill) { - printf("\\M[%s]\n.sp -1\n", color_fill); + printf("\\M[%s]\n", color_fill); last_filled = strsave(color_fill); } if (color_outlined) { - printf("\\m[%s]\n.sp -1\n", color_outlined); + printf("\\m[%s]\n", color_outlined); last_outlined = strsave(color_outlined); } } @@ -511,12 +515,12 @@ void troff_output::reset_color() { if (driver_extension_flag) { if (last_filled) { - printf("\\M[]\n.sp -1\n"); + printf("\\M[]\n"); a_delete last_filled; last_filled = 0; } if (last_outlined) { - printf("\\m[]\n.sp -1\n"); + printf("\\m[]\n"); a_delete last_outlined; last_outlined = 0; } |