From 98a07e7455f567f7e0ec8f62788f883a8efd7eae Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 12 Nov 2009 05:50:12 +0000 Subject: Basically re-wrote -Tascii font handling: instead of incrementers for bold and underline, we use a stack (no cascading, no double-font-mode). Font modes with \f only affect the current stack point, as documented in mdoc.7 and man.7. While -mdoc stacks fonts with embedded macros, -man replaces them (the stack is always size 1). This works for all invocations in supported systems' manual corpora to date. It doesn't support groff's insanity with line-scoped \f as documented in mdoc.7. --- term.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'term.h') diff --git a/term.h b/term.h index ee8fd90e..2cee1723 100644 --- a/term.h +++ b/term.h @@ -23,6 +23,12 @@ enum termenc { TERMENC_ASCII }; +enum termfont { + TERMFONT_NONE = 0, + TERMFONT_BOLD, + TERMFONT_UNDER +}; + struct termp { size_t rmargin; /* Current right margin. */ size_t maxrmargin; /* Max right margin. */ @@ -41,15 +47,12 @@ struct termp { #define TERMP_NOSPLIT (1 << 11) /* See termp_an_pre/post(). */ #define TERMP_SPLIT (1 << 12) /* See termp_an_pre/post(). */ #define TERMP_ANPREC (1 << 13) /* See termp_an_pre(). */ - int bold; - int under; - int metafont; /* See do_escaped(). */ -#define METAF_BOLD (1 << 0) -#define METAF_UNDER (1 << 1) - int metamask; /* See do_escaped(). */ char *buf; /* Output buffer. */ enum termenc enc; /* Type of encoding. */ void *symtab; /* Encoded-symbol table. */ + enum termfont fontl; /* Last font set. */ + enum termfont fontq[10]; /* Symmetric fonts. */ + int fonti; /* Index of font stack. */ }; void term_newln(struct termp *); @@ -60,6 +63,14 @@ void term_flushln(struct termp *); size_t term_hspan(const struct roffsu *); size_t term_vspan(const struct roffsu *); +enum termfont term_fonttop(struct termp *); +const void *term_fontq(struct termp *); +void term_fontpush(struct termp *, enum termfont); +void term_fontpop(struct termp *); +void term_fontpopq(struct termp *, const void *); +void term_fontrepl(struct termp *, enum termfont); +void term_fontlast(struct termp *); + __END_DECLS #endif /*!TERM_H*/ -- cgit