summaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorwlemb <wlemb>2003-04-03 06:43:52 +0000
committerwlemb <wlemb>2003-04-03 06:43:52 +0000
commitcc324ae5f0e7f6739f67095e15c7e4099541c186 (patch)
treed875e9063e7c497722d7b6d4ffa42259d80fc783 /src/devices
parentc69450f356c00387c014c8ed1533fd5339b99ddc (diff)
downloadgroff-cc324ae5f0e7f6739f67095e15c7e4099541c186.tar.gz
* src/devices/grohtml/html-table.cc (html_table::emit_col,
html_table::is_gap): Compute table widths after converting border positions to avoid rounding errors. * src/devices/grohtml/html-text.cc (html_text::do_space): Handle `space_emitted' properly.
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/grohtml/html-table.cc22
-rw-r--r--src/devices/grohtml/html-text.cc3
2 files changed, 18 insertions, 7 deletions
diff --git a/src/devices/grohtml/html-table.cc b/src/devices/grohtml/html-table.cc
index 458dbd02..9ff41fe9 100644
--- a/src/devices/grohtml/html-table.cc
+++ b/src/devices/grohtml/html-table.cc
@@ -388,8 +388,12 @@ void html_table::emit_col (int n)
// move across to column n
while (b != c) {
- width = ((get_right(b) - b->left)*100 + get_effective_linelength()/2)
- / get_effective_linelength();
+ // we compute the difference after converting positions
+ // to avoid rounding errors
+ width = (get_right(b)*100 + get_effective_linelength()/2)
+ / get_effective_linelength()
+ - (b->left*100 + get_effective_linelength()/2)
+ /get_effective_linelength();
if (width)
out->put_string("<td width=\"")
.put_number(width)
@@ -403,8 +407,10 @@ void html_table::emit_col (int n)
.nl();
b = b->next;
}
- width = ((get_right(b) - b->left)*100 + get_effective_linelength()/2)
- / get_effective_linelength();
+ width = (get_right(b)*100 + get_effective_linelength()/2)
+ / get_effective_linelength()
+ - (b->left*100 + get_effective_linelength()/2)
+ /get_effective_linelength();
switch (b->alignment) {
case 'C':
out->put_string("<td width=\"")
@@ -622,8 +628,12 @@ int html_table::is_gap (cols *c)
if (c == NULL || c->right <= 0 || c->next == NULL)
return 0;
else
- return ((c->next->left - c->right)*100 + get_effective_linelength()/2)
- / get_effective_linelength();
+ // we compute the difference after converting positions
+ // to avoid rounding errors
+ return (c->next->left*100 + get_effective_linelength()/2)
+ / get_effective_linelength()
+ - (c->right*100 + get_effective_linelength()/2)
+ / get_effective_linelength();
}
/*
diff --git a/src/devices/grohtml/html-text.cc b/src/devices/grohtml/html-text.cc
index 31e43116..8087dd22 100644
--- a/src/devices/grohtml/html-text.cc
+++ b/src/devices/grohtml/html-text.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
*
* Gaius Mulley (gaius@glam.ac.uk) wrote html-text.cc
*
@@ -707,6 +707,7 @@ void html_text::do_space (void)
else {
do_emittext("", 0);
out->nl();
+ space_emitted = TRUE;
}
} else {
html_indent *i = remove_indent(P_TAG);