From b3a09b4f2e6de787535cd7659fd19f1c7f91eada Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 26 Mar 2009 16:44:22 +0000 Subject: Added simple font-escapes. --- mandoc.1 | 13 ++++++++++++- terminal.c | 22 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/mandoc.1 b/mandoc.1 index 807d4045..27c663fc 100644 --- a/mandoc.1 +++ b/mandoc.1 @@ -1,4 +1,4 @@ -.\" $Id: mandoc.1,v 1.10 2009/03/26 16:23:22 kristaps Exp $ +.\" $Id: mandoc.1,v 1.11 2009/03/26 16:44:22 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons .\" @@ -160,6 +160,17 @@ format is recommended; .Xr man 7 should only be used for legacy manuals. +.Pp +The following escape sequences are recognised, although the per-format +compiler may not allow certain sequences. +.Bl -tag -width Ds -offset XXXX +.It \efX +sets the font mode to X (B, I, R or P, where P resets the font) +.It \eX, \e(XX, \e[XN] +queries the special-character table for a corresponding symbol +.It \e*X, \e*(XX, \e*[XN] +deprecated special-character format +.El .\" SUB-SECTION .Ss Output Formats The diff --git a/terminal.c b/terminal.c index 2c991534..484bb32f 100644 --- a/terminal.c +++ b/terminal.c @@ -1,4 +1,4 @@ -/* $Id: terminal.c,v 1.10 2009/03/26 14:44:41 kristaps Exp $ */ +/* $Id: terminal.c,v 1.11 2009/03/26 16:44:22 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -454,6 +454,26 @@ term_pescape(struct termp *p, const char *word, int *i, int len) term_nescape(p, &word[*i], 1); return; } + + } else if ('f' == word[*i]) { + if (++(*i) >= len) + return; + switch (word[*i]) { + case ('B'): + p->flags |= TERMP_BOLD; + break; + case ('I'): + p->flags |= TERMP_UNDER; + break; + case ('P'): + /* FALLTHROUGH */ + case ('R'): + p->flags &= ~TERMP_STYLE; + break; + default: + break; + } + return; } else if ('[' != word[*i]) { term_nescape(p, &word[*i], 1); -- cgit v1.2.3-56-ge451