[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff] patches for html2 and specific help requested
From: |
Gaius Mulley |
Subject: |
[Groff] patches for html2 and specific help requested |
Date: |
Tue, 17 Oct 2000 18:37:23 +0100 (BST) |
Hi Werner,
Here are some patches for html2. These patches allow groff -Thtml2
to create minimal png files. They also provide a fix to html w.r.t
eqn handling.
I wonder whether I could ask for some help in the following areas:
tmac/tmac.html-tags:
could someone check that the tag generation mechanism is
non intrusive.
src/preproc/html2/pre-html.cc: in function createImage
I'm having difficulty producing transparent png files.
If anyone has done this before - maybe you can drop me
an email.
in src/src/devices/grohtml/html.cc the function
assign_min_max_for_arc works out the smallest box which
will encompass an arc. I wonder whether a groff friend
who is also a mathematician can find a better solution
than my 16 tests :-) this code is also needed in troff
src/roff/troff/node.cc:determine_line_limits. But
I've not copied it yet..
many thanks Gaius
--- groff-cvs/ChangeLog Sun Oct 15 00:57:32 2000
+++ groff-html/ChangeLog Tue Oct 17 17:17:59 2000
@@ -1,3 +1,9 @@
+2000-10-17 Gaius Mulley <address@hidden>
+
+ * src/roff/troff/node.cc fixed calculation of opminx
+ and fixed non intrusive eol marker.
+ Added method determine_line_limits.
+
2000-10-14 Werner LEMBERG <address@hidden>
Replace tmac.safer with a real secure solution.
--- groff-cvs/src/roff/troff/node.cc Fri Aug 25 08:44:08 2000
+++ groff-html/src/roff/troff/node.cc Tue Oct 17 17:18:51 2000
@@ -752,6 +752,7 @@
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 @@
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 @@
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; i<npoints; i++) {
+ x += point[i].h.to_units();
+ y += point[i].v.to_units();
+ check_output_limits(x, y);
+ }
+ }
+}
+
void troff_output_file::draw(char code, hvpair *point, int npoints,
font_size fsize)
{
@@ -1088,6 +1128,9 @@
put(' ');
put(point[i].v.to_units());
}
+
+ determine_line_limits(code, point, npoints);
+
for (i = 0; i < npoints; i++)
output_hpos += point[i].h.to_units();
hpos = output_hpos;
@@ -1324,14 +1367,6 @@
{
if (printing && output_on)
really_print_line(x, y, n, before, after, width);
-
- if (before.to_units() < after.to_units()) {
- check_output_limits(x.to_units() ,
y.to_units()+before.to_units());
- check_output_limits(x.to_units()+width.to_units(),
y.to_units()+after.to_units()+n->size());
- } 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);
}
--- groff-cvs/src/roff/troff/env.cc Fri Aug 25 08:44:08 2000
+++ groff-html/src/roff/troff/env.cc Tue Oct 17 15:59:41 2000
@@ -1946,8 +1946,9 @@
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()
--- groff-cvs/src/preproc/eqn/main.cc Fri Mar 10 00:35:32 2000
+++ groff-html/src/preproc/eqn/main.cc Mon Oct 16 09:43:34 2000
@@ -110,8 +110,8 @@
}
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))
--- groff-cvs/src/preproc/html2/pre-html.cc Mon Oct 9 20:41:59 2000
+++ groff-html/src/preproc/html2/pre-html.cc Tue Oct 17 17:50:10 2000
@@ -39,6 +39,10 @@
#include <unistd.h>
#endif
+#ifndef errno
+extern int errno;
+#endif
+
#ifdef _POSIX_VERSION
#include <sys/wait.h>
#define PID_T pid_t
@@ -267,7 +271,7 @@
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 +387,17 @@
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);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff] patches for html2 and specific help requested,
Gaius Mulley <=