summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-10-13 22:00:42 +0000
committerschwarze <schwarze@openbsd.org>2014-10-13 22:00:42 +0000
commit96ecfaaf8b2b9836993c5b520de6c13f816c7906 (patch)
treefef3ca9978a8b0d82beae7ade6cbef1c4a02d416
parentAdd missing */ after $OpenBSD$ tag (diff)
downloadwireguard-openbsd-96ecfaaf8b2b9836993c5b520de6c13f816c7906.tar.xz
wireguard-openbsd-96ecfaaf8b2b9836993c5b520de6c13f816c7906.zip
Properly scale string length measurements for PostScript and PDF output;
this doesn't change anything for ASCII and UTF-8. Problem reported by bentley@.
-rw-r--r--usr.bin/mandoc/mdoc_term.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 6652ff5b31f..02ddb33eb86 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_term.c,v 1.181 2014/09/17 20:17:55 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.182 2014/10/13 22:00:42 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -539,8 +539,10 @@ a2width(const struct termp *p, const char *v)
struct roffsu su;
assert(v);
- if ( ! a2roffsu(v, &su, SCALE_MAX))
+ if ( ! a2roffsu(v, &su, SCALE_MAX)) {
SCALE_HS_INIT(&su, term_strlen(p, v));
+ su.scale /= term_strlen(p, "0");
+ }
return(term_hspan(p, &su));
}
@@ -558,8 +560,10 @@ a2offs(const struct termp *p, const char *v)
return(term_len(p, p->defindent + 1));
else if (0 == strcmp(v, "indent-two"))
return(term_len(p, (p->defindent + 1) * 2));
- else if ( ! a2roffsu(v, &su, SCALE_MAX))
+ else if ( ! a2roffsu(v, &su, SCALE_MAX)) {
SCALE_HS_INIT(&su, term_strlen(p, v));
+ su.scale /= term_strlen(p, "0");
+ }
return(term_hspan(p, &su));
}