[tex-k] Re: Metafont bug located

Julian Gilbey J.D.Gilbey@qmw.ac.uk
Fri, 26 Jan 2001 16:19:32 +0000


--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Jan 26, 2001 at 03:29:55PM +0000, Julian Gilbey wrote:
> On Fri, Jan 26, 2001 at 01:35:41AM +0000, Julian Gilbey wrote:
> > On Mon, Jan 22, 2001 at 02:47:50PM +0000, Julian Gilbey wrote:
> > > Wow!  I got a MetaFont "This can't happen (m)" error.  Here's how I
> > > did it.
> > > [...]
> 
> The following is a partial patch to fix this bug.  I have applied it
> to the change file, not to the WEB file itself.  At the moment, it
> only examines the x-coordinates, not yet the y-coordinates.  It is not
> fully tested or rigorously justified.  It's not particularly clean,
> either.  However, Metafont still passes the trap test and produces
> identical output on the cmr10 font (comparing log files with
> loggingall; selected) when compiled with the patch.  It also no longer
> dies with break.mf or the xslhz20.mf in ljfzzz mode, as originally
> happened.

Well, it would have been nice to attach it, wouldn't it ;-)
Anyway, here it is, with the y-coordinates also fixed.  Haven't looked
at the round_diag procedure, and am not sure that I'll have time to do
so, either.  If someone could apply this patch to the Web2C change
file until Knuth can fix it himself, that would be fantastic.

   Julian

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

         Julian Gilbey, Dept of Maths, Queen Mary, Univ. of London
       Debian GNU/Linux Developer,  see http://people.debian.org/~jdg
  Donate free food to the world's hungry: see http://www.thehungersite.com/

--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mf.ch.diff"

--- mf.ch.orig	Thu Jan 25 10:41:36 2001
+++ mf.ch	Fri Jan 26 16:10:21 2001
@@ -1207,6 +1207,58 @@
 then
 @z
 
+@x [21.433,436] Try to handle bad rounding effects
+procedure xy_round;
+var @!p,@!q:pointer; {list manipulation registers}
+@y
+procedure xy_round;
+var @!p,@!q,@!last_fixed:pointer; {list manipulation registers}
+@z
+
+@x
+until cur_rounding_ptr=0;
+end
+@y
+until cur_rounding_ptr=0;
+p:=cur_spec;
+last_fixed:=cur_spec;
+repeat q:=link(p);
+  abnegate(x_coord(q),y_coord(q),right_type(q),right_type(p));
+  if cur_x<x_coord(p) then
+  begin
+    abnegate(x_coord(p),y_coord(p),right_type(p),right_type(q));
+    right_x(p):=x_coord(p);
+    left_x(q):=x_coord(p);
+    x_coord(q):=cur_x;
+    last_fixed:=p;
+  end;
+  p:=q;
+until p=last_fixed;
+end
+@z
+
+@x
+until cur_rounding_ptr=0;
+end
+@y
+until cur_rounding_ptr=0;
+p:=cur_spec;
+last_fixed:=cur_spec;
+repeat q:=link(p);
+  abnegate(x_coord(q),y_coord(q),right_type(q),right_type(p));
+  if cur_y<y_coord(p) then
+  begin
+    abnegate(x_coord(p),y_coord(p),right_type(p),right_type(q));
+    right_y(p):=y_coord(p);
+    left_y(q):=y_coord(p);
+    y_coord(q):=cur_y;
+    last_fixed:=p;
+  end;
+  p:=q;
+until p=last_fixed;
+end
+@z
+
 @x [442] Use halfp.
 @<Compute a good coordinate at a diagonal transition@>=
 begin if cur_pen=null_pen then pen_edge:=0

--VS++wcV0S1rZb1Fb--