summaryrefslogtreecommitdiffstatshomepage
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
commit754ffee707861356b63ca9cf6d44f5d683edf9f3 (patch)
tree8d87e9f691c5f59a89cdcde5a4f89e40f10bc048 /term.h
parentf2108e6ac6a2dab810b9177f6f302c9032ca4af5 (diff)
downloadmandoc-754ffee707861356b63ca9cf6d44f5d683edf9f3.tar.gz
mandoc-754ffee707861356b63ca9cf6d44f5d683edf9f3.tar.zst
mandoc-754ffee707861356b63ca9cf6d44f5d683edf9f3.zip
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.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/term.h b/term.h
index 46c8b509..134c83de 100644
--- a/term.h
+++ b/term.h
@@ -1,4 +1,4 @@
-/* $Id: term.h,v 1.50 2009/11/05 08:40:16 kristaps Exp $ */
+/* $Id: term.h,v 1.51 2009/11/12 05:50:13 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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*/