=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/man_term.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- src/usr.bin/mandoc/man_term.c 2010/10/28 10:42:39 1.51 +++ src/usr.bin/mandoc/man_term.c 2010/11/29 00:12:02 1.52 @@ -1,6 +1,7 @@ -/* $Id: man_term.c,v 1.51 2010/10/28 10:42:39 schwarze Exp $ */ +/* $Id: man_term.c,v 1.52 2010/11/29 00:12:02 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons + * Copyright (c) 2010 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -92,6 +93,7 @@ static int pre_literal(DECL_ARGS); static int pre_sp(DECL_ARGS); static int pre_TS(DECL_ARGS); +static int pre_ft(DECL_ARGS); static void post_IP(DECL_ARGS); static void post_HP(DECL_ARGS); @@ -140,6 +142,7 @@ { pre_in, NULL, MAN_NOTEXT }, /* in */ { pre_TS, NULL, 0 }, /* TS */ { NULL, NULL, 0 }, /* TE */ + { pre_ft, NULL, MAN_NOTEXT }, /* ft */ }; @@ -326,6 +329,48 @@ term_fontrepl(p, TERMFONT_BOLD); return(1); +} + + +/* ARGSUSED */ +static int +pre_ft(DECL_ARGS) +{ + const char *cp; + + if (NULL == n->child) { + term_fontlast(p); + return(0); + } + + cp = n->child->string; + switch (*cp) { + case ('4'): + /* FALLTHROUGH */ + case ('3'): + /* FALLTHROUGH */ + case ('B'): + term_fontrepl(p, TERMFONT_BOLD); + break; + case ('2'): + /* FALLTHROUGH */ + case ('I'): + term_fontrepl(p, TERMFONT_UNDER); + break; + case ('P'): + term_fontlast(p); + break; + case ('1'): + /* FALLTHROUGH */ + case ('C'): + /* FALLTHROUGH */ + case ('R'): + term_fontrepl(p, TERMFONT_NONE); + break; + default: + break; + } + return(0); }