v04i076: JetRoff Source Code (07 of 7)

root2 at pcrat.UUCP root2 at pcrat.UUCP
Sun Sep 18 09:11:56 AEST 1988


Posting-number: Volume 4, Issue 76
Submitted-by: "A. Nonymous" <root2 at pcrat.UUCP>
Archive-name: jetroff/src/Part07

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 7 (of 7)."
# Contents:  djet/Porting djet/pk16.c font/devjet/makeDESC.c
# Wrapped by rick at pcroe on Sat Aug 27 13:01:17 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'djet/Porting' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'djet/Porting'\"
else
echo shar: Extracting \"'djet/Porting'\" \(16827 characters\)
sed "s/^X//" >'djet/Porting' <<'END_OF_FILE'
XPORTING INFORMATION
X-------------------
X
Xdjet lints TOTALLY clean except for the porting (-p) option.  The -p
Xoption restricts identifier length to 6 characters (amongst other
Xthings), making it unlikely that djet will ever pass muster under -p.
X
Xdjet is known to run on the following machines:
X
XMach	Operating System			.text   .data  .bss   TOTAL
X----------------------------------------------------------------------------
X386/AT	386/ix sVr3				45824 + 6944 + 24996 = 77764
X286/AT	Venix sVr2 (AT&T 286 large model SGS)	45118 + 5612 + 25144 = 75874
X
Xand has had a little testing on a Pyramid runing BSD.
X
XHowever, djet requires dynamic storage, which makes it unlikely to
Xrun on a PDP-11 or a 286 (small model) for anything but the simplest
Xdocuments.
X
XThe major dynamic storage requirements are:
X
X	~7000		DESC file contents (always used)
X	 ~700		per additional non-default fonts
X	 3000 on up	per font/size combo
X	  550		per raster line of drawing (potentially 1.3 MB)
X
XFor really complex documents which use lots of dynamic storage,
Xdjet slows down considerably unless you have virtual memory.
Xdjet only downloads the descriptions of the characters you
Xactually use (for printing speed).
X
Xdjet needs a floating point processor if you make heavy use of:
X
X	arcs		(parts of a circle, but not whole circles)
X	splines		(wiggly lines)
X
X(Anybody know of a good PD integer arc or spline algorithm?)
X
XPROGRAMS AND FILES
X------------------
X	/usr/bin/jetroff		Shell driver
X	/usr/bin/djet			Postprocessor
X	/usr/bin/jetroff_bm		Bitmap includer
X	/usr/bin/jetbm			JetRoff standard bitmap reader
X	/usr/bin/pcpaint		PC Paint Plus bitmap reader
X	/usr/bin/pcx			PC Paintbrush bitmap reader
X	/usr/bin/jetcheck		Preprocessor scanner
X	/usr/bin/jetbackup		4 on 1 landscape filter
X	/usr/lib/tmac/tmac.jetroff	Bitmap macros
X	/usr/lib/font/devjet/makeDESC	Build Troff Description files
X	/usr/lib/font/devjet/fontlist	Description of fonts to build
X	/usr/lib/font/devjet/mkfont	Compile Troff Description files
X	/usr/lib/font/devjet/sfp2pk	Convert Soft Fonts to packed format
X	/usr/lib/font/devjet/pk/*	Packed format Fonts
X
XFONTS
X-----
X
XThe fonts occupy about 2 megabytes of space.  Except for the ST
Xfont, each font contains 128 characters.
X
Xtotal 3982
X	------ BOLD (B) ------
X-rw-r--r--   1 rick     pcr         5428 May 25 23:08 cmbx10.300pk
X-rw-r--r--   1 rick     pcr         5900 May 25 23:14 cmbx11.300pk
X-rw-r--r--   1 rick     pcr         6384 May 25 23:16 cmbx12.300pk
X-rw-r--r--   1 rick     pcr         7412 May 25 23:19 cmbx14.300pk
X-rw-r--r--   1 rick     pcr         8656 May 25 23:21 cmbx16.300pk
X-rw-r--r--   1 rick     pcr         9704 May 25 23:23 cmbx18.300pk
X-rw-r--r--   1 rick     pcr        11008 May 25 23:26 cmbx20.300pk
X-rw-r--r--   1 rick     pcr        12144 May 25 23:28 cmbx22.300pk
X-rw-r--r--   1 rick     pcr        13372 May 25 23:30 cmbx24.300pk
X-rw-r--r--   1 rick     pcr        16088 May 25 23:33 cmbx28.300pk
X-rw-r--r--   1 rick     pcr        19208 May 25 23:35 cmbx32.300pk
X-rw-r--r--   1 rick     pcr        22228 May 25 23:38 cmbx36.300pk
X-rw-r--r--   1 rick     pcr         2984 May 25 22:54 cmbx4.300pk
X-rw-r--r--   1 rick     pcr        24920 May 25 23:40 cmbx40.300pk
X-rw-r--r--   1 rick     pcr        27684 May 26 08:28 cmbx44.300pk
X-rw-r--r--   1 rick     pcr         3340 May 25 22:56 cmbx5.300pk
X-rw-r--r--   1 rick     pcr         3848 May 25 22:59 cmbx6.300pk
X-rw-r--r--   1 rick     pcr         4244 May 25 23:01 cmbx7.300pk
X-rw-r--r--   1 rick     pcr         4592 May 25 23:03 cmbx8.300pk
X-rw-r--r--   1 rick     pcr         5060 May 25 23:06 cmbx9.300pk
X	------ MATH ITALIC (SI) ------
X-rw-r--r--   1 rick     pcr         6512 May 25 18:13 cmmi10.300pk
X-rw-r--r--   1 rick     pcr         7164 May 26 02:30 cmmi11.300pk
X-rw-r--r--   1 rick     pcr         7752 May 26 02:33 cmmi12.300pk
X-rw-r--r--   1 rick     pcr         9164 May 26 02:35 cmmi14.300pk
X-rw-r--r--   1 rick     pcr        10516 May 26 02:37 cmmi16.300pk
X-rw-r--r--   1 rick     pcr        11920 May 26 02:39 cmmi18.300pk
X-rw-r--r--   1 rick     pcr        13332 May 26 02:42 cmmi20.300pk
X-rw-r--r--   1 rick     pcr        14648 May 26 02:44 cmmi22.300pk
X-rw-r--r--   1 rick     pcr        16216 May 26 02:46 cmmi24.300pk
X-rw-r--r--   1 rick     pcr        18664 May 26 02:48 cmmi28.300pk
X-rw-r--r--   1 rick     pcr        21548 May 26 02:51 cmmi32.300pk
X-rw-r--r--   1 rick     pcr        24152 May 26 02:53 cmmi36.300pk
X-rw-r--r--   1 rick     pcr         3128 May 26 02:17 cmmi4.300pk
X-rw-r--r--   1 rick     pcr        27328 May 26 02:55 cmmi40.300pk
X-rw-r--r--   1 rick     pcr         3660 May 26 02:20 cmmi5.300pk
X-rw-r--r--   1 rick     pcr         4292 May 26 02:22 cmmi6.300pk
X-rw-r--r--   1 rick     pcr         4808 May 26 02:24 cmmi7.300pk
X-rw-r--r--   1 rick     pcr         5320 May 26 02:26 cmmi8.300pk
X-rw-r--r--   1 rick     pcr         5820 May 26 02:28 cmmi9.300pk
X	------ ROMAN (R) ------
X-rw-r--r--   1 rick     pcr         5364 May 25 17:44 cmr10.300pk
X-rw-r--r--   1 rick     pcr         5772 May 25 22:25 cmr11.300pk
X-rw-r--r--   1 rick     pcr         6308 May 25 22:27 cmr12.300pk
X-rw-r--r--   1 rick     pcr         7312 May 25 22:30 cmr14.300pk
X-rw-r--r--   1 rick     pcr         8396 May 25 22:32 cmr16.300pk
X-rw-r--r--   1 rick     pcr         9352 May 25 22:34 cmr18.300pk
X-rw-r--r--   1 rick     pcr        10488 May 25 22:37 cmr20.300pk
X-rw-r--r--   1 rick     pcr        11740 May 25 22:39 cmr22.300pk
X-rw-r--r--   1 rick     pcr        12712 May 25 22:42 cmr24.300pk
X-rw-r--r--   1 rick     pcr        14488 May 25 22:44 cmr28.300pk
X-rw-r--r--   1 rick     pcr        16908 May 25 22:47 cmr32.300pk
X-rw-r--r--   1 rick     pcr        18672 May 25 22:49 cmr36.300pk
X-rw-r--r--   1 rick     pcr         2844 May 25 22:11 cmr4.300pk
X-rw-r--r--   1 rick     pcr        20664 May 25 22:52 cmr40.300pk
X-rw-r--r--   1 rick     pcr        23228 May 26 08:26 cmr44.300pk
X-rw-r--r--   1 rick     pcr         3304 May 25 22:13 cmr5.300pk
X-rw-r--r--   1 rick     pcr         3656 May 25 22:15 cmr6.300pk
X-rw-r--r--   1 rick     pcr         4136 May 25 22:18 cmr7.300pk
X-rw-r--r--   1 rick     pcr         4504 May 25 22:20 cmr8.300pk
X-rw-r--r--   1 rick     pcr         4804 May 25 22:22 cmr9.300pk
X	------ SANS SERIF (H) ------
X-rw-r--r--   1 rick     pcr         4632 May 25 18:04 cmss10.300pk
X-rw-r--r--   1 rick     pcr         4964 May 25 21:20 cmss11.300pk
X-rw-r--r--   1 rick     pcr         5364 May 25 21:21 cmss12.300pk
X-rw-r--r--   1 rick     pcr         6168 May 25 21:23 cmss14.300pk
X-rw-r--r--   1 rick     pcr         6944 May 25 21:24 cmss16.300pk
X-rw-r--r--   1 rick     pcr         7620 May 25 21:26 cmss18.300pk
X-rw-r--r--   1 rick     pcr         8612 May 25 21:27 cmss20.300pk
X-rw-r--r--   1 rick     pcr         9496 May 25 21:29 cmss22.300pk
X-rw-r--r--   1 rick     pcr        10308 May 25 21:30 cmss24.300pk
X-rw-r--r--   1 rick     pcr        12032 May 25 21:32 cmss28.300pk
X-rw-r--r--   1 rick     pcr        14436 May 25 21:34 cmss32.300pk
X-rw-r--r--   1 rick     pcr        16548 May 25 21:35 cmss36.300pk
X-rw-r--r--   1 rick     pcr         2700 May 25 20:53 cmss4.300pk
X-rw-r--r--   1 rick     pcr        18316 May 25 21:37 cmss40.300pk
X-rw-r--r--   1 rick     pcr         3044 May 25 20:55 cmss5.300pk
X-rw-r--r--   1 rick     pcr         3320 May 25 21:14 cmss6.300pk
X-rw-r--r--   1 rick     pcr         3620 May 25 21:16 cmss7.300pk
X-rw-r--r--   1 rick     pcr         3956 May 25 21:17 cmss8.300pk
X-rw-r--r--   1 rick     pcr         4300 May 25 21:18 cmss9.300pk
X	------ SANS SERIF BOLD (HB) ------
X-rw-r--r--   1 rick     pcr         4664 Jun  2 23:34 cmssbx10.300pk
X-rw-r--r--   1 rick     pcr         5140 Jun  2 23:36 cmssbx11.300pk
X-rw-r--r--   1 rick     pcr         5720 Jun  2 23:37 cmssbx12.300pk
X-rw-r--r--   1 rick     pcr         6500 Jun  2 23:39 cmssbx14.300pk
X-rw-r--r--   1 rick     pcr         7444 Jun  2 23:40 cmssbx16.300pk
X-rw-r--r--   1 rick     pcr         8552 Jun  2 23:42 cmssbx18.300pk
X-rw-r--r--   1 rick     pcr        10020 Jun  2 23:43 cmssbx20.300pk
X-rw-r--r--   1 rick     pcr        11236 Jun  2 23:45 cmssbx22.300pk
X-rw-r--r--   1 rick     pcr        12804 Jun  2 23:47 cmssbx24.300pk
X-rw-r--r--   1 rick     pcr        15672 Jun  2 23:49 cmssbx28.300pk
X-rw-r--r--   1 rick     pcr        17908 Jun  2 23:50 cmssbx32.300pk
X-rw-r--r--   1 rick     pcr        20528 Jun  2 23:52 cmssbx36.300pk
X-rw-r--r--   1 rick     pcr         2500 Jun  2 23:25 cmssbx4.300pk
X-rw-r--r--   1 rick     pcr        22548 Jun  2 23:54 cmssbx40.300pk
X-rw-r--r--   1 rick     pcr         2856 Jun  2 23:27 cmssbx5.300pk
X-rw-r--r--   1 rick     pcr         3272 Jun  2 23:28 cmssbx6.300pk
X-rw-r--r--   1 rick     pcr         3552 Jun  2 23:30 cmssbx7.300pk
X-rw-r--r--   1 rick     pcr         3880 Jun  2 23:31 cmssbx8.300pk
X-rw-r--r--   1 rick     pcr         4296 Jun  2 23:33 cmssbx9.300pk
X	------ SANS SERIF DEMIBOLD CONDENSED (HD) ------
X-rw-r--r--   1 rick     pcr         4440 May 25 18:06 cmssdc10.300pk
X-rw-r--r--   1 rick     pcr         4836 May 26 00:32 cmssdc11.300pk
X-rw-r--r--   1 rick     pcr         5240 May 26 00:33 cmssdc12.300pk
X-rw-r--r--   1 rick     pcr         6212 May 26 00:35 cmssdc14.300pk
X-rw-r--r--   1 rick     pcr         7088 May 26 00:36 cmssdc16.300pk
X-rw-r--r--   1 rick     pcr         7840 May 26 00:38 cmssdc18.300pk
X-rw-r--r--   1 rick     pcr         8904 May 26 00:39 cmssdc20.300pk
X-rw-r--r--   1 rick     pcr        10016 May 26 00:41 cmssdc22.300pk
X-rw-r--r--   1 rick     pcr        11228 May 26 00:42 cmssdc24.300pk
X-rw-r--r--   1 rick     pcr        14204 May 26 00:44 cmssdc28.300pk
X-rw-r--r--   1 rick     pcr        16752 May 26 00:46 cmssdc32.300pk
X-rw-r--r--   1 rick     pcr        19192 May 26 00:47 cmssdc36.300pk
X-rw-r--r--   1 rick     pcr         2400 May 26 00:23 cmssdc4.300pk
X-rw-r--r--   1 rick     pcr        21764 May 26 00:49 cmssdc40.300pk
X-rw-r--r--   1 rick     pcr         2740 May 26 00:24 cmssdc5.300pk
X-rw-r--r--   1 rick     pcr         3132 May 26 00:26 cmssdc6.300pk
X-rw-r--r--   1 rick     pcr         3480 May 26 00:27 cmssdc7.300pk
X-rw-r--r--   1 rick     pcr         3792 May 26 00:29 cmssdc8.300pk
X-rw-r--r--   1 rick     pcr         4140 May 26 00:30 cmssdc9.300pk
X	------ SANS SERIF ITALIC (HI) ------
X-rw-r--r--   1 rick     pcr         5624 May 25 18:08 cmssi10.300pk
X-rw-r--r--   1 rick     pcr         6124 May 26 01:00 cmssi11.300pk
X-rw-r--r--   1 rick     pcr         6664 May 26 01:01 cmssi12.300pk
X-rw-r--r--   1 rick     pcr         7644 May 26 01:03 cmssi14.300pk
X-rw-r--r--   1 rick     pcr         8744 May 26 01:04 cmssi16.300pk
X-rw-r--r--   1 rick     pcr         9700 May 26 01:06 cmssi18.300pk
X-rw-r--r--   1 rick     pcr        10964 May 26 01:08 cmssi20.300pk
X-rw-r--r--   1 rick     pcr        12048 May 26 01:09 cmssi22.300pk
X-rw-r--r--   1 rick     pcr        13252 May 26 01:11 cmssi24.300pk
X-rw-r--r--   1 rick     pcr        15652 May 26 01:13 cmssi28.300pk
X-rw-r--r--   1 rick     pcr        18740 May 26 01:14 cmssi32.300pk
X-rw-r--r--   1 rick     pcr        21960 May 26 01:16 cmssi36.300pk
X-rw-r--r--   1 rick     pcr         2924 May 26 00:50 cmssi4.300pk
X-rw-r--r--   1 rick     pcr        24688 May 26 01:18 cmssi40.300pk
X-rw-r--r--   1 rick     pcr         3392 May 26 00:52 cmssi5.300pk
X-rw-r--r--   1 rick     pcr         3788 May 26 00:53 cmssi6.300pk
X-rw-r--r--   1 rick     pcr         4228 May 26 00:55 cmssi7.300pk
X-rw-r--r--   1 rick     pcr         4680 May 26 00:56 cmssi8.300pk
X-rw-r--r--   1 rick     pcr         5172 May 26 00:58 cmssi9.300pk
X	------ MATH SYMBOLS (S) ------
X-rw-r--r--   1 rick     pcr         6504 May 25 18:11 cmsy10.300pk
X-rw-r--r--   1 rick     pcr         7076 May 26 02:03 cmsy11.300pk
X-rw-r--r--   1 rick     pcr         7728 May 26 02:04 cmsy12.300pk
X-rw-r--r--   1 rick     pcr         8952 May 26 02:05 cmsy14.300pk
X-rw-r--r--   1 rick     pcr        10148 May 26 02:06 cmsy16.300pk
X-rw-r--r--   1 rick     pcr        11320 May 26 02:07 cmsy18.300pk
X-rw-r--r--   1 rick     pcr        12580 May 26 02:08 cmsy20.300pk
X-rw-r--r--   1 rick     pcr        14220 May 26 02:10 cmsy22.300pk
X-rw-r--r--   1 rick     pcr        15496 May 26 02:11 cmsy24.300pk
X-rw-r--r--   1 rick     pcr        17812 May 26 02:12 cmsy28.300pk
X-rw-r--r--   1 rick     pcr        20416 May 26 02:13 cmsy32.300pk
X-rw-r--r--   1 rick     pcr        23076 May 26 02:14 cmsy36.300pk
X-rw-r--r--   1 rick     pcr         3408 May 26 01:58 cmsy4.300pk
X-rw-r--r--   1 rick     pcr        26004 May 26 02:15 cmsy40.300pk
X-rw-r--r--   1 rick     pcr         3920 May 26 01:59 cmsy5.300pk
X-rw-r--r--   1 rick     pcr         4424 May 26 01:59 cmsy6.300pk
X-rw-r--r--   1 rick     pcr         4872 May 26 02:00 cmsy7.300pk
X-rw-r--r--   1 rick     pcr         5384 May 26 02:01 cmsy8.300pk
X-rw-r--r--   1 rick     pcr         5952 May 26 02:02 cmsy9.300pk
X	------ TEXT ITALIC (I) ------
X-rw-r--r--   1 rick     pcr         6508 May 25 18:03 cmti10.300pk
X-rw-r--r--   1 rick     pcr         7284 May 25 20:19 cmti11.300pk
X-rw-r--r--   1 rick     pcr         7924 May 25 23:57 cmti12.300pk
X-rw-r--r--   1 rick     pcr         9220 May 25 23:59 cmti14.300pk
X-rw-r--r--   1 rick     pcr        10508 May 26 00:01 cmti16.300pk
X-rw-r--r--   1 rick     pcr        11996 May 26 00:04 cmti18.300pk
X-rw-r--r--   1 rick     pcr        13580 May 26 00:06 cmti20.300pk
X-rw-r--r--   1 rick     pcr        15100 May 26 00:09 cmti22.300pk
X-rw-r--r--   1 rick     pcr        16604 May 26 00:11 cmti24.300pk
X-rw-r--r--   1 rick     pcr        19272 May 26 00:14 cmti28.300pk
X-rw-r--r--   1 rick     pcr        22300 May 26 00:16 cmti32.300pk
X-rw-r--r--   1 rick     pcr        25312 May 26 00:19 cmti36.300pk
X-rw-r--r--   1 rick     pcr         3288 May 25 23:43 cmti4.300pk
X-rw-r--r--   1 rick     pcr        28432 May 26 00:21 cmti40.300pk
X-rw-r--r--   1 rick     pcr        32080 May 26 08:31 cmti44.300pk
X-rw-r--r--   1 rick     pcr         3656 May 25 23:45 cmti5.300pk
X-rw-r--r--   1 rick     pcr         4240 May 25 23:47 cmti6.300pk
X-rw-r--r--   1 rick     pcr         4880 May 25 23:50 cmti7.300pk
X-rw-r--r--   1 rick     pcr         5288 May 25 23:52 cmti8.300pk
X-rw-r--r--   1 rick     pcr         5824 May 25 23:54 cmti9.300pk
X	------ TROFF SYMBOLS (ST) ------
X-rw-r--r--   1 rick     pcr          964 Jun  4 21:44 cmtrf10.300pk
X-rw-r--r--   1 rick     pcr          956 Jun  3 09:46 cmtrf11.300pk
X-rw-r--r--   1 rick     pcr         1020 Jun  3 09:47 cmtrf12.300pk
X-rw-r--r--   1 rick     pcr         1176 Jun  3 09:47 cmtrf14.300pk
X-rw-r--r--   1 rick     pcr         1308 Jun  3 09:47 cmtrf16.300pk
X-rw-r--r--   1 rick     pcr         1420 Jun  3 09:48 cmtrf18.300pk
X-rw-r--r--   1 rick     pcr         1548 Jun  3 09:48 cmtrf20.300pk
X-rw-r--r--   1 rick     pcr         1748 Jun  3 09:48 cmtrf22.300pk
X-rw-r--r--   1 rick     pcr         1808 Jun  3 09:48 cmtrf24.300pk
X-rw-r--r--   1 rick     pcr         2024 Jun  3 09:49 cmtrf28.300pk
X-rw-r--r--   1 rick     pcr         2444 Jun  3 09:49 cmtrf32.300pk
X-rw-r--r--   1 rick     pcr         2968 Jun  4 18:41 cmtrf36.300pk
X-rw-r--r--   1 rick     pcr          608 Jun  3 09:44 cmtrf4.300pk
X-rw-r--r--   1 rick     pcr         3060 Jun  3 09:50 cmtrf40.300pk
X-rw-r--r--   1 rick     pcr          656 Jun  3 09:45 cmtrf5.300pk
X-rw-r--r--   1 rick     pcr          704 Jun  3 09:45 cmtrf6.300pk
X-rw-r--r--   1 rick     pcr          748 Jun  3 09:45 cmtrf7.300pk
X-rw-r--r--   1 rick     pcr          808 Jun  3 09:46 cmtrf8.300pk
X-rw-r--r--   1 rick     pcr          852 Jun  3 09:46 cmtrf9.300pk
X	------ TEXT TYPEWRITER (CW) ------
X-rw-r--r--   1 rick     pcr         4412 May 25 18:10 cmtt10.300pk
X-rw-r--r--   1 rick     pcr         4856 May 26 01:32 cmtt11.300pk
X-rw-r--r--   1 rick     pcr         5180 May 26 01:34 cmtt12.300pk
X-rw-r--r--   1 rick     pcr         5708 May 26 01:37 cmtt14.300pk
X-rw-r--r--   1 rick     pcr         6780 May 26 01:39 cmtt16.300pk
X-rw-r--r--   1 rick     pcr         7668 May 26 01:41 cmtt18.300pk
X-rw-r--r--   1 rick     pcr         8340 May 26 01:43 cmtt20.300pk
X-rw-r--r--   1 rick     pcr         9332 May 26 01:45 cmtt22.300pk
X-rw-r--r--   1 rick     pcr        10248 May 26 01:48 cmtt24.300pk
X-rw-r--r--   1 rick     pcr        11900 May 26 01:50 cmtt28.300pk
X-rw-r--r--   1 rick     pcr        13868 May 26 01:52 cmtt32.300pk
X-rw-r--r--   1 rick     pcr        16288 May 26 01:54 cmtt36.300pk
X-rw-r--r--   1 rick     pcr         2520 May 26 01:20 cmtt4.300pk
X-rw-r--r--   1 rick     pcr        17940 May 26 01:57 cmtt40.300pk
X-rw-r--r--   1 rick     pcr         2888 May 26 01:22 cmtt5.300pk
X-rw-r--r--   1 rick     pcr         3132 May 26 01:24 cmtt6.300pk
X-rw-r--r--   1 rick     pcr         3444 May 26 01:26 cmtt7.300pk
X-rw-r--r--   1 rick     pcr         3684 May 26 01:28 cmtt8.300pk
X-rw-r--r--   1 rick     pcr         3988 May 26 01:30 cmtt9.300pk
END_OF_FILE
if test 16827 -ne `wc -c <'djet/Porting'`; then
    echo shar: \"'djet/Porting'\" unpacked with wrong size!
fi
# end of 'djet/Porting'
fi
if test -f 'djet/pk16.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'djet/pk16.c'\"
else
echo shar: Extracting \"'djet/pk16.c'\" \(19595 characters\)
sed "s/^X//" >'djet/pk16.c' <<'END_OF_FILE'
X/*c
X *	JetRoff - DWB 2.0 postprocessor for HP LaserJet Series II
X *
X *	Copyright (c) 1988 PC Research, Inc.  All Rights Reserved.
X *
X *	This source code is supplied to you under the terms of the
X *	contents of the "License" agreement found with this source
X *	distribution.  You must read the "License" before you use
X *	this source code in any way.
X *
Xc*/
X
X/*
X *	pk.c:
X *		unpack and download the fonts as needed.
X *
X *	You haven't a prayer of getting this to work for any complicated
X *	documents unless you've got lots of RAM.  286 architectures need
X *	large model.  Even then, font files > 32767 bytes can't be handled.
X */
X
X/*
X * $Id: pk16.c,v 1.1 88/08/26 23:11:05 rick Exp $
X *
X * $Log:	pk16.c,v $
X * Revision 1.1  88/08/26  23:11:05  rick
X * Initial revision
X * 
X */
X#ifndef lint
Xstatic char rcsid[] = "@(#) $Id: pk16.c,v 1.1 88/08/26 23:11:05 rick Exp $";
X#endif
X
X#include <stdio.h>
X#include <values.h>		/* for MAXINT */
X#include <memory.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X
X#ifdef UNIT_TEST
X#define EXTERN
X#endif
X
X#include "dlj.h"
X#include "lj.h"
X#include "paths.h"
X
X#define PERM	/* Make fonts permanent (for testing) */
X
Xtypedef struct
X{
X	char	loaded;
X	char	turn_on;
X	uchar	dyn_f;
X/*	long	pl;	notused */
X/*	long	cc;	notused */
X/*	long	tfm;	notused */
X	long	dx;
X/*	long	dy;	notused */
X	short	w;
X	short	h;
X	short	hoff;
X	short	voff;
X	uchar	*bytep;
X} PK_CHAR;
X
Xtypedef struct
X{
X	uchar	*storage;
X	long	design_size;
X	long	hppp;
X	long	vppp;
X	char	loaded;
X	char	used;
X	/* Stuff needed by HP LaserJet */
X	short	baseline;
X	short	cellheight;
X	short	cellwidth;
X	char	name[16];
X	PK_CHAR	chars[128];
X} PK;
X
X#define	MAXPK	64
X
X#ifdef	ERR_ARRAY_TOO_LARGE
X				/* Brain-dead AT&T 286 SGS thinks this is */
X				/* too big (256 bytes!) */
X	PK	*pk[MAXPK/4];
X	PK	*pk2[MAXPK/4];	/* Hope this storage lands contiguously! */
X	PK	*pk3[MAXPK/4];
X	PK	*pk4[MAXPK/4];
X
X#else
X
X	PK	*pk[MAXPK];
X
X#endif
X
Xint	npk = 0;
Xint	pk_downbytes = 0;
X
Xpk_endpage()
X{
X	register int i;
X	register int used = 0;
X
X	for (i = 0; i < npk; ++i)
X	{
X		if (pk[i]->used)
X		{
X			++used;
X			pk[i]->used = 0;
X		}
X	}
X	if (used > 16)	/* HP limit */
X		error(0,
X"\tWarning: Page %d used %d fonts and/or sizes.\n\tThe LaserJet has a limit of 16; you must simplify the page.", PageNumber, used);
X}
X
X#ifdef DEBUG
Xint	pk_debug = 1;
X#endif
X
X#define	PK_PRE	247
X#define	PK_ID	89
X#define	PK_XXX1	240
X#define	PK_YYY	244
X#define	PK_POST	245
X#define	PK_NOP	246
X
X/*
X *	Get bytes/shorts/longs from .PK file
X */
X
Xint	pk_loc;
Xunsigned char pk_byte() { return (pk[npk]->storage[pk_loc++]); }
Xshort pk_short()
X{
X	register short a = pk_byte();
X	return (a*256 + pk_byte());
X}
Xlong pk_long()
X{
X	register long	a = pk_short();
X	if (a > 32767) a -= 65536;
X	return (a*65536 + pk_short());
X}
X
X/*
X *	Open .PK file and return descriptor
X */
X
Xpk_open(name, size, res)
Xchar	*name;	/* "cmr" */
Xint	size;	/* 10 */
Xint	res;	/* 300 */
X{
X	char		filename[256];
X	int		fd;
X	struct	stat	stats;
X	int		descend;
X
X	if (npk >= MAXPK)
X		error(1, "too many font/size combinations");
X	if (pk[npk]) Free(pk[npk]);
X	pk[npk] = (PK *) Malloc(sizeof(PK), 0);
X	if (!pk[npk])
X		error(1, "can't get space for raster file %s", filename);
X	Sprintf(filename, "%s%d.%d                ", name, size, res);
X	(void) memcpy(pk[npk]->name, filename, 16);
X	Sprintf(filename, "%s/%s%d.%dpk", RastDir, name, size, res);
X	fd = open(filename, 0);
X	if (fd < 0)
X	{
X		error(0, "can't open raster file %s", filename);
X		return (-1);
X	}
X	(void) fstat(fd, &stats);
X	descend = MAXINT;
X	if (stats.st_size > descend)
X		error(1,
X		"font '%s' too large (%ld bytes); max is %d for this machine!",
X			filename, stats.st_size, descend);
X	pk[npk]->storage = (uchar *) Malloc( (unsigned) stats.st_size, 0);
X	if (pk[npk]->storage == NULL)
X		error(1, "no space for raster file %s", filename);
X	if (read(fd, (char *) pk[npk]->storage, (unsigned int) stats.st_size)
X			!= stats.st_size)
X		error(1, "error reading raster file %s", filename);
X	(void) close(fd);
X
X	/*
X	 * Read preamble
X	 */
X	pk_loc = 0;
X	if (pk_byte() != PK_PRE)
X		error(1, "bad pk file -- no preamble");
X	if (pk_byte() != PK_ID)
X		error(1, "bad pk file -- wrong version");
X	{
X		register int comment_length = pk_byte();
X		pk_loc += comment_length;
X	}
X	pk[npk]->design_size = pk_long();
X	pk_loc += sizeof(long);		/* Skip checksum */
X	pk[npk]->hppp = pk_long();
X	pk[npk]->vppp = pk_long();
X	if (pk[npk]->hppp != pk[npk]->vppp)
X		error(0, "aspect ratio not 1:1");
X	pk[npk]->baseline = 0;
X	pk[npk]->cellheight = 0;
X	pk[npk]->cellwidth = 0;
X	pk[npk]->loaded = 0;
X	descend = 0;
X
X	/*
X	 * Compute interesting stuff about characters
X	 */
X	for(;;)
X	{
X		register int	flag;
X		int		dyn_f;
X		int		turn_on;
X		int		next_packet;
X		long		pl, cc, tfm, dx, /* dy,*/ w, h, hoff, voff;
X		register PK_CHAR	*p;
X
X		pk_skip_specials();
X		flag = pk_byte();
X		if (flag == PK_POST) break;
X		dyn_f = flag / 16;
X		flag %= 16;
X		turn_on = flag >= 8;
X		if (turn_on) flag -= 8;
X		if (flag == 7)
X		{	/* long preamble */
X			pl = pk_long();
X			cc = pk_long();
X			next_packet = pk_loc + pl;
X			tfm = pk_long();
X			dx = pk_long();
X			/* dy = */ (void) pk_long();
X			w = pk_long();
X			h = pk_long();
X			hoff = pk_long();
X			voff = pk_long();
X		}
X		else if (flag > 3)
X		{	/* extended short preamble */
X			pl = (flag - 4) * 65536 + pk_short();
X			cc = pk_byte();
X			next_packet = pk_loc + pl;
X			tfm = pk_byte(); tfm = tfm*65536 + pk_short();
X			dx = pk_short() * 65536;
X/*			dy = 0;		not used */
X			w = pk_short();
X			h = pk_short();
X			hoff = pk_short();
X			voff = pk_short();
X		}
X		else
X		{	/* short preamble */
X			pl = flag * 256 + pk_byte();
X			cc = pk_byte();
X			next_packet = pk_loc + pl;
X			tfm = pk_byte(); tfm = tfm*65536 + pk_short();
X			dx = pk_byte() * 65536;
X/*			dy = 0;		not used */
X			w = pk_byte();
X			h = pk_byte();
X			hoff = (char) pk_byte();
X			voff = (char) pk_byte();
X		}
X		if (cc < 0 || cc > 127)
X			error(1, "character code out of range");
X		p = &pk[npk]->chars[cc];
X		p->dyn_f = dyn_f;
X		p->turn_on = turn_on;
X/*		p->pl = pl;	not used*/
X/*		p->cc = cc;	not used*/
X/*		p->tfm = tfm;	not used*/
X		p->dx = dx;
X/*		p->dy = dy;	not used*/
X		p->w = w;
X		p->h = h;
X		p->hoff = hoff;
X		p->voff = voff;
X		p->bytep = &pk[npk]->storage[pk_loc];
X		p->loaded = 0;
X
X		if (voff > pk[npk]->baseline) pk[npk]->baseline = voff;
X		if ( (h-voff) > descend) descend = h-voff;
X		if ( (w-hoff) > pk[npk]->cellwidth) pk[npk]->cellwidth = w-hoff;
X
X		pk_loc = next_packet;
X	}
X	pk[npk]->cellheight = pk[npk]->baseline + descend;
X
X#	ifdef DEBUG
X	{
X		register int i;
X
X		if (pk_debug)
X		{
X			pk_dump_pk();
X			for (i = 0; i <= 127; ++i)
X				pk_dump(i);
X		}
X	}
X#	endif
X	return (npk++);
X}
X
Xint	pk_last_id = -1;
X
X/*
X *	Close usage of font on "n", spit stuff to fp to free font memory
X */
X#ifdef UNIT_TEST
X
X/* ARGSUSED */
Xpk_close(fp, n)
XFILE	*fp;
X{
X#	if 1	/* Not implemented (or used!) */
X		return;
X#	else
X		if (n == (npk-1) )
X		{
X			--npk;
X		} 
X		Fprintf(fp, "\033*c%dd%dF", pk_last_id = n, 2);
X		Free(pk[n]->storage);
X#	endif
X}
X#endif
X
Xpk_skip_specials()
X{
X	register int	i, j;
X	register int	flag;
X
X	while ( (flag = pk_byte()) >= 240)
X	{
X		switch(flag)
X		{
X		case 240: case 241: case 242: case 243:
X			for (i = 0, j = 240; j <= flag; ++j)
X				i = i*256 + pk_byte();
X			pk_loc += i;
X			break;
X		case 244:
X			pk_loc += sizeof(long);
X			break;
X		case 245:
X			goto out;
X		case 246:
X			break;
X		default:
X			error(1, "unexpected flag");
X		}
X	}
Xout:
X	--pk_loc;
X}
X
X/*
X *	Laserjet downloading routines
X */
X#define ljshort(fp, s)	((void) putc((s)>>8, fp), (void) putc((s), fp))
X#define ljbyte(fp, b)	((void) putc((b), fp))
X
X#define PRIMARY		0x0f
X#define SECONDARY	0x0e
X
Xpk_download(n, c, fp)
Xregister FILE	*fp;
X{
X	register PK		*p = pk[n];
X	register PK_CHAR	*pc = &pk[n]->chars[c];
X#ifdef PERM
X	static int first = 1;
X	if (first)
X	{
X		Fprintf(fp, "\033*c%dF", 0);
X		first = 0;
X	}
X#endif
X
X	if (pk_last_id != n)
X	{
X		Fprintf(fp, "\033*c%dD", pk_last_id = n );
X		if (p->loaded == 0)
X			pk_fontdesc(p, fp);
X		p->used = 1;
X		Fprintf(fp, "\033)%dX%c", pk_last_id, SECONDARY );
X	}
X	if (pc->loaded)
X	{
X		ljbyte(fp, ljmap(c));
X		return (pc->dx>>16);
X	}
X
X	/*
X	 *	Send out character descriptor
X	 */
X	Fprintf(fp, "\033*c%dE", ljmap(c) );
X	if (Landscape)
X		Fprintf(fp, "\033(s%dW",
X			CHAR_DESC_SIZE + 2 + pc->w * ((pc->h+7)/8) );
X	else
X		Fprintf(fp, "\033(s%dW",
X			CHAR_DESC_SIZE + 2 + pc->h * ((pc->w+7)/8) );
X	ljbyte(fp, CHAR_DESC_FORMAT);
X	ljbyte(fp, 0);
X	ljbyte(fp, CHAR_DESC_SIZE);
X	ljbyte(fp, CLASS);
X	if (Landscape)
X		ljbyte(fp, ORIENTATION_LANDSCAPE);
X	else
X		ljbyte(fp, ORIENTATION_PORTRAIT);
X	ljbyte(fp, 0);
X	if (Landscape)
X	{
X		ljshort(fp, - pc->voff);
X		ljshort(fp, (pc->w - pc->hoff) - 1);
X		ljshort(fp, pc->h);
X		ljshort(fp, pc->w);
X	}
X	else
X	{
X		ljshort(fp, - pc->hoff);
X		ljshort(fp, pc->voff);
X		ljshort(fp, pc->w);
X		ljshort(fp, pc->h);
X	}
X
X	{
X		register short dw = (pc->dx>>16) * 4;
X		ljshort(fp, dw);
X	}
X
X	/*
X	 * Unpack the bits
X	 */
X	if (pc->dyn_f == 14)
X	{	/* Unpack raster by bits */
X		if (Landscape)
X			pk_bitlraster(fp, pc);
X		else
X			pk_bitraster(fp, pc);
X	}
X	else
X	{	/* Unpack run length encoded raster */
X		if (Landscape)
X			pk_runlraster(fp, pc);
X		else
X			pk_runraster(fp, pc);
X	}
X	pc->loaded = 1;
X	ljbyte(fp, ljmap(c));
X	return (pc->dx>>16);
X}
X
Xpk_fontdesc(p, fp)
Xregister PK	*p;
Xregister FILE	*fp;
X{
X	register long height;
X
X	Fprintf(fp, "\033)s%dW", FONT_DESC_SIZE);
X	ljshort(fp, FONT_DESC_SIZE);
X	ljbyte(fp, 0);
X	ljbyte(fp, FONT_TYPE_8BIT);
X	ljshort(fp, 0);
X	ljshort(fp, p->baseline);
X	if (Landscape)
X	{
X		ljshort(fp, p->cellwidth);
X		ljshort(fp, p->cellheight);
X		ljbyte(fp, ORIENTATION_LANDSCAPE);
X	}
X	else
X	{
X		ljshort(fp, p->cellwidth);
X		ljshort(fp, p->cellheight);
X		ljbyte(fp, ORIENTATION_PORTRAIT);
X	}
X	ljbyte(fp, SPACING_PROPORTIONAL);
X	ljshort(fp, SYMBOLSET_HP_ROMAN8);
X	ljshort(fp, p->cellwidth * 4);	/* default pitch??? */
X	height = ((p->design_size/(1<<18))*p->vppp*4)/(1<<18);
X	ljshort(fp, (short) height);
X	ljshort(fp, 0);
X	ljbyte(fp, WIDTH_NORMAL);
X	ljbyte(fp, STYLE_UPRIGHT);
X	ljbyte(fp, STROKE_MEDIUM);
X	ljbyte(fp, TYPEFACE_TMSRMN);
X	ljbyte(fp, 0);
X	ljbyte(fp, SERIF_SANS_SQUARE);
X	ljshort(fp, 0);
X	ljbyte(fp, 0);
X	ljbyte(fp, 0);
X	ljshort(fp, 0);
X	ljshort(fp, 0);
X	ljshort(fp, 0);
X	ljshort(fp, 0);
X	ljbyte(fp, 0);
X	ljbyte(fp, 0);
X	ljshort(fp, 0);
X	ljshort(fp, 0);
X	ljshort(fp, 0);
X	(void) fwrite(p->name, 16, 1, fp);
X	p->loaded = 1;
X#ifdef PERM
X	Fprintf(fp, "\033*c%dF", 5);
X#endif
X}
X
X
X/*
X *	Unpack bits/nibbles
X */
Xuchar	pk_input_byte;
Xuchar	pk_bit_weight;
Xuchar	*pk_bytep;
X
Xpk_get_bit()
X{
X	if ( (pk_bit_weight>>=1) == 0)
X	{
X		pk_input_byte = *pk_bytep++;
X		pk_bit_weight = 128;
X	}
X	return (pk_input_byte & pk_bit_weight);
X}
X
Xpk_bitraster(fp, pc)
XFILE	*fp;
XPK_CHAR	*pc;
X{
X	static uchar	power[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
X	register uchar	byte;
X	register int	byte_weight;
X	register int	cols;
X	int		rows;
X
X#	ifdef DEBUG
X		if (pk_debug) Fprintf(stderr, "Unpack by bits %d, %d\n",
X			pc->w, pc->h);
X#	endif
X	pk_bytep = pc->bytep;
X	pk_bit_weight = 0;
X	for (rows = pc->h; rows; --rows)
X	{
X		byte = 0;
X		byte_weight = 7;
X		for (cols = pc->w; cols; --cols)
X		{
X			if (pk_get_bit())
X				byte |= power[byte_weight];
X			if (--byte_weight < 0)
X			{
X				ljbyte(fp, (char) byte);
X				byte = 0;
X				byte_weight = 7;
X			}
X		}
X		if (byte_weight < 7)
X			ljbyte(fp, (char) byte);
X	}
X	pk_downbytes += pc->h*((pc->w+7)/8);
X}
X
Xpk_bitlraster(fp, pc)
XFILE	*fp;
XPK_CHAR	*pc;
X{
X	static uchar	power[8] = { 128, 64, 32, 16, 8, 4, 2, 1 };
X	register int	cols;
X	register int	rows;
X	register int	rowbytes;
X	uchar		*s;
X
X#	ifdef DEBUG
X		if (pk_debug) Fprintf(stderr, "Unpack by bits %d, %d\n",
X			pc->w, pc->h);
X#	endif
X	rowbytes = (pc->h+7)/8;
X	s = (uchar *) Malloc( (unsigned) pc->w * rowbytes, 0);
X	if (s == NULL)
X		error(1, "no space to rotate font");
X	(void) memset( (char *) s, 0, pc->w * rowbytes);
X	pk_bytep = pc->bytep;
X	pk_bit_weight = 0;
X	for (cols = 0; cols < pc->h; ++cols)
X	{
X		for (rows = pc->w-1; rows >= 0; --rows)
X#			ifdef ERR_SEG_OVERWRITE	/* AT&T again */
X				if (pk_get_bit())
X				{
X					int a = rows*rowbytes + (cols>>3);
X					s[a] |= power[cols & 7];
X				}
X#			else
X				if (pk_get_bit())
X				s[rows*rowbytes + (cols>>3)] |= power[cols & 7];
X#			endif
X	}
X	for (rows = 0; rows < pc->w; ++rows)
X		for (cols = 0; cols < rowbytes; ++cols)
X			ljbyte(fp, (char) s[rows*rowbytes + cols]);
X	Free((char *) s);
X	pk_downbytes += pc->w*rowbytes;
X}
X
Xint	pk_repeat_count;
X
Xpk_get_nyb()
X{
X	if (pk_bit_weight == 0)
X	{
X		pk_input_byte = *pk_bytep++;
X		pk_bit_weight = 16;
X		return ( (pk_input_byte >> 4) & 0x0f);
X	}
X	else
X	{
X		pk_bit_weight = 0;
X		return ( pk_input_byte & 0x0f);
X	}
X}
X
Xpk_packed_num(dyn_f)
Xregister int	dyn_f;
X{
X	register i, j;
X
X	i = pk_get_nyb();
X	if (i == 0)
X	{
X		do
X		{
X			j = pk_get_nyb();
X			++i;
X		} while (j == 0);
X		while(i--) j = j*16 + pk_get_nyb();
X		return (j - 15 + (13-dyn_f)*16 + dyn_f);
X	}
X	else if (i <= dyn_f)
X		return (i);
X	else if (i < 14)
X		return (i-dyn_f-1)*16 + pk_get_nyb() + dyn_f + 1;
X	else
X	{
X		if (i == 14)
X			pk_repeat_count = pk_packed_num(dyn_f);
X		else
X			pk_repeat_count = 1;
X		return (pk_packed_num(dyn_f));
X	}
X}
X
Xpk_runraster(fp, pc)
XFILE	*fp;
XPK_CHAR	*pc;
X{
X	static uchar	gpower[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
X	register uchar	byte;
X	register int	byte_weight;
X	register int	rows;
X	int		h_bit;
X	int		turn_on;
X	int		count;
X	int		r_p;
X	int		i, j;
X	int		byte_width = (pc->w+7)/8;
X	uchar		rowbuf[400];
X
X#	ifdef DEBUG
X		if (pk_debug) Fprintf(stderr, "Unpack by runs\n");
X#	endif
X	pk_bytep = pc->bytep;
X	pk_bit_weight = 0;
X	turn_on = pc->turn_on;
X
X	rows = pc->h;
X	h_bit = pc->w;
X	pk_repeat_count = 0;
X	byte_weight = 8;
X	byte = 0;
X	r_p = 0;
X	while (rows > 0)
X	{
X		count = pk_packed_num( (int) pc->dyn_f);
X		while (count > 0)
X		{
X			if (count < byte_weight && count < h_bit)
X			{
X				if (turn_on)
X					byte += gpower[byte_weight]
X						- gpower[byte_weight-count];
X				h_bit -= count;
X				byte_weight -= count;
X				count = 0;
X			}
X			else if (count >= h_bit && h_bit <= byte_weight)
X			{
X				if (turn_on)
X					byte += gpower[byte_weight]
X						- gpower[byte_weight-h_bit];
X				rowbuf[r_p] = byte;
X				/* send row */
X				for (i = 0; i <= pk_repeat_count; ++i)
X				{
X					for (j = 0; j < byte_width; ++j)
X					{
X						ljbyte(fp, (char) rowbuf[j]);
X#ifdef DEBUG
Xif (pk_debug)
X{
X	static uchar	power[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
X	int k;
X	for (k = 7; k >= 0; --k)
X		Fprintf(stderr, "%c", (rowbuf[j] & power[k]) ? '#' : '.');
X}
X					}
Xif (pk_debug) Fprintf(stderr, "\n");
X#else
X					}
X#endif
X				}
X				rows = rows - pk_repeat_count - 1;
X				pk_repeat_count = 0;
X				r_p = 0;
X				byte = 0;
X				byte_weight = 8;
X				count -= h_bit;
X				h_bit = pc->w;
X			}
X			else
X			{
X				if (turn_on)
X					byte += gpower[byte_weight];
X				rowbuf[r_p++] = byte;
X				byte = 0;
X				count -= byte_weight;
X				h_bit -= byte_weight;
X				byte_weight = 8;
X			}
X		}
X		turn_on = !turn_on;
X	}
X	if (rows != 0 || h_bit != pc->w)
X		error(1, "Bad pk file -- more bits than required!");
X	pk_downbytes += pc->h*((pc->w+7)/8);
X}
X
X/*
X *	TODO:	inefficient algorithm
X */
Xpk_runlraster(fp, pc)
XFILE	*fp;
XPK_CHAR	*pc;
X{
X	static uchar	gpower[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
X	register uchar	byte;
X	register int	byte_weight;
X	register int	rows;
X	int		h_bit;
X	int		turn_on;
X	int		count;
X	int		r_p;
X	int		i;
X	int		byte_width = (pc->w+7)/8;
X	uchar		rowbuf[400];
X	uchar		*s;
X
X#	ifdef DEBUG
X		if (pk_debug) Fprintf(stderr, "Unpack by runs\n");
X#	endif
X	pk_bytep = pc->bytep;
X	pk_bit_weight = 0;
X	turn_on = pc->turn_on;
X
X	rows = 0;
X	h_bit = pc->w;
X	pk_repeat_count = 0;
X	byte_weight = 8;
X	byte = 0;
X	r_p = 0;
X	s = (uchar *) Malloc( (unsigned) pc->h*byte_width, 0);
X	if (s == NULL)
X		error(1, "no space to rotate font");
X	(void) memset( (char *) s, 0, pc->h*byte_width);
X	while (rows < pc->h)
X	{
X		count = pk_packed_num( (int) pc->dyn_f);
X		while (count > 0)
X		{
X			if (count < byte_weight && count < h_bit)
X			{
X				if (turn_on)
X					byte += gpower[byte_weight]
X						- gpower[byte_weight-count];
X				h_bit -= count;
X				byte_weight -= count;
X				count = 0;
X			}
X			else if (count >= h_bit && h_bit <= byte_weight)
X			{
X				if (turn_on)
X					byte += gpower[byte_weight]
X						- gpower[byte_weight-h_bit];
X				rowbuf[r_p] = byte;
X				/* send row */
X				for (i = 0; i <= pk_repeat_count; ++i)
X				{
X					(void)
X					memcpy( (char *) s+(rows+i)*byte_width,
X						(char *) rowbuf, byte_width);
X				}
X				rows += pk_repeat_count + 1;
X				pk_repeat_count = 0;
X				r_p = 0;
X				byte = 0;
X				byte_weight = 8;
X				count -= h_bit;
X				h_bit = pc->w;
X			}
X			else
X			{
X				if (turn_on)
X					byte += gpower[byte_weight];
X				rowbuf[r_p++] = byte;
X				byte = 0;
X				count -= byte_weight;
X				h_bit -= byte_weight;
X				byte_weight = 8;
X			}
X		}
X		turn_on = !turn_on;
X	}
X	if (rows != pc->h || h_bit != pc->w)
X		error(1, "Bad pk file -- more bits than required!");
X
X	/*
X	 * Now rotate the bits
X	 */
X	for (rows = pc->w-1; rows >= 0; --rows)
X	{
X#		define	cols	byte_weight
X		byte = 0;
X		for (cols = 0; cols < pc->h; ++cols)
X		{
X			int ibit;
X			static uchar ipower[8]={ 128, 64, 32, 16, 8, 4, 2, 1 };
X			
X			ibit = rows + cols * byte_width * 8;
X			if (s[ibit>>3] & ipower[ibit&7])
X				byte |= ipower[cols&7];
X			if ((cols & 7) == 7)
X			{
X				ljbyte(fp, (char) byte);
X				byte = 0;
X			}
X		}
X		if (pc->h & 7)
X			ljbyte(fp, (char) byte);
X	}
X	Free((char *) s);
X	byte_width = (pc->h+7)/8;
X	pk_downbytes += pc->w*byte_width;
X}
X
X/*
X *	Debugging routines
X */
X
X#ifdef DEBUG
X
Xpk_dump_pk()
X{
X	register PK	*p = pk[npk];
X
X	Fprintf(stderr, "Design_size=%d, hppp = %d, vppp = %d\n",
X		p->design_size, p->hppp, p->vppp);
X	Fprintf(stderr, "baseline = %d, cellwidth = %d, cellheight = %d\n",
X		p->baseline, p->cellwidth, p->cellheight);
X}
X
Xpk_dump(cc)
X{
X	register PK_CHAR	*p = &pk[npk]->chars[cc];
X
X	if (cc > ' ' && cc < 127)
X		Fprintf(stderr, "Character '%c':\n", cc);
X	else
X		Fprintf(stderr, "Character %d:\n", cc);
X/*	Fprintf(stderr, "tfm(width) = %d\n", p->tfm); */
X	Fprintf(stderr, "dx = %d (%d), ", p->dx, p->dx>>16);
X	Fprintf(stderr, "dy = %d\n", 0/*p->dy*/);
X	Fprintf(stderr, "w = %d, ", p->w);
X	Fprintf(stderr, "h = %d\n", p->h);
X	Fprintf(stderr, "hoff = %d, ", p->hoff);
X	Fprintf(stderr, "voff = %d\n", p->voff);
X}
X#endif
X
X/*
X *	Unit Test Routines
X */
X
X#ifdef UNIT_TEST
X
Xerror(n, s, s2)
Xchar	*s;
Xchar	*s2;
X{
X	Fprintf(stderr, s, s2);
X	Fprintf(stderr, "\n");
X	if (n) exit(n);
X}
X
Xchar	*names[] =
X{
X	"b", "bsy", "bx", "bxsl", "bxti", "csc", "dunh", "ex", "ff", "fi",
X	"fib", "inch", "itt", "mi", "mib", "r", "sl", "sltt", "ss", "ssbx",
X	"ssdc", "ssi", "ssqi", "sy", "tcsc", "tex", "ti", "tt", "u", "vtt",
X	NULL
X};
X
Xmain(argc, argv)
Xchar	*argv[];
X{
X	int		n;
X	int		c;
X	char		*p;
X	int		getopt();
X	extern int	optind;
X	extern char	*optarg;
X
X	Strcpy(RastDir, RASTDIR); if (p = getenv(RASTENV)) Strcpy(RastDir, p);
X
X	while ( (c = getopt(argc, argv, "R:")) != EOF)
X	{
X		switch (c)
X		{
X		case 'R':
X			Strcpy(RastDir, optarg);
X			break;
X		}
X	}
X
X	Printf("\033*c1F\033&lo6dl66pe66f1x1H\033*t300R");
X
X	if (optind < argc)
X		style_sheet(argv[optind]);
X	else
X		for (n = 0; names[n]; ++n)
X		{
X			style_sheet(names[n]);
X		}
X}
Xstyle_sheet(name)
Xchar	*name;
X{
X	int	c;
X	int	i;
X	int	s;
X	char	buf[256];
X	int	pk;
X	int	y;
X	int	nn = 0;
X
X	y = 200;
X	for (s = 4; s <= 72; ++s)
X	{
X		Sprintf(buf, "%s/cm%s%d.300pk", RastDir, name, s);
X		if (access(buf, 0) != 0) continue;
X		Sprintf(buf, "cm%s", name);
X		pk = pk_open(buf, s, 300);
X		if (pk == -1) continue;
X		Sprintf(buf, "cm%s%d", name,s);
X		Printf("\033*p100x%dY%c%s%c", y, PRIMARY, buf, SECONDARY );
X		for (i = 0; i <= 127; ++i)
X		{
X			if ( (i%32) == 0)
X			{
X				Printf("\033*p400x%dY", y + (i/32)*s*6);
X			}
X			c = pk_download(pk, i, stdout);
X		}
X		pk_close(stdout, pk);
X		if (++nn == 16) { y = 200; Printf("\f"); nn = 0; }
X		else y += s*6*4;
X	}
X	if (y != 200)
X		Printf("\033E");
X}
X#endif
END_OF_FILE
if test 19595 -ne `wc -c <'djet/pk16.c'`; then
    echo shar: \"'djet/pk16.c'\" unpacked with wrong size!
fi
# end of 'djet/pk16.c'
fi
if test -f 'font/devjet/makeDESC.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'font/devjet/makeDESC.c'\"
else
echo shar: Extracting \"'font/devjet/makeDESC.c'\" \(15861 characters\)
sed "s/^X//" >'font/devjet/makeDESC.c' <<'END_OF_FILE'
X/*c
X *	JetRoff - DWB 2.0 postprocessor for HP LaserJet Series II
X *
X *	Copyright (c) 1988 PC Research, Inc.  All Rights Reserved.
X *
X *	This source code is supplied to you under the terms of the
X *	contents of the "License" agreement found with this source
X *	distribution.  You must read the "License" before you use
X *	this source code in any way.
X *
Xc*/
X
X#ifndef lint
Xstatic char	Copyright[] =
X"@(#) JetRoff (c) Copyright 1988 PC Research, Inc.  All Rights Reserved.";
X#endif
X
X/*
X *	"pk.c" hacked to make R, B, I, ... files
X */
X
X/*
X * $Id: makeDESC.c,v 1.1 88/08/27 00:00:04 rick Exp $
X *
X * $Log:	makeDESC.c,v $
X * Revision 1.1  88/08/27  00:00:04  rick
X * Initial revision
X * 
X */
X#ifndef lint
Xstatic char rcsid[] = "@(#) $Id: makeDESC.c,v 1.1 88/08/27 00:00:04 rick Exp $";
X#endif
X
X#include <stdio.h>
X#include <string.h>
X#include <varargs.h>
X#include <values.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X
Xtypedef unsigned char	uchar;
X
Xextern void	exit();
Xextern char	*malloc();
Xextern void	free();
X#define	Sprintf	(void) sprintf
X#define	Fprintf	(void) fprintf
X
Xtypedef struct
X{
X	char	loaded;
X	char	turn_on;
X	uchar	dyn_f;
X/*	long	pl;	notused */
X/*	long	cc;	notused */
X	long	tfm;
X	long	dx;
X/*	long	dy;	notused */
X	short	w;
X	short	h;
X	short	hoff;
X	short	voff;
X	uchar	*bytep;
X} PK_CHAR;
X
Xtypedef struct
X{
X	char	name[16];
X	uchar	*storage;
X	long	design_size;
X	long	hppp;
X	long	vppp;
X	PK_CHAR	chars[128];
X	int	loaded;
X	/* Stuff needed by HP LaserJet */
X	int	baseline;
X	int	cellheight;
X	int	cellwidth;
X} PK;
X
X#ifdef DEMOJET
Xchar	*FontPath = "../devjet/pk";
X#else
Xchar	*FontPath = "./pk";
X#endif
X
X#define	MAXPK	64
X
X#ifdef	ERR_ARRAY_TOO_LARGE
X				/* Brain-dead AT&T 286 SGS thinks this is */
X				/* too big (256 bytes!) */
X	PK	*pk[MAXPK/4];
X	PK	*pk2[MAXPK/4];	/* Hope this storage lands contiguously! */
X	PK	*pk3[MAXPK/4];
X	PK	*pk4[MAXPK/4];
X
X#else
X
X	PK	*pk[MAXPK];
X
X#endif
X
Xint	npk = 0;
X
X#undef DEBUG
X#ifdef DEBUG
Xint	pk_debug = 1;
X#endif
X
X#define	PK_PRE	247
X#define	PK_ID	89
X#define	PK_XXX1	240
X#define	PK_YYY	244
X#define	PK_POST	245
X#define	PK_NOP	246
X
X/*
X *	Get bytes/shorts/longs from .PK file
X */
X
Xint	pk_loc;
Xunsigned char pk_byte() { return (pk[npk]->storage[pk_loc++]); }
Xshort pk_short()
X{
X	register short a = pk_byte();
X	return (a*256 + pk_byte());
X}
Xlong pk_long()
X{
X	register long	a = pk_short();
X	if (a > 32767) a -= 65536;
X	return (a*65536 + pk_short());
X}
X
X/*
X *	Open .PK file and return descriptor
X */
X
Xpk_open(name, size, res)
Xchar	*name;	/* "cmr" */
Xint	size;	/* 10 */
Xint	res;	/* 300 */
X{
X	char		filename[256];
X	int		fd;
X	struct	stat	stats;
X	int		descend;
X
X	if (npk >= MAXPK)
X		error(1, "too many font/size combinations");
X	if (pk[npk]) free(pk[npk]);
X	pk[npk] = (PK *) malloc(sizeof(PK));
X	if (!pk[npk])
X		error(1, "can't get space for raster file %s", filename);
X
X	Sprintf(pk[npk]->name, "%s%d.%d", name, size, res);
X	Sprintf(filename, "%s/%spk", FontPath, pk[npk]->name);
X	fd = open(filename, 0);
X	if (fd < 0)
X	{
X		error(0, "can't open raster file %s", filename);
X		return (-1);
X	}
X	(void) fstat(fd, &stats);
X	descend = MAXINT;
X	if (stats.st_size > descend)
X		error(1,
X		"font '%s' too large (%ld bytes); max is %d for this machine!",
X			filename, stats.st_size, descend);
X	pk[npk]->storage = (uchar *) malloc( (unsigned) stats.st_size);
X	if (pk[npk]->storage == NULL)
X		error(1, "no space for raster file %s", filename);
X	if (read(fd, (char *) pk[npk]->storage, (unsigned) stats.st_size)
X			!= stats.st_size)
X		error(1, "error reading raster file %s", filename);
X	(void) close(fd);
X
X	/*
X	 * Read preamble
X	 */
X	pk_loc = 0;
X	if (pk_byte() != PK_PRE)
X		error(1, "bad pk file -- no preamble");
X	if (pk_byte() != PK_ID)
X		error(1, "bad pk file -- wrong version");
X	{
X		register int comment_length = pk_byte();
X		pk_loc += comment_length;
X	}
X	pk[npk]->design_size = pk_long();
X	pk_loc += sizeof(long);		/* Skip checksum */
X	pk[npk]->hppp = pk_long();
X	pk[npk]->vppp = pk_long();
X	if (pk[npk]->hppp != pk[npk]->vppp)
X		error(0, "aspect ratio not 1:1");
X	pk[npk]->baseline = 0;
X	pk[npk]->cellheight = 0;
X	pk[npk]->cellwidth = 0;
X	pk[npk]->loaded = 0;
X	descend = 0;
X
X	/*
X	 * Compute interesting stuff about characters
X	 */
X	for(;;)
X	{
X		int		flag;
X		int		dyn_f;
X		int		turn_on;
X		int		next_packet;
X		long		pl, cc, tfm, dx, dy, w, h, hoff, voff;
X		register PK_CHAR	*p;
X
X		pk_skip_specials();
X		flag = pk_byte();
X		if (flag == PK_POST) break;
X		dyn_f = flag / 16;
X		flag %= 16;
X		turn_on = flag >= 8;
X		if (turn_on) flag -= 8;
X		if (flag == 7)
X		{	/* long preamble */
X			pl = pk_long();
X			cc = pk_long();
X			next_packet = pk_loc + pl;
X			tfm = pk_long();
X			dx = pk_long();
X			dy = pk_long();
X			w = pk_long();
X			h = pk_long();
X			hoff = pk_long();
X			voff = pk_long();
X		}
X		else if (flag > 3)
X		{	/* extended short preamble */
X			pl = (flag - 4) * 65536 + pk_short();
X			cc = pk_byte();
X			next_packet = pk_loc + pl;
X			tfm = pk_byte(); tfm = tfm*65536 + pk_short();
X			dx = pk_short() * 65536;
X			dy = 0;
X			w = pk_short();
X			h = pk_short();
X			hoff = pk_short();
X			voff = pk_short();
X		}
X		else
X		{	/* short preamble */
X			pl = flag * 256 + pk_byte();
X			cc = pk_byte();
X			next_packet = pk_loc + pl;
X			tfm = pk_byte(); tfm = tfm*65536 + pk_short();
X			dx = pk_byte() * 65536;
X			dy = 0;
X			w = pk_byte();
X			h = pk_byte();
X			hoff = (char) pk_byte();
X			voff = (char) pk_byte();
X		}
X		if (cc < 0 || cc > 127)
X			error(1, "character code %d out of range", cc);
X		p = &pk[npk]->chars[cc];
X		p->dyn_f = dyn_f;
X		p->turn_on = turn_on;
X/*		p->pl = pl;	not used*/
X/*		p->cc = cc;	not used*/
X		p->tfm = tfm;
X		p->dx = dx;
X/*		p->dy = dy;	not used*/
X		p->w = w;
X		p->h = h;
X		p->hoff = hoff;
X		p->voff = voff;
X		p->bytep = &pk[npk]->storage[pk_loc];
X		p->loaded = 0;
X
X		if (voff > pk[npk]->baseline) pk[npk]->baseline = voff;
X		if ( (h-voff) > descend) descend = h-voff;
X		if ( (w-hoff) > pk[npk]->cellwidth) pk[npk]->cellwidth = w-hoff;
X
X		pk_loc = next_packet;
X	}
X	pk[npk]->cellheight = pk[npk]->baseline + descend;
X
X#	ifdef DEBUG
X	{
X		register int i;
X
X		if (pk_debug)
X		{
X			pk_dump_pk();
X			for (i = 0; i <= 127; ++i)
X				pk_dump(i);
X		}
X	}
X#	endif
X	return (npk++);
X}
X
Xpk_skip_specials()
X{
X	register int i, j;
X	register int	flag;
X
X	while ( (flag = pk_byte()) >= 240)
X	{
X		switch(flag)
X		{
X		case 240: case 241: case 242: case 243:
X			for (i = 0, j = 240; j <= flag; ++j)
X				i = i*256 + pk_byte();
X			pk_loc += i;
X			break;
X		case 244:
X			pk_loc += sizeof(long);
X			break;
X		case 245:
X			goto out;
X		case 246:
X			break;
X		default:
X			error(1, "unexpected flag");
X		}
X	}
Xout:
X	--pk_loc;
X}
X
X/*
X *	Debugging routines
X */
X
X#ifdef DEBUG
X
Xpk_dump_pk()
X{
X	register PK	*p = pk[npk];
X
X	Fprintf(stderr, "Design_size=%d, hppp = %d, vppp = %d\n",
X		p->design_size, p->hppp, p->vppp);
X	Fprintf(stderr, "baseline = %d, cellwidth = %d, cellheight = %d\n",
X		p->baseline, p->cellwidth, p->cellheight);
X}
X
Xpk_dump(cc)
X{
X	register PK_CHAR	*p = &pk[npk]->chars[cc];
X
X	if (cc > ' ' && cc < 127)
X		Fprintf(stderr, "Character '%c' (%d):\n", cc, cc);
X	else
X		Fprintf(stderr, "Character %d:\n", cc);
X	Fprintf(stderr, "tfm(width) = %d\n", p->tfm);
X	Fprintf(stderr, "dx = %d (%d), ", p->dx, p->dx>>16);
X	Fprintf(stderr, "dy = %d\n", 0/*p->dy*/);
X	Fprintf(stderr, "w = %d, ", p->w);
X	Fprintf(stderr, "h = %d\n", p->h);
X	Fprintf(stderr, "hoff = %d, ", p->hoff);
X	Fprintf(stderr, "voff = %d\n", p->voff);
X}
X#endif
X
X/*
X *	Unit Test Routines
X */
X
X
Xtypedef struct
X{
X	char	*troff_name;
X	char	*tex_name;
X	int	special;
X	char	**tbl;
X	char	*comment;
X	int	kern_code;
X	int	spacewidth;
X} TT;
X
X#define	MAXFONT	32
X
Xint	kernhi[MAXFONT];
Xint	kernlo[MAXFONT];
Xint	kern_highest;
Xint	kern_lowest;
X
Xint	nspecials = 0;
Xchar	specials[1024][2];
X
X#define	MAXSIZE	100	/* Largest point size allowed */
Xint	all_sizes[MAXSIZE+1];
X
Xint	Nfont;	/* Total number of fonts */
Xint	Sfont;	/* Number of preloaded fonts */
XTT	font[MAXFONT];	/* fontinfo storage */
X
Xtypedef struct
X{
X	char	*name;
X	char	**tbl;
X} CODETABLE;
X
XCODETABLE	codes[MAXFONT];
Xint		Ncodes = 0;
X
Xchar	*getqarg(fp, name)
XFILE	*fp;
Xchar	*name;
X{
X	static char	*p = "";
X	char		*sp;
X	char		*ep;
X	static char	buf[256];
X	static char	buf2[256];
X	int		state = 0;
X
Xmore:
X	if (!*p)
X	{
X		if (fgets(buf, sizeof(buf), fp) == NULL)
X			goto eof;
X		p = buf;
X		(void) strcpy(buf2, buf);
X	}
X	while (*p != '"') if (!*p) goto more; else ++p;
X	ep = sp = ++p;
X	for(;;)
X	{
X		if (!*p)
X		{
X			Fprintf(stderr, "%s\n", buf2);
X			Fprintf(stderr, "%*s^\n", p-buf, "");
X			error(1, "unterminated quote in '%s'", name);
X		}
X		switch (state)
X		{
X		case 0:
X			if (*p == '"') goto eos;
X			else if (*p == '\\') state = '\\';
X			else *ep++ = *p;
X			++p;
X			break;
X		case '\\':
X			*ep++ = *p++;
X			state = 0;
X			break;
X		}
X	}
Xeos:
X	++p;
X	*ep = 0;
X	
X	return (sp);
Xeof:
X	p = "";
X	return (NULL);
X}
X
Xread_codes(n, s)
Xchar	*s;
X{
X	FILE	*fp;
X	int	i;
X	char	*p;
X	char	buf[64];
X
X	Sprintf(buf, "%s.code", s);
X	fp = fopen(buf, "r");
X	if (!fp) error(1, "can't find code table '%s'", buf);
X
X	codes[n].name = (char *) malloc( (unsigned) strlen(s) + 1);
X	(void) strcpy(codes[n].name, s);
X	codes[n].tbl = (char **) malloc(128 * sizeof (char *));
X
X	i = 0;
X	while (p = getqarg(fp, buf))
X	{
X/* Fprintf(stderr, "getqarg '%s'\n", p);*/
X		if (i >= 128)
X			error(1, "too many codes in '%s'", buf);
X		codes[n].tbl[i] = (char *) malloc( (unsigned) strlen(p) + 1);
X		(void) strcpy(codes[n].tbl[i], p);
X		++i;
X	}
X	(void) fclose(fp);
X}
X
Xchar	*getstr(pp)
Xchar	**pp;
X{
X	static char	buf[128];
X	register char	*p, *bp;
X
X	p = *pp;
X	while (*p == ' ' || *p == '\t') ++p;
X	bp = buf;
X	while (*p && *p != ' ' && *p != '\t' && *p != '\n' && *p != '\r')
X		*bp++ = *p++;
X	*bp = 0;
X	*pp = p;
X/*Fprintf(stderr, "getstr = '%s'\n", buf);*/
X	return (buf);
X}
X
Xread_fontlist()
X{
X	FILE	*fp;
X	char	*p, *ap;
X	int	i;
X	char	buf[512];
X
X	fp = fopen("fontlist", "r");
X	if (!fp) error(1, "can't find 'fontlist'");
X
X	Nfont = Sfont = 0;
X	while (fgets(buf, sizeof(buf), fp))
X	{
X		if (buf[0] == '#') continue;
X		if (buf[0] == '\n') continue;
X		if (buf[0] == '\t') continue;
X		if (buf[0] == ' ') continue;
X		if (buf[0] == '-') { Sfont = Nfont; continue;}
X		ap = buf;
X		p = getstr(&ap);
X		font[Nfont].troff_name = malloc( (unsigned) strlen(p) + 1);
X		(void) strcpy(font[Nfont].troff_name, p);
X		p = getstr(&ap);
X		font[Nfont].tex_name = malloc( (unsigned) strlen(p) + 1);
X		(void) strcpy(font[Nfont].tex_name, p);
X		p = getstr(&ap);
X		font[Nfont].special = atoi(p);
X
X		p = getstr(&ap);/*code table*/
X
X		for (i = 0; i < Ncodes; ++i)
X			if (strcmp(p, codes[i].name) == 0) break;
X		if (i == Ncodes)
X		{
X			read_codes(Ncodes, p);
X			++Ncodes;
X		}
X		font[Nfont].tbl = codes[i].tbl;
X
X		p = getstr(&ap);
X		if (*p < '0' || *p > '9')
X		{	/* Use another table */
X			for (i = 0; i < Nfont; ++i)
X				if (strcmp(p, font[i].troff_name) == 0)
X					break;
X			if (i != Nfont)
X				font[Nfont].kern_code = 256 + i;
X			else
X				error(1, "kerning for '%s' is unknown", p);
X		}
X		else
X			font[Nfont].kern_code = atoi(p);
X
X
X		p = getstr(&ap);
X		font[Nfont].spacewidth = atoi(p);
X
X		while(*ap == ' ' || *ap == '\t') ++ap;
X		p = strchr(ap, '\n'); if(p) *p = 0;
X		font[Nfont].comment = malloc( (unsigned) strlen(ap) + 1);
X		(void) strcpy(font[Nfont].comment, ap);
X		
X		++Nfont;
X	}
X	(void) fclose(fp);
X}
X
Xint	wsize;
X
Xchar	*argv0;
X
Xmain(argc, argv)
Xchar	*argv[];
X{
X	int	f;
X	int	c;
X	int	i;
X	int	npk;
X	FILE	*fp;
X	char	ligatures[256];
X	char	buf[256];
X
X	argv0 = argv[0];
X#	ifdef lint
X		i = argc;
X#	endif
X	read_fontlist();
X
X	for (f = 0; f < Nfont; ++f)
X	{
X		/*
X		 * See what sizes are available
X		 */
X		wsize = 0;
X		Sprintf(buf, "%s.SZ", font[f].troff_name);
X		fp = fopen(buf, "w");
X		Fprintf(fp, "%s", font[f].tex_name);
X		for (i = 1; i <= MAXSIZE; ++i)
X		{
X			Sprintf(buf, "%s/%s%d.%dpk",
X				FontPath, font[f].tex_name, i, 300);
X			if (access(buf, 0) == 0)
X			{
X				Fprintf(fp, " %d", i);
X				all_sizes[i] = 1;
X				if (i == 10) wsize = 10;
X				else if (wsize != 10) wsize = i;
X			}
X		}
X		Fprintf(fp, "\n");
X		(void) fclose(fp);
X
X		npk = pk_open(font[f].tex_name, wsize, 300);
X		fp = fopen(font[f].troff_name, "w");
X		Fprintf(fp, "# %s\n", font[f].comment);
X		Fprintf(fp, "name %s\n", font[f].troff_name);
X		Fprintf(fp, "internalname %d\n", f+1);
X		if (font[f].spacewidth)
X			Fprintf(fp, "spacewidth %d\n", font[f].spacewidth);
X		if (font[f].special)
X			Fprintf(fp, "special\n");
X		if (font[f].kern_code < 256)
X		{	/* Figure out low/high points of (usually) "a" */
X			c = font[f].kern_code;
X			kern_highest = pk[npk]->chars[c].voff;
X			kern_lowest = kern_highest - pk[npk]->chars[c].h;
X			kernhi[f] = kern_highest;
X			kernlo[f] = kern_lowest;
X		}
X		else
X		{
X			kern_highest = kernhi[font[f].kern_code-256];
X			kern_lowest = kernlo[font[f].kern_code-256];
X		}
X		ligatures[0] = 0;
X		for (c = 0; c < 128; ++c)
X		{	/* scan for ligatures */
X			if (strcmp(font[f].tbl[c], "ff") == 0)
X				(void) strcat(ligatures, "ff ");
X			else if (strcmp(font[f].tbl[c], "fi") == 0)
X				(void) strcat(ligatures, "fi ");
X			else if (strcmp(font[f].tbl[c], "fl") == 0)
X				(void) strcat(ligatures, "fl ");
X			else if (strcmp(font[f].tbl[c], "Fi") == 0)
X				(void) strcat(ligatures, "ffi ");
X			else if (strcmp(font[f].tbl[c], "Fl") == 0)
X				(void) strcat(ligatures, "ffl ");
X		}
X		if (ligatures[0])
X			Fprintf(fp, "ligatures %s0\n", ligatures);
X		Fprintf(fp, "charset\n");
X		for (c = 0; c < 128; ++c)
X		{
X			char_info(fp, npk, c, font[f].tbl);
X		}
X		(void) fclose(fp);
X
X	}
X	fp = fopen("DESC", "w");
X	Fprintf(fp, "# DESC for LaserJet\n");
X	Fprintf(fp, "#	generated by out.c from rasters in:\n");
X	Fprintf(fp, "#	%s\n", FontPath);
X	Fprintf(fp, "res 300\n");
X	Fprintf(fp, "hor 1\n");
X	Fprintf(fp, "vert 1\n");
X	Fprintf(fp, "unitwidth 10\n");
X	Fprintf(fp, "sizescale 1\n");
X	Fprintf(fp, "paperwidth %d\n", 11*300);
X	Fprintf(fp, "paperlength %d\n", 11*300);
X	Fprintf(fp, "biggestfont %d\n", 128);
X	Fprintf(fp, "fonts %d", Sfont);
X	for (f = 0; f < Sfont; ++f)
X		Fprintf(fp, " %s", font[f].troff_name);
X	Fprintf(fp, "\n");
X	Fprintf(fp, "sizes");
X	for (i = 1; i <= MAXSIZE; ++i)
X		if (all_sizes[i])
X			Fprintf(fp, " %d", i);
X	Fprintf(fp, " 0\n");
X	if (nspecials) Fprintf(fp, "charset");
X	for (f = 0; f < nspecials; ++f)
X	{
X		if ( (f % 16) == 0) Fprintf(fp, "\n");
X		Fprintf(fp, "%2.2s ", specials[f]);
X	}
X	if (nspecials) Fprintf(fp, "\n");
X	(void) fclose(fp);
X	exit(0);
X	/* NOTREACHED */
X}
X
Xchar_info(fp, npk, c, tbl)
XFILE	*fp;
Xchar	*tbl[];
X{
X	char	*chname;
X	int	width = 0;
X	int	kerning = 0;
X	int	code;
X	int	first = 1;
X	/*
X	 *	"##"
X	 *	"a"
X	 *	"a -"
X
X	/* char	width kerning code */
X	chname = tbl[c];
X	if (strcmp(chname, "##") == 0)
X		return;
X	width = pk[npk]->chars[c].dx>>16;
X	if (wsize != 10)
X	{
X		width *= 10;
X		width /= wsize;
X	}
X	code = c;
X	if (pk[npk]->chars[c].voff > kern_highest)
X		kerning += 2;
X	if ( (pk[npk]->chars[c].voff-pk[npk]->chars[c].h) < kern_lowest)
X		kerning += 1;
X	for(;;)
X	{
X		if (strlen(chname) <= 2)
X		{
X			if (strcmp(chname, "br") == 0)
X			{	/* Special Case for Box Rule */
X				width = 0;	/* Zero Width!!! */
X				first = 1;
X			}
X			if (first)
X				Fprintf(fp, "%s	%d	%d	%d\n",
X					chname, width, kerning, code);
X			else
X				Fprintf(fp, "%s	\"\n", chname);
X			if (strlen(chname) == 2)
X				add_special(chname);
X			break;
X		}
X		else
X		{
X			if (first)
X				Fprintf(fp, "%2.2s	%d	%d	%d\n",
X					chname, width, kerning, code);
X			else
X				Fprintf(fp, "%2.2s	\"\n", chname);
X			add_special(chname);
X			chname += 2;
X		}
X		first = 0;
X	}
X}
X
Xadd_special(s)
Xchar	*s;
X{
X	register int	i;
X
X	for (i = 0; i < nspecials; ++i)
X		if (specials[i][0] == s[0] && specials[i][1] == s[1])
X			return;
X	specials[nspecials][0] = s[0];
X	specials[nspecials][1] = s[1];
X	++nspecials;
X}
X
X/* VARARGS */
Xerror(va_alist)
Xva_dcl
X{
X	va_list		args;
X	register int	fatal;
X	register char	*fmt;
X
X	va_start(args);
X#	if lint			/* Lint bitches here, don't know why */
X		fatal = 0;
X		fmt = "";
X#	else
X		fatal = va_arg(args, int);	
X		fmt = va_arg(args, char *);
X#	endif
X	(void) fprintf(stderr, "%s: ", argv0);
X	(void) vfprintf(stderr, fmt, args);
X	va_end(args);
X	(void) putc('\n', stderr);
X	if (fatal)
X		exit(fatal&255);
X}
END_OF_FILE
if test 15861 -ne `wc -c <'font/devjet/makeDESC.c'`; then
    echo shar: \"'font/devjet/makeDESC.c'\" unpacked with wrong size!
fi
# end of 'font/devjet/makeDESC.c'
fi
echo shar: End of archive 7 \(of 7\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 7 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0



More information about the Comp.sources.misc mailing list