From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-4.sys.kth.se (smtp-4.sys.kth.se [130.237.48.193]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s7C14dW8017201 for ; Mon, 11 Aug 2014 21:04:44 -0400 (EDT) Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 3D291294; Tue, 12 Aug 2014 03:04:38 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id PMdovBmJFCYL; Tue, 12 Aug 2014 03:04:28 +0200 (CEST) X-KTH-Auth: kristaps [2a02:1205:5033:5b0:2c0f:fa2a:73a4:f9ba] X-KTH-mail-from: kristaps@bsd.lv Received: from [IPv6:2a02:1205:5033:5b0:2c0f:fa2a:73a4:f9ba] (unknown [IPv6:2a02:1205:5033:5b0:2c0f:fa2a:73a4:f9ba]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 0DABD11D; Tue, 12 Aug 2014 03:04:18 +0200 (CEST) Message-ID: <53E9680C.9050702@bsd.lv> Date: Tue, 12 Aug 2014 03:04:12 +0200 From: Kristaps Dzonsons User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 To: Ingo Schwarze CC: tech@mdocml.bsd.lv Subject: Re: \w'blah'u issues (really: 'u' scaling width) References: <53E653F4.2030402@bsd.lv> <20140809204126.GG30999@iris.usta.de> In-Reply-To: <20140809204126.GG30999@iris.usta.de> Content-Type: multipart/mixed; boundary="------------090202060701020205070803" This is a multi-part message in MIME format. --------------090202060701020205070803 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Ingo, Enclosed are the horizontal adjustments as per your suggestions. (NOT the vertical ones yet.) To test this, I simply ran mandoc and groff side-by-side with both -Tascii and -Tps with each test unit having a resulting non-zero length. They're more-or-less similar, but if we want to be precisely the same, there's more work to be done. Best, Kristaps --------------090202060701020205070803 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="hspaces.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="hspaces.diff" Index: html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v retrieving revision 1.160 diff -u -p -r1.160 html.c --- html.c 10 Aug 2014 23:54:41 -0000 1.160 +++ html.c 12 Aug 2014 01:02:16 -0000 @@ -759,6 +759,8 @@ bufcat_su(struct html *h, const char *p, v = su->scale; if (SCALE_MM == su->unit && 0.0 == (v /= 100.0)) v = 1.0; + else if (SCALE_BU == su->unit) + v /= 24.0; bufcat_fmt(h, "%s: %.2f%s;", p, v, roffscales[su->unit]); } Index: term_ascii.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ascii.c,v retrieving revision 1.28 diff -u -p -r1.28 term_ascii.c --- term_ascii.c 10 Aug 2014 23:54:41 -0000 1.28 +++ term_ascii.c 12 Aug 2014 01:02:16 -0000 @@ -230,31 +230,41 @@ ascii_hspan(const struct termp *p, const 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 * 2750.0; 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; } Index: term_ps.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ps.c,v retrieving revision 1.63 diff -u -p -r1.63 term_ps.c --- term_ps.c 10 Aug 2014 23:54:41 -0000 1.63 +++ term_ps.c 12 Aug 2014 01:02:17 -0000 @@ -1117,28 +1117,32 @@ ps_hspan(const struct termp *p, const st */ switch (su->unit) { - case SCALE_CM: - r = PNT2AFM(p, su->scale * 28.34); - break; - case SCALE_IN: - r = PNT2AFM(p, su->scale * 72.0); + case SCALE_BU: + r = PNT2AFM(p, su->scale * 6.0 / 240.0); break; - case SCALE_PC: - r = PNT2AFM(p, su->scale * 12.0); - break; - case SCALE_PT: - r = PNT2AFM(p, su->scale * 100.0); + case SCALE_CM: + r = PNT2AFM(p, su->scale * 72.0 / 2.54); break; case SCALE_EM: r = su->scale * fonts[(int)TERMFONT_NONE].gly[109 - 32].wx; break; - case SCALE_MM: - r = PNT2AFM(p, su->scale * 2.834); - break; case SCALE_EN: r = su->scale * fonts[(int)TERMFONT_NONE].gly[110 - 32].wx; + break; + case SCALE_IN: + r = PNT2AFM(p, su->scale * 72.0); + break; + case SCALE_MM: + r = su->scale * + fonts[(int)TERMFONT_NONE].gly[109 - 32].wx / 100.0; + break; + case SCALE_PC: + r = PNT2AFM(p, su->scale * 12.0); + break; + case SCALE_PT: + r = PNT2AFM(p, su->scale * 1.0); break; case SCALE_VS: r = su->scale * p->ps->lineheight; --------------090202060701020205070803-- -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv