summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-13 22:00:43 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-13 22:00:43 +0000
commita43b2dbe89bb4cc37c08cdb56c668c17f5a6c47c (patch)
tree347a951a4aaf6209488f71d5617e74c049402e55
parent352c74d9b34b60a61ac8f13e89e8dd4da71d9be3 (diff)
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));
}