From 2c9e399563f0727410bbcdf0e023f956634dccf4 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 14 Mar 2017 01:35:15 +0000 Subject: 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 . --- html.c | 4 +++- mdoc_html.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/html.c b/html.c index 95df14ea..9d3ca523 100644 --- a/html.c +++ b/html.c @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.208 2017/03/13 19:01:38 schwarze Exp $ */ +/* $Id: html.c,v 1.209 2017/03/14 01:35:15 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017 Ingo Schwarze @@ -591,6 +591,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/mdoc_html.c b/mdoc_html.c index 07583538..8a0eb8dc 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.275 2017/03/13 20:22:18 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.276 2017/03/14 01:35:15 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze @@ -628,7 +628,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, ""); -- cgit v1.2.3-56-ge451