summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwl <wl>2010-05-23 05:09:00 +0000
committerwl <wl>2010-05-23 05:09:00 +0000
commit85e96668e55fa4e53090df101c329e74047470b0 (patch)
treea8188f3ed50e29f944ec860d59f6e1e7c2d0502c /src
parent1855efd41b208d1674e27f946c864a352cebadb2 (diff)
downloadgroff-85e96668e55fa4e53090df101c329e74047470b0.tar.gz
Use DESC's `unicode' keyword for grotty.
Consequently, no longer check directly for the `utf8' device name which prevented the creation of arbitrarily called output device directories like `devunicode'. Problem reported by Christopher Yeleighton <giecrilj@stegny.2a.pl> in Savannah bug #29895. * src/devices/grotty/tty.cpp (tty_printer): Remove `is_utf8' member. Replace all ocurrences with `font::is_unicode'. (tty_printer::tty_printer): Remove argument. * src/devices/grotty/grotty.man: Document `unicode' keyword.
Diffstat (limited to 'src')
-rw-r--r--src/devices/grotty/grotty.man15
-rw-r--r--src/devices/grotty/tty.cpp17
2 files changed, 22 insertions, 10 deletions
diff --git a/src/devices/grotty/grotty.man b/src/devices/grotty/grotty.man
index 30510eab..4b299f5f 100644
--- a/src/devices/grotty/grotty.man
+++ b/src/devices/grotty/grotty.man
@@ -1,5 +1,5 @@
.ig
-Copyright (C) 1989-2000, 2001, 2002, 2003, 2005, 2006, 2009
+Copyright (C) 1989-2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010
Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
@@ -200,6 +200,19 @@ This code can also be used in the
escape sequence in
.BR troff .
.
+.LP
+If the
+.B DESC
+file contains the keyword
+.BR unicode ,
+.B grotty
+emits Unicode characters in UTF-8 encoding.
+Otherwise, it emits characters in a single-byte encoding depending
+on the data in the font description files.
+See the
+.BR groff_font (@MAN5EXT@)
+man page for more details.
+.
.
.SH OPTIONS
.
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 9b824097..0ea7969e 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989-2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+/* Copyright (C) 1989-2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+ 2010
Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
@@ -196,7 +197,6 @@ void tty_glyph::operator delete(void *p)
}
class tty_printer : public printer {
- int is_utf8;
tty_glyph **lines;
int nlines;
int cached_v;
@@ -219,7 +219,7 @@ class tty_printer : public printer {
void draw_line(int *, int, const environment *);
void draw_polygon(int *, int, const environment *);
public:
- tty_printer(const char *);
+ tty_printer();
~tty_printer();
void set_char(glyph *, font *, const environment *, int, const char *);
void draw(int, int *, int, const environment *);
@@ -273,10 +273,9 @@ int tty_printer::tty_color(unsigned int r,
return unknown_color;
}
-tty_printer::tty_printer(const char *dev) : cached_v(0)
+tty_printer::tty_printer() : cached_v(0)
{
- is_utf8 = !strcmp(dev, "utf8");
- if (is_utf8) {
+ if (font::is_unicode) {
hline_char = 0x2500;
vline_char = 0x2502;
}
@@ -603,7 +602,7 @@ void tty_printer::line(int hpos, int vpos, int dx, int dy,
void tty_printer::put_char(output_character wc)
{
- if (is_utf8 && wc >= 0x80) {
+ if (font::is_unicode && wc >= 0x80) {
char buf[6 + 1];
int count;
char *p = buf;
@@ -719,7 +718,7 @@ void tty_printer::end_page(int page_length)
if (nextp && p->hpos == nextp->hpos) {
if (p->draw_mode() == HDRAW_MODE &&
nextp->draw_mode() == VDRAW_MODE) {
- if (is_utf8)
+ if (font::is_unicode)
nextp->code =
crossings[((p->mode & (START_LINE|END_LINE)) >> 4)
+ ((nextp->mode & (START_LINE|END_LINE)) >> 6)];
@@ -844,7 +843,7 @@ font *tty_printer::make_font(const char *nm)
printer *make_printer()
{
- return new tty_printer(device);
+ return new tty_printer();
}
static void update_options()