diff options
author | asmodai <asmodai@FreeBSD.org> | 2000-01-12 09:51:43 +0000 |
---|---|---|
committer | asmodai <asmodai@FreeBSD.org> | 2000-01-12 09:51:43 +0000 |
commit | 2e2c9047c3a8b5b6fdcdcd4585d5b114f31cd386 (patch) | |
tree | 723c5fa18b7084a4da09e4e42000ef10cbc884fa /contrib/groff/libdriver | |
parent | 35cdaa022af3f495aa21a1292d85ee40b28f86fb (diff) | |
download | FreeBSD-src-2e2c9047c3a8b5b6fdcdcd4585d5b114f31cd386.zip FreeBSD-src-2e2c9047c3a8b5b6fdcdcd4585d5b114f31cd386.tar.gz |
Virgin import of FSF groff v1.15
Diffstat (limited to 'contrib/groff/libdriver')
-rw-r--r-- | contrib/groff/libdriver/input.cc | 2 | ||||
-rw-r--r-- | contrib/groff/libdriver/printer.cc | 50 |
2 files changed, 38 insertions, 14 deletions
diff --git a/contrib/groff/libdriver/input.cc b/contrib/groff/libdriver/input.cc index 6d77b5e..41411dc 100644 --- a/contrib/groff/libdriver/input.cc +++ b/contrib/groff/libdriver/input.cc @@ -291,6 +291,8 @@ void do_file(const char *filename) if (np > 0) env.hpos += p[0]; } + else if (c == 'f' || c == 't') + ; else { int i; for (i = 0; i < np/2; i++) { diff --git a/contrib/groff/libdriver/printer.cc b/contrib/groff/libdriver/printer.cc index e7547de..7abe746 100644 --- a/contrib/groff/libdriver/printer.cc +++ b/contrib/groff/libdriver/printer.cc @@ -108,41 +108,63 @@ void printer::draw(int, int *, int, const environment *) void printer::set_ascii_char(unsigned char c, const environment *env, int *widthp) { - char buf[2]; + char buf[2]; + int w; + font *f; + buf[0] = c; buf[1] = '\0'; - set_special_char(buf, env, widthp); + + int i = set_char_and_width(buf, env, &w, &f); + set_char(i, f, env, w, 0); + if (widthp) { + *widthp = w; + } } void printer::set_special_char(const char *nm, const environment *env, - int *widthp) + int *widthp) +{ + font *f; + int w; + int i = set_char_and_width(nm, env, &w, &f); + if (i != -1) { + set_char(i, f, env, w, nm); + if (widthp) { + *widthp = w; + } + } +} + +int printer::set_char_and_width(const char *nm, const environment *env, + int *widthp, font **f) { int i = font::name_to_index(nm); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); - return; + return(-1); } - font *f = font_table[fn]; - if (f == 0) { + *f = font_table[fn]; + if (*f == 0) { error("no font mounted at `%1'", fn); - return; + return(-1); } - if (!f->contains(i)) { + if (!(*f)->contains(i)) { if (nm[0] != '\0' && nm[1] == '\0') error("font `%1' does not contain ascii character `%2'", - f->get_name(), + (*f)->get_name(), nm[0]); else error("font `%1' does not contain special character `%2'", - f->get_name(), + (*f)->get_name(), nm); - return; + return(-1); } - int w = f->get_width(i, env->size); + int w = (*f)->get_width(i, env->size); if (widthp) *widthp = w; - set_char(i, f, env, w); + return( i ); } void printer::set_numbered_char(int num, const environment *env, int *widthp) @@ -167,7 +189,7 @@ void printer::set_numbered_char(int num, const environment *env, int *widthp) int w = f->get_width(i, env->size); if (widthp) *widthp = w; - set_char(i, f, env, w); + set_char(i, f, env, w, 0); } // This utility function adjusts the specified center of the |