summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-18 11:52:18 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-18 11:52:18 +0000
commit875d1ed3815d5169ba16d4c2b40ca30b885bdfdf (patch)
tree08fa4f67d1cfafe3a16481a5fec9fb19151c0b70
parent99d2c05b48b4557b0fb112e8139c67f71959cdd0 (diff)
downloadmandoc-875d1ed3815d5169ba16d4c2b40ca30b885bdfdf.tar.gz
mandoc-875d1ed3815d5169ba16d4c2b40ca30b885bdfdf.tar.zst
mandoc-875d1ed3815d5169ba16d4c2b40ca30b885bdfdf.zip
Fitted -man -Tascii with scaling units (.5i, etc.).
-rw-r--r--man_term.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/man_term.c b/man_term.c
index d6582d59..b5196503 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.37 2009/10/18 11:14:04 kristaps Exp $ */
+/* $Id: man_term.c,v 1.38 2009/10/18 11:52:18 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -140,6 +140,7 @@ static void print_foot(struct termp *,
static void fmt_block_vspace(struct termp *,
const struct man_node *);
static int a2width(const char *);
+static int a2height(const char *);
void
@@ -196,6 +197,46 @@ fmt_block_vspace(struct termp *p, const struct man_node *n)
static int
+a2height(const char *p)
+{
+ struct roffsu su;
+ double r;
+
+ if ( ! a2roffsu(p, &su))
+ return(1);
+
+ switch (su.unit) {
+ case (SCALE_CM):
+ r = su.scale * 2;
+ break;
+ case (SCALE_IN):
+ r = su.scale * 6;
+ break;
+ case (SCALE_PC):
+ r = su.scale;
+ break;
+ case (SCALE_PT):
+ r = su.scale / 8;
+ break;
+ case (SCALE_MM):
+ r = su.scale / 1000;
+ break;
+ case (SCALE_VS):
+ r = su.scale;
+ break;
+ default:
+ r = su.scale - 1;
+ break;
+ }
+
+ if (r < 0.0)
+ r = 0.0;
+ return(/* LINTED */(int)
+ r);
+}
+
+
+static int
a2width(const char *p)
{
struct roffsu su;
@@ -435,7 +476,9 @@ pre_sp(DECL_ARGS)
return(0);
}
- len = atoi(n->child->string);
+ assert(MAN_TEXT == n->child->type);
+ len = a2height(n->child->string);
+
if (0 == len)
term_newln(p);
for (i = 0; i < len; i++)