Hi! tbl's -Thtml ignores font requests; additionally, the tbl f-request parser only allows single-character fonts. Cf. the Debian bug (http://bugs.debian.org/992002) for additional context. Please consider the following patch. наб --- With this patch, the following document: -- >8 -- .Dd .Dt V 1 .Os . \fBtext\fItext\f(BItext\f(CRtext\f(CBtext\f(CItext\fR .Pp .TS lfB lfI lfBI lb li lbi lfCR lfCB lfCI . text text text text text text text text text .TE -- >8 -- Renders to a teletype with the expected fonts: b, ul, bul; b, ul, bul; normal, b, ul -Thtml -Ofragment yields, as expected: -- >8 --
V(1) General Commands Manual V(1)
texttexttexttexttexttext

text text text text text text text text text
August 8, 2021 Debian
-- >8 -- --- mdocml-1.14.5.orig/tbl.7 +++ mdocml-1.14.5/tbl.7 @@ -178,10 +178,11 @@ of any other column also having the .Cm e modifier. .It Cm f -The next character selects the font to use for this cell. +The next two characters select the font to use for this cell. +One-character font names must be followed by a blank or period. See the .Xr roff 7 -manual for supported one-character font names. +manual for supported font names. .It Cm i Use an italic font for the contents of this cell. .It Cm m --- mdocml-1.14.5.orig/tbl.h +++ mdocml-1.14.5/tbl.h @@ -59,12 +59,13 @@ struct tbl_cell { int flags; #define TBL_CELL_BOLD (1 << 0) /* b, B, fB */ #define TBL_CELL_ITALIC (1 << 1) /* i, I, fI */ -#define TBL_CELL_TALIGN (1 << 2) /* t, T */ -#define TBL_CELL_UP (1 << 3) /* u, U */ -#define TBL_CELL_BALIGN (1 << 4) /* d, D */ -#define TBL_CELL_WIGN (1 << 5) /* z, Z */ -#define TBL_CELL_EQUAL (1 << 6) /* e, E */ -#define TBL_CELL_WMAX (1 << 7) /* x, X */ +#define TBL_CELL_FONTCW (1 << 2) /* fC[RBI] */ +#define TBL_CELL_TALIGN (1 << 3) /* t, T */ +#define TBL_CELL_UP (1 << 4) /* u, U */ +#define TBL_CELL_BALIGN (1 << 5) /* d, D */ +#define TBL_CELL_WIGN (1 << 6) /* z, Z */ +#define TBL_CELL_EQUAL (1 << 7) /* e, E */ +#define TBL_CELL_WMAX (1 << 8) /* x, X */ enum tbl_cellt pos; }; --- mdocml-1.14.5.orig/tbl_html.c +++ mdocml-1.14.5/tbl_html.c @@ -25,6 +25,7 @@ #include #include "mandoc.h" +#include "mandoc_aux.h" #include "tbl.h" #include "out.h" #include "html.h" @@ -218,6 +219,7 @@ print_tbl(struct html *h, const struct t else valign = NULL; + int flags = cp->flags; for (i = dp->hspans; i > 0; i--) cp = cp->next; switch (cp->vert) { @@ -239,8 +241,36 @@ print_tbl(struct html *h, const struct t "vertical-align", valign, "text-align", halign, "border-right-style", rborder); - if (dp->string != NULL) - print_text(h, dp->string); + if (dp->string != NULL) { + const char *font = NULL; + switch (flags & (TBL_CELL_BOLD | TBL_CELL_ITALIC | TBL_CELL_FONTCW)) { + case TBL_CELL_BOLD: + font = "\\fB"; + break; + case TBL_CELL_ITALIC: + font = "\\fI"; + break; + case TBL_CELL_BOLD | TBL_CELL_ITALIC: + font = "\\f(BI"; + break; + case TBL_CELL_FONTCW: + font = "\\f(CR"; + break; + case TBL_CELL_FONTCW | TBL_CELL_BOLD: + font = "\\f(CB"; + break; + case TBL_CELL_FONTCW | TBL_CELL_ITALIC: + font = "\\f(CI"; + break; + } + if (font) { + char *str; + mandoc_asprintf(&str, "%s%s\\fP", font, dp->string); + print_text(h, str); + free(str); + } else + print_text(h, dp->string); + } } print_tagq(h, tt); --- mdocml-1.14.5.orig/tbl_layout.c +++ mdocml-1.14.5/tbl_layout.c @@ -170,9 +170,7 @@ mod: if (p[*pos] == '(') goto mod; - /* Support only one-character font-names for now. */ - - if (p[*pos] == '\0' || (p[*pos + 1] != ' ' && p[*pos + 1] != '.')) { + if (p[*pos] == '\0' || (!isalnum(p[*pos + 1]) && p[*pos + 1] != ' ' && p[*pos + 1] != '.')) { mandoc_msg(MANDOCERR_FT_BAD, ln, *pos, "TS %s", p + *pos - 1); if (p[*pos] != '\0') @@ -182,23 +180,27 @@ mod: goto mod; } - switch (p[(*pos)++]) { - case '3': - case 'B': + char fn[3] = {'\0'}, *fp = fn; + fn[0] = p[(*pos)++]; + fn[1] = p[*pos] == ' ' || p[*pos] == '.' ? '\0' : p[(*pos)++]; + +refont: + if (!strcmp(fp, "3") || !strcmp(fp, "B")) cp->flags |= TBL_CELL_BOLD; - goto mod; - case '2': - case 'I': + else if (!strcmp(fp, "2") || !strcmp(fp, "I")) cp->flags |= TBL_CELL_ITALIC; - goto mod; - case '1': - case 'R': - goto mod; - default: + else if (!strcmp(fp, "1") || !strcmp(fp, "R")) + ; + else if (!strcmp(fp, "BI")) + cp->flags |= TBL_CELL_BOLD | TBL_CELL_ITALIC; + else if (fp[0] == 'C' && fp[1]) { + cp->flags |= TBL_CELL_FONTCW; + ++fp; + goto refont; + } else mandoc_msg(MANDOCERR_FT_BAD, - ln, *pos - 1, "TS f%c", p[*pos - 1]); - goto mod; - } + ln, *pos - strlen(fn), "TS f%s", fn); + goto mod; } static void --- mdocml-1.14.5.orig/tbl_term.c +++ mdocml-1.14.5/tbl_term.c @@ -922,10 +922,17 @@ tbl_word(struct termp *tp, const struct int prev_font; prev_font = tp->fonti; - if (dp->layout->flags & TBL_CELL_BOLD) - term_fontpush(tp, TERMFONT_BOLD); - else if (dp->layout->flags & TBL_CELL_ITALIC) - term_fontpush(tp, TERMFONT_UNDER); + switch (dp->layout->flags & (TBL_CELL_BOLD | TBL_CELL_ITALIC)) { + case TBL_CELL_BOLD | TBL_CELL_ITALIC: + term_fontpush(tp, TERMFONT_BI); + break; + case TBL_CELL_BOLD: + term_fontpush(tp, TERMFONT_BOLD); + break; + case TBL_CELL_ITALIC: + term_fontpush(tp, TERMFONT_UNDER); + break; + } term_word(tp, dp->string);