Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Silence "warning: cannot select font 'C'" with GNU roff 1.23
It's difficult to portably ask the man(7) macro package for a monospaced font (whether it's referred to as C, CW or CR) without any extra configuration. That's what leads to: warning: cannot select font 'C' This can be reproduced on Fedora 39, which has GNU roff 1.23, with: $ man crun >/dev/null troff:<standard input>:25: warning: cannot select font 'C' troff:<standard input>:134: warning: cannot select font 'C' ... $ man podman >/dev/null troff:<standard input>:15: warning: cannot select font 'C' troff:<standard input>:25: warning: cannot select font 'C' ... $ man toolbox >/dev/null troff:<standard input>:33: warning: cannot select font 'C' troff:<standard input>:43: warning: cannot select font 'C' ... These may look like odd uses of man(1), but it's used by the Toolbx [1] test suite to ensure that 'toolbox help' and 'toolbox --help' do render the toolbox(1) manual, which, like crun(1) and podman(1), is generated by go-md2man(1). The warnings come from the current \\fB\\fC sequence for inline code enclosed in single backticks (ie., `) that uses 'C' to ask for a monospace font. Other than the difficulties with portably asking the man(7) macro package for a monospace font, the \\fB\\fC sequence has some oddities. If a monospace font does get selected by \\fC, then the request for bold with \\fB gets masked, with the possible surprise that switching back to the 'previous font' with \\fP will result in bold. This is what happens when the output is in HyperText Markup Language or PostScript. If the output is a terminal device, \\fC is a NOP because terminals are always monospaced and can't change the font family, so only \\fB is in effect. Therefore, the use of \\fC is only relevant for non-terminal outputs, like HTML and PS. Since HTML and PS use serif fonts by default, an inline switch to monospace looks visually jarring. This is different from other common uses of monospace for inline code, such as on GitLab and GitHub, where sans-serif fonts are used by default. Therefore, just don't attempt to use monospace for inline code enclosed in single backticks (ie., `) and stick to bold everywhere. As suggested by G. Branden Robinson. [1] https://containertoolbx.org/ https://github.com/containers/toolbox cpuguy83#99 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1049968
- Loading branch information