Re: metafont trouble with dpdfezzz

"Dr. Werner Fink" <[email protected]>
Newsgroups gmane.comp.tex.tetex.general
Organization SuSE LINUX AG
Message-ID <[email protected]>
On Mon, May 30, 2005 at 06:05:40PM +0200, Dr. Werner Fink wrote:
> Hi,
> 
> just found out that `dvips -Ppdf' catch an error:
> 
>   werner/Tests> mktexpk --mfmode dpdfezzz --bdpi 8000 --mag 1+0/8000 --dpi 8000 tcrm1000
>   mktexpk: Running mf-nowin -progname=mf \mode:=dpdfezzz; mag:=1+0/8000; nonstopmode; input tcrm1000
>   This is METAFONT, Version 2.71828 (Web2C 7.5.4)
>   ! Enormous number has been reduced.
>   <*> \mode:=dpdfezzz; mag:=1+0/8000
>                                     ; nonstopmode; input tcrm1000
>   ? 
>   ! Emergency stop.
>   <*> \mode:=dpdfezzz; mag:=1+0/8000
>                                     ; nonstopmode; input tcrm1000
>   Transcript written on mfput.log.
>   grep: tcrm1000.log: No such file or directory
>   mktexpk: `mf-nowin -progname=mf \mode:=dpdfezzz; mag:=1+0/8000; nonstopmode; input tcrm1000' failed to make tcrm1000.8000pk.
>   werner/Tests> 
> 
> A workaround would be a recalculation of the 0/8000 value, just like
> done with
> 
>   werner/Tests> mktexpk --mfmode dpdfezzz --bdpi 8000 --mag '1+0/(4000*2)' --dpi 8000 tcrm1000
> 
> comments?

I've atached a simple fix

        Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
tetex-src-3.0-mktexpk.dif (text/plain, 848 B)
--- texk/kpathsea/tex-make.c
+++ texk/kpathsea/tex-make.c	2005-06-02 12:38:14.000000000 +0000
@@ -55,7 +55,25 @@
   (void) kpse_magstep_fix (dpi, bdpi, &m);
   
   if (m == 0)
-    sprintf (q, "%d+%d/%d", dpi / bdpi, dpi % bdpi, bdpi);
+    {
+      if (bdpi <= 4000)
+	sprintf (q, "%u+%u/%u", dpi / bdpi, dpi % bdpi, bdpi);
+      else
+	{
+	  unsigned f = bdpi/4000;
+	  unsigned r = bdpi%4000;
+
+	  if (f > 1)
+	    {
+	      if (r > 0)
+		sprintf (q, "%u+%u/(%u*%u + %u)", dpi/bdpi, dpi%bdpi, f, (bdpi - r)/f, r);
+	      else
+		sprintf (q, "%u+%u/(%u*%u)", dpi/bdpi, dpi%bdpi, f, bdpi/f);
+	    }
+	  else
+	    sprintf (q, "%u+%u/(%u + %u)", dpi/bdpi, dpi%bdpi, bdpi, r);
+	}
+    }
   else
     { /* m is encoded with LSB being a ``half'' bit (see magstep.h).  Are
          we making an assumption here about two's complement?  Probably.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.