home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / psroff30 / patch14 < prev    next >
Encoding:
Text File  |  1993-05-01  |  62.2 KB  |  2,508 lines

  1. Newsgroups: comp.sources.unix
  2. From: clewis@ferret.ocunix.on.ca (Chris Lewis)
  3. Subject: v26i205: psroff 3.0, Patch14
  4. Sender: unix-sources-moderator@efficacy.home.vix.com
  5. Approved: WhoAmI@efficacy.home.vix.com
  6.  
  7. Submitted-By: clewis@ferret.ocunix.on.ca (Chris Lewis)
  8. Posting-Number: Volume 26, Issue 205
  9. Archive-Name: psroff3.0/patch14
  10.  
  11. Path: pa.dec.com!sousa.tay.dec.com!nntpd.lkg.dec.com!news.crl.dec.com!deccrl!enterpoop.mit.edu!spool.mu.edu!uunet!uunet.ca!ecicrl!clewis
  12. From: clewis@ferret.ocunix.on.ca (Chris Lewis)
  13. Newsgroups: comp.sources.bugs,alt.sources
  14. Subject: Official Patch 14 for Psroff 3.0
  15. Message-ID: <4056@ecicrl.ocunix.on.ca>
  16. Date: 2 Dec 92 03:28:21 GMT
  17. Followup-To: comp.sources.bugs
  18. Organization: Elegant Communications Inc., Ottawa, Canada
  19. Lines: 2486
  20. Xref: pa.dec.com comp.sources.bugs:3431 alt.sources:7082
  21.  
  22. Archive-name: psroff3.0/Patch.14
  23. Submitted-by: clewis@ferret.ocunix.on.ca (Chris Lewis)
  24.  
  25. [Repost, previous copy black-holed.]
  26.  
  27.     This is official patch 14 for Psroff 3.0.
  28.     Please apply it by:
  29.     cd <psroff source directory>
  30.     patch -N -p < <this file>
  31.     
  32.     The base release of psroff3.0 and first four patches were in
  33.     comp.sources.unix volume 24.
  34.  
  35.     Psroff 3.0 is maintained in full patched, but shar'd form on
  36.     ftp.uunet.ca.  You will want to pick up files:
  37.  
  38.     /distrib/chris_lewis/psroff3.0/part[00..11].Z
  39.  
  40. Major new features:
  41.     - Laserjet fonts are automatically scaled on the fly,
  42.       so you can use any size of a font.  Previous versions
  43.       required you to obtain fonts from other sources to
  44.       get pointsizes other than 10.  (Note: Laserjet III, PCL5,
  45.       scalable fonts were already supported in the lj3 personalities)
  46.       Of particular interest to hp2pbm users to convert LJ
  47.       to other formats (such as Epson dotmatrix)
  48.     - Full support for laserjet ditroff graphics: lines, arcs,
  49.       circles, ellipses, polygons, splines, with fill and line
  50.       thickness settings.  (Note: Laserjet III, PC5, HPGL/2
  51.       was already supported in the lj3 personalities.  This
  52.       extends it to PCL4 via raster graphics)
  53.       Of particular interest to hp2pbm users to convert LJ
  54.       to other formats (such as Epson dotmatrix)
  55.     - seamless integration into groff: after installation,
  56.       both "psroff -Tg[lj, lj3, lj3u]" and "groff -T[lj, lj3, lj3u]"
  57.       will work.
  58.  
  59. PL15 will be out soon, many minor little extensions planned, eg: german
  60. \(ss character etc.
  61.  
  62. ./man/psxlate.1.S        man page example improvment from vidiot
  63. ./widths/installdit.S        groff fixes
  64. ./utils/Makefile        scaleljfonts
  65. ./utils/catconv.S        fix character extension fakeout for CAT troff
  66. ./utils/pk2ditwid.c        groff compatibility problems
  67. ./dt.c                font switch bug fixed.
  68. ./ps.c                chars < ' ' should be octalized
  69. ./defs.h            PL14
  70. ./Makefile            scaleljfonts, pkscale.o inclusion
  71. ./opt.c                debug statements accidentally deleted.
  72. ./lj.c                font scaling, drawing support
  73. ./ljdraw.c            major changes for drawing support
  74. ./lj3draw.c            Ypos caching botch
  75. ./pkscale.c            header banging botch
  76. ./pk.h                pkscale() decl.
  77.  
  78. Patchwrapped: 921126233632
  79.  
  80. Index: ./man/psxlate.1.S
  81. *** /tmp/PATCHold/./man/psxlate.1.S    Thu Nov 26 23:33:12 1992
  82. --- ./man/psxlate.1.S    Thu Nov 26 23:33:13 1992
  83. ***************
  84. *** 1,4 ****
  85. ! .\"Copyright 1991 by Chris Lewis 2.8 91/07/11
  86.   .TH PSXLATE %%MANEXT%% "Psroff %%T2VERSION%%"
  87.   .SH NAME
  88.   psxlate \- General Postscript page flipper etcetera
  89. --- 1,4 ----
  90. ! .\"Copyright 1991 by Chris Lewis 2.9 92/11/11
  91.   .TH PSXLATE %%MANEXT%% "Psroff %%T2VERSION%%"
  92.   .SH NAME
  93.   psxlate \- General Postscript page flipper etcetera
  94. ***************
  95. *** 16,32 ****
  96.   .BI ">" output file
  97.   .SH DESCRIPTION
  98.   .B Psxlate
  99. ! reads a Postscript file that are conformant with the Adobe Document
  100.   Structuring Convention standard (DSC), shuffles the pages around according
  101.   to the parameters, and outputs the result.
  102. - Further, if you have
  103. - .B psnup
  104. - from comp.sources.misc (volume 16), you can use the postscript files
  105. - that come with it to do n-up printing.
  106.   ``Conformant'' in this context, means files that begin with ``%!PS\-Adobe\-'',
  107.   have pages that are prefixed with ``%%Page:'' comments and have a trailer
  108.   prefixed by ``%%Trailer:''.
  109.   Case is significant.
  110.   .PP
  111.   .B Psxlate
  112.   is ideally used as the filter in your print spooler system.
  113. --- 16,37 ----
  114.   .BI ">" output file
  115.   .SH DESCRIPTION
  116.   .B Psxlate
  117. ! reads a Postscript file that is conformant with the Adobe Document
  118.   Structuring Convention standard (DSC), shuffles the pages around according
  119.   to the parameters, and outputs the result.
  120.   ``Conformant'' in this context, means files that begin with ``%!PS\-Adobe\-'',
  121.   have pages that are prefixed with ``%%Page:'' comments and have a trailer
  122.   prefixed by ``%%Trailer:''.
  123.   Case is significant.
  124. + It also PostScript that contains embedded EPS files provided that they are
  125. + compliant with the DSC and use BeginDocument/EndDocument.
  126. + .PP
  127. + If you have
  128. + .B psnup
  129. + from comp.sources.misc (volume 16),
  130. + .B psxlate
  131. + can be configured to use it to provide n-up printing.
  132. + that come with it to do n-up printing.
  133.   .PP
  134.   .B Psxlate
  135.   is ideally used as the filter in your print spooler system.
  136. ***************
  137. *** 74,88 ****
  138.   characters, some UNIX systems can't send 8-bit characters down
  139.   a serial line without grave difficulty, and it sort of defeats the
  140.   purpose of Postscript in the first place.
  141. - .SH OPTIONS
  142.   .PP
  143. ! The
  144.   .B \-d
  145. ! option enables debugging.
  146. ! .PP
  147. ! The
  148.   .B \-n
  149. ! option permits you to select specific pages for printing.
  150.   You can specify pages or ranges of pages.
  151.   Ie: \-n4,5,20-25
  152.   Selects the fourth, fifth and 20th thru 25th pages for printing.
  153. --- 79,104 ----
  154.   characters, some UNIX systems can't send 8-bit characters down
  155.   a serial line without grave difficulty, and it sort of defeats the
  156.   purpose of Postscript in the first place.
  157.   .PP
  158. ! If, when working with PostScript that contains inclusions of other
  159. ! PostScript (ie: groff PostScript inclusions), you find that Psxlate
  160. ! generates output that has the pages scrambled or PostScript errors,
  161. ! the inclusions were probably done incorrectly.
  162. ! According to the DSC (3, possibly 2 as well), included PostScript
  163. ! should start with "%%BeginDocument:" and end with "%%EndDocument".
  164. ! If these aren't there, any EPS comments inside may confuse
  165. ! .BR psxlate .
  166. ! If this happens, you should either modify the application that
  167. ! includes the PostScript to insert the BeginDocument and EndDocument
  168. ! comments, or manually insert them into the EPS before doing the
  169. ! inclusion.
  170. ! .SH OPTIONS
  171. ! .TP
  172.   .B \-d
  173. ! This option enables debugging.
  174. ! .TP
  175.   .B \-n
  176. ! Permits you to select specific pages for printing.
  177.   You can specify pages or ranges of pages.
  178.   Ie: \-n4,5,20-25
  179.   Selects the fourth, fifth and 20th thru 25th pages for printing.
  180. ***************
  181. *** 93,112 ****
  182.   sees them.
  183.   If the second part of a range is omitted, it means to the end of the document.
  184.   If the first part of a range is omitted, it means from the beginning of the document.
  185. ! .PP
  186.   The other options,
  187.   .BR r ,
  188.   .BR b ,
  189.   .BR 2 ,
  190. ! .B c ,
  191.   plus any others locally implemented, denote different shuffle
  192.   algorithms which will be applied in-turn to the Postscript and
  193.   can be specified more than once.
  194.   Specification of none of these options gives no shuffle at all.
  195. ! .PP
  196. ! The
  197. ! .B r
  198. ! option denotes page reversal - the order of the pages will be
  199.   reversed.
  200.   This is particularly handy for laser printers that stack face up
  201.   (eg: the Canon I Laser engine in older HP Laserjets and Apple Laserwriters)
  202. --- 109,127 ----
  203.   sees them.
  204.   If the second part of a range is omitted, it means to the end of the document.
  205.   If the first part of a range is omitted, it means from the beginning of the document.
  206. ! .sp .65v
  207.   The other options,
  208.   .BR r ,
  209.   .BR b ,
  210.   .BR 2 ,
  211. ! .BR c ,
  212.   plus any others locally implemented, denote different shuffle
  213.   algorithms which will be applied in-turn to the Postscript and
  214.   can be specified more than once.
  215.   Specification of none of these options gives no shuffle at all.
  216. ! .TP
  217. ! .B \-r
  218. ! Denotes page reversal - the order of the pages will be
  219.   reversed.
  220.   This is particularly handy for laser printers that stack face up
  221.   (eg: the Canon I Laser engine in older HP Laserjets and Apple Laserwriters)
  222. ***************
  223. *** 113,129 ****
  224.   and without reversal would require you to do a lot of page shuffling.
  225.   If used in conjunction with the \-p and \-s options, this will
  226.   also generate the n-up pages in the correct order.
  227. ! .PP
  228. ! The
  229. ! .B b
  230. ! option denotes book order:
  231. ! .PP
  232.   1 2 3 4 5 6 7 8 .... n
  233. ! .PP
  234.   is transformed into:
  235. ! .PP
  236.   n 1 n\-2 3 n\-4 5 ... 2 n\-1 4 n\-3 ...
  237. ! .PP
  238.   This is the order that you would output pages for 2-up printing to
  239.   be rebound into a book.
  240.   This can be used in conjunction with the
  241. --- 128,149 ----
  242.   and without reversal would require you to do a lot of page shuffling.
  243.   If used in conjunction with the \-p and \-s options, this will
  244.   also generate the n-up pages in the correct order.
  245. ! Under most circumstances, this option should be placed after a
  246. ! .B \-2B
  247. ! or
  248. ! .BR \-2E .
  249. ! Placing it first may cause the wrong pages to be printed from what is expected.
  250. ! See the notes below for examples.
  251. ! .TP
  252. ! .B \-b
  253. ! Denotes book order:
  254. ! .sp .35v
  255.   1 2 3 4 5 6 7 8 .... n
  256. ! .sp .35v
  257.   is transformed into:
  258. ! .sp .35v
  259.   n 1 n\-2 3 n\-4 5 ... 2 n\-1 4 n\-3 ...
  260. ! .sp .35v
  261.   This is the order that you would output pages for 2-up printing to
  262.   be rebound into a book.
  263.   This can be used in conjunction with the
  264. ***************
  265. *** 137,172 ****
  266.   You should consult your printer manual to find out the proper orientation.
  267.   Up to 3 blank pages are inserted on the end to get a multiple of 4
  268.   pages in total.
  269. ! .PP
  270. ! The
  271.   .B \-c
  272. ! option is the ``couple swap'' option.
  273.   It is similar to reversal, except that it is pairs of pages that
  274.   are swapped.
  275.   As in:
  276. ! .PP
  277.   1 2 3 4 5 6 ... n
  278. ! .PP
  279.   is converted to:
  280. ! .PP
  281.   n\-1 n n\-3 n\-2 ... 1 2
  282. ! .PP
  283.   This is useful for running after the
  284.   .B \-b
  285.   option for printers that need reversal, but since you'll be shuffling
  286.   the pages anyways, it's probably not all that critical.
  287.   A single page may be appended to get the number of pages to be even.
  288. ! .PP
  289. ! The
  290.   .B \-2
  291. ! option transforms:
  292. ! .PP
  293.   1 2 3 4 5 6 7 8
  294. ! .PP
  295.   into:
  296.   1 3 5 7 ... 2 4 6 8
  297. ! .PP
  298.   suitable for portrait two-sided output.
  299.   .SH "NOTES FOR PSNUP (\-p/\-s)"
  300.   The
  301.   .B Psnup
  302. --- 157,207 ----
  303.   You should consult your printer manual to find out the proper orientation.
  304.   Up to 3 blank pages are inserted on the end to get a multiple of 4
  305.   pages in total.
  306. ! .TP
  307.   .B \-c
  308. ! This is the ``couple swap'' option.
  309.   It is similar to reversal, except that it is pairs of pages that
  310.   are swapped.
  311.   As in:
  312. ! .sp .35v
  313.   1 2 3 4 5 6 ... n
  314. ! .sp .35v
  315.   is converted to:
  316. ! .sp .35v
  317.   n\-1 n n\-3 n\-2 ... 1 2
  318. ! .sp .35v
  319.   This is useful for running after the
  320.   .B \-b
  321.   option for printers that need reversal, but since you'll be shuffling
  322.   the pages anyways, it's probably not all that critical.
  323.   A single page may be appended to get the number of pages to be even.
  324. ! .TP
  325.   .B \-2
  326. ! This option transforms:
  327. ! .sp .35v
  328.   1 2 3 4 5 6 7 8
  329. ! .sp .35v
  330.   into:
  331. + .sp .35v
  332.   1 3 5 7 ... 2 4 6 8
  333. ! .sp .35v
  334.   suitable for portrait two-sided output.
  335. + .TP
  336. + .B \-B
  337. + This option prints the first half of the pages.
  338. + It is normally used in conjunction with
  339. + .B \-2
  340. + or
  341. + .BR \-b .
  342. + See the notes below for examples.
  343. + .TP
  344. + .B \-E
  345. + This option prints the last half of the pages.
  346. + It is normally used in conjunction with
  347. + .B \-2
  348. + or
  349. + .BR \-b .
  350. + See the notes below for examples.
  351.   .SH "NOTES FOR PSNUP (\-p/\-s)"
  352.   The
  353.   .B Psnup
  354. ***************
  355. *** 211,225 ****
  356.   can run
  357.   .B psxlate
  358.   on that.
  359. ! To print two sided on a reversing printer, you would type:
  360. ! .sp
  361. ! .nf
  362.   psroff .... \-t files > /tmp/saveit
  363.   psxlate \-2B < /tmp/saveit | <your printer spooler>
  364. ! change paper around
  365. ! psxlate \-r2E < /tmp/saveit | <your printer spooler>
  366.   .fi
  367.   .PP
  368.   On a non-reversing printer, the
  369.   .B \-r
  370.   option wouldn't be necessary.
  371. --- 246,308 ----
  372.   can run
  373.   .B psxlate
  374.   on that.
  375. ! To print two sided, you would type (the Apple LaserWriter/LaserWriterPlus
  376. ! cannot be used for double-sided printing):
  377. ! .PP
  378.   psroff .... \-t files > /tmp/saveit
  379. + .PP
  380. + For the Apple LaserWriter II series of printers, using the top output tray,
  381. + the following would be done:
  382. + .nf
  383. + psxlate \-2Br < /tmp/saveit | <your printer spooler>
  384. + Move the paper from the output tray to the paper tray, white side up:
  385.   psxlate \-2B < /tmp/saveit | <your printer spooler>
  386. ! .fi
  387. ! .PP
  388. ! When using the Apple LaserWriter II series of printers you must remember to
  389. ! turn the paper around 180 degrees, before placing the output stack into the
  390. ! paper tray.
  391. ! Otherwise the second pass will print upside-down.
  392. ! .PP
  393. ! Also note that the Apple LaserWriter IINT printer has a nasty habit of
  394. ! curling the paper bad enough during the first pass that the second pass
  395. ! may jam or wrinkle.
  396. ! .PP
  397. ! If groff is used as the troff processor, then the resulting PostScript file
  398. ! can be edited and made to print upside-down.
  399. ! Then the paper can be moved from the output tray to the paper tray,
  400. ! without turning it around 180 degrees.
  401. ! .PP
  402. ! Place the following lines into an executable file named
  403. ! .BR upsxlate :
  404. ! .PP
  405. ! .nf
  406. ! #!/bin/sh
  407. ! sed -e "/1 -1 scale/s/scale/scale 612 PL translate 180 rotate/" | psxlate $*
  408.   .fi
  409.   .PP
  410. + Using the exact same syntax as
  411. + .BR psxlate ,
  412. + the
  413. + .B
  414. + upsxlate
  415. + script will cause the groff portrait output to print upside down.
  416. + .PP
  417. + If you are printing on a Sun SPARCprinter, the following is used to print
  418. + double-sided:
  419. + .PP
  420. + .nf
  421. + psxlate \-2Er < /tmp/saveit | lpr -Psparc
  422. + move the paper from the output tray to the paper tray (face up):
  423. + psxlate \-2E < /tmp/saveit | lpr -Psparc
  424. + .fi
  425. + .PP
  426. + The first batch printed to the SPARCprinter will contain all of the odd pages,
  427. + in reverse order, placing page one on the top of the output stack.
  428. + When the second batch is printed, all of the even pages will be done in
  429. + ascending order.
  430. + When completed, the output stack will be in the correct order.
  431. + .PP
  432.   On a non-reversing printer, the
  433.   .B \-r
  434.   option wouldn't be necessary.
  435. ***************
  436. *** 256,259 ****
  437.   .B sed
  438.   to delete them.
  439.   .SH AUTHOR
  440. ! Written by Chris Lewis
  441. --- 339,343 ----
  442.   .B sed
  443.   to delete them.
  444.   .SH AUTHOR
  445. ! Written by Chris Lewis.
  446. ! Examples provided by Michael Brown.
  447. Index: ./widths/installdit.S
  448. *** /tmp/PATCHold/./widths/installdit.S    Thu Nov 26 23:33:26 1992
  449. --- ./widths/installdit.S    Thu Nov 26 23:33:27 1992
  450. ***************
  451. *** 5,18 ****
  452.   #    See the LICENSE file for a full description of the restrictions
  453.   #    under which this software is provided.
  454.   #
  455. ! #1.9 92/06/01
  456.   MAKEDEV=%%MAKEDEV%%
  457. ! if [ ! -f "$MAKEDEV" ]
  458. ! then
  459. !     echo "no $MAKEDEV program - don't worry unless you're using psroff"
  460. !     echo "with REAL ditroff instead of C/A/T troff"
  461. !     exit 0
  462. ! fi
  463.   if [ "$1" = "-i" ]
  464.   then
  465.       install=1
  466. --- 5,13 ----
  467.   #    See the LICENSE file for a full description of the restrictions
  468.   #    under which this software is provided.
  469.   #
  470. ! #1.10 92/11/26
  471.   MAKEDEV=%%MAKEDEV%%
  472. ! LIBDIR=%%LIBDIR%%
  473.   if [ "$1" = "-i" ]
  474.   then
  475.       install=1
  476. ***************
  477. *** 37,43 ****
  478.       else
  479.       srcfont=$Targ
  480.       fi
  481. !     echo "PROCESSING $i: width=$width, psroff widths: $srcfont"
  482.       if [ -z "$width" ]
  483.       then
  484.       echo "Something wrong with $i entry, skipping (no width)"
  485. --- 32,38 ----
  486.       else
  487.       srcfont=$Targ
  488.       fi
  489. !     echo "CHECKING $i: width=$width, psroff widths: $srcfont"
  490.       if [ -z "$width" ]
  491.       then
  492.       echo "Something wrong with $i entry, skipping (no width)"
  493. ***************
  494. *** 56,61 ****
  495. --- 51,61 ----
  496.       fi
  497.       if [ -z "$install" ]
  498.       then
  499. +     if [ ! -r $MAKEDEV ]
  500. +     then
  501. +         echo "No MAKEDEV ($MAKEDEV) skipping"
  502. +         continue
  503. +     fi
  504.       if [ -r $dir/ditdone ]
  505.       then
  506.           continue
  507. ***************
  508. *** 67,72 ****
  509. --- 67,73 ----
  510.       $MAKEDEV DESC
  511.       cd ..
  512.       else
  513. +     groffpostpro=''
  514.       if [ -n "$Garg" ]
  515.       then
  516.           if [ ! -d %%GFONTDIR%% ]
  517. ***************
  518. *** 76,81 ****
  519. --- 77,83 ----
  520.           else
  521.           echo "H'm, looks like groff width tables in %%GFONTDIR%%"
  522.           destdir=%%GFONTDIR%%/dev$width
  523. +         groffpostpro=$LIBDIR/troff2ps_$width
  524.           fi
  525.       else
  526.           destdir=%%FONTDIR%%/dev$width
  527. ***************
  528. *** 83,89 ****
  529. --- 85,93 ----
  530.       if [ ! -d $destdir ]
  531.       then
  532.           mkdir $destdir
  533. +         chmod 755 $destdir
  534.           echo "Psroff-built width tables" > $destdir/PSROFF-BUILT
  535. +         chmod 644 $destdir/PSROFF-BUILT
  536.       fi
  537.       if [ ! -w $destdir ]
  538.       then
  539. ***************
  540. *** 109,114 ****
  541. --- 113,131 ----
  542.       then
  543.           echo "INSTALLING ditroff widths from $dir into $destdir"
  544.           cp $list $destdir
  545. +         chmod 644 $destdir/*
  546. +         if [ -n "$groffpostpro" ]
  547. +         then
  548. +         echo "  inserting groff postpro line into $destdir/DESC"
  549. +         sed -e "/font/a\\
  550. + postpro $groffpostpro" $destdir/DESC > /tmp/$$
  551. +         mv /tmp/$$ $destdir/DESC
  552. +         chmod 644 $destdir/DESC
  553. +         echo "   installing groff postprocessor in $LIBDIR"
  554. +         rm -f $groffpostpro
  555. +         echo "$LIBDIR/troff2ps $t2arg" > $groffpostpro
  556. +         chmod 755 $groffpostpro
  557. +         fi
  558.       fi
  559.       cd ../
  560.       fi
  561. Index: ./utils/Makefile
  562. *** /tmp/PATCHold/./utils/Makefile    Thu Nov 26 23:33:37 1992
  563. --- ./utils/Makefile    Thu Nov 26 23:33:38 1992
  564. ***************
  565. *** 4,10 ****
  566.   #    See the LICENSE file for a full description of the restrictions
  567.   #    under which this software is provided.
  568.   #
  569. ! #2.11 92/05/19
  570.   SCRIPTS    = psdtwd showfont mkenctab calcfonts catconv dodps
  571.   PROGRAMS = hpinterp psxlate pk2sfp pk2ditwid pktype dumpft pk2ps lj2ps \
  572.       asc2ps
  573. --- 4,10 ----
  574.   #    See the LICENSE file for a full description of the restrictions
  575.   #    under which this software is provided.
  576.   #
  577. ! #2.12 92/10/30
  578.   SCRIPTS    = psdtwd showfont mkenctab calcfonts catconv dodps
  579.   PROGRAMS = hpinterp psxlate pk2sfp pk2ditwid pktype dumpft pk2ps lj2ps \
  580.       asc2ps
  581. ***************
  582. *** 36,42 ****
  583.       rm -f T
  584.   
  585.   #    This isn't perfect, but close
  586. ! ../debug.o ../pk.o ../cattab.o: ../defs.h ../pk.h
  587.       @echo "Some troff2ps objects are out of date"
  588.       @echo "Make troff2ps at the top level first"
  589.       exit
  590. --- 36,42 ----
  591.       rm -f T
  592.   
  593.   #    This isn't perfect, but close
  594. ! ../debug.o ../pk.o ../cattab.o ../pkscale.o: ../defs.h ../pk.h
  595.       @echo "Some troff2ps objects are out of date"
  596.       @echo "Make troff2ps at the top level first"
  597.       exit
  598. Index: ./utils/catconv.S
  599. *** /tmp/PATCHold/./utils/catconv.S    Thu Nov 26 23:33:48 1992
  600. --- ./utils/catconv.S    Thu Nov 26 23:33:49 1992
  601. ***************
  602. *** 10,16 ****
  603.   #
  604.   #    This does a very simpleminded conversion of ditroff-only-isms
  605.   #    (such as graphics) into something handleable by CAT troff.
  606. ! #    1.11 92/06/02
  607.   $cc{'em'}=1; $cc{'ru'}=1; $cc{'14'}=1; $cc{'12'}=1; $cc{'hy'}=1;
  608.   $cc{'34'}=1; $cc{'fi'}=1; $cc{'fl'}=1; $cc{'ff'}=1; $cc{'ct'}=1;
  609.   $cc{'Fl'}=1; $cc{'Fi'}=1; $cc{'de'}=1; $cc{'dg'}=1; $cc{'rg'}=1;
  610. --- 10,16 ----
  611.   #
  612.   #    This does a very simpleminded conversion of ditroff-only-isms
  613.   #    (such as graphics) into something handleable by CAT troff.
  614. ! #    1.12 92/11/26
  615.   $cc{'em'}=1; $cc{'ru'}=1; $cc{'14'}=1; $cc{'12'}=1; $cc{'hy'}=1;
  616.   $cc{'34'}=1; $cc{'fi'}=1; $cc{'fl'}=1; $cc{'ff'}=1; $cc{'ct'}=1;
  617.   $cc{'Fl'}=1; $cc{'Fi'}=1; $cc{'de'}=1; $cc{'dg'}=1; $cc{'rg'}=1;
  618. ***************
  619. *** 114,120 ****
  620.           } else {
  621.           printf STDERR "Don't know the width of \\($char";
  622.           }
  623. !         $newline .= "\\ka\\o'\\(bs\\(bs'C$char\\(bs\\h'|\\nau+\\w'$w''";
  624.       }
  625.       }
  626.       $newline .= $line;
  627. --- 114,120 ----
  628.           } else {
  629.           printf STDERR "Don't know the width of \\($char";
  630.           }
  631. !         $newline .= "\\ka\\o'\\(bs\\(bs'C$char\\(bs\\h'|\\nau+\\w\"$w\"'";
  632.       }
  633.       }
  634.       $newline .= $line;
  635. Index: ./utils/pk2ditwid.c
  636. *** /tmp/PATCHold/./utils/pk2ditwid.c    Thu Nov 26 23:33:57 1992
  637. --- ./utils/pk2ditwid.c    Thu Nov 26 23:33:58 1992
  638. ***************
  639. *** 10,16 ****
  640.   
  641.   #ifndef    lint
  642.   static char SCCSID[] =
  643. !     "@(#)pk2ditwid.c 2.4 Copyright 91/12/26 17:59:20 Chris Lewis";
  644.   #endif
  645.   
  646.   #include "defs.h"
  647. --- 10,16 ----
  648.   
  649.   #ifndef    lint
  650.   static char SCCSID[] =
  651. !     "@(#)pk2ditwid.c 2.5 Copyright 92/11/26 19:45:39 Chris Lewis";
  652.   #endif
  653.   
  654.   #include "defs.h"
  655. ***************
  656. *** 132,137 ****
  657. --- 132,139 ----
  658.           fprintf(fout, "# %s\n", buf);
  659.           fprintf(fout, "# Generated by pk2ditwid\n");
  660.           fprintf(fout, "name %s\n", buf);
  661. +         if (buf[0] == 'S')
  662. +         fprintf(fout, "special\n");
  663.           fprintf(fout, "spacewidth 22\n");
  664.           fprintf(fout, "charset\n");
  665.       }
  666. ***************
  667. *** 179,185 ****
  668.           fprintf(fout, "%s\t%ld\t%d\t",
  669.               et->e_name, et->e_wid & 0x3f, (et->e_wid>>6)&0x3);
  670.           for (pp = et->e_seq; *pp; pp++)
  671. !             fprintf(fout, "\\%03o", (*pp)&0xff);
  672.           fprintf(fout, "\n");
  673.           }
  674.       }
  675. --- 181,187 ----
  676.           fprintf(fout, "%s\t%ld\t%d\t",
  677.               et->e_name, et->e_wid & 0x3f, (et->e_wid>>6)&0x3);
  678.           for (pp = et->e_seq; *pp; pp++)
  679. !             fprintf(fout, "%04o", (*pp)&0xff);
  680.           fprintf(fout, "\n");
  681.           }
  682.       }
  683. Index: ./dt.c
  684. *** /tmp/PATCHold/./dt.c    Thu Nov 26 23:34:08 1992
  685. --- ./dt.c    Thu Nov 26 23:34:10 1992
  686. ***************
  687. *** 12,18 ****
  688.   
  689.   #ifndef    lint
  690.   static char SCCSid[] =
  691. !     "@(#)dt.c: 2.13 Copyright 91/11/22 03:55:58 Chris Lewis";
  692.   #endif
  693.   
  694.   /*    These two tables are always included so that we have the
  695. --- 12,18 ----
  696.   
  697.   #ifndef    lint
  698.   static char SCCSid[] =
  699. !     "@(#)dt.c: 2.14 Copyright 92/11/26 23:31:01 Chris Lewis";
  700.   #endif
  701.   
  702.   /*    These two tables are always included so that we have the
  703. ***************
  704. *** 420,425 ****
  705. --- 420,428 ----
  706.       return;
  707.       }
  708.   
  709. +     DBP((D_BEND, "font, pfont, flags, seq = %d,%d,%02x,%s\n",
  710. +     font, pfont, fonttable[pfont].flags, sequence));
  711.       /*    We're committed now - the "if" statements avoid floating
  712.       arithmetic on slow machines */
  713.   
  714. ***************
  715. *** 432,438 ****
  716.   #ifdef DTOPT
  717.       checknl();
  718.   #endif /* DTOPT */
  719. !     printf("x font %d %s\n", font+1, fonttable[pfont].troffName);
  720.       fonttable[pfont].flags |= MOUNTED;
  721.       lastFont = 9999;
  722.       }
  723. --- 435,441 ----
  724.   #ifdef DTOPT
  725.       checknl();
  726.   #endif /* DTOPT */
  727. !     printf("x font %d %s\n", pfont+1, fonttable[pfont].troffName);
  728.       fonttable[pfont].flags |= MOUNTED;
  729.       lastFont = 9999;
  730.       }
  731. ***************
  732. *** 444,453 ****
  733.   #endif /* DTOPT */
  734.   
  735.       fonttable[pfont].flags |= USED;
  736. !     printf("f%d\n", font+1);
  737.       printf("s%d\n", points);
  738.       lastPoints = points;
  739. !     lastFont = font;
  740.       }
  741.   
  742.   #ifndef DTOPT
  743. --- 447,456 ----
  744.   #endif /* DTOPT */
  745.   
  746.       fonttable[pfont].flags |= USED;
  747. !     printf("f%d\n", pfont+1);
  748.       printf("s%d\n", points);
  749.       lastPoints = points;
  750. !     lastFont = pfont;
  751.       }
  752.   
  753.   #ifndef DTOPT
  754. ***************
  755. *** 591,596 ****
  756. --- 594,600 ----
  757.   
  758.   dtEpilog() {
  759.   
  760. +     int i;
  761.   #ifdef DTOPT
  762.       checknl();
  763.   #endif /* DTOPT */
  764. ***************
  765. *** 599,604 ****
  766. --- 603,613 ----
  767.       printf("x stop\n");
  768.   #ifndef    NOCHATTER
  769.       printf("#Pages: %d\n", currentPage);
  770. +     printf("#FontsUsed:");
  771. +     for (i = 0; i < MAXFONTS; i++)
  772. +     if (fonttable[i].flags&USED)
  773. +         printf(" %s", fonttable[i].fontName);
  774. +     putchar('\n');
  775.   #endif
  776.   }
  777.   
  778. Index: ./ps.c
  779. *** /tmp/PATCHold/./ps.c    Thu Nov 26 23:34:23 1992
  780. --- ./ps.c    Thu Nov 26 23:34:26 1992
  781. ***************
  782. *** 15,21 ****
  783.   
  784.   #ifndef    lint
  785.   static char SCCSid[] =
  786. !     "@(#)ps.c: 2.20 Copyright 92/06/01 21:18:19 Chris Lewis";
  787.   #endif
  788.   
  789.   /*    ps.c will generate some additional "print" commands to cause
  790. --- 15,21 ----
  791.   
  792.   #ifndef    lint
  793.   static char SCCSid[] =
  794. !     "@(#)ps.c: 2.21 Copyright 92/11/26 19:41:28 Chris Lewis";
  795.   #endif
  796.   
  797.   /*    ps.c will generate some additional "print" commands to cause
  798. ***************
  799. *** 362,368 ****
  800.   register char *sequence; {
  801.       putchar('(');
  802.       while(*sequence) {
  803. !     if ((*sequence)&0x80)
  804.           printf("\\%03o", (*sequence++)&0xff);
  805.       else if (*sequence == '(' || *sequence == ')' ||
  806.           *sequence == '\\')
  807. --- 362,368 ----
  808.   register char *sequence; {
  809.       putchar('(');
  810.       while(*sequence) {
  811. !     if (((*sequence)&0x80) || (*sequence < ' '))
  812.           printf("\\%03o", (*sequence++)&0xff);
  813.       else if (*sequence == '(' || *sequence == ')' ||
  814.           *sequence == '\\')
  815. Index: ./defs.h
  816. *** /tmp/PATCHold/./defs.h    Thu Nov 26 23:34:39 1992
  817. --- ./defs.h    Thu Nov 26 23:34:41 1992
  818. ***************
  819. *** 9,15 ****
  820.    */
  821.   
  822.   /*    Official Release and Patch level:    */
  823. ! #define    T2VERSION    "@(#)PSROFF Copyright 92/07/09 Chris Lewis - R3 PL13"
  824.   
  825.   /*    Configuration parameters:
  826.    */
  827. --- 9,15 ----
  828.    */
  829.   
  830.   /*    Official Release and Patch level:    */
  831. ! #define    T2VERSION    "@(#)PSROFF Copyright 92/10/30 Chris Lewis - R3 PL14"
  832.   
  833.   /*    Configuration parameters:
  834.    */
  835. ***************
  836. *** 133,138 ****
  837. --- 133,140 ----
  838.   #define    DT    /* ditroff */
  839.   
  840.   /*    Laserjet driver config: */
  841. + #define PKSCALE    /* enable lj font built-in scaling.  Needs PK */
  842.   #define    PK    /* enable PK font downloading (needs LJ) */
  843.   
  844.   #define    SFP    /* enable SFP incremental font downloading (needs PK).
  845. ***************
  846. *** 218,223 ****
  847. --- 220,229 ----
  848.   #endif
  849.   
  850.   #if    !defined(LJ) && defined(PK)
  851. + #include    "Pointless to define PK without LJ"
  852. + #endif
  853. + #if    !defined(PK) && defined(PKSCALE)
  854.   #include    "Pointless to define PK without LJ"
  855.   #endif
  856.   
  857. Index: ./Makefile
  858. *** /tmp/PATCHold/./Makefile    Thu Nov 26 23:34:53 1992
  859. --- ./Makefile    Thu Nov 26 23:34:55 1992
  860. ***************
  861. *** 7,13 ****
  862.   #    Function: Upper level makefile; configuration options.
  863.   #
  864.   #
  865. ! #ident  "@(#)Makefile: 2.34 Copyright 92/07/09 23:36:01 Chris Lewis"
  866.   
  867.   #    If you're not sure whether you have a System V make, leave
  868.   #    this alone, and run the make anyways.  If it dies horribly
  869. --- 7,13 ----
  870.   #    Function: Upper level makefile; configuration options.
  871.   #
  872.   #
  873. ! #ident  "@(#)Makefile: 2.35 Copyright 92/10/30 02:28:20 Chris Lewis"
  874.   
  875.   #    If you're not sure whether you have a System V make, leave
  876.   #    this alone, and run the make anyways.  If it dies horribly
  877. ***************
  878. *** 110,116 ****
  879.   
  880.   #    Compile flags needed to compile things on your machine.
  881.   #    Usually just -O.  May need to tell gcc that this isn't
  882. ! #    Posix compliant code.
  883.   #
  884.   CCFLAGS = -O
  885.   
  886. --- 110,116 ----
  887.   
  888.   #    Compile flags needed to compile things on your machine.
  889.   #    Usually just -O.  May need to tell gcc that this isn't
  890. ! #    Posix compliant code.  RISC Ultrix needs "-Olimit 600".
  891.   #
  892.   CCFLAGS = -O
  893.   
  894. ***************
  895. *** 181,187 ****
  896.   
  897.   #    Drivers:
  898.   
  899. ! BACKENDS = lj.o pk.o pkc.o ljdraw.o lj3draw.o ps.o dt.o dit.o
  900.   
  901.   DEFINES    = '-DLIBDIR="$(LIBDIR)/lib"' '-DFONTDIR="$(FONTDIR)"'\
  902.       '-DLJF="$(LJF)"' $(CCFLAGS)
  903. --- 181,187 ----
  904.   
  905.   #    Drivers:
  906.   
  907. ! BACKENDS = lj.o pk.o pkc.o pkscale.o ljdraw.o lj3draw.o ps.o dt.o dit.o
  908.   
  909.   DEFINES    = '-DLIBDIR="$(LIBDIR)/lib"' '-DFONTDIR="$(FONTDIR)"'\
  910.       '-DLJF="$(LJF)"' $(CCFLAGS)
  911. ***************
  912. *** 212,218 ****
  913.   CFLAGS    = $(DEFINES)
  914.   
  915.   all:    troff2ps myuid subst.done makeincl psroff README TROUBLE LASERFONTS \
  916. !     MISC DITROFF INSTALL LICENSE LJIII zap pkscale.o submakes
  917.   
  918.   subst.done:    sedscript
  919.       rm -f psroff makeincl
  920. --- 212,218 ----
  921.   CFLAGS    = $(DEFINES)
  922.   
  923.   all:    troff2ps myuid subst.done makeincl psroff README TROUBLE LASERFONTS \
  924. !     MISC DITROFF INSTALL LICENSE LJIII zap submakes
  925.   
  926.   subst.done:    sedscript
  927.       rm -f psroff makeincl
  928. ***************
  929. *** 300,305 ****
  930. --- 300,323 ----
  931.       @echo "don't panic if the next line dies"
  932.       $(IGNORESH) test -z "$(PKFONTS)" -o ! -d "$(NEWFONTS)" \
  933.           || cp $(NEWFONTS)/* $(LJF)
  934. + scaleljfonts: myuid
  935. +     test "`./myuid`" = 0 || \
  936. +         ( echo "ERROR: You must be root to scale LJ fonts" ; exit 1 )
  937. +     [ -r $(LIBDIR)/lib/lj/R.10.pk ] || \
  938. +         ( echo "ERROR: Laserjet fonts not installed" ; exit 1 )
  939. +     cd $(LIBDIR)/lib/lj ; \
  940. +         for i in *.10.* ; \
  941. +         do \
  942. +         b=`basename $$i .10.sfp` ; \
  943. +         b=`basename $$i .10.pk` ; \
  944. +         for j in 6 7 8 9 11 12 14 16 18 20 22 24 28 36 ; \
  945. +         do \
  946. +             [ -r $$b.$$j.pk ] && continue ; \
  947. +             echo "Making $$b.$$j.sfp" ; \
  948. +             $(LIBDIR)/pk2sfp -o $$j $$i > $$b.$$j.sfp ; \
  949. +         done ; \
  950. +         done
  951.   
  952.   register:
  953.       make troff2ps makeincl
  954. Index: ./opt.c
  955. *** /tmp/PATCHold/./opt.c    Thu Nov 26 23:35:17 1992
  956. --- ./opt.c    Thu Nov 26 23:35:18 1992
  957. ***************
  958. *** 23,29 ****
  959.   #ifdef    OPT
  960.   #ifndef    lint
  961.   static char SCCSid[] =
  962. !     "@(#)opt.c: 2.12 Copyright 92/06/01 21:16:34 Chris Lewis";
  963.   #endif
  964.   
  965.   struct insbuf {
  966. --- 23,29 ----
  967.   #ifdef    OPT
  968.   #ifndef    lint
  969.   static char SCCSid[] =
  970. !     "@(#)opt.c: 2.13 Copyright 92/10/30 02:25:40 Chris Lewis";
  971.   #endif
  972.   
  973.   struct insbuf {
  974. ***************
  975. *** 81,92 ****
  976. --- 81,96 ----
  977.   
  978.       if (insptr->xpos < insbuf[0].xpos) {
  979.       DBP((D_CAT, "canonflush: BACK (%d chars)\n", insptr - insbuf + 1));
  980. + #if defined(DEBUG)
  981.       insdump(insbuf, insptr);
  982. + #endif
  983.       for(ip = insptr;ip >= insbuf; ip--)
  984.           canonchar(ip->xpos, insypos, ip->font, ip->points, ip->nc);
  985.       } else {
  986.       DBP((D_CAT, "canonflush: FORW (%d chars)\n", insptr - insbuf + 1));
  987. + #if defined(DEBUG)
  988.       insdump(insbuf, insptr);
  989. + #endif
  990.       for(ip = insbuf;ip <= insptr; ip++)
  991.           canonchar(ip->xpos, insypos, ip->font, ip->points, ip->nc);
  992.       }
  993. ***************
  994. *** 356,361 ****
  995. --- 360,366 ----
  996.   }
  997.   #endif
  998.   
  999. + #if defined(DEBUG)
  1000.   insdump(b, p)
  1001.   register struct insbuf *b, *p; {
  1002.       if (!(debug&D_VERB))
  1003. ***************
  1004. *** 364,366 ****
  1005. --- 369,372 ----
  1006.       for(; b <= p; b++)
  1007.       DBP((D_VERB, "%d %d\n", b->xpos, b->nc));
  1008.   }
  1009. + #endif
  1010. Index: ./lj.c
  1011. *** /tmp/PATCHold/./lj.c    Thu Nov 26 23:35:30 1992
  1012. --- ./lj.c    Thu Nov 26 23:35:32 1992
  1013. ***************
  1014. *** 32,38 ****
  1015.   
  1016.   #ifndef    lint
  1017.   static char SCCSid[] =
  1018. !     "@(#)lj.c: 2.11 Copyright 92/01/28 22:50:03 Chris Lewis";
  1019.   #endif
  1020.   
  1021.   struct troff2befont ljStdFont[108] = {
  1022. --- 32,38 ----
  1023.   
  1024.   #ifndef    lint
  1025.   static char SCCSid[] =
  1026. !     "@(#)lj.c: 2.13 Copyright 92/11/26 19:43:30 Chris Lewis";
  1027.   #endif
  1028.   
  1029.   struct troff2befont ljStdFont[108] = {
  1030. ***************
  1031. *** 304,310 ****
  1032.   int fontCount = 0;
  1033.   
  1034.   ljPage() {
  1035. !     printf("\033&l0H");
  1036.       pagePending = 1;
  1037.   }
  1038.   
  1039. --- 304,313 ----
  1040.   int fontCount = 0;
  1041.   
  1042.   ljPage() {
  1043. !     if (!pagePending) {
  1044. !     emitrast();
  1045. !     printf("\033&l0H");
  1046. !     }
  1047.       pagePending = 1;
  1048.   }
  1049.   
  1050. ***************
  1051. *** 385,390 ****
  1052. --- 388,430 ----
  1053.       return (points);
  1054.   }
  1055.   
  1056. + #ifdef PKSCALE
  1057. + static int
  1058. + scalematch(font, points, type)
  1059. + int font, points;
  1060. + char *type; {
  1061. +     register char *p;
  1062. +     register int i, t;
  1063. +     p = fonttable[font].fontFlags;
  1064. +     for (i = points; i <= 36; i++)
  1065. +     switch(t = p[ptcvt(i)]) {
  1066. +         case 'S':
  1067. +         case 'P':
  1068. +         t = tolower(t);
  1069. +         case 's':
  1070. +         case 'p':
  1071. +         *type = t;
  1072. +         return(i);
  1073. +     }
  1074. +     for (i = points; i >= 6; i--)
  1075. +     switch(t = p[ptcvt(i)]) {
  1076. +         case 'S':
  1077. +         case 'P':
  1078. +         t = tolower(t);
  1079. +         case 's':
  1080. +         case 'p':
  1081. +         *type = t;
  1082. +         return(i);
  1083. +     }
  1084. +     return(-1);
  1085. + }
  1086. + #endif
  1087.   #ifdef    INCR
  1088.   dumpseq(font, pointidx, seq)
  1089.   int font, pointidx;
  1090. ***************
  1091. *** 431,436 ****
  1092. --- 471,477 ----
  1093.       extern FILE *popen();
  1094.       register char *pf, *p;
  1095.       register struct pkp *pk;
  1096. +     char resulttype;
  1097.   #if    !defined(INCR) && defined(PK)
  1098.       register struct pkc *pc;
  1099.   #endif
  1100. ***************
  1101. *** 438,443 ****
  1102. --- 479,485 ----
  1103.   #ifndef    PARTIAL
  1104.       FILE *fontfile;
  1105.   #endif
  1106. +     int scalepoints;
  1107.       int count;
  1108.       int ftid;
  1109.   
  1110. ***************
  1111. *** 451,468 ****
  1112.       return;
  1113.   #endif
  1114.   
  1115.       points = bestmatch(font, selpoints);
  1116.       pointidx = ptcvt(points);
  1117.   
  1118.       pf = &fonttable[font].fontFlags[pointidx];
  1119.       ftid = (font << 4) + pointidx;
  1120.   
  1121. ! #ifdef    INCR
  1122.   #ifdef    SFP
  1123. !     if (*pf == 'S' || *pf == 'P') {
  1124. ! #else
  1125. !     if (*pf == 'P') {
  1126.   #endif
  1127.       /* header downloaded, check and download individual characters */
  1128.       dumpseq(font, pointidx, sequence);
  1129.   
  1130. --- 493,517 ----
  1131.       return;
  1132.   #endif
  1133.   
  1134. + #ifdef PKSCALE
  1135. +     points = selpoints;
  1136. + #else
  1137.       points = bestmatch(font, selpoints);
  1138. + #endif
  1139.       pointidx = ptcvt(points);
  1140.   
  1141.       pf = &fonttable[font].fontFlags[pointidx];
  1142.       ftid = (font << 4) + pointidx;
  1143.   
  1144. ! #if defined(INCR) || defined(SFP) || defined(PKSCALE)
  1145. !     if (
  1146. ! #ifdef    PKSCALE
  1147. !     *pf == 'N' ||
  1148. ! #endif
  1149.   #ifdef    SFP
  1150. !     *pf == 'S' ||
  1151.   #endif
  1152. +     *pf == 'P') {
  1153.       /* header downloaded, check and download individual characters */
  1154.       dumpseq(font, pointidx, sequence);
  1155.   
  1156. ***************
  1157. *** 484,490 ****
  1158.       lastPoints = selpoints;
  1159.       lastFont = font;
  1160.   
  1161. !     switch(*pf) {
  1162.   #ifdef    PK
  1163.       case 'p':
  1164.   #ifdef    PARTIAL
  1165. --- 533,549 ----
  1166.       lastPoints = selpoints;
  1167.       lastFont = font;
  1168.   
  1169. !     scalepoints = points;
  1170. !     switch(resulttype = *pf) {
  1171. ! #ifdef    PKSCALE
  1172. !     case 'n':
  1173. !         scalepoints = scalematch(font, points, &resulttype);
  1174. !         /* on a successful call, *pf is now either "s" or
  1175. !            "p".  */
  1176. !         DBP((D_FONT,"Scale select %s.%d via '%d' points (%c)\n",
  1177. !         fonttable[font].troffName, points, scalepoints, *pf));
  1178. ! #endif
  1179.   #ifdef    PK
  1180.       case 'p':
  1181.   #ifdef    PARTIAL
  1182. ***************
  1183. *** 491,498 ****
  1184.       case 's':
  1185.   #endif
  1186.           sprintf(buf, "%s/%s.%d.%s", LJF,
  1187. !         fonttable[font].troffName, points,
  1188. !             (*pf == 's') ? "sfp":"pk");
  1189.   
  1190.           fontCount++;
  1191.           if (fontCount >= MAXDLFONTS) {
  1192. --- 550,557 ----
  1193.       case 's':
  1194.   #endif
  1195.           sprintf(buf, "%s/%s.%d.%s", LJF,
  1196. !         fonttable[font].troffName, scalepoints,
  1197. !         (resulttype == 's') ? "sfp":"pk");
  1198.   
  1199.           fontCount++;
  1200.           if (fontCount >= MAXDLFONTS) {
  1201. ***************
  1202. *** 508,514 ****
  1203.           points, buf));
  1204.   
  1205.           /* Read the PK file in-core */
  1206. !         pk = pk_read(buf,fontcode);
  1207.   
  1208.           /* Set the fontid we'll use */
  1209.           printf("\033*c%dd4F", ftid);
  1210. --- 567,582 ----
  1211.           points, buf));
  1212.   
  1213.           /* Read the PK file in-core */
  1214. !         pk = pk_read(buf, fontcode);
  1215. ! #ifdef    PKSCALE
  1216. !         if (scalepoints != points) {
  1217. !         DBP((D_FONT, "SCALE %d->%d (font thinks it's %d)\n",
  1218. !             scalepoints, points, pk->pkp_npts));
  1219. !         pk = pkscale(pk, points);    /* destroys old PK */
  1220. !         DBP((D_FONT, "font now thinks it's %d\n", pk->pkp_npts));
  1221. !         }
  1222. ! #endif
  1223.   
  1224.           /* Set the fontid we'll use */
  1225.           printf("\033*c%dd4F", ftid);
  1226. ***************
  1227. *** 597,606 ****
  1228.   #endif
  1229.           /* Fall Thru */
  1230.   
  1231. !     case 'S': case 'P':
  1232.           /* Select primary font by font id */
  1233.       setdownloaded:
  1234. !         DBP((D_FONT, "Selecting font2 %d\n", ftid));
  1235.           printf("\033(%dX", ftid);
  1236.           break;
  1237.   
  1238. --- 665,674 ----
  1239.   #endif
  1240.           /* Fall Thru */
  1241.   
  1242. !     case 'S': case 'P': case 'N':
  1243.           /* Select primary font by font id */
  1244.       setdownloaded:
  1245. !         DBP((D_FONT, "Selecting fontid %d\n", ftid));
  1246.           printf("\033(%dX", ftid);
  1247.           break;
  1248.   
  1249. ***************
  1250. *** 624,635 ****
  1251.   
  1252.   static fixpoints(points)
  1253.   int points; {
  1254. !     static char ptab[30] = {
  1255.        6,  7,  8,  9, 10, 11,
  1256.       12, 12, 14, 14, 16, 16,
  1257.       18, 18, 20, 20, 22, 22,
  1258.       24, 24, 24, 28, 28, 28,
  1259. !     28, 28, 28, 28, 36, 36};
  1260.   
  1261.       if (points < 6)
  1262.       return(6);
  1263. --- 692,704 ----
  1264.   
  1265.   static fixpoints(points)
  1266.   int points; {
  1267. !     static char ptab[31] = {
  1268.        6,  7,  8,  9, 10, 11,
  1269.       12, 12, 14, 14, 16, 16,
  1270.       18, 18, 20, 20, 22, 22,
  1271.       24, 24, 24, 28, 28, 28,
  1272. !     28, 28, 28, 28, 36, 36,
  1273. !     36};
  1274.   
  1275.       if (points < 6)
  1276.       return(6);
  1277. ***************
  1278. *** 748,767 ****
  1279.       for (c = 0; fonttable[c].troffName; c++) {
  1280.       register int i;
  1281.       for (i = 0, p = fonttable[c].fontFlags; *p; p++, i++)
  1282. ! #ifdef    SFP
  1283. !         if (*p == 'p' || *p == 's') {
  1284.   #else
  1285. !         if (*p == 'p') {
  1286.   #endif
  1287. !         DBP((D_FONT, "Allocating font %d, size %d\n",
  1288. !             c, i));
  1289. !         if (!fonttable[c].map) {
  1290. !             fonttable[c].map = (struct downmaps *)
  1291. !             mustmalloc(sizeof(struct downmaps), "downmaps");
  1292. !         }
  1293. !         fonttable[c].map->nm[i] = (ETYP *) mustmalloc(ELEN *
  1294. !             sizeof(ETYP), "Nmaps");
  1295. !         fonttable[c].map->lastpage[i] = 0;
  1296.           }
  1297.       }
  1298.   
  1299. --- 817,842 ----
  1300.       for (c = 0; fonttable[c].troffName; c++) {
  1301.       register int i;
  1302.       for (i = 0, p = fonttable[c].fontFlags; *p; p++, i++)
  1303. !         switch(*p) {
  1304. !         case 'n':
  1305. ! #ifndef PKSCALE    
  1306. !             break;
  1307.   #else
  1308. !             /* FALLTHRU */
  1309.   #endif
  1310. ! #ifdef    SFP
  1311. !         case 's':
  1312. ! #endif
  1313. !         case 'p':
  1314. !             DBP((D_FONT, "Allocating font %d, size %d\n",
  1315. !             c, i));
  1316. !             if (!fonttable[c].map) {
  1317. !             fonttable[c].map = (struct downmaps *)
  1318. !                 mustmalloc(sizeof(struct downmaps), "downmaps");
  1319. !             }
  1320. !             fonttable[c].map->nm[i] = (ETYP *) mustmalloc(ELEN *
  1321. !             sizeof(ETYP), "Nmaps");
  1322. !             fonttable[c].map->lastpage[i] = 0;
  1323.           }
  1324.       }
  1325.   
  1326. Index: ./ljdraw.c
  1327. *** /tmp/PATCHold/./ljdraw.c    Thu Nov 26 23:35:49 1992
  1328. --- ./ljdraw.c    Thu Nov 26 23:35:52 1992
  1329. ***************
  1330. *** 6,13 ****
  1331.       this software is provided.
  1332.   
  1333.       Function:        LaserJet driver, drawing code.
  1334. !             Needs LJII or later (rules)
  1335.   
  1336.   */
  1337.   
  1338. --- 6,26 ----
  1339.       this software is provided.
  1340.   
  1341.       Function:        LaserJet driver, drawing code.
  1342. !             Needs LJII (actually PCL4) or later (rules)
  1343. !     
  1344. !     Currently supports:
  1345. !     line thickness set
  1346. !     fill set
  1347. !     circle & ellipse, c&e fill
  1348. !     lines
  1349. !     polygons
  1350. !     splines
  1351. !     
  1352. !     TODO: 
  1353. !     - polyfill.  Polyfill probably never unless somebody
  1354. !       gives me a polygon fill algorithm (hint hint!)
  1355. !     - optimize emitrast some more.  (wastes up to 25 bytes per subsequent
  1356. !       raster line where the start point is within 2/3 inch.)
  1357.   
  1358.   */
  1359.   
  1360. ***************
  1361. *** 15,24 ****
  1362.   
  1363.   #if    defined(LJ) && defined(INSPECIAL)
  1364.   #include "lj.h"
  1365.   
  1366.   #ifndef    lint
  1367.   static char SCCSid[] =
  1368. !     "@(#)ljdraw.c: 1.1 Copyright 92/01/23 14:26:18 Chris Lewis";
  1369.   #endif
  1370.   
  1371.   static int ljLine();
  1372. --- 28,38 ----
  1373.   
  1374.   #if    defined(LJ) && defined(INSPECIAL)
  1375.   #include "lj.h"
  1376. + #include "math.h"
  1377.   
  1378.   #ifndef    lint
  1379.   static char SCCSid[] =
  1380. !     "@(#)ljdraw.c: 1.2 Copyright 92/11/26 19:39:27 Chris Lewis";
  1381.   #endif
  1382.   
  1383.   static int ljLine();
  1384. ***************
  1385. *** 25,38 ****
  1386.   
  1387.   /*    Do ditroff drawing command in s from origX,origY.
  1388.       If opcode 0 just moveto
  1389. -     This is hardly complete.  Consider it a skeleton
  1390. -     for further work.  Before extending it beyond
  1391. -     horizontal and vertical lines, I'm going to switch
  1392. -     the whole driver over to 300ths from 720ths.
  1393. -     Which should eliminate a little jitter, and removes
  1394. -     a lot of excess work in line drawing.
  1395.    */
  1396.   ljDraw(origX, origY, opcode, ctindex, numbers, saves)
  1397.   int origX, origY;
  1398.   int opcode;
  1399. --- 39,59 ----
  1400.   
  1401.   /*    Do ditroff drawing command in s from origX,origY.
  1402.       If opcode 0 just moveto
  1403.    */
  1404. + int curthick = 1;    /* half of current thickness */
  1405. + int curfill = 0;    /* solid black 1000 is solid white */
  1406. + int drawDot();
  1407. + #define sqr(x)    ((x) * (x))
  1408. + static long    rastcount, total;
  1409. + #ifndef M_PI
  1410. + #define    M_PI    3.141529
  1411. + #endif
  1412. + #define    RAD_C    (M_PI*2)
  1413.   ljDraw(origX, origY, opcode, ctindex, numbers, saves)
  1414.   int origX, origY;
  1415.   int opcode;
  1416. ***************
  1417. *** 40,49 ****
  1418.   int ctindex;
  1419.   short *numbers; {
  1420.   
  1421. !     int i, fill = 0;
  1422. !     static float curfill = 0;
  1423. !     static int curthick = 1;
  1424. !     static int warned = 0;
  1425.   
  1426.       /* map absolute beginning position. */
  1427.       origX = TROFF2LJX(origX);
  1428. --- 61,67 ----
  1429.   int ctindex;
  1430.   short *numbers; {
  1431.   
  1432. !     int i;
  1433.   
  1434.       /* map absolute beginning position. */
  1435.       origX = TROFF2LJX(origX);
  1436. ***************
  1437. *** 50,192 ****
  1438.       origY = TROFF2LJY(origY);
  1439.   
  1440.       if (!opcode) {
  1441. !     printf(XY, origX, origY);
  1442. !     lastYPos = origY;
  1443.       return;
  1444.       }
  1445.   
  1446. -     if (opcode != 'l')
  1447. -     if (!warned) {
  1448. -         fprintf(stderr, "%s: only lines are currently supported\n", progname);
  1449. -         warned = 1;
  1450. -         return;
  1451. -     }
  1452.       switch (opcode) {
  1453.       case 'f':
  1454.           if (ctindex == 2)
  1455.           ctindex = 1;
  1456. !         if (!require(1, ctindex, "set fill", saves))
  1457. !         curfill = (double) numbers[0] / 1000;
  1458.           return;
  1459.       case 't':
  1460.           if (ctindex == 2)
  1461.           ctindex = 1;
  1462. !         if (!require(1, ctindex, "set thick", saves))
  1463. !         curthick = numbers[0];
  1464.           return;
  1465.       }
  1466.   
  1467.       DBP((D_CAT, "ljDraw: (%d,%d): %s\n", origX, origY, saves));
  1468.   
  1469.       switch (opcode) {
  1470. !     case 'C':
  1471.           if (ctindex == 2)
  1472.           ctindex = 1;
  1473. -     case 'E':
  1474. -     case 'P':
  1475. -         fill = 1;
  1476. -         if (opcode != 'P')
  1477. -         break;
  1478. -     case 'l':
  1479. -     case 'a':
  1480. -     case 'p':
  1481. -     case '~':
  1482. -         for (i = 0; i < ctindex; i++)
  1483. -         numbers[i] = numbers[i] * LJRESOLUTION / TROFFRESOLUTION;
  1484.       }
  1485.       switch(opcode) {
  1486.       case 'l':
  1487.           if (require(2, ctindex, "line", saves))
  1488.           return;
  1489. -         DBP((D_CAT, "drawline: %d, %d\n", numbers[0], numbers[1]));
  1490.           ljLine(origX, origY, origX + numbers[0], origY + numbers[1]);
  1491. !         break;
  1492. ! #if    0
  1493. !     case 'a':
  1494. !         if (require(4, ctindex, "arc", saves))
  1495. !         return;
  1496. !         for (i = 0; i < 4; i++) {
  1497. !         emitnums(numbers[i]);
  1498. !         }
  1499. !         putnl("Arc");
  1500. !         break;
  1501.       case 'C':
  1502.       case 'c':
  1503.           if (require(1, ctindex, "circle", saves))
  1504.           return;
  1505.           numbers[1] = numbers[0];
  1506. !         ctindex++;
  1507.       case 'E':
  1508.       case 'e':
  1509.           if (require(2, ctindex, "ellipse", saves))
  1510.           return;
  1511. !         DBP((D_CAT, "drawellipse: %d, %d\n", numbers[0], numbers[1]));
  1512. !         emitnums((int) numbers[0]);
  1513. !         emitnums((int) numbers[1]);
  1514. !         putnl("Ellipse");
  1515. !         break;
  1516.       case 'P':
  1517.       case 'p':
  1518.           if (ctindex&1) {
  1519. !         fprintf(stderr, "%s: even number of points for polygon: %s\n",
  1520.               progname, saves);
  1521. !         break;
  1522. !         }
  1523. !         for (i = 0; i < ctindex; i += 2) {
  1524. !         emitnums((int) numbers[i]);
  1525. !         emitnums((int) numbers[i+1]);
  1526. !         putnl("rlineto");
  1527.           }
  1528. !         putnl(" closepath");
  1529. !         break;
  1530. !     case '~':
  1531. !         if (ctindex < 4) {
  1532. !         fprintf(stderr, "%s: too few points to spline: %s\n",
  1533.               progname, saves);
  1534. !         break;
  1535. !         }
  1536. !         emitnums(numbers[0]/2);
  1537. !         emitnums(numbers[1]/2);
  1538. !         putnl("rlineto");
  1539. !         /* NUM/DEN should be between 0 and 1; the closer it is to 1
  1540. !         the tighter the curve will be to the guiding lines; 2/3
  1541. !         is the standard value */
  1542. ! #define    NUM    2
  1543. ! #define    DEN    3
  1544. !         for (i = 0; i < ctindex - 2; i += 2) {
  1545. !         emitnums((numbers[i]*NUM)/(2*DEN));
  1546. !         emitnums((numbers[i + 1]*NUM)/(2*DEN));
  1547. !         emitnums(numbers[i]/2 + (numbers[i + 2]*(DEN - NUM))/(2*DEN));
  1548. !         emitnums(numbers[i + 1]/2 + (numbers[i + 3]*(DEN - NUM))/(2*DEN));
  1549. !         emitnums((numbers[i] - numbers[i]/2) + numbers[i + 2]/2);
  1550. !         emitnums((numbers[i + 1] - numbers[i + 1]/2) + numbers[i + 3]/2);
  1551. !         putnl("rcurveto");
  1552.           }
  1553. !         emitnums(numbers[ctindex - 2] - numbers[ctindex - 2]/2);
  1554. !         emitnums(numbers[ctindex - 1] - numbers[ctindex - 1]/2);
  1555. !         putnl("rlineto");
  1556. !         break;
  1557. ! #endif
  1558.       default:
  1559.           fprintf(stderr, "%s: invalid draw code %c (%s)\n", progname, opcode,
  1560.           saves);
  1561. !         break;
  1562.       }
  1563.   }
  1564.   
  1565. ! static
  1566. ! linwid() {
  1567. !     register int a;
  1568. !     a = lastPoints / 4;
  1569. !     if (!a)
  1570. !     a = 1;
  1571. !     else if (a > 10)
  1572. !     a = 10;
  1573. !     return(a);
  1574.   }
  1575. !     
  1576.   
  1577.   static ljPos(x, y)
  1578.   register int x, y; {
  1579. --- 68,246 ----
  1580.       origY = TROFF2LJY(origY);
  1581.   
  1582.       if (!opcode) {
  1583. !     ljPos(origX, origY);
  1584.       return;
  1585.       }
  1586.   
  1587.       switch (opcode) {
  1588.       case 'f':
  1589.           if (ctindex == 2)
  1590.           ctindex = 1;
  1591. !         if (!require(1, ctindex, "set fill", saves)) {
  1592. !         curfill = numbers[0];
  1593. !         if (curfill < 0)
  1594. !             curfill = 0;
  1595. !         if (curfill > 1000)
  1596. !             curfill = 1000;
  1597. !         DBP((D_PIC, "FILL: %d\n", curfill));
  1598. !         }
  1599.           return;
  1600.       case 't':
  1601.           if (ctindex == 2)
  1602.           ctindex = 1;
  1603. !         if (!require(1, ctindex, "set thick", saves)) {
  1604. !         curthick = numbers[0] / 2;
  1605. !         if (curthick < 1)
  1606. !             curthick = 1;
  1607. !         DBP((D_PIC, "THICK: %d\n", curthick));
  1608. !         }
  1609.           return;
  1610.       }
  1611.   
  1612.       DBP((D_CAT, "ljDraw: (%d,%d): %s\n", origX, origY, saves));
  1613.   
  1614.       switch (opcode) {
  1615. !     case 'C': case 'c':
  1616.           if (ctindex == 2)
  1617.           ctindex = 1;
  1618.       }
  1619. +     for (i = 0; i < ctindex; i++)
  1620. +     numbers[i] = numbers[i] * LJRESOLUTION / TROFFRESOLUTION;
  1621.       switch(opcode) {
  1622.       case 'l':
  1623.           if (require(2, ctindex, "line", saves))
  1624.           return;
  1625.           ljLine(origX, origY, origX + numbers[0], origY + numbers[1]);
  1626. !         return;
  1627.       case 'C':
  1628.       case 'c':
  1629.           if (require(1, ctindex, "circle", saves))
  1630.           return;
  1631.           numbers[1] = numbers[0];
  1632. !         ljCircle(origX + numbers[0] / 2, origY, numbers[0] / 2,
  1633. !         drawDot, opcode == 'C' ? curfill: -1);
  1634. !         return;
  1635.       case 'E':
  1636.       case 'e':
  1637.           if (require(2, ctindex, "ellipse", saves))
  1638.           return;
  1639. !         ljEllipse(origX + numbers[0] / 2, origY, numbers[0]/2, numbers[1]/2,
  1640. !         opcode == 'E' ? curfill: -1);
  1641. !         return;
  1642.       case 'P':
  1643.       case 'p':
  1644.           if (ctindex&1) {
  1645. !         fprintf(stderr, "%s: need even number of points for polygon: %s\n",
  1646.               progname, saves);
  1647. !         return;
  1648.           }
  1649. !         ljPoly(origX, origY, ctindex, numbers);
  1650. !         return;
  1651. !     case 'a':
  1652. !         if (require(4, ctindex, "arc", saves))
  1653. !         return;
  1654. !         ljArc(origX, origY, numbers[0], numbers[1], numbers[2], numbers[3]);
  1655. !         return;
  1656. !     case '~': 
  1657. !         if (ctindex < 4 || (ctindex&1)) {
  1658. !         fprintf(stderr, "%s: too few points to spline, or odd point count: %s\n",
  1659.               progname, saves);
  1660. !         return;
  1661.           }
  1662. !         ljSpline(origX, origY, ctindex, numbers);
  1663. !         return;
  1664. !         
  1665.       default:
  1666.           fprintf(stderr, "%s: invalid draw code %c (%s)\n", progname, opcode,
  1667.           saves);
  1668. !         return;
  1669.       }
  1670.   }
  1671.   
  1672. ! /* Can't do polygon fill.  Probably never will - needs far more
  1673. !    advanced techniques than I'm willing to do */
  1674. ! ljPoly(curx, cury, ctindex, numbers)
  1675. ! int curx, cury, ctindex;
  1676. ! short *numbers; {
  1677. !     int i;
  1678. !     DBP((D_PIC, "ljPoly\n"));
  1679. !     for (i = 0; i < ctindex; i += 2) {
  1680. !     ljLine(curx, cury, curx + numbers[i], cury + numbers[i+1]);
  1681. !     curx += numbers[i];
  1682. !     cury += numbers[i+1];
  1683. !     }
  1684. ! }
  1685. ! int lx, ly;
  1686. ! ljSpline(ox, oy, ctindex, numbers)
  1687. ! int ox, oy, ctindex;
  1688. ! short *numbers; {
  1689. !     int dx = numbers[0], dy = numbers[1];
  1690. !     int sx = ox, sy = oy, tx = sx + dx, ty = sy + dy;
  1691. !     int i;
  1692. !     DBP((D_PIC, "ljSpline\n"));
  1693. !     ljLine(sx, sy, lx = (sx + tx) / 2, ly = (sy + ty) / 2);
  1694. !     for (i = 2; i < ctindex; i += 2) {
  1695. !     int ux = ox + (dx += numbers[i]);
  1696. !     int uy = oy + (dy += numbers[i+1]);
  1697. !     flatten((sx + tx*5)/6, (sy + ty*5)/6, (tx*5 + ux) / 6,
  1698. !         (ty*5 + uy) / 6, (tx + ux) / 2, (ty + uy) / 2);
  1699. !     sx = tx;
  1700. !     sy = ty;
  1701. !     tx = ux;
  1702. !     ty = uy;
  1703. !     }
  1704. !     ljLine(lx, ly, tx, ty);
  1705.   }
  1706. ! #define FLAT 1
  1707. ! flatten(x2, y2, x3, y3, x4, y4)
  1708. ! int x2, y2, x3, y3, x4, y4; {
  1709. !     int x1 = lx, y1 = ly, dx, dy, n1, n2, n;
  1710. !     dx = x4 - x1;
  1711. !     dy = y4 - y1;
  1712. !     n1 = dy*(x2 - x1) - dx*(y2 - y1);
  1713. !     n2 = dy*(x3 - x1) - dx*(y3 - y1);
  1714. !     if (n1 < 0)
  1715. !     n1 = -n1;
  1716. !     if (n2 < 0)
  1717. !     n2 = -n2;
  1718. !     n = n1 > n2 ? n1 : n2;
  1719. !     if (n*n / (dy*dy + dx*dx) <= FLAT*FLAT) {
  1720. !     ljLine(lx, ly, x4, y4);
  1721. !     lx = x4;
  1722. !     ly = y4;
  1723. !     } else {
  1724. !     flatten( (x1 + x2)/2, (y1 + y2)/2,
  1725. !           (x1 + x2*2 + x3)/4, (y1 + y2*2 + y3)/4,
  1726. !           (x1 +3*x2 + 3*x3 + x4)/8, (y1 +3*y2 + 3*y3 + y4)/8);
  1727. !     flatten( (x2 + x3*2 + x4)/4, (y2 + y3*2 + y4)/4,
  1728. !           (x3 + x4)/2, (y3 + y4)/2, x4, y4);
  1729. !     }
  1730. ! }
  1731.   
  1732.   static ljPos(x, y)
  1733.   register int x, y; {
  1734. ***************
  1735. *** 194,241 ****
  1736.       lastYPos = y;
  1737.   }
  1738.   
  1739. - static
  1740. - ljHLine(x0, y0, x1, y1)
  1741. - int x0, y0, x1, y1; {
  1742. -     static int warning = 0;
  1743. -     if (!warning) {
  1744. -     fprintf(stderr, "%s: contains non-vertical or horizontal lines.  Ignored\n",
  1745. -         progname);
  1746. -     warning = 1;
  1747. -     }
  1748. - }
  1749.   
  1750.   static
  1751.   ljVerLine(x0, y0, y1)
  1752.   register int x0, y0, y1; {
  1753. -     register int t;
  1754.       if (y0 > y1) {
  1755.       t = y0;
  1756.       y0 = y1;
  1757.       y1 = t;
  1758.       }
  1759. !     t = linwid();
  1760. !     ljPos(x0, y0-t+1);
  1761. !     printf("\033*c%da%db0P", t, y1-y0+t);
  1762.   }
  1763.   
  1764.   static
  1765.   ljHorLine(x0, y0, x1)
  1766.   register int x0, y0, x1; {
  1767. -     register int t = linwid();
  1768.       if (x0 > x1) {
  1769.       t = x0;
  1770.       x0 = x1;
  1771.       x1 = t;
  1772.       }
  1773. !     t = linwid();
  1774. !     ljPos(x0, y0-t+1);
  1775. !     printf("\033*c%da%db0P", x1-x0+t, t);
  1776.   }
  1777.   
  1778.   static
  1779.   ljLine(x0, y0, x1, y1)
  1780.   register int x0, y0, x1, y1; {
  1781.       if (y0 == y1)
  1782.       ljHorLine(x0, y0, x1);
  1783.       else if (x0 == x1)
  1784. --- 248,288 ----
  1785.       lastYPos = y;
  1786.   }
  1787.   
  1788.   
  1789.   static
  1790.   ljVerLine(x0, y0, y1)
  1791.   register int x0, y0, y1; {
  1792.       if (y0 > y1) {
  1793. +     register int t;
  1794.       t = y0;
  1795.       y0 = y1;
  1796.       y1 = t;
  1797.       }
  1798. !     ljPos(x0-curthick, y0);
  1799. !     printf("\033*c%da%db0P", curthick<<1, y1-y0);
  1800. !     ljCircle (x0, y0, curthick, drawDot, 0);
  1801. !     ljCircle (x0, y1, curthick, drawDot, 0);
  1802.   }
  1803.   
  1804.   static
  1805.   ljHorLine(x0, y0, x1)
  1806.   register int x0, y0, x1; {
  1807.       if (x0 > x1) {
  1808. +     register int t;
  1809.       t = x0;
  1810.       x0 = x1;
  1811.       x1 = t;
  1812.       }
  1813. !     ljPos(x0, y0-curthick);
  1814. !     printf("\033*c%da%db0P", x1-x0, curthick<<1);
  1815. !     ljCircle (x0, y0, curthick, drawDot, 0);
  1816. !     ljCircle (x1, y0, curthick, drawDot, 0);
  1817.   }
  1818.   
  1819.   static
  1820.   ljLine(x0, y0, x1, y1)
  1821.   register int x0, y0, x1, y1; {
  1822. +     DBP((D_PIC, "ljLine: (%d,%d)..(%d,%d), curthick: %d\n", x0, y0, x1, y1, curthick));
  1823.       if (y0 == y1)
  1824.       ljHorLine(x0, y0, x1);
  1825.       else if (x0 == x1)
  1826. ***************
  1827. *** 243,248 ****
  1828. --- 290,786 ----
  1829.       else
  1830.       ljHLine(x0, y0, x1, y1);
  1831.   
  1832. + }
  1833. + #define    abs(x)    ((x) < 0? -(x): (x))
  1834. + /*    Breshenham's line drawing algorithm.
  1835. +     Extended to full 4 quadrant line drawing.
  1836. +     Uses only adds/subtracts and <<1.
  1837. +     Should run like the proverbial bat */
  1838. + ljHLine(x0, y0, x1, y1)
  1839. + int x0, y0, x1, y1; {
  1840. +     extern int rev;
  1841. +     if (abs(y1 - y0) > abs(x1 - x0)) {
  1842. +     rev=1;
  1843. +     lineseg2(y0, x0, y1, x1);
  1844. +     } else {
  1845. +     rev=0;
  1846. +     lineseg2(x0, y0, x1, y1);
  1847. +     }
  1848. +     rev = 0;
  1849. + }
  1850. + int rev;
  1851. +         
  1852. + /* extend base algorithm to -45..45 & 135..225 */
  1853. + lineseg2(x0, y0, x1, y1)
  1854. + int x0, y0, x1, y1; {
  1855. +     if (x1 < x0)
  1856. +     lineseg(x1, y1, x0, y0);
  1857. +     else
  1858. +     lineseg(x0, y0, x1, y1);
  1859. + }
  1860. + static
  1861. + lineseg (x0, y0, x1, y1)
  1862. + int x0, y0, x1, y1; {
  1863. +     register int dx, dy, iE, iNE, d, x, y, ddy;
  1864. +     /* extend algorithm to -45..45 */
  1865. +     dx = x1 - x0;
  1866. +     dy = y1 - y0;
  1867. +     if (dy < 0) {
  1868. +     ddy = -1;
  1869. +     dy = -dy;
  1870. +     } else
  1871. +     ddy = 1;
  1872. +     /* Basic algorithm, 0..45 degrees */
  1873. +     d = 2 * dy - dx;
  1874. +     iE = 2 * dy;
  1875. +     iNE = 2 * (dy - dx);
  1876. +     x = x0;
  1877. +     y = y0;
  1878. +     linePoints(x, y);
  1879. +     while (x < x1) {
  1880. +     if (d <= 0) {
  1881. +         d = d + iE;
  1882. +         x = x + 1;
  1883. +     } else {
  1884. +         d = d + iNE;
  1885. +         x = x + 1;
  1886. +         y = y + ddy;
  1887. +     }
  1888. +     linePoints(x, y);
  1889. +     }
  1890. + }
  1891. + /* This procedure uses second-order partial differences to compute increments
  1892. +    in the decision variable.  Assumes center of circle is at origin.
  1893. +    It actually calculates only one octant, then circlePoints maps
  1894. +    it into the rest of a circle */
  1895. + ljCircle (origx, origy, radius, dotfcn, fill)
  1896. + int origx, origy, radius, fill;
  1897. + FUNC dotfcn;
  1898. + {
  1899. +     register int x, y, d, deltaE, deltaSE;
  1900. +     DBP((dotfcn == drawDot ? D_PIC: 0, "ljCircle: (%d,%d),r%d,f%d\n",
  1901. +     origx, origy, radius, fill));
  1902. +     x = 0;
  1903. +     y = radius;
  1904. +     d = 1 - radius;
  1905. +     deltaE = 3;
  1906. +     deltaSE = -2 * radius + 5;
  1907. +     circlePoints(origx, origy, x, y, dotfcn, fill);
  1908. +     while (y > x) {
  1909. +     if (d < 0) { /* select E */
  1910. +         d += deltaE;
  1911. +         deltaE += 2;
  1912. +         deltaSE += 2;
  1913. +         x++;
  1914. +     } else {    /* select SE */
  1915. +         d += deltaSE;
  1916. +         deltaE += 2;
  1917. +         deltaSE += 4;
  1918. +         x++;
  1919. +         y--;
  1920. +     }
  1921. +     circlePoints(origx, origy, x, y, dotfcn, fill);
  1922. +     }
  1923. + }
  1924. + circlePoints(ox, oy, x, y, dotfcn, fill)
  1925. + int ox, oy, x, y, fill;
  1926. + FUNC dotfcn; {
  1927. +     if (fill != -1) {
  1928. +     dofill(ox, x, oy+y, fill);
  1929. +     dofill(ox, x, oy-y, fill);
  1930. +     dofill(ox, y, oy+x, fill);
  1931. +     dofill(ox, y, oy-x, fill);
  1932. +     } else {
  1933. +     dotfcn(ox+x, oy+y, dotfcn);
  1934. +     dotfcn(ox+x, oy-y, dotfcn);
  1935. +     dotfcn(ox-x, oy+y, dotfcn);
  1936. +     dotfcn(ox-x, oy-y, dotfcn);
  1937. +     dotfcn(ox+y, oy+x, dotfcn);
  1938. +     dotfcn(ox+y, oy-x, dotfcn);
  1939. +     dotfcn(ox-y, oy+x, dotfcn);
  1940. +     dotfcn(ox-y, oy-x, dotfcn);
  1941. +     }
  1942. + }
  1943. + /*    Describes octants, counterclockwise from 0.
  1944. +     0: off
  1945. +     1: on
  1946. +     2: calculate
  1947. +  */
  1948. + static int    arcOctant[8], invert;
  1949. + static double arcStart, arcEnd;
  1950. + /* roughly the same as ljCircle, except octant selector gunge */
  1951. + ljArc (x0, y0, xc, yc, x1, y1)
  1952. + int x0, y0, xc, yc, x1, y1;
  1953. + {
  1954. +     register int x, y, d, deltaE, deltaSE, radius;
  1955. +     double t, c;
  1956. +     DBP((D_PIC, "ljArc: %d, %d, %d, %d, %d, %d\n",
  1957. +     x0, y0, xc, yc, x1, y1));
  1958. +     {
  1959. +     int inttmp;
  1960. +     inttmp = x0 + xc;
  1961. +     x0 = xc;
  1962. +     xc = inttmp;
  1963. +     inttmp = y0 + yc;
  1964. +     y0 = yc;
  1965. +     yc = inttmp;
  1966. +     }
  1967. +     radius = sqrt((double) sqr(x0) + (double) sqr(y0)) + .5;
  1968. +     arcStart = atan2((double) y0, (double) -x0);
  1969. +     arcEnd = atan2((double) -y1, (double) x1);
  1970. +     if (arcStart < 0)
  1971. +     arcStart += RAD_C;
  1972. +     if (arcEnd < 0)
  1973. +     arcEnd += RAD_C;
  1974. +     if (arcStart > arcEnd) {
  1975. +     invert = 1;
  1976. +     t = arcStart;
  1977. +     arcStart = arcEnd;
  1978. +     arcEnd = t;
  1979. +     } else {
  1980. +     invert = 0;
  1981. +     }
  1982. +     DBP((D_PIC, "ljArc: (%d,%d),r%d,inv:%d, (%f,%f)\n",
  1983. +     xc, yc, radius, invert, arcStart, arcEnd));
  1984. +     for (x = 0; x < 8; x++)
  1985. +     arcOctant[x] = invert;
  1986. +     x = 8 * arcStart / (2*M_PI);
  1987. +     y = 8 * arcEnd / (2*M_PI);
  1988. +     arcOctant[x] = 2;
  1989. +     arcOctant[y] = 2;
  1990. +     for (d = x+1; d < y; d++)
  1991. +     arcOctant[d] = !invert;
  1992. +     t = 2*M_PI / 8;
  1993. +     for (x = 0; x < 8; x++) {
  1994. +     c = x*t;
  1995. +     DBP((D_PIC, "%d: %f:%f (%f:%f) %d (%d)\n", x, c, c+t, arcStart, arcEnd,
  1996. +         arcOctant[x], invert));
  1997. +     }
  1998. +     x = 0;
  1999. +     y = radius;
  2000. +     d = 1 - radius;
  2001. +     deltaE = 3;
  2002. +     deltaSE = -2 * radius + 5;
  2003. +     arcPoints(xc, yc, x, y);
  2004. +     while (y > x) {
  2005. +     if (d < 0) { /* select E */
  2006. +         d += deltaE;
  2007. +         deltaE += 2;
  2008. +         deltaSE += 2;
  2009. +         x++;
  2010. +     } else {    /* select SE */
  2011. +         d += deltaSE;
  2012. +         deltaE += 2;
  2013. +         deltaSE += 4;
  2014. +         x++;
  2015. +         y--;
  2016. +     }
  2017. +     arcPoints(xc, yc, x, y);
  2018. +     }
  2019. + }
  2020. + /* if (octant on) ||
  2021. +       (endpoints in this octant && calculation shows point should be here)
  2022. +    put a dot
  2023. +  */
  2024. + #define arcDot(q, a, b, c, d) if (arcOctant[q] == 1 || \
  2025. +     (arcOctant[q] == 2 && \
  2026. +     ((t = atan2((double) -b,(double) a)),t = (t<0?t+RAD_C:t),\
  2027. +     invert ^ (t >= arcStart && t <= arcEnd)))) \
  2028. +     drawDot(c,d)
  2029. + arcPoints(ox, oy, x, y)
  2030. + int ox, oy, x, y; {
  2031. +     double t;
  2032. +     arcDot(0, y, -x, ox+y, oy-x);
  2033. +     arcDot(1, x, -y, ox+x, oy-y);
  2034. +     arcDot(2, -x, -y, ox-x, oy-y);
  2035. +     arcDot(3, -y, -x, ox-y, oy-x);
  2036. +     arcDot(4, -y, x, ox-y, oy+x);
  2037. +     arcDot(5, -x, y, ox-x, oy+y);
  2038. +     arcDot(6, x, y, ox+x, oy+y);
  2039. +     arcDot(7, y, x, ox+y, oy+x);
  2040. + }
  2041. + /*    the fill range 0..1000 selects one of these 8
  2042. +     rows.  Each row describes a 8x8 fill pattern.
  2043. +  */
  2044. + static char fillpat[9][8] = {
  2045. +     { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
  2046. +     { 0xc3, 0xa5, 0x24, 0xe9, 0xe9, 0x24, 0xa5, 0xc3 },
  2047. +     { 0xe7, 0xc3, 0x24, 0x3c, 0x3c, 0x24, 0xc3, 0xe7 },
  2048. +     { 0xc3, 0x81, 0x00, 0x18, 0x18, 0x00, 0x81, 0xc3 },
  2049. +     { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 },
  2050. +     { 0x81, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x81 },
  2051. +     { 0x00, 0x42, 0x00, 0x18, 0x18, 0x00, 0x42, 0x00 },
  2052. +     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  2053. +     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
  2054. + };
  2055. + /* fill from (x-dx,y) to (x+dx, y) with the fill pattern.
  2056. +     fill pattern is aligned on byte boundaries in raster,
  2057. +     so theoretically, we could convert this to 0..7
  2058. +     of bit-dinks, a multi-byte memset, and 0..7 more
  2059. +     bit-dinks.  Profiling doesn't seem to show this as significant.
  2060. +  */
  2061. + dofill(x, dx, y, fill)
  2062. + register int x, dx, y, fill; {
  2063. +     register int t, td;
  2064. +     static int lastind = -1;
  2065. +     register int ind = fill/125;
  2066. +     register char fp = fillpat[ind][y&7];
  2067. + #ifdef DEBUG
  2068. +     if (lastind != ind) {
  2069. +     DBP((D_PIC, "dofill: (%d+-%d,%d) %d->%d, fp:%02x\n", x, dx, y, fill, ind, fp));
  2070. +     lastind = ind;
  2071. +     }
  2072. + #endif
  2073. +     asetbit(x, y);    /* make sure row is allocated */
  2074. +     td = x + dx;
  2075. +     for (t = x - dx; t < td; t++)
  2076. +     if ((0x80 >> (t&7)) & fp)
  2077. +         setbit(t, y);
  2078. +     else
  2079. +         clearbit(t, y);
  2080. + }
  2081. + EllipsePoints (ox, oy, x, y, fill)
  2082. + int ox, oy, x, y, fill; {
  2083. +     if (fill != -1) {
  2084. +     dofill(ox, x, oy+y, fill);
  2085. +     dofill(ox, x, oy-y, fill);
  2086. +     } else {
  2087. +     drawDot(ox + x, oy + y);
  2088. +     drawDot(ox + x, oy - y);
  2089. +     drawDot(ox - x, oy + y);
  2090. +     drawDot(ox - x, oy - y);
  2091. +     }
  2092. + }
  2093. + ljEllipse(ox, oy, a, b, fill)
  2094. + int ox, oy, a, b, fill; {
  2095. +     int x, y;
  2096. +     double d1, d2;
  2097. +     int sqra = a*a,
  2098. +     sqrb = b*b;
  2099. +     DBP((D_PIC, "ljEllipse: (%d,%d),xr%d,yr%d,f%d\n",
  2100. +     ox, oy, a, b, fill));
  2101. +     x = 0;
  2102. +     y = b;
  2103. +     d1 = sqrb - sqra * b + (double) sqra / 4;
  2104. +     EllipsePoints(ox, oy, x, y, fill);
  2105. +     while (sqra * (y - .5) > sqrb * (x + 1)) {
  2106. +     if (d1 < 0) {
  2107. +         d1 = d1 + sqrb * (2 * x + 3);
  2108. +         x++;
  2109. +     } else {
  2110. +         d1 = d1 + sqrb * (2 * x + 3) + sqra * (-2 * y + 2);
  2111. +         x++;
  2112. +         y--;
  2113. +     }
  2114. +     EllipsePoints(ox, oy, x, y, fill);
  2115. +     }
  2116. +     d2 = sqrb * sqr(x + .5) + sqra * sqr(y - 1) - sqra * sqrb;
  2117. +     while (y > 0) {
  2118. +     if (d2 < 0) {
  2119. +         d2 = d2 + sqrb * (2 * x + 2) + sqra * (-2 * y + 3);
  2120. +         x++;
  2121. +         y--;
  2122. +     } else {
  2123. +         d2 = d2 + sqra * (-2 * y + 3);
  2124. +         y--;
  2125. +     }
  2126. +     EllipsePoints(ox, oy, x, y, fill);
  2127. +     }
  2128. + }
  2129. + linePoints(x, y)
  2130. + int x, y; {
  2131. +     if (rev)
  2132. +     drawDot(y,x);
  2133. +     else
  2134. +     drawDot(x,y);
  2135. + }
  2136. + /* General point drawing routine.  The idea is to draw a filled circle
  2137. +    at each pixel with radius 1/2 the desired thickness.  Doing a filled
  2138. +    circle is a lot of bit-dinking, so we optimize by drawing unfilled
  2139. +    circles with minimum line-width, and rely on adjacent circles to fill
  2140. +    in the hole.  Means that lines shorter than the line thickness
  2141. +    may have some hollow bits.
  2142. +  */
  2143. + drawDot(x, y)
  2144. + int x, y; {
  2145. +     if (curthick <= 1) {
  2146. +     asetbit(x, y);
  2147. +     asetbit(x+1, y);
  2148. +     asetbit(x, y+1);
  2149. +     asetbit(x+1, y+1);
  2150. +     } else
  2151. +     ljCircle(x, y, curthick, asetbit, -1);
  2152. + }
  2153. + /*    RASTER ENGINE */
  2154. + char **ljraster = NULL;
  2155. + int thispage = 0;
  2156. + /* only supports drawing resolution of 300 at the moment. */
  2157. + #define DRAWRES    300
  2158. + #define BYTESPERLINE (8 * DRAWRES) / 8
  2159. + #define RESMULT (LJRESOLUTION / DRAWRES)
  2160. + #define ESCLEN 25
  2161. + int
  2162. + nullscan(start, end)
  2163. + register char *start, *end; {
  2164. +     register char *cur;
  2165. +     for (cur = start; cur < end && !*cur; cur++);
  2166. +     return(cur - start);
  2167. + }
  2168. + int
  2169. + pixblock(start, end)
  2170. + register char *start, *end; {
  2171. +     register char *cur;
  2172. +     register int numnulls;
  2173. +     if (end - start <= ESCLEN * 2)    /* no point optimizing */
  2174. +     return(end - start);
  2175. +     cur = start;
  2176. +     while(cur < end) {
  2177. +     for(; *cur && cur < end; cur++);
  2178. +     numnulls = nullscan(cur, end);
  2179. +     if (numnulls > ESCLEN)
  2180. +         return(cur - start);
  2181. +     else
  2182. +         cur += numnulls;
  2183. +     }
  2184. +     return(end - start);
  2185. + }
  2186. + emitrast()
  2187. + {
  2188. +     int bperline;
  2189. +     int numx = BYTESPERLINE * 8;
  2190. +     int numy = pagelength;
  2191. +     register char *ip, *lineanch, *nip;
  2192. +     register currow, bcount;
  2193. +     int linecount = 0;
  2194. +     bperline = ((numx + 7) / 8);
  2195. +     if (!thispage)
  2196. +     return;
  2197. +     printf("\033*t%dR", DRAWRES);
  2198. +     for(currow = 0; currow < numy; currow++) {
  2199. +     linecount++;
  2200. +     if (!ljraster[currow])
  2201. +         continue;
  2202. +     lineanch = ip = ljraster[currow];
  2203. +     nip = ip + bperline;
  2204. +     while (ip < nip && !*ip) ip++;
  2205. +     if (ip >= nip)
  2206. +         continue;    /* line has no pixels */
  2207. +     while (!*(nip - 1)) nip--;    /* truncate trailing nulls */
  2208. +     while (ip < nip) {    /* inv: !*ip && !*nip */
  2209. +         bcount = pixblock(ip, nip);
  2210. +         printf("\033*p%dx%dY\033*r1A\033*b%dW",
  2211. +         (ip - lineanch) * 8 * RESMULT, currow * RESMULT, bcount);
  2212. +         rastcount += bcount;
  2213. +         total += (bcount + ESCLEN);
  2214. +         fwrite(ip, 1, bcount, stdout);
  2215. +         fputs("\033*rB", stdout);
  2216. +         for(ip += bcount; ip < nip && !*ip; ip++);
  2217. +     }
  2218. +     free(ljraster[currow]);
  2219. +     ljraster[currow] = (char *) NULL;
  2220. +     }
  2221. +     DBP((D_PIC, "emit raster: %d lines, %d rastbytes, total %d bytes\n",
  2222. +     linecount, rastcount, total));
  2223. +     rastcount = total = 0;
  2224. +     thispage = 0;
  2225. + }
  2226. + asetbit(x, y)
  2227. + register int x, y; {
  2228. +     thispage = 1;
  2229. +     if (y < 0 || y > pagelength) {
  2230. +     /*fprintf(stderr, "y (%d) too big or small (0..%d)\n", y, pagelength);*/
  2231. +     return;
  2232. +     }
  2233. +     if (x < 0 || x > BYTESPERLINE * 8) {
  2234. +     /*fprintf(stderr, "x (%d) too big or small (0..%d)\n", x, BYTESPERLINE*8);*/
  2235. +     return;
  2236. +     }
  2237. +     if (!ljraster) {
  2238. +     ljraster = (char **) mustmalloc(pagelength * sizeof(char *),
  2239. +         "ljraster pointers");
  2240. +     clrarray(ljraster, pagelength * sizeof(char *));
  2241. +     }
  2242. +     if (!ljraster[y]) {
  2243. +     ljraster[y] = (char *) mustmalloc(BYTESPERLINE, "ljraster line");
  2244. +     clrarray(ljraster[y], BYTESPERLINE);
  2245. +     }
  2246. +     ljraster[y][x >> 3] |= (0x80 >> (x & 0x7));
  2247. + }
  2248. + setbit(x, y)
  2249. + register int x, y; {
  2250. +     ljraster[y][x >> 3] |= (0x80 >> (x & 0x7));
  2251. + }
  2252. + clearbit(x, y)
  2253. + register int x, y; {
  2254. +     ljraster[y][x >> 3] &= ~(0x80 >> (x & 0x7));
  2255.   }
  2256.   
  2257.   
  2258. Index: ./lj3draw.c
  2259. *** /tmp/PATCHold/./lj3draw.c    Thu Nov 26 23:36:08 1992
  2260. --- ./lj3draw.c    Thu Nov 26 23:36:09 1992
  2261. ***************
  2262. *** 29,35 ****
  2263.   
  2264.   #ifndef    lint
  2265.   static char SCCSid[] =
  2266. !     "@(#)lj3draw.c: 1.2 Copyright 92/02/10 16:49:48 Chris Lewis";
  2267.   #endif
  2268.   
  2269.   #define to_deg(a)    ((180.0/M_PI) * (a))
  2270. --- 29,35 ----
  2271.   
  2272.   #ifndef    lint
  2273.   static char SCCSid[] =
  2274. !     "@(#)lj3draw.c: 1.3 Copyright 92/11/26 19:42:32 Chris Lewis";
  2275.   #endif
  2276.   
  2277.   #define to_deg(a)    ((180.0/M_PI) * (a))
  2278. ***************
  2279. *** 120,125 ****
  2280. --- 120,126 ----
  2281.           return;
  2282.       }
  2283.       printf(XY,origX,origY);
  2284. +     lastYPos = -1;
  2285.       if (!opcode)
  2286.       return;
  2287.   
  2288. Index: ./pkscale.c
  2289. *** /tmp/PATCHold/./pkscale.c    Thu Nov 26 23:36:17 1992
  2290. --- ./pkscale.c    Thu Nov 26 23:36:18 1992
  2291. ***************
  2292. *** 12,18 ****
  2293.   #ifdef    PK
  2294.   
  2295.   #ifndef lint
  2296. ! static char SCCSid[] = "@(#)pkscale.c 1.2 Copyright 92/05/19 23:10:53 Chris Lewis";
  2297.   #endif
  2298.   
  2299.   #include "pk.h"
  2300. --- 12,18 ----
  2301.   #ifdef    PK
  2302.   
  2303.   #ifndef lint
  2304. ! static char SCCSid[] = "@(#)pkscale.c 1.3 Copyright 92/10/30 02:27:04 Chris Lewis";
  2305.   #endif
  2306.   
  2307.   #include "pk.h"
  2308. ***************
  2309. *** 70,79 ****
  2310. --- 70,84 ----
  2311.       npkp->pkp_kh = scalenum(sf, npkp->pkp_kh);
  2312.       npkp->pkp_kl = scalenum(sf, npkp->pkp_kl);
  2313.   
  2314. +     DBP((D_FONT,"To scale %d characters\n", pkp->pkp_num));
  2315.       for (i = 0; i < pkp->pkp_num; i++) {
  2316.       register struct ras *r;
  2317.       pc = pkp->pkp_list[i];
  2318.   
  2319. +     DBP((D_FONT,"Scale char %ld (%c) to %d (%f)\n", pc->pkc_char,
  2320. +         pc->pkc_char, target, sf));
  2321.       /* create new char descriptor, initialized to old */
  2322.       npc = (struct pkc *) mustmalloc(sizeof(struct pkc),
  2323.           "New PK character descriptor");
  2324. ***************
  2325. *** 80,88 ****
  2326. --- 85,97 ----
  2327.       *npc = *pc;
  2328.       if (!npkp->pkp_chars)
  2329.           npkp->pkp_chars = npc;
  2330. +     else
  2331. +         npkp->pkp_list[i-1]->pkc_next = npc;
  2332.       npkp->pkp_last = npc;
  2333.       npkp->pkp_list[i] = npc;
  2334.   
  2335.       /* get a raster to play with */
  2336.       pc->pkc_sfpr = pkrast(pc);
  2337.       if (pc->pkc_pkr)
  2338. ***************
  2339. *** 158,163 ****
  2340. --- 167,176 ----
  2341.       for (x = 0, p = sl; x < sln; x++)
  2342.           *p++ = scale * x + .5;
  2343.       }
  2344. +     DBP((D_FONT, "rast %d:%d (%d) -> %d:%d (%d) (%f)\n",
  2345. +     from->ras_width, from->ras_height, from->ras_bytes,
  2346. +     to->ras_width, to->ras_height, to->ras_bytes, scale));
  2347.   
  2348.       clrarray(to->ras_raster, to->ras_bytes);
  2349.   
  2350. Index: ./pk.h
  2351. *** /tmp/PATCHold/./pk.h    Thu Nov 26 23:36:26 1992
  2352. --- ./pk.h    Thu Nov 26 23:36:27 1992
  2353. ***************
  2354. *** 8,14 ****
  2355.       Function:        PK format font file description
  2356.    */
  2357.   
  2358. ! /* 2.2 91/02/20 */
  2359.   
  2360.   #ifdef    PK
  2361.   
  2362. --- 8,14 ----
  2363.       Function:        PK format font file description
  2364.    */
  2365.   
  2366. ! /* 2.3 92/10/30 */
  2367.   
  2368.   #ifdef    PK
  2369.   
  2370. ***************
  2371. *** 51,56 ****
  2372. --- 51,59 ----
  2373.   };
  2374.   
  2375.   struct pkp *pk_read();
  2376. + #ifdef PKSCALE
  2377. + struct pkp *pkscale();
  2378. + #endif
  2379.   
  2380.   struct pkc {
  2381.       long pkc_flag;    /* flag byte */
  2382.  
  2383.  
  2384.  
  2385. -- 
  2386. Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541
  2387. Psroff 3.0 info: psroff-request@ferret.ocunix.on.ca
  2388. Ferret list: ferret-request@ferret.ocunix.on.ca
  2389.