summaryrefslogtreecommitdiffstats
path: root/term.h
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-11-12 05:50:12 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-11-12 05:50:12 +0000
commit98a07e7455f567f7e0ec8f62788f883a8efd7eae (patch)
treedf0f64f0018c106998276752306943790552bf8a /term.h
parent8d9b3e337843a72a4e23e3cc12bf7337cde4d8b9 (diff)
downloadmandoc-98a07e7455f567f7e0ec8f62788f883a8efd7eae.tar.gz
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.
Diffstat (limited to 'term.h')
-rw-r--r--term.h23
1 files changed, 17 insertions, 6 deletions
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*/