From eaf84848c463416967ecacc10a55630fcf7f115c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 10 Aug 2021 12:55:03 +0000 Subject: Support two-character font names (BI, CW, CR, CB, CI) in the tbl(7) layout font modifier. Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead, which simplifies and unifies some code. While here, also support CB and CI in roff(7) \f escape sequences and in roff(7) .ft requests for all output modes. Using those is certainly not recommended because portability is limited even with groff, but supporting them makes some existing third-party manual pages look better, in particular in HTML output mode. Bug-compatible with groff as far as i'm aware, except that i consider font names starting with the '\n' (ASCII 0x0a line feed) character so insane that i decided to not support them. Missing feature reported by nabijaczleweli dot xyz in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002. I used none of the code from the initial patch submitted by nabijaczleweli, but some of their ideas. Final patch tested by them, too. --- mandoc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mandoc.c') diff --git a/mandoc.c b/mandoc.c index dfd1b466..2d9398d9 100644 --- a/mandoc.c +++ b/mandoc.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons - * Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze + * Copyright (c) 2011-2015, 2017-2021 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 @@ -74,12 +74,12 @@ mandoc_font(const char *cp, int sz) case 'C': switch (cp[1]) { case 'B': - return ESCAPE_FONTBOLD; + return ESCAPE_FONTCB; case 'I': - return ESCAPE_FONTITALIC; + return ESCAPE_FONTCI; case 'R': case 'W': - return ESCAPE_FONTCW; + return ESCAPE_FONTCR; default: return ESCAPE_ERROR; } -- cgit