diff options
author | 2017-03-14 01:34:57 +0000 | |
---|---|---|
committer | 2017-03-14 01:34:57 +0000 | |
commit | 95d7264c8c60fea3692dfde5a6553942ecc25a55 (patch) | |
tree | 059eb0dd6096cbb82b133cf5e6bf01c7ce53261a | |
parent | Add unit test for convtime(). (diff) | |
download | wireguard-openbsd-95d7264c8c60fea3692dfde5a6553942ecc25a55.tar.xz wireguard-openbsd-95d7264c8c60fea3692dfde5a6553942ecc25a55.zip |
Slightly increase widths calculated from string lengths (mainly
for .Bl -tag lists and SYNOPSIS .Nm blocks), such that the text
still fits even if it is printed in bold font.
This is an ugly band aid - but implementing font-dependent width
measurements would be a major project and even more difficult
for HTML than for PostScript.
Issue reported by Jan Stary <hans at stare dot cz>.
-rw-r--r-- | usr.bin/mandoc/html.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 35463630df3..c645cb71d3a 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.78 2017/03/13 19:01:14 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.79 2017/03/14 01:34:57 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -589,6 +589,8 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) break; su = &mysu; a2width(arg2, su); + /* Increase width to make even bold text fit. */ + su->scale *= 1.1; if (fmt[-1] == 'W') su->scale *= -1.0; break; diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index ed55a42c65a..d25686ff906 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.150 2017/03/13 20:22:11 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.151 2017/03/14 01:34:57 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -626,7 +626,8 @@ mdoc_nm_pre(MDOC_ARGS) len = html_strlen(meta->name); t = print_otag(h, TAG_COLGROUP, ""); - print_otag(h, TAG_COL, "shw", len); + /* Increase width to make even bold text fit. */ + print_otag(h, TAG_COL, "shw", len + 2); print_otag(h, TAG_COL, ""); print_tagq(h, t); print_otag(h, TAG_TR, ""); |