summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2003-04-01 21:26:41 +0000
committerwlemb <wlemb>2003-04-01 21:26:41 +0000
commit18a7f724864d3cbb282a90849268df0ba905b0c1 (patch)
tree7b83fece3ba6fa1c421bf3aaf3c641cafe2f21d6
parenteddc04d73ab0dd063925712f1448826403d2afb4 (diff)
downloadgroff-18a7f724864d3cbb282a90849268df0ba905b0c1.tar.gz
* src/devices/grohtml/html-table.cc: Fix column width calculation.
(html_table::set_linelength): Don't add 1. (html_table::add_indent): Don't subtract 1. * tmac/html.tmac: Set default page offset to zero. Make groff emit `&nbsp;' for `\ ' and `\~' if `-Thtml' is used. * src/roff/troff/node.cc (space_char_hmotion_node::tprint, unbreakable_space_node::tprint): New functions. (troff_output_file): Make space_char_hmotion_mode::tprint and unbreakable_space_node::tprint to friends. * src/roff/troff/node.h: Updated. * font/devhtml/R.proto: Add `&nbsp' at position 0xA0 (as defined in the HTML standard).
-rw-r--r--ChangeLog21
-rw-r--r--font/devhtml/R.proto1
-rw-r--r--src/devices/grohtml/html-table.cc14
-rw-r--r--src/roff/troff/node.cc26
-rw-r--r--src/roff/troff/node.h2
-rw-r--r--tmac/html.tmac2
6 files changed, 58 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index f4d5f8a7..f3c52203 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2003-03-31 Werner LEMBERG <wl@gnu.org>
+
+ * src/devices/grohtml/html-table.cc: Fix column width calculation.
+ (html_table::set_linelength): Don't add 1.
+ (html_table::add_indent): Don't subtract 1.
+
+ * tmac/html.tmac: Set default page offset to zero.
+
+2003-03-30 Werner LEMBERG <wl@gnu.org>
+
+ Make groff emit `&nbsp;' for `\ ' and `\~' if `-Thtml' is used.
+
+ * src/roff/troff/node.cc (space_char_hmotion_node::tprint,
+ unbreakable_space_node::tprint): New functions.
+ (troff_output_file): Make space_char_hmotion_mode::tprint and
+ unbreakable_space_node::tprint to friends.
+ * src/roff/troff/node.h: Updated.
+
+ * font/devhtml/R.proto: Add `&nbsp' at position 0xA0 (as defined
+ in the HTML standard).
+
2003-03-29 Werner LEMBERG <wl@gnu.org>
* src/roff/troff/env.cc (point_size): Fix emission of html tag.
diff --git a/font/devhtml/R.proto b/font/devhtml/R.proto
index 7dd39b93..a4bddf0c 100644
--- a/font/devhtml/R.proto
+++ b/font/devhtml/R.proto
@@ -118,6 +118,7 @@ rC 24 0 0x007D
a~ 24 0 0x007E
~ "
ti "
+--- 24 0 0x00A0 &nbsp;
r! 24 0 0x00A1 &iexcl;
ct 24 0 0x00A2 &cent;
Po 24 0 0x00A3 &pound;
diff --git a/src/devices/grohtml/html-table.cc b/src/devices/grohtml/html-table.cc
index faf72fa8..458dbd02 100644
--- a/src/devices/grohtml/html-table.cc
+++ b/src/devices/grohtml/html-table.cc
@@ -283,8 +283,8 @@ void html_table::set_linelength (int linelen)
}
p = c;
}
- if (p != NULL && p->right != 0)
- add_column(p->no+1, p->right+1, linelen, 'L');
+ if (p != NULL && p->right > 0)
+ add_column(p->no+1, p->right, linelength, 'L');
}
/*
@@ -306,7 +306,7 @@ int html_table::get_effective_linelength (void)
void html_table::add_indent (int indent)
{
if (columns != NULL && columns->left > indent)
- add_column(0, indent, columns->left-1, 'L');
+ add_column(0, indent, columns->left, 'L');
}
/*
@@ -518,7 +518,7 @@ int html_table::insert_column (int coln, int hstart, int hend, char align)
c = c->next;
}
if ((l != NULL) && (hstart < l->right))
- return FALSE; // new column bumps into previous one
+ return FALSE; // new column bumps into previous one
if ((l != NULL) && (l->next != NULL) &&
(l->next->left < hend))
@@ -554,7 +554,7 @@ int html_table::modify_column (cols *c, int hstart, int hend, char align)
l = l->next;
if ((l != NULL) && (hstart < l->right))
- return FALSE; // new column bumps into previous one
+ return FALSE; // new column bumps into previous one
if ((c->next != NULL) && (c->next->left < hend))
return FALSE; // new column bumps into next one
@@ -577,7 +577,7 @@ int html_table::modify_column (cols *c, int hstart, int hend, char align)
int html_table::find_tab_column (int pos)
{
- // remember the first column is reserved for un tabbed glyphs
+ // remember the first column is reserved for untabbed glyphs
return tab_stops->find_tab(pos)+1;
}
@@ -619,7 +619,7 @@ int html_table::no_columns (void)
int html_table::is_gap (cols *c)
{
- if (c == NULL || c->right == 0 || c->next == NULL)
+ if (c == NULL || c->right <= 0 || c->next == NULL)
return 0;
else
return ((c->next->left - c->right)*100 + get_effective_linelength()/2)
diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc
index 53b9477e..86c51d86 100644
--- a/src/roff/troff/node.cc
+++ b/src/roff/troff/node.cc
@@ -787,6 +787,8 @@ public:
void fill_color(color *c);
int get_hpos() { return hpos; }
int get_vpos() { return vpos; }
+ friend void space_char_hmotion_node::tprint(troff_output_file *);
+ friend void unbreakable_space_node::tprint(troff_output_file *);
};
static void put_string(const char *s, FILE *fp)
@@ -4408,6 +4410,17 @@ void hmotion_node::tprint(troff_output_file *out)
out->right(n);
}
+void space_char_hmotion_node::tprint(troff_output_file *out)
+{
+ out->fill_color(col);
+ if (is_html) {
+ out->flush_tbuf();
+ out->do_motion();
+ out->put("N160\n"); // this is &nbsp;
+ }
+ out->right(n);
+}
+
void vmotion_node::tprint(troff_output_file *out)
{
out->fill_color(col);
@@ -5263,6 +5276,19 @@ int word_space_node::force_tprint()
return 0;
}
+void unbreakable_space_node::tprint(troff_output_file *out)
+{
+ out->fill_color(col);
+ if (is_html) {
+ out->flush_tbuf();
+ out->do_motion();
+ out->put("N160\n"); // this is &nbsp;
+ }
+ else
+ out->word_marker();
+ out->right(n);
+}
+
int unbreakable_space_node::same(node *nd)
{
return n == ((unbreakable_space_node *)nd)->n
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 526e59a4..54f8822a 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -218,6 +218,7 @@ public:
unbreakable_space_node(hunits, color *, node * = 0);
node *copy();
int reread(int *);
+ void tprint(troff_output_file *);
int same(node *);
void asciify(macro *);
const char *type();
@@ -311,6 +312,7 @@ public:
node *copy();
void ascii_print(ascii_output_file *);
void asciify(macro *);
+ void tprint(troff_output_file *);
int same(node *);
const char *type();
int force_tprint();
diff --git a/tmac/html.tmac b/tmac/html.tmac
index 0a3cf31b..9d400e02 100644
--- a/tmac/html.tmac
+++ b/tmac/html.tmac
@@ -709,7 +709,7 @@
. do mso cp1047.tmac
.
.\" tell grohtml some default parameter values
-.po \n[.o]u
+.po 0
.ll \n[.l]u
.ta \n[.tabs]
.