From 5eda43815781d2f6dde50e670e33d155679e6c14 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 16 Feb 2017 14:38:12 +0000 Subject: Surprisingly, groff does not support scaling units in .Bl -column column width specifiers, so stop supporting them, too. As a side effect, this fixes an assertion failure that tb@ found with afl(1), triggered by: .Bl -column -4n --- mdoc_term.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'mdoc_term.c') diff --git a/mdoc_term.c b/mdoc_term.c index 398fc3f5..bc125f29 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.344 2017/02/16 03:00:23 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.345 2017/02/16 14:38:12 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2017 Ingo Schwarze @@ -606,6 +606,7 @@ termp_ll_pre(DECL_ARGS) static int termp_it_pre(DECL_ARGS) { + struct roffsu su; char buf[24]; const struct roff_node *bl, *nn; size_t ncols, dcol; @@ -683,9 +684,12 @@ termp_it_pre(DECL_ARGS) for (i = 0, nn = n->prev; nn->prev && i < (int)ncols; - nn = nn->prev, i++) - offset += dcol + a2width(p, - bl->norm->Bl.cols[i]); + nn = nn->prev, i++) { + SCALE_HS_INIT(&su, + term_strlen(p, bl->norm->Bl.cols[i])); + su.scale /= term_strlen(p, "0"); + offset += term_hspan(p, &su) / 24 + dcol; + } /* * When exceeding the declared number of columns, leave @@ -700,7 +704,9 @@ termp_it_pre(DECL_ARGS) * Use the declared column widths, extended as explained * in the preceding paragraph. */ - width = a2width(p, bl->norm->Bl.cols[i]) + dcol; + SCALE_HS_INIT(&su, term_strlen(p, bl->norm->Bl.cols[i])); + su.scale /= term_strlen(p, "0"); + width = term_hspan(p, &su) / 24 + dcol; break; default: if (NULL == bl->norm->Bl.width) -- cgit v1.2.3