summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2002-10-26 12:26:12 +0000
committerwlemb <wlemb>2002-10-26 12:26:12 +0000
commitf07ab9d46fd6ecdc561b3b700f40f4020b6c2bbd (patch)
treeaa57f909175e96b5b6fc17550e59efde57dbb131
parent1ce342d083dd738e46cc7ead8923c57dcabfc76b (diff)
downloadgroff-f07ab9d46fd6ecdc561b3b700f40f4020b6c2bbd.tar.gz
* tmac/an-old.tmac (SH, SS, TP, IP, HP, TS): Protect .sp with .br
so that it survives the implicit new-page trap. * src/roff/troff/node.cc: Fix the changes from 2002-10-23. (troff_output_file::set_font): Call flush_tbuf if necessary. (troff_output_file::fill_color, troff_output_file::glyph_color): Call flush_tbuf and do_motion only if necessary. (troff_output_file::start_special, troff_output_file::put_char_width, troff_output_file::put_char, troff_output_file::draw): Updated. (word_space_node::tprint, space_node::tprint, hmotion_node::tprint, vmotion_node::tprint): Undo change 2002-10-23.
-rw-r--r--ChangeLog15
-rw-r--r--src/roff/troff/node.cc55
-rw-r--r--tmac/an-old.tmac6
3 files changed, 55 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index b09f8225..515123a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2002-10-26 Werner LEMBERG <wl@gnu.org>
+
+ * tmac/an-old.tmac (SH, SS, TP, IP, HP, TS): Protect .sp with .br
+ so that it survives the implicit new-page trap.
+
+ * src/roff/troff/node.cc: Fix the changes from 2002-10-23.
+ (troff_output_file::set_font): Call flush_tbuf if necessary.
+ (troff_output_file::fill_color, troff_output_file::glyph_color): Call
+ flush_tbuf and do_motion only if necessary.
+ (troff_output_file::start_special,
+ troff_output_file::put_char_width, troff_output_file::put_char,
+ troff_output_file::draw): Updated.
+ (word_space_node::tprint, space_node::tprint, hmotion_node::tprint,
+ vmotion_node::tprint): Undo change 2002-10-23.
+
2002-10-25 Werner LEMBERG <wl@gnu.org>
* tmac/www.tmac (DC): Fix case of overlapping images.
diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc
index 25519777..af10122b 100644
--- a/src/roff/troff/node.cc
+++ b/src/roff/troff/node.cc
@@ -822,12 +822,11 @@ inline void troff_output_file::put(unsigned int i)
void troff_output_file::start_special(tfont *tf, color *gcol, color *fcol,
int no_init_string)
{
- flush_tbuf();
- do_motion();
- if (tf != current_tfont)
- set_font(tf);
+ set_font(tf);
glyph_color(gcol);
fill_color(fcol);
+ flush_tbuf();
+ do_motion();
if (!no_init_string)
put("x X ");
}
@@ -984,14 +983,13 @@ void troff_output_file::put_char_width(charinfo *ci, tfont *tf,
hpos += w.to_units() + kk;
return;
}
- if (tf != current_tfont) {
- flush_tbuf();
- set_font(tf);
- }
+ set_font(tf);
char c = ci->get_ascii_code();
if (c == '\0') {
glyph_color(gcol);
fill_color(fcol);
+ flush_tbuf();
+ do_motion();
check_charinfo(tf, ci);
if (ci->numbered()) {
put('N');
@@ -1024,6 +1022,8 @@ void troff_output_file::put_char_width(charinfo *ci, tfont *tf,
}
glyph_color(gcol);
fill_color(fcol);
+ flush_tbuf();
+ do_motion();
check_charinfo(tf, ci);
tbuf[tbuf_len++] = c;
output_hpos += w.to_units() + kk;
@@ -1056,15 +1056,17 @@ void troff_output_file::put_char_width(charinfo *ci, tfont *tf,
void troff_output_file::put_char(charinfo *ci, tfont *tf,
color *gcol, color *fcol)
{
- flush_tbuf();
- if (!is_on())
+ if (!is_on()) {
+ flush_tbuf();
return;
- if (tf != current_tfont)
- set_font(tf);
+ }
+ set_font(tf);
char c = ci->get_ascii_code();
if (c == '\0') {
glyph_color(gcol);
fill_color(fcol);
+ flush_tbuf();
+ do_motion();
if (ci->numbered()) {
put('N');
put(ci->get_number());
@@ -1095,16 +1097,21 @@ void troff_output_file::put_char(charinfo *ci, tfont *tf,
else {
glyph_color(gcol);
fill_color(fcol);
+ flush_tbuf();
+ do_motion();
put('c');
put(c);
}
}
}
+// set_font calls `flush_tbuf' if necessary.
+
void troff_output_file::set_font(tfont *tf)
{
if (current_tfont == tf)
return;
+ flush_tbuf();
int n = tf->get_input_position();
symbol nm = tf->get_name();
if (n >= nfont_positions || font_position[n] != nm) {
@@ -1157,15 +1164,17 @@ void troff_output_file::set_font(tfont *tf)
current_tfont = tf;
}
+// fill_color calls `flush_tbuf' and `do_motion' if necessary.
+
void troff_output_file::fill_color(color *col)
{
- flush_tbuf();
- do_motion();
if (!col || current_fill_color == col)
return;
current_fill_color = col;
if (!color_flag)
return;
+ flush_tbuf();
+ do_motion();
put("DF");
unsigned int components[4];
color_scheme cs;
@@ -1208,16 +1217,18 @@ void troff_output_file::fill_color(color *col)
put('\n');
}
+// glyph_color calls `flush_tbuf' and `do_motion' if necessary.
+
void troff_output_file::glyph_color(color *col)
{
- flush_tbuf();
- // grotty doesn't like a color command if the vertical position is zero.
- do_motion();
if (!col || current_glyph_color == col)
return;
current_glyph_color = col;
if (!color_flag)
return;
+ flush_tbuf();
+ // grotty doesn't like a color command if the vertical position is zero.
+ do_motion();
put("m");
unsigned int components[4];
color_scheme cs;
@@ -1353,6 +1364,8 @@ void troff_output_file::draw(char code, hvpair *point, int npoints,
int i;
glyph_color(gcol);
fill_color(fcol);
+ flush_tbuf();
+ do_motion();
if (is_on()) {
int size = fsize.to_scaled_points();
if (current_size != size) {
@@ -4018,9 +4031,9 @@ int word_space_node::set_unformat_flag()
void word_space_node::tprint(troff_output_file *out)
{
+ out->fill_color(col);
out->word_marker();
out->right(n);
- out->fill_color(col);
}
int word_space_node::merge_space(hunits h, hunits sw, hunits ssw)
@@ -4374,20 +4387,20 @@ void node::zero_width_tprint(troff_output_file *out)
void space_node::tprint(troff_output_file *out)
{
- out->right(n);
out->fill_color(col);
+ out->right(n);
}
void hmotion_node::tprint(troff_output_file *out)
{
- out->right(n);
out->fill_color(col);
+ out->right(n);
}
void vmotion_node::tprint(troff_output_file *out)
{
- out->down(n);
out->fill_color(col);
+ out->down(n);
}
void kern_pair_node::tprint(troff_output_file *out)
diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index 3cee9074..3958c36d 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -264,6 +264,7 @@
.if \n[cR] .em an-end
.
.de1 SH
+. br
. sp \\n[PD]u
. nr an-level 1
. set-an-margin
@@ -282,6 +283,7 @@
..
.
.de1 SS
+. br
. sp \\n[PD]u
. nr an-level 1
. set-an-margin
@@ -324,6 +326,7 @@
..
.
.de1 TP
+. br
. sp \\n[PD]u
. if \\n[.$] .nr an-prevailing-indent (n;\\$1)
. it 1 an-trap
@@ -408,6 +411,7 @@
. ps \\n[PS]u
. vs \\n[VS]u
. ft R
+. br
. sp \\n[PD]u
. ne (1v + 1u)
. in (\\n[an-margin]u + \\n[an-prevailing-indent]u)
@@ -423,6 +427,7 @@
. ps \\n[PS]u
. vs \\n[VS]u
. ft R
+. br
. sp \\n[PD]u
. ne (1v + 1u)
. if \\n[.$] .nr an-prevailing-indent (n;\\$1)
@@ -532,6 +537,7 @@
.\" table support
.
.de1 TS
+. br
. sp \\n[PD]u
. HTML-IMAGE
..