home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume25 / dvi / patch02 / patch-1.7-1.8 < prev   
Encoding:
Text File  |  1991-11-11  |  33.8 KB  |  1,211 lines

  1. *** tmp/Makefile    Mon May 20 19:05:45 1991
  2. --- Makefile    Tue Oct 22 10:20:07 1991
  3. ***************
  4. *** 1,5
  5.   # Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  6. ! # $Header: Makefile,v 1.24 91/05/20 20:05:44 hmgr Exp $
  7.   
  8.   CXX = CC
  9.   .SUFFIXES: .C
  10.  
  11. --- 1,5 -----
  12.   # Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  13. ! # $Header: Makefile,v 1.28 91/10/22 11:20:05 hmgr Exp $
  14.   
  15.   CXX = CC
  16.   .SUFFIXES: .C
  17. ***************
  18. *** 10,15
  19.   # -DBSD            for BSD derivatives
  20.   # -DMSDOS        for Zortech C++ - also run "make msdos-files"
  21.   # -DFREE_TAKES_CHAR    if you have a free(char*) instead of free(void*)
  22.   # -DHP2686_FPATH=/path1:/path2:...
  23.   #            to modify the default font search path
  24.   CFLAGS = -g
  25.  
  26. --- 10,17 -----
  27.   # -DBSD            for BSD derivatives
  28.   # -DMSDOS        for Zortech C++ - also run "make msdos-files"
  29.   # -DFREE_TAKES_CHAR    if you have a free(char*) instead of free(void*)
  30. + # -DUSE_DIRENT        use <dirent.h> instead of <ndir.h> or <sys/dir.h>
  31. + #
  32.   # -DHP2686_FPATH=/path1:/path2:...
  33.   #    to modify the default font search path for your system
  34.   #
  35. ***************
  36. *** 11,17
  37.   # -DMSDOS        for Zortech C++ - also run "make msdos-files"
  38.   # -DFREE_TAKES_CHAR    if you have a free(char*) instead of free(void*)
  39.   # -DHP2686_FPATH=/path1:/path2:...
  40. ! #            to modify the default font search path
  41.   CFLAGS = -g
  42.   LIBS = -lm
  43.   
  44.  
  45. --- 13,25 -----
  46.   # -DUSE_DIRENT        use <dirent.h> instead of <ndir.h> or <sys/dir.h>
  47.   #
  48.   # -DHP2686_FPATH=/path1:/path2:...
  49. ! #    to modify the default font search path for your system
  50. ! #
  51. ! # -DMF_SCRIPT=\"script\"
  52. ! #    where the usage is: script dpi bdpi magnification [mode]
  53. ! #    script tries to build the needed font on-the-fly
  54. ! #    you can use the "MakeTeXPK" script that comes with the dvips package
  55. ! #
  56.   CFLAGS = -g
  57.   LIBS = -lm
  58.   
  59. ***************
  60. *** 19,25
  61.       util.C global.C stack.C dirs.C dvi.C font.C readfont.C gffont.C \
  62.       pkfont.C bitvec.C hp2684.h hp33440.h hp2686.h defs.h extern.h \
  63.       dirs.h font.h dev.h darray.h boolean.h bitvec.h \
  64. !     ljdump.c
  65.   
  66.   OBJS = main.o dev.o hp2686.o hp33440.o hp2684.o util.o global.o stack.o \
  67.       dirs.o dvi.o font.o readfont.o gffont.o pkfont.o bitvec.o
  68.  
  69. --- 27,33 -----
  70.       util.C global.C stack.C dirs.C dvi.C font.C readfont.C gffont.C \
  71.       pkfont.C bitvec.C hp2684.h hp33440.h hp2686.h defs.h extern.h \
  72.       dirs.h font.h dev.h darray.h boolean.h bitvec.h \
  73. !     ljdump.c MakeTeXPK
  74.   
  75.   OBJS = main.o dev.o hp2686.o hp33440.o hp2684.o util.o global.o stack.o \
  76.       dirs.o dvi.o font.o readfont.o gffont.o pkfont.o bitvec.o
  77. *** tmp/README    Thu May 23 10:45:10 1991
  78. --- README    Tue Oct 22 10:42:57 1991
  79. ***************
  80. *** 1,4
  81. ! $Header: README,v 1.15 91/05/23 11:45:11 hmgr Exp $
  82.   
  83.   Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  84.   You can do what you wish with this as long as
  85.  
  86. --- 1,4 -----
  87. ! $Header: README,v 1.22 91/10/22 11:42:54 hmgr Exp $
  88.   
  89.   Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  90.   You can do what you wish with this as long as
  91. ***************
  92. *** 59,64
  93.   You will have to define -DMSDOS or -DBSD in the Makefile if you are on
  94.   those systems.  My Sparc also needed -DFREE_TAKES_CHAR.
  95.   
  96.   Use "make ljdump" to build the "ljdump" program.  This is useful for
  97.   debugging dvi by converting PCL to a semi-human-readable dump.
  98.   
  99.  
  100. --- 59,75 -----
  101.   You will have to define -DMSDOS or -DBSD in the Makefile if you are on
  102.   those systems.  My Sparc also needed -DFREE_TAKES_CHAR.
  103.   
  104. + You can make dvi run a script to build missing fonts on the fly.  Add
  105. + the -DMF_SCRIPT="script" definition in the Makefile if you want this.
  106. + The script is run as "script dpi bdpi magnification [mode]".
  107. + You can use the "MakeTeXPK" script that comes from the fine dvips
  108. + package by Tomas Rokicki at Stanford University.  dvips, which converts
  109. + DVI output to PostScript, may be ftp-ed from labrea.stanford.edu.  An
  110. + internal-HP version of MakeTeXPK is included with this package, though
  111. + it doubtless will need hacking to make it work on your system.  This
  112. + feature is unlikely to work on MSDOS.
  113.   Use "make ljdump" to build the "ljdump" program.  This is useful for
  114.   debugging dvi by converting PCL to a semi-human-readable dump.
  115.   
  116. ***************
  117. *** 72,78
  118.   available to others too.
  119.   
  120.   
  121.       -- Parag Patel <parag@sde.hp.com>
  122.   
  123.   
  124.  
  125. --- 83,88 -----
  126.   available to others too.
  127.   
  128.   
  129.       -- Parag Patel <parag@sde.hp.com>
  130.   
  131.   
  132. ***************
  133. *** 79,85
  134.   
  135.   --------------------REVISION-INFO----------------------
  136.   
  137. ! 1.6    released on HP INTERX Contrib Tape and comp.sources.misc
  138.   
  139.   1.7    first bug-fix release
  140.       files modified: Makefile README extern.h main.C readfont.C hp2686.h
  141.  
  142. --- 89,95 -----
  143.   
  144.   --------------------REVISION-INFO----------------------
  145.   
  146. ! 1.6    released on HP INTEREX Contrib Tape and comp.sources.misc
  147.   
  148.   1.7    first bug-fix release
  149.       files modified: Makefile README extern.h main.C readfont.C hp2686.h
  150. ***************
  151. *** 87,89
  152.       version string slightly modified so say_hello() in main.C works
  153.       also look for fonts such as /path/cmr7.300pk and cmr7.300gf
  154.       allow overriding default font search path from Makefile
  155.  
  156. --- 97,108 -----
  157.       version string slightly modified so say_hello() in main.C works
  158.       also look for fonts such as /path/cmr7.300pk and cmr7.300gf
  159.       allow overriding default font search path from Makefile
  160. + 1.8    use DVIFONTPATH env var instead of FONTPATH to search for fonts
  161. +     try running a script which runs Metafont to generate fonts on the fly
  162. +         (this only works under Unix right now)
  163. +     LaserJet+ cannot really handle 8-bit data - back to the old code
  164. +     dvi -v runs properly when strings are put into read-only memory
  165. +     Set -DUSE_DIRENT in the Makefile if you have <dirent.h> and not
  166. +         <ndir.h> or <sys/dir.h>
  167. +     dvi compiles and runs using C++ 3.0 now
  168. *** tmp/dirs.C    Fri Feb 22 14:57:30 1991
  169. --- dirs.C    Mon Aug 19 16:45:52 1991
  170. ***************
  171. *** 1,5
  172.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  173. ! static const char rcsid[] = "$Header: dirs.C,v 1.10 91/02/22 15:57:16 hmgr Exp $";
  174.   
  175.   // read font directory names into memory for fast traversal
  176.   //
  177.  
  178. --- 1,5 -----
  179.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  180. ! static const char rcsid[] = "$Header: dirs.C,v 1.11 91/08/19 17:45:50 hmgr Exp $";
  181.   
  182.   // read font directory names into memory for fast traversal
  183.   //
  184. ***************
  185. *** 12,18
  186.   #define    d_name    name
  187.   #else
  188.   #ifdef    BSD
  189. ! #include <sys/dir.h>
  190.   #else
  191.   #include <ndir.h>
  192.   #endif
  193.  
  194. --- 12,18 -----
  195.   #define    d_name    name
  196.   #else
  197.   #ifdef    BSD
  198. ! #  include <sys/dir.h>
  199.   #else
  200.   #  ifdef USE_DIRENT
  201.   #      include <dirent.h>
  202. ***************
  203. *** 14,20
  204.   #ifdef    BSD
  205.   #include <sys/dir.h>
  206.   #else
  207. ! #include <ndir.h>
  208.   #endif
  209.   #endif
  210.   
  211.  
  212. --- 14,24 -----
  213.   #ifdef    BSD
  214.   #  include <sys/dir.h>
  215.   #else
  216. ! #  ifdef USE_DIRENT
  217. ! #      include <dirent.h>
  218. ! #  else
  219. ! #      include <ndir.h>
  220. ! #  endif
  221.   #endif
  222.   #endif
  223.   
  224. ***************
  225. *** 82,88
  226.       for (FIND *ent = findfirst(dos_dirpath, FA_DIREC); ent != NULL;
  227.           ent = findnext())
  228.   #else
  229. !     for (direct * ent = readdir(dir); ent != NULL; ent = readdir(dir))
  230.   #endif
  231.       {
  232.           char *s = strchr(ent->d_name, '.');
  233.  
  234. --- 86,96 -----
  235.       for (FIND *ent = findfirst(dos_dirpath, FA_DIREC); ent != NULL;
  236.           ent = findnext())
  237.   #else
  238. ! #  ifdef USE_DIRENT
  239. !     for (dirent *ent = readdir(dir); ent != NULL; ent = readdir(dir))
  240. ! #  else
  241. !     for (direct *ent = readdir(dir); ent != NULL; ent = readdir(dir))
  242. ! #  endif
  243.   #endif
  244.       {
  245.           char *s = strchr(ent->d_name, '.');
  246. *** tmp/dvi.1    Fri Feb 22 14:53:53 1991
  247. --- dvi.1    Mon Aug 19 16:41:17 1991
  248. ***************
  249. *** 1,5
  250.   .\" Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  251. ! .\" $Header: dvi.1,v 1.29 91/02/22 15:53:38 hmgr Exp $
  252.   .TH DVI 1 unsupported
  253.   .ad b
  254.   .SH NAME
  255.  
  256. --- 1,5 -----
  257.   .\" Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  258. ! .\" $Header: dvi.1,v 1.30 91/08/19 17:41:15 hmgr Exp $
  259.   .TH DVI 1 unsupported
  260.   .ad b
  261.   .SH NAME
  262. ***************
  263. *** 117,123
  264.   should look for either the GF or PK format font files.
  265.   The directories should have subdirectories for various magnifications.
  266.   Overrides the value of the environment var
  267. ! .B FONTPATH
  268.   if it exists.
  269.   The separator between the various path is platform dependent.
  270.   See the section on PLATFORM DEPENDENCIES for details.
  271.  
  272. --- 117,123 -----
  273.   should look for either the GF or PK format font files.
  274.   The directories should have subdirectories for various magnifications.
  275.   Overrides the value of the environment var
  276. ! .B DVIFONTPATH
  277.   if it exists.
  278.   The separator between the various path is platform dependent.
  279.   See the section on PLATFORM DEPENDENCIES for details.
  280. ***************
  281. *** 196,202
  282.   It searches along a default directory path for a printer
  283.   to find the necessary fonts.
  284.   The environment variable
  285. ! .B FONTPATH
  286.   or the
  287.   .B \-d
  288.   option
  289.  
  290. --- 196,202 -----
  291.   It searches along a default directory path for a printer
  292.   to find the necessary fonts.
  293.   The environment variable
  294. ! .B DVIFONTPATH
  295.   or the
  296.   .B \-d
  297.   option
  298. ***************
  299. *** 201,207
  300.   .B \-d
  301.   option
  302.   may be used to override this if desired.
  303. ! The default FONTPATHs are listed in the PRINTER DEPENDENCIES section below.
  304.   .PP
  305.   The GF format is part of the normal output from the Metafont program.
  306.   The PK format is a packed version of the GF file and is
  307.  
  308. --- 201,207 -----
  309.   .B \-d
  310.   option
  311.   may be used to override this if desired.
  312. ! The default DVIFONTPATHs are listed in the PRINTER DEPENDENCIES section below.
  313.   .PP
  314.   The GF format is part of the normal output from the Metafont program.
  315.   The PK format is a packed version of the GF file and is
  316. ***************
  317. *** 307,313
  318.   Other commands may be supported in the future.
  319.   .SH PLATFORM DEPENDENCIES
  320.   The separator between the component parts
  321. ! in either the FONTPATH environment variable
  322.   or the optional fontpath specification is platform dependent.
  323.   Default separator for UNIX is the colon character,
  324.   for MSDOS it is the semicolon character.
  325.  
  326. --- 307,313 -----
  327.   Other commands may be supported in the future.
  328.   .SH PLATFORM DEPENDENCIES
  329.   The separator between the component parts
  330. ! in either the DVIFONTPATH environment variable
  331.   or the optional fontpath specification is platform dependent.
  332.   Default separator for UNIX is the colon character,
  333.   for MSDOS it is the semicolon character.
  334. ***************
  335. *** 321,327
  336.   .br
  337.   Default options: page-reversal on, portrait
  338.   .br
  339. ! Default FONTPATH for UNIX:
  340.   /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  341.   .br
  342.   Default FONTPATH for MSDOS:
  343.  
  344. --- 321,327 -----
  345.   .br
  346.   Default options: page-reversal on, portrait
  347.   .br
  348. ! Default DVIFONTPATH for UNIX:
  349.   /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  350.   .br
  351.   Default DVIFONTPATH for MSDOS:
  352. ***************
  353. *** 324,330
  354.   Default FONTPATH for UNIX:
  355.   /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  356.   .br
  357. ! Default FONTPATH for MSDOS:
  358.   /usr/lib/tex/fontbits/laser;/usr/lib/tex/fnt;/usr/local/tex/fontbits/laser
  359.   .TP
  360.   .B HP33440 LaserJetII ljII lj2 laser2 laserII default
  361.  
  362. --- 324,330 -----
  363.   Default DVIFONTPATH for UNIX:
  364.   /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  365.   .br
  366. ! Default DVIFONTPATH for MSDOS:
  367.   /usr/lib/tex/fontbits/laser;/usr/lib/tex/fnt;/usr/local/tex/fontbits/laser
  368.   .TP
  369.   .B HP33440 LaserJetII ljII lj2 laser2 laserII default
  370. ***************
  371. *** 336,342
  372.   .br
  373.   Default options: page-reversal off, portrait
  374.   .br
  375. ! Default FONTPATH: <same as LJ+>
  376.   .TP
  377.   .B HP33447 LaserJetIID ljIId lj2d laser2D laserIID
  378.   HP LaserJetIID \-
  379.  
  380. --- 336,342 -----
  381.   .br
  382.   Default options: page-reversal off, portrait
  383.   .br
  384. ! Default DVIFONTPATH: <same as LJ+>
  385.   .TP
  386.   .B HP33447 LaserJetIID ljIId lj2d laser2D laserIID
  387.   HP LaserJetIID \-
  388. ***************
  389. *** 344,350
  390.   .br
  391.   Default options: page-reversal off, portrait, double-sided vertical binding
  392.   .br
  393. ! Default FONTPATH: <same as LJ+>
  394.   .TP
  395.   .B HP2684 JumboJet lj2000 laser2000 lj2k
  396.   HP LaserJet 2000 \-
  397.  
  398. --- 344,350 -----
  399.   .br
  400.   Default options: page-reversal off, portrait, double-sided vertical binding
  401.   .br
  402. ! Default DVIFONTPATH: <same as LJ+>
  403.   .TP
  404.   .B HP2684 JumboJet lj2000 laser2000 lj2k
  405.   HP LaserJet 2000 \-
  406. ***************
  407. *** 353,359
  408.   .br
  409.   Default options: page-reversal off, portrait, double-sided vertical binding
  410.   .br
  411. ! Default FONTPATH: <same as LJ+>
  412.   .SH FILES
  413.   .nf
  414.   /usr/lib/tex/fontbits/<printer>/<magdirs>/<PK fonts>
  415.  
  416. --- 353,359 -----
  417.   .br
  418.   Default options: page-reversal off, portrait, double-sided vertical binding
  419.   .br
  420. ! Default DVIFONTPATH: <same as LJ+>
  421.   .SH FILES
  422.   .nf
  423.   /usr/lib/tex/fontbits/<printer>/<magdirs>/<PK fonts>
  424. *** tmp/dvi.C    Fri Feb 22 14:57:47 1991
  425. --- dvi.C    Mon Aug 19 16:46:03 1991
  426. ***************
  427. *** 1,5
  428.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  429. ! static const char rcsid[] = "$Header: dvi.C,v 1.24 91/02/22 15:57:33 hmgr Exp $";
  430.   
  431.   // dvi scanning routines
  432.   //
  433.  
  434. --- 1,5 -----
  435.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  436. ! static const char rcsid[] = "$Header: dvi.C,v 1.25 91/08/19 17:46:00 hmgr Exp $";
  437.   
  438.   // dvi scanning routines
  439.   //
  440. *** tmp/extern.h    Fri May 17 15:28:16 1991
  441. --- extern.h    Thu Oct 10 10:15:55 1991
  442. ***************
  443. *** 1,5
  444.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  445. ! // $Header: extern.h,v 1.25 91/05/17 16:28:17 hmgr Exp $
  446.   
  447.   // externs for various LaserJet+ DVI filter functions
  448.   //
  449.  
  450. --- 1,5 -----
  451.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  452. ! // $Header: extern.h,v 1.26 91/09/13 16:14:20 hmgr Exp $
  453.   
  454.   // externs for various LaserJet+ DVI filter functions
  455.   //
  456. ***************
  457. *** 94,100
  458.   #if FREE_TAKES_CHAR
  459.   inline void  strfree(const char *s) { if (s != NULL) free((char *)s); }
  460.   #else
  461. ! inline void  strfree(const char *s) { if (s != NULL) free((const void *)s); }
  462.   #endif
  463.   inline char *strdup(const char *s)
  464.       { return s != NULL ? strcpy((char*)malloc(strlen(s) + 1), s) : NULL; }
  465.  
  466. --- 94,100 -----
  467.   #if FREE_TAKES_CHAR
  468.   inline void  strfree(const char *s) { if (s != NULL) free((char *)s); }
  469.   #else
  470. ! inline void  strfree(const char *s) { if (s != NULL) free((void *)s); }
  471.   #endif
  472.   inline char *strdup(const char *s)
  473.       { return s != NULL ? strcpy((char*)malloc(strlen(s) + 1), s) : NULL; }
  474. *** tmp/gffont.C    Fri Feb 22 14:58:20 1991
  475. --- gffont.C    Mon Aug 19 16:45:55 1991
  476. ***************
  477. *** 1,5
  478.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  479. ! static const char rcsid[] = "$Header: gffont.C,v 1.20 91/02/22 15:58:04 hmgr Exp $";
  480.   
  481.   // read font data from the METAFONT GF (generic font) files
  482.   //
  483.  
  484. --- 1,5 -----
  485.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  486. ! static const char rcsid[] = "$Header: gffont.C,v 1.21 91/08/19 17:45:52 hmgr Exp $";
  487.   
  488.   // read font data from the METAFONT GF (generic font) files
  489.   //
  490. ***************
  491. *** 85,95
  492.   
  493.       long dsize = getsval(4, fp);
  494.       debug(4, "GF designsize=%ld", dsize);
  495. !     if (f.basename != NULL && dsize >> 4 != f.designsize)
  496. !     if (dochecksum && dsize != 0 && f.designsize != 0)
  497. !         quit("Designsize in DVI and GF file %s does not match", f.path);
  498. !     else
  499. !         warn("Designsize in DVI and GF file %s does not match", f.path);
  500.   
  501.       // check the checksum (!)
  502.       long check = getuval(4, fp);
  503.  
  504. --- 85,91 -----
  505.   
  506.       long dsize = getsval(4, fp);
  507.       debug(4, "GF designsize=%ld", dsize);
  508. !     // do not bother checking the designsize - it seems pointless
  509.   
  510.       // check the checksum (!)
  511.       long check = getuval(4, fp);
  512. *** tmp/global.C    Fri Feb 22 14:57:10 1991
  513. --- global.C    Mon Aug 19 16:42:34 1991
  514. ***************
  515. *** 1,5
  516.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  517. ! static const char rcsid[] = "$Header: global.C,v 1.24 91/02/22 15:56:57 hmgr Exp $";
  518.   
  519.   // Global variables for DVI filter.
  520.   // All globally visible variables are here.
  521.  
  522. --- 1,5 -----
  523.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  524. ! static const char rcsid[] = "$Header: global.C,v 1.25 91/08/19 17:42:32 hmgr Exp $";
  525.   
  526.   // Global variables for DVI filter.
  527.   // All globally visible variables are here.
  528. ***************
  529. *** 119,125
  530.       char *str;
  531.       if (fontpath == NULL)
  532.       {
  533. !     str = getenv("FONTPATH");
  534.       if (str != NULL && *str != '\0')
  535.           fontpath = str;
  536.       }
  537.  
  538. --- 119,127 -----
  539.       char *str;
  540.       if (fontpath == NULL)
  541.       {
  542. !     str = getenv("DVIFONTPATH");
  543. !     if (str == NULL || *str == '\0')
  544. !         str = getenv("FONTPATH");    // for backward-compatibility - sorry!
  545.       if (str != NULL && *str != '\0')
  546.           fontpath = str;
  547.       }
  548. *** tmp/hp2686.C    Fri Feb 22 14:56:06 1991
  549. --- hp2686.C    Mon Aug 19 16:46:06 1991
  550. ***************
  551. *** 1,5
  552.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  553. ! static const char rcsid[] = "$Header: hp2686.C,v 1.20 91/02/22 15:55:21 hmgr Exp $";
  554.   
  555.   // HP2686 LaserJet+ and LaserJetII device-specific functions.
  556.   // The various Reference Manuals should be consulted for more
  557.  
  558. --- 1,5 -----
  559.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  560. ! static const char rcsid[] = "$Header: hp2686.C,v 1.21 91/08/19 17:46:04 hmgr Exp $";
  561.   
  562.   // HP2686 LaserJet+ and LaserJetII device-specific functions.
  563.   // The various Reference Manuals should be consulted for more
  564. ***************
  565. *** 66,74
  566.   //
  567.   const char *HP2686::char2dev(int ch, int &len)
  568.   {
  569. !     static char buf[20];
  570. !     if ((ch >= 32 && ch <= 127) || ch >= 160)
  571. !     sprintf(buf, "%c", ch);
  572.       else
  573.       sprintf(buf, "\033&p1X%c", ch);
  574.       len = strlen(buf);
  575.  
  576. --- 66,82 -----
  577.   //
  578.   const char *HP2686::char2dev(int ch, int &len)
  579.   {
  580. !     static char buf[2];
  581. !     // the LaserJet Plus can't really handle full 8-bit fonts.
  582. !     // it can handle only character codes 33-127 and 160-255
  583. !     // we'll map as many of these as possible on a lowest-code first basis
  584. !     buf[0] = buf[1] = 0;
  585. !     if (ch <= 32)
  586. !     buf[0] = ch + 160;
  587. !     else if (ch > 32 && ch <= 127)
  588. !     buf[0] = ch;
  589. !     else if (ch <= 190)
  590. !     buf[0] = ch + 65;
  591.       else
  592.       quit("LaserJet+ cannot handle true 8-bit fonts -- Sorry");
  593.       len = 1;
  594. ***************
  595. *** 70,79
  596.       if ((ch >= 32 && ch <= 127) || ch >= 160)
  597.       sprintf(buf, "%c", ch);
  598.       else
  599. !     sprintf(buf, "\033&p1X%c", ch);
  600. !     len = strlen(buf);
  601. !     if (ch == 0)
  602. !     len++;
  603.       return buf;
  604.   }
  605.   
  606.  
  607. --- 78,85 -----
  608.       else if (ch <= 190)
  609.       buf[0] = ch + 65;
  610.       else
  611. !     quit("LaserJet+ cannot handle true 8-bit fonts -- Sorry");
  612. !     len = 1;
  613.       return buf;
  614.   }
  615.   
  616. ***************
  617. *** 219,227
  618.   // 
  619.   void HP2686::downchar(font &f, fontchar &g, int ch)
  620.   {
  621. !     // describe the character and its font to the LaserJet
  622. !     printf("\033*c%ldd%dE", f.num, ch);
  623. !     downljchar(f, g, ch);
  624.   }
  625.   
  626.   // this sets up this character in the LaserJet memory so that
  627.  
  628. --- 225,249 -----
  629.   // 
  630.   void HP2686::downchar(font &f, fontchar &g, int ch)
  631.   {
  632. !     // describe the character and its font to the LaserJet Plus
  633. !     // remember, only codes 33-127 and 160-255 can be sent
  634. !     if (ch <= 32)
  635. !     {
  636. !     printf("\033*c%ldd%dE", f.num, ch + 160);
  637. !     downljchar(f, g, ch + 160);
  638. !     }
  639. !     else if (ch > 32 && ch <= 127)
  640. !     {
  641. !     printf("\033*c%ldd%dE", f.num, ch);
  642. !     downljchar(f, g, ch);
  643. !     }
  644. !     else if (ch <= 190)
  645. !     {
  646. !     printf("\033*c%ldd%dE", f.num, ch + 65);
  647. !     downljchar(f, g, ch + 65);
  648. !     }
  649. !     else
  650. !     quit("LaserJet+ cannot handle true 8-bit fonts -- Sorry!");
  651.   }
  652.   
  653.   // this sets up this character in the LaserJet memory so that
  654. *** tmp/hp33440.C    Fri Feb 22 14:56:34 1991
  655. --- hp33440.C    Mon Aug 19 16:45:57 1991
  656. ***************
  657. *** 1,5
  658.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  659. ! // $Header: hp33440.C,v 1.13 91/02/22 15:56:21 hmgr Exp $
  660.   
  661.   // LaserJetII series device-specific functions.
  662.   // The LaserJetII Reference Manual should be consulted for more
  663.  
  664. --- 1,5 -----
  665.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  666. ! // $Header: hp33440.C,v 1.15 91/08/19 17:45:54 hmgr Exp $
  667.   
  668.   // LaserJetII series device-specific functions.
  669.   // The LaserJetII Reference Manual should be consulted for more
  670. ***************
  671. *** 16,22
  672.   
  673.   // initialize the LaserJet II
  674.   HP33440::HP33440() :
  675. !     HP2686(257, 256, 32, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  676.               -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  677.   {
  678.   }
  679.  
  680. --- 16,22 -----
  681.   
  682.   // initialize the LaserJet II
  683.   HP33440::HP33440() :
  684. !     HP2686(257, 256, 16, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  685.               -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  686.   {
  687.   }
  688. ***************
  689. *** 19,24
  690.       HP2686(257, 256, 32, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  691.               -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  692.   {
  693.   }
  694.   
  695.   // LaserJetIID:
  696.  
  697. --- 19,49 -----
  698.       HP2686(257, 256, 16, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  699.               -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  700.   {
  701. + }
  702. + // convert a character number to something that the device can deal with
  703. + // for a LaserJet II
  704. + //
  705. + const char *HP33440::char2dev(int ch, int &len)
  706. + {
  707. +     static char buf[20];
  708. +     if ((ch >= 32 && ch <= 127) || ch >= 160)
  709. +     sprintf(buf, "%c", ch);
  710. +     else
  711. +     sprintf(buf, "\033&p1X%c", ch);
  712. +     len = strlen(buf);
  713. +     if (ch == 0)
  714. +     len++;
  715. +     return buf;
  716. + }
  717. + // download a character for a particular font for the LaserJet II
  718. + // 
  719. + void HP33440::downchar(font &f, fontchar &g, int ch)
  720. + {
  721. +     // describe the character and its font to the LaserJet II
  722. +     printf("\033*c%ldd%dE", f.num, ch);
  723. +     downljchar(f, g, ch);
  724.   }
  725.   
  726.   // LaserJetIID:
  727. *** tmp/hp33440.h    Fri Feb 22 14:58:53 1991
  728. --- hp33440.h    Mon Aug 19 16:46:12 1991
  729. ***************
  730. *** 1,5
  731.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  732. ! // $Header: hp33440.h,v 1.8 91/02/22 15:58:41 hmgr Exp $
  733.   
  734.   // LaserJetII series device-specific definitions.
  735.   // The LaserJetII Reference Manual should be consulted for more
  736.  
  737. --- 1,5 -----
  738.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  739. ! // $Header: hp33440.h,v 1.9 91/08/19 17:46:06 hmgr Exp $
  740.   
  741.   // LaserJetII series device-specific definitions.
  742.   // The LaserJetII Reference Manual should be consulted for more
  743. ***************
  744. *** 16,23
  745.       HP33440(int maxf, int maxc, int maxpg, int maxld, int res,
  746.               int ho, int vo, int fhmn, int fhmx, int fvmn, int fvmx,
  747.               int fwd, int fhg, char *deffp) :
  748. !     HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  749. !         fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  750.   public:
  751.       HP33440();
  752.   };
  753.  
  754. --- 16,23 -----
  755.       HP33440(int maxf, int maxc, int maxpg, int maxld, int res,
  756.               int ho, int vo, int fhmn, int fhmx, int fvmn, int fvmx,
  757.               int fwd, int fhg, char *deffp) :
  758. !         HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  759. !             fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  760.   public:
  761.       const char *char2dev(int ch, int &len);
  762.       void downchar(font &f, fontchar &g, int ch);
  763. ***************
  764. *** 19,24
  765.       HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  766.           fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  767.   public:
  768.       HP33440();
  769.   };
  770.   
  771.  
  772. --- 19,26 -----
  773.           HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  774.               fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  775.   public:
  776. +     const char *char2dev(int ch, int &len);
  777. +     void downchar(font &f, fontchar &g, int ch);
  778.       HP33440();
  779.   };
  780.   
  781. *** tmp/main.C    Fri May 17 15:28:21 1991
  782. --- main.C    Fri Sep 27 15:13:37 1991
  783. ***************
  784. *** 1,5
  785.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  786. ! static const char rcsid[] = "$Header: main.C,v 1.32 91/05/17 16:28:22 hmgr Exp $";
  787.   
  788.   // TeX DVI filter main() - just parses arguments and calls functions
  789.   //
  790.  
  791. --- 1,5 -----
  792.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  793. ! static const char rcsid[] = "$Header: main.C,v 1.33 91/08/19 17:45:57 hmgr Exp $";
  794.   
  795.   // TeX DVI filter main() - just parses arguments and calls functions
  796.   //
  797. ***************
  798. *** 7,13
  799.   
  800.   #include "defs.h"
  801.   
  802. ! static char *const whatid = "@(#)dvi 1.7 (02 April 1991)";
  803.   
  804.   static void say_hello()
  805.   {
  806.  
  807. --- 7,13 -----
  808.   
  809.   #include "defs.h"
  810.   
  811. ! static char *const whatid = "@(#)dvi 1.8 (19 August 1991)";
  812.   
  813.   static void say_hello()
  814.   {
  815. ***************
  816. *** 13,18
  817.   {
  818.       // hello message like (but unlike) TeX - the following mess should
  819.       // strip out the revision number out of the build ID string "whatid"
  820.       char *s = strchr(whatid, ' ');
  821.       while (*s == ' ')
  822.       s++;
  823.  
  824. --- 13,19 -----
  825.   {
  826.       // hello message like (but unlike) TeX - the following mess should
  827.       // strip out the revision number out of the build ID string "whatid"
  828. +     mesg("TeX DVI filter version ");
  829.       char *s = strchr(whatid, ' ');
  830.       while (*s == ' ')
  831.       s++;
  832. ***************
  833. *** 16,26
  834.       char *s = strchr(whatid, ' ');
  835.       while (*s == ' ')
  836.       s++;
  837. !     char *t = s;
  838. !     while (*t != ' ' && *t != '$' && *t != '\0')
  839. !     t++;
  840. !     *t = '\0';
  841. !     mesg("TeX DVI filter version %s for ", s);
  842.   }
  843.   
  844.   static long strtonum(char *s, char **ptr)
  845.  
  846. --- 17,25 -----
  847.       char *s = strchr(whatid, ' ');
  848.       while (*s == ' ')
  849.       s++;
  850. !     while (*s != ' ' && *s != '$' && *s != '\0')
  851. !     mesg("%c", *s++);
  852. !     mesg(" for ");
  853.   }
  854.   
  855.   static long strtonum(char *s, char **ptr)
  856. *** tmp/pkfont.C    Fri Feb 22 14:58:33 1991
  857. --- pkfont.C    Mon Aug 19 16:46:18 1991
  858. ***************
  859. *** 1,5
  860.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  861. ! static const char rcsid[] = "$Header: pkfont.C,v 1.21 91/02/22 15:58:17 hmgr Exp $";
  862.   
  863.   // read font data from the METAFONT PK (packed font) files
  864.   //
  865.  
  866. --- 1,5 -----
  867.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  868. ! static const char rcsid[] = "$Header: pkfont.C,v 1.22 91/08/19 17:46:14 hmgr Exp $";
  869.   
  870.   // read font data from the METAFONT PK (packed font) files
  871.   //
  872. ***************
  873. *** 67,77
  874.   
  875.       long dsize = getsval(4, fp);
  876.       debug(4, "PK designsize=%ld", dsize);
  877. !     if (f.basename != NULL && dsize >> 4 != f.designsize)
  878. !     if (dochecksum && dsize != 0 && f.designsize != 0)
  879. !         quit("Designsize in DVI and PK file %s does not match", f.path);
  880. !     else
  881. !         warn("Designsize in DVI and PK file %s does not match", f.path);
  882.   
  883.       // check the checksum
  884.       long check = getuval(4, fp);
  885.  
  886. --- 67,73 -----
  887.   
  888.       long dsize = getsval(4, fp);
  889.       debug(4, "PK designsize=%ld", dsize);
  890. !     // do not bother checking the designsize - it seems pointless
  891.   
  892.       // check the checksum
  893.       long check = getuval(4, fp);
  894. *** tmp/readfont.C    Mon May 20 15:12:45 1991
  895. --- readfont.C    Tue Oct 22 10:13:23 1991
  896. ***************
  897. *** 1,5
  898.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  899. ! static const char rcsid[] = "$Header: readfont.C,v 1.22 91/05/20 16:12:46 hmgr Exp $";
  900.   
  901.   // read font data from the METAFONT GF (generic font) files
  902.   //
  903.  
  904. --- 1,5 -----
  905.   // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  906. ! static const char rcsid[] = "$Header: readfont.C,v 1.24 91/10/22 11:13:21 hmgr Exp $";
  907.   
  908.   // read font data from the METAFONT GF (generic font) files
  909.   //
  910. ***************
  911. *** 4,9
  912.   // read font data from the METAFONT GF (generic font) files
  913.   //
  914.   // by Parag Patel
  915.   
  916.   #include "defs.h"
  917.   
  918.  
  919. --- 4,11 -----
  920.   // read font data from the METAFONT GF (generic font) files
  921.   //
  922.   // by Parag Patel
  923. + //
  924. + // MF_SCRIPT hacks by Peter Marvit
  925.   
  926.   #include "defs.h"
  927.   
  928. ***************
  929. *** 90,96
  930.   // the information from the DVI file - we now have to actually read the
  931.   // font file (GF or PK) to get the rest of the font's description
  932.   // 
  933. ! void setupfont(font &f)
  934.   {
  935.       if (f.path != NULL)
  936.       if (tryfile(f, f.path, "", f.basename, ""))
  937.  
  938. --- 92,98 -----
  939.   // the information from the DVI file - we now have to actually read the
  940.   // font file (GF or PK) to get the rest of the font's description
  941.   // 
  942. ! static boolean trysetupfont(font &f)
  943.   {
  944.       if (f.path != NULL)
  945.       if (tryfile(f, f.path, "", f.basename, ""))
  946. ***************
  947. *** 94,100
  948.   {
  949.       if (f.path != NULL)
  950.       if (tryfile(f, f.path, "", f.basename, ""))
  951. !         return;
  952.   
  953.       // setup the font directory cache if we need to
  954.       if (pathlist.size() < 1)
  955.  
  956. --- 96,102 -----
  957.   {
  958.       if (f.path != NULL)
  959.       if (tryfile(f, f.path, "", f.basename, ""))
  960. !         return TRUE;
  961.   
  962.       // setup the font directory cache if we need to
  963.       if (pathlist.size() < 1)
  964. ***************
  965. *** 105,111
  966.       Pathent & p = pathlist[i];
  967.   
  968.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  969. !         return;
  970.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  971.           return;
  972.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  973.  
  974. --- 107,113 -----
  975.       Pathent & p = pathlist[i];
  976.   
  977.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  978. !         return TRUE;
  979.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  980.           return TRUE;
  981.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  982. ***************
  983. *** 107,113
  984.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  985.           return;
  986.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  987. !         return;
  988.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  989.           return;
  990.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  991.  
  992. --- 109,115 -----
  993.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  994.           return TRUE;
  995.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  996. !         return TRUE;
  997.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  998.           return TRUE;
  999.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1000. ***************
  1001. *** 109,115
  1002.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1003.           return;
  1004.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1005. !         return;
  1006.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1007.           return;
  1008.   
  1009.  
  1010. --- 111,117 -----
  1011.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1012.           return TRUE;
  1013.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1014. !         return TRUE;
  1015.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1016.           return TRUE;
  1017.   
  1018. ***************
  1019. *** 111,117
  1020.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1021.           return;
  1022.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1023. !         return;
  1024.   
  1025.       char ext[30];
  1026.       sprintf(ext, ".%dpk", RESOLUTION);
  1027.  
  1028. --- 113,119 -----
  1029.       if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1030.           return TRUE;
  1031.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1032. !         return TRUE;
  1033.   
  1034.       char ext[30];
  1035.       sprintf(ext, ".%dpk", RESOLUTION);
  1036. ***************
  1037. *** 116,122
  1038.       char ext[30];
  1039.       sprintf(ext, ".%dpk", RESOLUTION);
  1040.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1041. !         return;
  1042.       sprintf(ext, ".%dgf", RESOLUTION);
  1043.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1044.           return;
  1045.  
  1046. --- 118,124 -----
  1047.       char ext[30];
  1048.       sprintf(ext, ".%dpk", RESOLUTION);
  1049.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1050. !         return TRUE;
  1051.       sprintf(ext, ".%dgf", RESOLUTION);
  1052.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1053.           return TRUE;
  1054. ***************
  1055. *** 119,125
  1056.           return;
  1057.       sprintf(ext, ".%dgf", RESOLUTION);
  1058.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1059. !         return;
  1060.       }
  1061.       quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
  1062.           f.basename, f.mag / 1000, f.mag % 1000);
  1063.  
  1064. --- 121,127 -----
  1065.           return TRUE;
  1066.       sprintf(ext, ".%dgf", RESOLUTION);
  1067.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1068. !         return TRUE;
  1069.       }
  1070.       return FALSE;
  1071.   }
  1072. ***************
  1073. *** 121,126
  1074.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1075.           return;
  1076.       }
  1077.       quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
  1078.           f.basename, f.mag / 1000, f.mag % 1000);
  1079.   }
  1080.  
  1081. --- 123,245 -----
  1082.       if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1083.           return TRUE;
  1084.       }
  1085. +     return FALSE;
  1086. + }
  1087. + #ifdef MF_SCRIPT
  1088. + // The following routine is cribbed (with permission) from the fine "dvips"
  1089. + // package by Tomas Rokicki at Stanford U.
  1090. + //
  1091. + static int magstep(int n, int bdpi)
  1092. + {
  1093. +     register float t;
  1094. +     int neg = 0;
  1095. +     if (n < 0)
  1096. +     {
  1097. +     neg = 1;
  1098. +     n = -n;
  1099. +     }
  1100. +     if (n & 1)
  1101. +     {
  1102. +     n &= ~1;
  1103. +     t = 1.095445115;
  1104. +     }
  1105. +     else
  1106. +     t = 1.0;
  1107. +     while (n > 8)
  1108. +     {
  1109. +     n -= 8;
  1110. +     t = t * 2.0736;
  1111. +     }
  1112. +     while (n > 0)
  1113. +     {
  1114. +     n -= 2;
  1115. +     t = t * 1.2;
  1116. +     }
  1117. +     if (neg)
  1118. +     return (int)(0.5 + bdpi / t);
  1119. +     else
  1120. +     return (int)(0.5 + bdpi * t);
  1121. + }
  1122. + #endif
  1123. + // Try to get and set the fonts we need.  If it fails, it probably means 
  1124. + // we can't find the fonts and will have to make them.  The #ifdef MF_SCRIPT 
  1125. + // allows an attempted creation of fonts, using an extrenal script which 
  1126. + // should call MetaFont, and then a retry of the [hopefully created] fonts.
  1127. + //
  1128. + void setupfont(font &f)
  1129. + {
  1130. +     if (trysetupfont(f))
  1131. +     return;
  1132. + #ifdef MF_SCRIPT
  1133. +     // The following code is cribbed (with permission) from the fine "dvips"
  1134. +     // package by Tomas Rokicki at Stanford U.
  1135. +     //
  1136. +     // First, the computation of magstep, stolen from dvips (makefont.c).
  1137. +     // This entire routine carefully lifted, though it works fine.
  1138. +     // 
  1139. +     int m, n, dpi, bdpi;
  1140. +     char magstepc[MAXPATHLEN + 1];
  1141. +     bdpi = RESOLUTION;
  1142. +     dpi = (int)f.mag * RESOLUTION / 1000;
  1143. +     m = 0;
  1144. +     if (dpi < bdpi)
  1145. +     {
  1146. +     while (1)
  1147. +     {
  1148. +         m--;
  1149. +         n = magstep(m, bdpi);
  1150. +         if (n == dpi)
  1151. +         break;
  1152. +         if (n < dpi || m < -40)
  1153. +         {
  1154. +         m = 9999;
  1155. +         break;
  1156. +         }
  1157. +     }
  1158. +     }
  1159. +     else if (dpi > bdpi)
  1160. +     {
  1161. +     while (1)
  1162. +     {
  1163. +         m++;
  1164. +         n = magstep(m, bdpi);
  1165. +         if (n == dpi)
  1166. +         break;
  1167. +         if (n > dpi || m > 40)
  1168. +         {
  1169. +         m = 9999;
  1170. +         break;
  1171. +         }
  1172. +     }
  1173. +     }
  1174. +     if (m == 9999)
  1175. +     {
  1176. +     (void)sprintf(magstepc, "%d+%d/%d", dpi / bdpi, dpi % bdpi, bdpi);
  1177. +     }
  1178. +     else if (m >= 0)
  1179. +     {
  1180. +     (void)sprintf(magstepc, "magstep\\(%d.%d\\)", m / 2, (m & 1) * 5);
  1181. +     }
  1182. +     else
  1183. +     {
  1184. +     (void)sprintf(magstepc, "magstep\\(-%d.%d\\)", (-m) / 2, (m & 1) * 5);
  1185. +     }
  1186. +     // Here is where we do the actually calling of the external script
  1187. +     // 
  1188. +     char buf[MAXPATHLEN + 1];
  1189. +     sprintf(buf, "%s %s %d %d %s\n", MF_SCRIPT, f.basename,
  1190. +         dpi, bdpi, magstepc);
  1191. +     system(buf);
  1192. +     if (trysetupfont(f))
  1193. +     return;
  1194. + #endif
  1195.       quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
  1196.           f.basename, f.mag / 1000, f.mag % 1000);
  1197.   }
  1198.