home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1370 < prev    next >
Text File  |  1990-12-28  |  7KB  |  249 lines

  1. Newsgroups: alt.sources
  2. From: kirkaas@oahu.cs.ucla.edu (paul kirkaas)
  3. Subject: [tex] HP DeskJet Plus: DVI driver patch and deskjet.mf metafont definition
  4. Message-ID: <1990May23.231628.21075@math.lsa.umich.edu>
  5. Date: Wed, 23 May 90 23:16:28 GMT
  6.  
  7. Archive-name: dvidjp/patch1
  8. Original-posting-by: kirkaas@oahu.cs.ucla.edu (paul kirkaas)
  9. Original-subject: HP DeskJet Plus: DVI driver patch and deskjet.mf metafont definition
  10. Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)
  11.  
  12. [Reposted from comp.text.tex.
  13. Comments on this service to emv@math.lsa.umich.edu (Edward Vielmetti).]
  14.  
  15. I just sent out the modified source for dvidjp.c (desk jet dvi driver)
  16. yesterday, and already found a couple of bugs that crept up on me.
  17. I am including the patch, as well as the deskjet.mf metafont definition
  18. that I use for my desk jet which was also requested recently on the net.
  19.  
  20. Paul Kirkaas
  21. kirkaas@cs.ucla.edu
  22.  
  23. ------------------------ deskjet.mf metafont definition ------------------
  24.  
  25. % Mode definition describing 300 by 300 dpi HP DeskJet Plus printer (pxk)
  26.  
  27. mode_def deskjet =
  28.   proofing:=0;
  29.   fontmaking:=1;
  30.   tracingtitles:=1;
  31.   pixels_per_inch:=300;
  32.   blacker:=.1; % Thicker lines -- For a perfect printer, set to 0, bad ~= 4.0
  33.   o_correction:=.4; % % of normal overshoot -- Perfect = 1.0; worst = 0.0
  34.   fillin:=.15;    % Perfect = 0; -.5 < bad < .5 (The amount by which diagonal
  35.         % lines are darker than vertical lines -- compensate)
  36. enddef;
  37.  
  38. base_version:=base_version&"/deskjet";
  39. localfont:=deskjet;
  40.  
  41. ------------------------ dvidjp.c patch 1 --------------------------------
  42.  
  43. *** dvidjp.c    Tue May 22 16:45:26 1990
  44. --- dvidjjp.c    Wed May 23 12:34:37 1990
  45. ***************
  46. *** 36,41 ****
  47. --- 36,42 ----
  48.   /* Driver for HP DeskJet Plus printer -- modified from
  49.    * Beebe Laser Jet driver
  50.    * by Paul Kirkaas (kirkaas@cs.ucla.edu) 22 May 1990
  51. +  *    patch 1 -- bugs in YOFF & COMPACTION fixed 23 May 1990
  52.    *
  53.    * Employs 3 types of data compaction for greater efficiency --
  54.    * up to 60 - 70% reduction in output file size.  Each compaction 
  55. ***************
  56. *** 84,105 ****
  57.   #define XOFF    1
  58.           /* Include the following line for Mode 2 Compaction */
  59.   #define    COMPACTION    1    
  60.   
  61.   #define VERSION_NO    "2.10"        /* DVI driver version number */
  62.   
  63. ! #ifdef COMPACTION
  64. ! #define  DEVICE_ID    "Hewlett-Packard Desk Jet plus (from LaserJet)\n\
  65. !     WITH Data Compaction for faster I/O"
  66. ! #else
  67. ! #define  DEVICE_ID    "Hewlett-Packard Desk Jet plus (from LaserJet)\n\
  68. !     with-OUT Data Compaction I/O"
  69. ! #endif COMPACTION
  70.                   /* this string is printed at runtime */
  71. ! #ifdef COMPACTION
  72. ! #define OUTFILE_EXT    "djp"
  73. ! #else
  74. ! #define OUTFILE_EXT    "dj"
  75. ! #endif COMPACTION
  76.   
  77.   #define  DEFAULT_RESOLUTION 300        /* default dots/inch on HP Desk Jet */
  78.   
  79. --- 85,103 ----
  80.   #define XOFF    1
  81.           /* Include the following line for Mode 2 Compaction */
  82.   #define    COMPACTION    1    
  83. + /*
  84. + #define COMPACTION    0
  85. + */
  86.   
  87.   #define VERSION_NO    "2.10"        /* DVI driver version number */
  88.   
  89. ! #define  DEVICE_ID    (comp ? \
  90. !         "Hewlett-Packard Desk Jet plus (from LaserJet)\n\
  91. !     WITH Data Compaction for faster I/O" : \
  92. !         "Hewlett-Packard Desk Jet plus (from LaserJet)\n\
  93. !     with-OUT Data Compaction I/O" )
  94.                   /* this string is printed at runtime */
  95. ! #define OUTFILE_EXT    (comp ? "djc" : "dj")
  96.   
  97.   #define  DEFAULT_RESOLUTION 300        /* default dots/inch on HP Desk Jet */
  98.   
  99. ***************
  100. *** 133,138 ****
  101. --- 131,137 ----
  102.   #undef SEGMEM
  103.   #define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
  104.   #endif
  105. + int comp = COMPACTION;        /* compaction flag -- reset in option.h */
  106.   
  107.   #include "bitmap.h"
  108.   
  109. ***************
  110. *** 164,176 ****
  111.       (void)getbmap();
  112.       OUTS("\033E");    /* printer reset */
  113.       OUTS("\033&l0L");    /* Disable perforation skip */
  114. !     OUTS("\033*rB");    /* End graphics */
  115.       OUTS("\033*t300R");    /* printer resolution */
  116. ! #ifdef COMPACTION
  117.       OUTS("\033*b2M");    /* Select Compacted Graphics Mode Two */
  118. ! #else
  119.       OUTS("\033*b0M");    /* Select Full Graphics Mode */
  120. ! #endif COMPACTION
  121.       OUTS("\033*r0A");    /* Start graphics, at leftmost position */
  122.   }
  123.   
  124. --- 163,175 ----
  125.       (void)getbmap();
  126.       OUTS("\033E");    /* printer reset */
  127.       OUTS("\033&l0L");    /* Disable perforation skip */
  128. ! /* OUTS("\033*rB");    /* End graphics */
  129.       OUTS("\033*t300R");    /* printer resolution */
  130. ! if (comp)
  131.       OUTS("\033*b2M");    /* Select Compacted Graphics Mode Two */
  132. ! else
  133.       OUTS("\033*b0M");    /* Select Full Graphics Mode */
  134.       OUTS("\033*r0A");    /* Start graphics, at leftmost position */
  135.   }
  136.   
  137. ***************
  138. *** 242,248 ****
  139.       register INT16 i,last_word;
  140.       int ic,jc;            /* just counters */
  141.       unsigned char * endb;    /* pointer to end of buf */
  142. - #ifdef COMPACTION
  143.       unsigned char greystr[129]; /* Max length of 127 in compacted mode 2 */
  144.       unsigned char * greyp;    /* Pointer to greystr[]  */
  145.       unsigned char outstr[999];    /* Compacted mode 2 output string */
  146. --- 241,246 ----
  147. ***************
  148. *** 253,261 ****
  149.       int count;
  150.       int gcnt;    /* Length of grey runs */
  151.   
  152. - #endif COMPACTION
  153.   
  154.   #if    IBM_PC_MICROSOFT
  155.       for (last_word = XBIT - 1;
  156.       (last_word >= 1) && (*(UNSIGN32*)normaddr(pbit,last_word) == 0);
  157. --- 251,257 ----
  158. ***************
  159. *** 320,326 ****
  160.   
  161.       endb = &buf[last_word];
  162.   
  163. ! #ifdef COMPACTION
  164.       greyp = greystr;
  165.       outp = outstr;
  166.       outsz = gcnt = 0;
  167. --- 316,323 ----
  168.   
  169.       endb = &buf[last_word];
  170.   
  171. ! if (comp)
  172. !   {
  173.       greyp = greystr;
  174.       outp = outstr;
  175.       outsz = gcnt = 0;
  176. ***************
  177. *** 390,402 ****
  178.       for (outp = outstr; outp <= endob; outp++ )
  179.           OUTC(*outp);
  180.   
  181. ! #else
  182.       OUTF("%dW",(int)last_word-ic); /* How much is coming ... */
  183.       /* cannot use fprintf with %s format because of
  184.                      NUL's in string, and it is slow anyway */
  185.       for (i = ic; i < last_word; ++pbuf,++i)
  186.           OUTC(*pbuf);
  187. ! #endif COMPACTION
  188.   #else
  189.       OUTF("\033*b%dW",(int)last_word);
  190.       pbuf = &buf[0];    /* cannot use fprintf with %s format because of
  191. --- 387,401 ----
  192.       for (outp = outstr; outp <= endob; outp++ )
  193.           OUTC(*outp);
  194.   
  195. !   }
  196. !  else 
  197. !   {
  198.       OUTF("%dW",(int)last_word-ic); /* How much is coming ... */
  199.       /* cannot use fprintf with %s format because of
  200.                      NUL's in string, and it is slow anyway */
  201.       for (i = ic; i < last_word; ++pbuf,++i)
  202.           OUTC(*pbuf);
  203. !   }
  204.   #else
  205.       OUTF("\033*b%dW",(int)last_word);
  206.       pbuf = &buf[0];    /* cannot use fprintf with %s format because of
  207. ***************
  208. *** 420,426 ****
  209. --- 419,435 ----
  210.   #ifdef YOFF
  211.       int ycnt = 0;
  212.   #endif YOFF
  213. + /*   OUTS("\033E");    /* printer reset */
  214. + /*    OUTS("\033&l0L");    /* Disable perforation skip */
  215. + /*    OUTS("\033*rB");    /* End graphics */
  216. + /*    OUTS("\033*t300R");    /* printer resolution */
  217. + if (comp)
  218. +     OUTS("\033*b2M");    /* Select Compacted Graphics Mode Two */
  219. + else
  220. +     OUTS("\033*b0M");    /* Select Full Graphics Mode */
  221.   
  222. +     OUTS("\033*r0A");    /* Start graphics, at leftmost position */
  223.       if (DBGOPT(DBG_PAGE_DUMP))
  224.       {
  225.       INT16 k1,k2,k3;
  226. ***************
  227. *** 535,541 ****
  228.   #else
  229.     p = pbit + XBIT - 1;        /* point to last word on line */
  230.     while ( !*p && p>pbit ) p--;
  231. !   if (p==pbit) return 1;
  232.     return 0;
  233.   #endif IBM_PC_MICROSOFT
  234.   }
  235. --- 544,550 ----
  236.   #else
  237.     p = pbit + XBIT - 1;        /* point to last word on line */
  238.     while ( !*p && p>pbit ) p--;
  239. !   if (p==pbit && !*p) return 1;
  240.     return 0;
  241.   #endif IBM_PC_MICROSOFT
  242.   }
  243. --
  244. Paul Kirkaas
  245. kirkaas@cs.ucla.edu
  246.