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 s79H22U0007302 for ; Sat, 9 Aug 2014 13:02:02 -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 8764F222 for ; Sat, 9 Aug 2014 19:02:01 +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 17IvwUd20FIt for ; Sat, 9 Aug 2014 19:01:51 +0200 (CEST) X-KTH-Auth: kristaps [2a02:1205:5033:5b0:c187:c525:e154:78f6] X-KTH-mail-from: kristaps@bsd.lv X-KTH-rcpt-to: tech@mdocml.bsd.lv Received: from [IPv6:2a02:1205:5033:5b0:c187:c525:e154:78f6] (unknown [IPv6:2a02:1205:5033:5b0:c187:c525:e154:78f6]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 3F729125 for ; Sat, 9 Aug 2014 19:01:42 +0200 (CEST) Message-ID: <53E653F4.2030402@bsd.lv> Date: Sat, 09 Aug 2014 19:01:40 +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: tech@mdocml.bsd.lv Subject: \w'blah'u issues (really: 'u' scaling width) Content-Type: multipart/mixed; boundary="------------030204070301050100020908" This is a multi-part message in MIME format. --------------030204070301050100020908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, Earlier I mentioned, as an aside, that OpenGL manuals look bad. Try rendering gluPerspective to see what I mean. (Attached.) I tracked this down to the following: .SH PARAMETERS .TP \w'\fIaspect\fP\ \ 'u \f2fovy\fP Specifies the field of view angle, in degrees, in the \f2y\fP direction. .TP \f2aspect\fP Note that the width of the TP head is being set to the contents of \w'xxx'. So this should be interpreted as .Tp u which should amount to 8 character widths. However, in roff.c:630, we multiply this width by 24. As a result, everything's wonky. (8 * 24 = a long line) At first I thought that we should just yank the 24. But in running a little test, it seems that the \w'' doesn't calculate the string width in characters, but in magic internal units. So it's not that we shouldn't multiply by 24, but instead that the "u" scaling unit should *divide* by 24. The test was: .TH FOO 1 .TP \w'h'u hello world .TP 24u hello world .TP 48u hello world These now display similarly between mandoc and nroff with the enclosed patch, though I haven't tested it exhaustively. Thoughts? Best, Kristaps --------------030204070301050100020908 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="gluPerspective.3" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gluPerspective.3" '\" e '\"macro stdmacro .ds Vn Version 1.2 .ds Dt 6 March 1997 .ds Re Release 1.2.0 .ds Dp May 22 14:54 .ds Dm 0 May 22 14: .ds Xs 14699 5 .TH GLUPERSPECTIVE 3G .SH NAME .B "gluPerspective \- set up a perspective projection matrix .SH C SPECIFICATION void \f3gluPerspective\fP( GLdouble \fIfovy\fP, .nf .ta \w'\f3void \fPgluPerspective( 'u GLdouble \fIaspect\fP, GLdouble \fIzNear\fP, GLdouble \fIzFar\fP ) .fi .SH PARAMETERS .TP \w'\fIaspect\fP\ \ 'u \f2fovy\fP Specifies the field of view angle, in degrees, in the \f2y\fP direction. .TP \f2aspect\fP Specifies the aspect ratio that determines the field of view in the \f2x\fP direction. The aspect ratio is the ratio of \f2x\fP (width) to \f2y\fP (height). .TP \f2zNear\fP Specifies the distance from the viewer to the near clipping plane (always positive). .TP \f2zFar\fP Specifies the distance from the viewer to the far clipping plane (always positive). .SH DESCRIPTION \%\f3gluPerspective\fP specifies a viewing frustum into the world coordinate system. In general, the aspect ratio in \%\f3gluPerspective\fP should match the aspect ratio of the associated viewport. For example, aspect = 2.0 means the viewer's angle of view is twice as wide in \f2x\fP as it is in \f2y\fP. If the viewport is twice as wide as it is tall, it displays the image without distortion. .P The matrix generated by \%\f3gluPerspective\fP is multipled by the current matrix, just as if \f3glMultMatrix\fP were called with the generated matrix. To load the perspective matrix onto the current matrix stack instead, precede the call to \%\f3gluPerspective\fP with a call to \f3glLoadIdentity\fP. .P Given \f2f\fP defined as follows: .sp .ce f = cotangent(fovy/2) The generated matrix is .Bd -literal f ------------ 0 0 0 aspect 0 f 0 0 zFar+zNear 2*zFar*zNear 0 0 ---------- ------------ zNear-zFar zNear-zFar 0 0 -1 0 .Ed .SH NOTES Depth buffer precision is affected by the values specified for \f2zNear\fP and \f2zFar\fP. The greater the ratio of \f2zFar\fP to \f2zNear\fP is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other. If .ce r = zFar/zNear .P roughly log2(r) bits of depth buffer precision are lost. Because r approaches infinity as \f2zNear\fP approaches 0, \f2zNear\fP must never be set to 0. .SH SEE ALSO \f3glFrustum\fP, \f3glLoadIdentity\fP, \f3glMultMatrix\fP, \%\f3gluOrtho2D\fP --------------030204070301050100020908 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="scale.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="scale.diff" Index: term_ps.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ps.c,v retrieving revision 1.62 diff -u -p -r1.62 term_ps.c --- term_ps.c 1 Aug 2014 19:25:52 -0000 1.62 +++ term_ps.c 9 Aug 2014 16:59:03 -0000 @@ -1145,6 +1145,9 @@ ps_hspan(const struct termp *p, const st case SCALE_VS: r = su->scale * p->ps->lineheight; break; + case SCALE_BU: + r = PNT2AFM(p, su->scale / 3.0); + break; default: r = su->scale; break; Index: term_ascii.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ascii.c,v retrieving revision 1.27 diff -u -p -r1.27 term_ascii.c --- term_ascii.c 1 Aug 2014 19:25:52 -0000 1.27 +++ term_ascii.c 9 Aug 2014 16:59:04 -0000 @@ -255,6 +255,9 @@ ascii_hspan(const struct termp *p, const case SCALE_VS: r = su->scale * 2.0 - 1.0; break; + case SCALE_BU: + r = su->scale / 24.0; + break; default: r = su->scale; break; Index: term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v retrieving revision 1.226 diff -u -p -r1.226 term.c --- term.c 1 Aug 2014 19:38:29 -0000 1.226 +++ term.c 9 Aug 2014 16:59:04 -0000 @@ -786,6 +786,9 @@ term_vspan(const struct termp *p, const case SCALE_VS: r = su->scale; break; + case SCALE_BU: + r = su->scale / 24.0; + break; default: r = su->scale - 1.0; break; Index: html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v retrieving revision 1.159 diff -u -p -r1.159 html.c --- html.c 23 Jul 2014 15:00:08 -0000 1.159 +++ html.c 9 Aug 2014 16:59:04 -0000 @@ -761,6 +761,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; + if (SCALE_BU == su->unit) + v /= 24.0; bufcat_fmt(h, "%s: %.2f%s;", p, v, roffscales[su->unit]); } --------------030204070301050100020908-- -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv