aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-12-16 00:17:02 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-12-16 00:17:02 +0000
commitfb7ea55796176565141285c5c6de1d3127655116 (patch)
tree63b21db96671f3ca27e3f0658ae34a5d8babc63d /roff_term.c
parentd672f8cb82878baf3834e938c4c416f4493952cf (diff)
downloadmandoc-fb7ea55796176565141285c5c6de1d3127655116.tar.gz
mandoc-fb7ea55796176565141285c5c6de1d3127655116.tar.zst
mandoc-fb7ea55796176565141285c5c6de1d3127655116.zip
Yet another round of improvements to manual font selection.
Unify handling of \f and .ft. Support \f4 (bold+italic). Support ".ft BI" and ".ft CW" for terminal output. Support the .ft request in HTML output. Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP. In regress.pl, only strip leading whitespace in math mode.
Diffstat (limited to 'roff_term.c')
-rw-r--r--roff_term.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/roff_term.c b/roff_term.c
index 6d0da8b9..a98f88f9 100644
--- a/roff_term.c
+++ b/roff_term.c
@@ -1,4 +1,4 @@
-/* $Id: roff_term.c,v 1.16 2018/12/14 01:18:26 schwarze Exp $ */
+/* $Id: roff_term.c,v 1.17 2018/12/16 00:17:02 schwarze Exp $ */
/*
* Copyright (c) 2010,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -18,6 +18,7 @@
#include <assert.h>
#include <stdio.h>
+#include <string.h>
#include "mandoc.h"
#include "roff.h"
@@ -113,25 +114,22 @@ roff_term_pre_ft(ROFF_TERM_ARGS)
{
const char *cp;
- if (*(cp = n->child->string) == 'C')
- cp++;
-
- switch (*cp) {
- case '4':
- case '3':
- case 'B':
+ cp = n->child->string;
+ switch (mandoc_font(cp, (int)strlen(cp))) {
+ case ESCAPE_FONTBOLD:
term_fontrepl(p, TERMFONT_BOLD);
break;
- case '2':
- case 'I':
+ case ESCAPE_FONTITALIC:
term_fontrepl(p, TERMFONT_UNDER);
break;
- case 'P':
+ case ESCAPE_FONTBI:
+ term_fontrepl(p, TERMFONT_BI);
+ break;
+ case ESCAPE_FONTPREV:
term_fontlast(p);
break;
- case '1':
- case 'C':
- case 'R':
+ case ESCAPE_FONTROMAN:
+ case ESCAPE_FONTCW:
term_fontrepl(p, TERMFONT_NONE);
break;
default: