summaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-11-05 08:40:16 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-11-05 08:40:16 +0000
commitd80276536610615caffcc3d1d5ffc405bfc5cc26 (patch)
treebb51d17964d6cda2548ff51c7f0cf7ae818099a0 /term.c
parentcb156f15852e81dc6e6cda189a91729f275f6c46 (diff)
downloadmandoc-d80276536610615caffcc3d1d5ffc405bfc5cc26.tar.gz
mandoc-d80276536610615caffcc3d1d5ffc405bfc5cc26.tar.zst
mandoc-d80276536610615caffcc3d1d5ffc405bfc5cc26.zip
Correct support for `\fX' font modes in -Tascii.
Diffstat (limited to 'term.c')
-rw-r--r--term.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/term.c b/term.c
index 7afa1019..d7d7b5d3 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.121 2009/11/05 07:21:02 kristaps Exp $ */
+/* $Id: term.c,v 1.122 2009/11/05 08:40:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -15,6 +15,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <assert.h>
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -373,7 +374,7 @@ do_reserved(struct termp *p, const char *word, size_t len)
static void
do_escaped(struct termp *p, const char **word)
{
- int j, type;
+ int j, type, sv;
const char *wp;
wp = *word;
@@ -428,16 +429,29 @@ do_escaped(struct termp *p, const char **word)
}
switch (*wp) {
+ case ('3'):
+ /* FALLTHROUGH */
case ('B'):
- p->bold++;
+ p->metamask = p->metafont;
+ p->metafont |= METAF_BOLD;
break;
+ case ('2'):
+ /* FALLTHROUGH */
case ('I'):
- p->under++;
+ p->metamask = p->metafont;
+ p->metafont |= METAF_UNDER;
break;
case ('P'):
+ sv = p->metamask;
+ p->metamask = p->metafont;
+ p->metafont = sv;
+ break;
+ case ('1'):
/* FALLTHROUGH */
case ('R'):
- p->bold = p->under = 0;
+ p->metamask = p->metafont;
+ p->metafont &= ~METAF_UNDER;
+ p->metafont &= ~METAF_BOLD;
break;
default:
break;
@@ -563,12 +577,12 @@ static void
encode(struct termp *p, char c)
{
- if (' ' != c) {
- if (p->under) {
+ if (isgraph((u_char)c)) {
+ if (p->under || METAF_UNDER & p->metafont) {
buffer(p, '_');
buffer(p, 8);
}
- if (p->bold) {
+ if (p->bold || METAF_BOLD & p->metafont) {
buffer(p, c);
buffer(p, 8);
}