summaryrefslogtreecommitdiffstats
path: root/term_ascii.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2014-08-13 20:34:29 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2014-08-13 20:34:29 +0000
commitc723dfca801f93364fefe102f1daa270ad740d4f (patch)
tree1dcdbec09fc85e3b795b25697473b85609220b81 /term_ascii.c
parentad2b1e6bad9b1abd3a86026b76e5fb100aaca2e4 (diff)
downloadmandoc-c723dfca801f93364fefe102f1daa270ad740d4f.tar.gz
Begin cleaning up scaling units.
Start with the horizontal terminal specifiers, making sure that they match up with troff. Then move on to PS, PDF, and HTML, noting that we stick to the terminal default width for "u". Lastly, fix some completely-wrong documentation and note that we diverge from troff w/r/t "u".
Diffstat (limited to 'term_ascii.c')
-rw-r--r--term_ascii.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/term_ascii.c b/term_ascii.c
index 3eb03801..2c11a79c 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -230,32 +230,42 @@ ascii_hspan(const struct termp *p, const struct roffsu *su)
double r;
/*
- * Approximate based on character width. These are generated
- * entirely by eyeballing the screen, but appear to be correct.
+ * Approximate based on character width.
+ * None of these will be actually correct given that an inch on
+ * the screen depends on character size, terminal, etc., etc.
*/
-
switch (su->unit) {
+ case SCALE_BU:
+ r = su->scale * 10.0 / 240.0;
+ break;
case SCALE_CM:
- r = su->scale * 4.0;
+ r = su->scale * 10.0 / 2.54;
+ break;
+ case SCALE_FS:
+ r = su->scale * 2730.666;
break;
case SCALE_IN:
r = su->scale * 10.0;
break;
+ case SCALE_MM:
+ r = su->scale / 100.0;
+ break;
case SCALE_PC:
- r = (su->scale * 10.0) / 6.0;
+ r = su->scale * 10.0 / 6.0;
break;
case SCALE_PT:
- r = (su->scale * 10.0) / 72.0;
- break;
- case SCALE_MM:
- r = su->scale / 1000.0;
+ r = su->scale * 10.0 / 72.0;
break;
case SCALE_VS:
r = su->scale * 2.0 - 1.0;
break;
- default:
+ case SCALE_EN:
+ case SCALE_EM:
r = su->scale;
break;
+ case SCALE_MAX:
+ abort();
+ break;
}
return(r);