From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Backed out margin calculations in favour of much simpler rule of
Date: Sun, 4 Jul 2010 15:24:00 -0400 (EDT) [thread overview]
Message-ID: <201007041924.o64JO0NF015904@krisdoz.my.domain> (raw)
Log Message:
-----------
Backed out margin calculations in favour of much simpler rule of thumb:
margins are 1/9 the length/width.
Modified Files:
--------------
mdocml:
mandoc.1
term_ps.c
Revision Data
-------------
Index: mandoc.1
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.1,v
retrieving revision 1.69
retrieving revision 1.70
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.69 -r1.70
--- mandoc.1
+++ mandoc.1
@@ -303,10 +303,8 @@ PostScript
Level-2 pages may be generated by
.Fl T Ns Cm ps .
Output pages default to letter sized and are rendered in the Times font
-family, 11-point. Margins are calculated as the maximum of either space
-left by page width minus text width (65
-.Sq m
-characters), or given default margins of 2 cm.
+family, 11-point.
+Margins are calculated as 1/9 the page length and width.
.Pp
Special characters are rendered as in
.Sx ASCII Output .
Index: term_ps.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ps.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lterm_ps.c -Lterm_ps.c -u -p -r1.27 -r1.28
--- term_ps.c
+++ term_ps.c
@@ -393,7 +393,7 @@ void *
ps_alloc(char *outopts)
{
struct termp *p;
- size_t pagex, pagey, margin, lineheight, m1, m2;
+ size_t pagex, pagey, marginx, marginy, lineheight;
const char *toks[2];
const char *pp;
char *v;
@@ -476,28 +476,23 @@ ps_alloc(char *outopts)
pagex = PNT2AFM(p, ((double)pagex * 2.834));
pagey = PNT2AFM(p, ((double)pagey * 2.834));
- /*
- * Calculate margins. First get the minimum text width: either
- * page minus margins or width of 65 'm' characters. Set total
- * margins to page size minus text width.
- */
+ /* Margins are 1/9 the page x and y. */
- m1 = ps_width(p, 'm') * 65;
- m2 = pagex - (2 * PNT2AFM(p, MINMARGIN_PNT));
- margin = (pagex - (m1 < m2 ? m1 : m2)) / 2;
+ marginx = (size_t)((double)pagex / 9.0);
+ marginy = (size_t)((double)pagey / 9.0);
lineheight = PNT2AFM(p, 16);
p->engine.ps.width = pagex;
p->engine.ps.height = pagey;
- p->engine.ps.header = pagey - (margin / 2) - (lineheight / 2);
- p->engine.ps.top = pagey - margin;
- p->engine.ps.footer = (margin / 2) - (lineheight / 2);
- p->engine.ps.bottom = margin;
- p->engine.ps.left = margin;
+ p->engine.ps.header = pagey - (marginy / 2) - (lineheight / 2);
+ p->engine.ps.top = pagey - marginy;
+ p->engine.ps.footer = (marginy / 2) - (lineheight / 2);
+ p->engine.ps.bottom = marginy;
+ p->engine.ps.left = marginx;
p->engine.ps.lineheight = lineheight;
- p->defrmargin = pagex - (margin * 2);
+ p->defrmargin = pagex - (marginx * 2);
return(p);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2010-07-04 19:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201007041924.o64JO0NF015904@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).