From a3263aead0b35bb7bd6f376d8bc0597f89654844 Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Wed, 18 Oct 2000 23:02:20 +0000 Subject: [PATCH] * src/roff/troff/node.cc: Fixed calculation of opminx and fixed non-intrusive eol marker. (troff_output_file::determine_line_limits): New function. (troff_output_file::draw): Use it. * src/roff/troff/env.cc (environment::add_html_tag): Use output() + output_pending_lines() instead of output_line(). * src/preproc/eqn/main.cc (do_file): Fix graphic_end(). * src/preproc/html2/pre-html.cc (char_buffer::write_file_troff, createImage): Small fixes. --- ChangeLog | 12 ++++++++++ src/preproc/eqn/main.cc | 2 +- src/preproc/html2/pre-html.cc | 13 ++++++----- src/roff/troff/env.cc | 5 +++-- src/roff/troff/node.cc | 51 ++++++++++++++++++++++++++++++++++++------- 5 files changed, 67 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43574eb5..bab5051e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-10-17 Gaius Mulley + + * src/roff/troff/node.cc: Fixed calculation of opminx and fixed + non-intrusive eol marker. + (troff_output_file::determine_line_limits): New function. + (troff_output_file::draw): Use it. + * src/roff/troff/env.cc (environment::add_html_tag): Use output() + + output_pending_lines() instead of output_line(). + * src/preproc/eqn/main.cc (do_file): Fix graphic_end(). + * src/preproc/html2/pre-html.cc (char_buffer::write_file_troff, + createImage): Small fixes. + 2000-10-14 Werner LEMBERG Replace tmac.safer with a real secure solution. diff --git a/src/preproc/eqn/main.cc b/src/preproc/eqn/main.cc index c0f40206..c51bcfa8 100644 --- a/src/preproc/eqn/main.cc +++ b/src/preproc/eqn/main.cc @@ -110,8 +110,8 @@ void do_file(FILE *fp, const char *filename) } restore_compatibility(); printf(".lf %d\n", current_lineno); - graphic_end(); put_string(linebuf, stdout); + graphic_end(); } else if (start_delim != '\0' && linebuf.search(start_delim) >= 0 && inline_equation(fp, linebuf, str)) diff --git a/src/preproc/html2/pre-html.cc b/src/preproc/html2/pre-html.cc index 872e7270..79943e4a 100755 --- a/src/preproc/html2/pre-html.cc +++ b/src/preproc/html2/pre-html.cc @@ -267,7 +267,7 @@ void char_buffer::write_file_troff (void) char_block *t=head; int r; - writeString(".nr html2enable 1\n"); + writeString(".nr html2enable 0\n"); writeString(".nr htmlflip 0\n"); if (t != 0) { do { @@ -383,14 +383,17 @@ static void createImage (imageItem *i) image_device, image_res, psFileName, - i->X1*image_res/POSTSCRIPTRES, + i->X1*image_res/POSTSCRIPTRES-IMAGE_BOARDER_PIXELS, i->Y1*image_res/POSTSCRIPTRES-IMAGE_BOARDER_PIXELS, - (i->X2-i->X1)*image_res/POSTSCRIPTRES+IMAGE_BOARDER_PIXELS, - (i->Y2-i->Y1)*image_res/POSTSCRIPTRES+IMAGE_BOARDER_PIXELS, + (i->X2-i->X1)*image_res/POSTSCRIPTRES+2*IMAGE_BOARDER_PIXELS, + (i->Y2-i->Y1)*image_res/POSTSCRIPTRES+2*IMAGE_BOARDER_PIXELS, TRANSPARENT, i->imageName); - fprintf(stderr, buffer); + // fprintf(stderr, buffer); system(buffer); + } else { + fprintf(stderr, "ignoring image as x1 coord is -1\n"); + fflush(stderr); } } diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc index b5e1ed74..cd5c45c9 100644 --- a/src/roff/troff/env.cc +++ b/src/roff/troff/env.cc @@ -1946,8 +1946,9 @@ void environment::add_html_tag (const char *name) if (!illegal_input_char((unsigned char)*p)) m->append(*p); output_pending_lines(); - output_line(new special_node(*m), 0); - } + output(new special_node(*m), !fill, 0, 0, 0); + output_pending_lines(); + } } void environment::do_break() diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc index 3c0d936e..a114a40e 100644 --- a/src/roff/troff/node.cc +++ b/src/roff/troff/node.cc @@ -752,6 +752,7 @@ public: void really_on(); void really_off(); void draw(char, hvpair *, int, font_size); + void determine_line_limits (char code, hvpair *point, int npoints); int get_hpos() { return hpos; } int get_vpos() { return vpos; } }; @@ -896,6 +897,9 @@ void troff_output_file::flush_tbuf() put(tbuf_kern); put(' '); } + + check_output_limits(output_hpos, output_vpos); + for (int i = 0; i < tbuf_len; i++) put(tbuf[i]); put('\n'); @@ -1061,6 +1065,42 @@ void troff_output_file::set_font(tfont *tf) current_tfont = tf; } +/* + * determine_line_limits - works out the smallest box which will contain + * the entity, code, built from the point array. + */ + +void troff_output_file::determine_line_limits (char code, hvpair *point, int npoints) +{ + int i, x, y; + + switch (code) { + + case 'c': + case 'C': + /* only the h field is used when defining a circle */ + check_output_limits(output_hpos, output_vpos-point[0].h.to_units()/2); + check_output_limits(output_hpos+point[0].h.to_units(), output_vpos+point[0].h.to_units()/2); + break; + case 'E': + case 'e': + check_output_limits(output_hpos, output_vpos-point[1].v.to_units()/2); + check_output_limits(output_hpos+point[0].h.to_units(), output_vpos+point[1].v.to_units()/2); + break; + default: + /* + * remember this doesn't work for arc.. + */ + x=output_hpos; + y=output_vpos; + for (i=0; isize()); - } else { - check_output_limits(x.to_units() , y.to_units()+after.to_units()); - check_output_limits(x.to_units()+width.to_units(), y.to_units()+before.to_units()+n->size()); - } delete_node_list(n); } -- 2.11.4.GIT