aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-10-13 22:00:47 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-10-13 22:00:47 +0000
commit93daba037963fcb960efc065a77dbf9147b76659 (patch)
tree101287e78e46bd4709371d553feee166ad650b17 /mdoc_term.c
parentccddf0063047104179acf0697799f81a7f19f6ac (diff)
downloadmandoc-93daba037963fcb960efc065a77dbf9147b76659.tar.gz
mandoc-93daba037963fcb960efc065a77dbf9147b76659.tar.zst
mandoc-93daba037963fcb960efc065a77dbf9147b76659.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@.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index c4e4ec4f..e650beb5 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.282 2014/09/17 20:18:58 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.283 2014/10/13 22:00:47 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -541,8 +541,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));
}
@@ -560,8 +562,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));
}