Path: seismo!harvard!think!mit-eddie!genrad!panda!sources-request From: sources-request@panda.UUCP Newsgroups: mod.sources Subject: troff->laserjet Message-ID: <1347@panda.UUCP> Date: 27 Jan 86 15:20:20 GMT Sender: jpn@panda.UUCP Lines: 1398 Approved: jpn@panda.UUCP Mod.sources: Volume 3, Issue 96 Submitted by: ihnp4!mnetor!clewis (Chris Lewis) This is a troff->HP laserjet filter package that should be capable of using Berkeley vfont files. I say "should be", because our system doesn't have any, and I converted some MAC fonts to look like what the manual pages say for vfonts. "vfontinfo" does seem to work properly. I will be submitting the MAC->vfont converter and some publically distributable MAC font files a little later. This was built on a Pyramid in the System V universe. #!/bin/sh echo 'Start of pack.out, part 01 of 01:' echo 'x - README' sed 's/^X//' > README << '/' XThis is a UNIX Troff to Laserjet converter filter. It supports rasterized XBerkeley vfonts. Er, rather, I uploaded some MAC fonts, converted them to Xwhat I *think* are Berkeley vfonts (vfontinfo works okay on 'em), and Xit works okay sort of. The manual page for lroff describes the whole thing. XThe MACfont to vfont converter plus whatever fonts I can legally distribute Xwill be posted separately. X XInstallation: X - modify BIN in the makefile to point to where you want to put X the executables. X - modify "lcat.c" initialization of "fontLIB" to point at either: X - the Berkeley vfont directory, or X - where you are going to place vfonts X (particularly from the MAC -> vfont converter) X - modify lroff for your printer system. You may have to modify X your printer system so that you can get both 8 bit and ^S/^Q X control, and that no other filters are used. We modified a System V X spooler to accept a "-p" to mean "plot mode", where the tty's X are set differently, and it doesn't go through the reversal filter X we use for normal stuff. X - make sure that tmac.lmm has the right path for your mm macro package. X - Run "make". X - Run "make test" to ensure everything is working reasonably. X This will give the printed example of the logo. X - run "make install". If it asks you for a password, then X enter your super-user password. It copies lroff, lcat to X $(BIN) and tmac.lmm to /usr/lib/tmac/tmac.lmm X XThis thing runs on System V. I don't think that there will be many changes Xfor Berkeley except for acquiring one of the public domain getopt's. / echo 'x - lcat.c' sed 's/^X//' > lcat.c << '/' X/***************************************************************** X X Copyright 1985. Chris Lewis X X Module : lcat.c 1.5 X Date submitted : 86/01/21 13:23:21 X Author : Chris Lewis X Origin : Permission to copy and further distribute is X freely given provided this copyright notice remains X intact and that this software is not sold for profit. X Description : Driver for troff WANG/CAT to HP laserjet filter. X X******************************************************************/ X X#ifndef lint Xstatic char SrcId[] = "@(#)lcat.c:1.5"; X#endif X X#include X#include X#include Xtypedef struct { X int size; X char *g_line; X} glyph[]; X X#include "bell.glyph.h" X X#define ESC 0x80 X#define FLASH 0x00 X#define CONTROL 0x40 X#define LEAD 0x60 X#define SIZE 0x50 X X#define DOWN 0 X#define UP 1 X#define LOWER 2 X#define UPPER 3 X#define FORWARD 4 X#define BACKWARD 5 X XFILE *diagFile = (FILE *) NULL; X#define DEBUGPRINTF if (diagFile) debugprintf X Xchar *toprnt(); X Xchar ptab[16] = { 7, 8, 10, 11, 12, 14, 18, 9, 6, 16, 20, 22, 24, 28, 36, 72}; Xint points; Xint vertChanged = 0; Xint quality = 1; X X X/* Scale factors: X (td/ld) * (lu / tu) X Where: X td: troff dimension in inches X ld: laserjet dimension in inches X lu: laserjet precision/inch X tu: troff precision/inch X X td = 6.5 (width), 11 (length) X tu = 432 X ld = 6.5 (width), 10 (length) X lu = 720 X*/ X X#define XSF 1.6666666 /* X Scale factor (troff to laserjet units) */ X#define YSF 1.5151515 /* Y Scale factor (troff to laserjet units) */ X Xlong xpos, oldypos = -9999, ypos = -153; X Xchar *words[] = { X "down", "up", "lower", "upper", "forward", "backwards" X }; X Xchar fontName[BUFSIZ] = "newyork"; Xchar *fontLib = "/u/clewis/lcat/fonts/"; X X#define CTOINT(val,sig) ((~c)&sig) X X#define UNITS 432 X#define FONT4 /* 4 Font device */ X X#ifdef FONT4 X#define calcfont font = ((mag == UPPER)<<1)|((rail == UPPER)) X#else X#define calcfont font = ((mag == UPPER)<<2)|((rail == UPPER)<<1)|(tilt==DOWN) X#endif X Xextern char *native[], *specnative[]; X Xmain(argc, argv) Xint argc; Xchar **argv; { X register int nc, c; X register char *rp; X register int i,j; X register int decipoints; X register int units; X register int oldFont, font, rail, mag, tilt, half, escape, lead; X X extern int getopt(); X extern char *optarg; X while((c = getopt(argc, argv, "hHDdf:")) != EOF) X switch (c) { X case 'D': X diagFile = fopen("diagnostics", "w"); X if (!diagFile) { X fprintf(stderr, "Could not open diagnostics file\n"); X exit(1); X } X break; X case 'f': X strcpy(fontName, optarg); X break; X case 'd': X fontName[0] = '\0'; X quality = 0; X break; X case 'h': X quality = 1; X break; X case 'H': X quality = 2; X break; X case '?': X usage(); X exit(1); X } X X if (diagFile) { X for (i = 0; i <= 107; i++) { X fprintf(diagFile, "%d: native: %s, ", i, toprnt(native[i])); X fprintf(diagFile, "Special:%s\n", toprnt(specnative[i])); X } X } X while (!feof(stdin)) { X c = getc(stdin); X switch(c) { X case 0x00: X DEBUGPRINTF("NOP\n"); X break; X /* Flash (print character) codes */ X case 0x01: case 0x02: case 0x03: case 0x04: X case 0x05: case 0x06: case 0x07: case 0x08: X case 0x09: case 0x0a: case 0x0b: case 0x0c: X case 0x0d: case 0x0e: case 0x0f: case 0x10: X case 0x11: case 0x12: case 0x13: case 0x14: X case 0x15: case 0x16: case 0x17: case 0x18: X case 0x19: case 0x1a: case 0x1b: case 0x1c: X case 0x1d: case 0x1e: case 0x1f: case 0x20: X case 0x21: case 0x22: case 0x23: case 0x24: X case 0x25: case 0x26: case 0x27: case 0x28: X case 0x29: case 0x2a: case 0x2b: case 0x2c: X case 0x2d: case 0x2e: case 0x2f: case 0x30: X case 0x31: case 0x32: case 0x33: case 0x34: X case 0x35: case 0x36: case 0x37: case 0x38: X case 0x39: case 0x3a: case 0x3b: case 0x3c: X case 0x3d: case 0x3e: case 0x3f: X /* This is terribly kludgey: X In 432 units per inch, 4752 is 11 inches. X When we go beyond this, we subtract 4752 X and ignore anything printed on this line. X */ X while (ypos >= 4752) { X ypos -= 4752; X oldypos = -9999; X DEBUGPRINTF("Page break\n", 0, 0); X putchar('\f'); X } X if (ypos <= 20) { X DEBUGPRINTF("Ignoring: %d, %d\n", xpos, ypos); X break; /* ignore anything less than this X from the beginning of a page */ X } X c = c&0x3f; X DEBUGPRINTF("Flash %02d %s font %d\n", c&0x3f, X words[half], font); X DEBUGPRINTF("x,y=%ld,%ld; font=%d; rail=%s; mag=%s; tilt=%s; half=%s\n", X xpos,ypos,font+1,words[rail],words[mag],words[tilt], X words[half]); X /* Find the C/A/T code */ X if (half == UPPER) { X if (c > 46) { X fprintf(stderr, "Illegal upper flash: %d\n", c); X exit(1); X } X nc = c + 62; X } else X nc = c - 1; X /* Move to the appropriate position */ X X if (!vertChanged && oldypos == ypos) { X printf("\033&a%dH",(int) (xpos*XSF)); X } else { X printf("\033&a%dh%dV",(int) (xpos*XSF), X (int) (ypos*YSF)); X } X oldypos = ypos; X vertChanged = 0; X if (font == 3 && nc == 34) { X prt_glyph(cX_glyph); X break; X } X if (points != 12 && fontName[0] != '\0' && quality) { X if (loadfont(fontName, points, quality)) { X flashrast(nc, points, font); X vertChanged = 1; X break; X } X } X if (oldFont != font) { X DEBUGPRINTF("Changing to font %d\n", font); X switch(font) { X case 3: X case 0: X /* upright, normal weight */ X printf("\033(s0s-2B"); X break; X case 1: X /* italics, light weight */ X printf("\033(s1s-3B"); X break; X case 2: X /* upright, heavy weight (bold)*/ X printf("\033(s0s7B"); X break; X } X } X oldFont = font; X X if (font < 3) X for (rp = native[nc]; *rp; rp++) X putc(*rp, stdout); X else X for (rp = specnative[nc]; *rp; rp++) X putc(*rp, stdout); X DEBUGPRINTF("Code %d is %d(%s)\n", c, nc, (font < 3) ? X toprnt(native[nc]):toprnt(specnative[nc])); X break; X /* Control codes */ X case 0x40: X DEBUGPRINTF("Initialize\n"); X xpos = 0; X ypos = -153; X escape = FORWARD; X lead = FORWARD; X half = LOWER; X rail = LOWER; X mag = LOWER; X tilt = DOWN; X calcfont; X break; X case 0x41: X DEBUGPRINTF("Rail lower\n"); X rail = LOWER; X calcfont; X break; X case 0x42: X DEBUGPRINTF("Rail upper\n"); X rail = UPPER; X calcfont; X break; X case 0x43: X DEBUGPRINTF("Mag upper\n"); X mag = UPPER; X calcfont; X break; X case 0x44: X DEBUGPRINTF("Mag lower\n"); X mag = LOWER; X calcfont; X break; X case 0x45: X DEBUGPRINTF("half lower\n"); X half = LOWER; X break; X case 0x46: X DEBUGPRINTF("half upper\n"); X half = UPPER; X break; X case 0x47: X DEBUGPRINTF("Escape forward\n"); X escape = FORWARD; X break; X case 0x48: X DEBUGPRINTF("Escape backward\n"); X escape = BACKWARD; X break; X case 0x49: X DEBUGPRINTF("STOP\n"); X break; X case 0x4a: X DEBUGPRINTF("Lead forward\n"); X lead = FORWARD; X break; X case 0x4b: X DEBUGPRINTF("Software cut!\n"); X break; X case 0x4c: X DEBUGPRINTF("Lead backward\n"); X lead = BACKWARD; X break; X case 0x4d: X DEBUGPRINTF("UNKNOWN CONTROL CODE!\n"); X exit(0); X case 0x4e: X DEBUGPRINTF("Tilt up\n"); X tilt = UP; X calcfont; X break; X case 0x4f: X DEBUGPRINTF("Tilt down\n"); X tilt = DOWN; X calcfont; X break; X X /* Size changes */ X case 0x50: case 0x51: case 0x52: case 0x53: X case 0x54: case 0x55: case 0x56: case 0x57: X case 0x58: case 0x59: case 0x5a: case 0x5b: X case 0x5c: case 0x5d: case 0x5e: case 0x5f: X DEBUGPRINTF("Size change %02x\n", c&0xf); X points = ptab[c&0xf]; X break; X /* Lead (vertical motion) codes */ X case 0x60: case 0x61: case 0x62: case 0x63: X case 0x64: case 0x65: case 0x66: case 0x67: X case 0x68: case 0x69: case 0x6a: case 0x6b: X case 0x6c: case 0x6d: case 0x6e: case 0x6f: X case 0x70: case 0x71: case 0x72: case 0x73: X case 0x74: case 0x75: case 0x76: case 0x77: X case 0x78: case 0x79: case 0x7a: case 0x7b: X case 0x7c: case 0x7d: case 0x7e: case 0x7f: X X DEBUGPRINTF("Lead(vertical) %02x\n", c&0x1f); X units = CTOINT(c,0x1f); X if (lead == FORWARD) { X ypos += 3*units; X } else { X ypos -= 3*units; X } X break; X /* Escape (horizontal motion) codes */ X case 0x80: case 0x81: case 0x82: case 0x83: X case 0x84: case 0x85: case 0x86: case 0x87: X case 0x88: case 0x89: case 0x8a: case 0x8b: X case 0x8c: case 0x8d: case 0x8e: case 0x8f: X case 0x90: case 0x91: case 0x92: case 0x93: X case 0x94: case 0x95: case 0x96: case 0x97: X case 0x98: case 0x99: case 0x9a: case 0x9b: X case 0x9c: case 0x9d: case 0x9e: case 0x9f: X case 0xa0: case 0xa1: case 0xa2: case 0xa3: X case 0xa4: case 0xa5: case 0xa6: case 0xa7: X case 0xa8: case 0xa9: case 0xaa: case 0xab: X case 0xac: case 0xad: case 0xae: case 0xaf: X case 0xb0: case 0xb1: case 0xb2: case 0xb3: X case 0xb4: case 0xb5: case 0xb6: case 0xb7: X case 0xb8: case 0xb9: case 0xba: case 0xbb: X case 0xbc: case 0xbd: case 0xbe: case 0xbf: X case 0xc0: case 0xc1: case 0xc2: case 0xc3: X case 0xc4: case 0xc5: case 0xc6: case 0xc7: X case 0xc8: case 0xc9: case 0xca: case 0xcb: X case 0xcc: case 0xcd: case 0xce: case 0xcf: X case 0xd0: case 0xd1: case 0xd2: case 0xd3: X case 0xd4: case 0xd5: case 0xd6: case 0xd7: X case 0xd8: case 0xd9: case 0xda: case 0xdb: X case 0xdc: case 0xdd: case 0xde: case 0xdf: X case 0xe0: case 0xe1: case 0xe2: case 0xe3: X case 0xe4: case 0xe5: case 0xe6: case 0xe7: X case 0xe8: case 0xe9: case 0xea: case 0xeb: X case 0xec: case 0xed: case 0xee: case 0xef: X case 0xf0: case 0xf1: case 0xf2: case 0xf3: X case 0xf4: case 0xf5: case 0xf6: case 0xf7: X case 0xf8: case 0xf9: case 0xfa: case 0xfb: X case 0xfc: case 0xfd: case 0xfe: X X units = CTOINT(c,0x7f); X if (escape == FORWARD) { X xpos += units; X } else { X xpos -= units; X } X DEBUGPRINTF("ESC (hor): %02x\n", c&0x7f); X break; X X case 0xff: X DEBUGPRINTF("Illegal: %02x\n", c); X break; X } X } X exit(0); X} X Xchar * Xtoprnt(s) Xchar *s; { X static char buf[BUFSIZ]; X register char *fromp, *top; X for (fromp = s, top = buf; *fromp; fromp++,top++) X if (isascii(*fromp) && isprint(*fromp)) X *top = *fromp; X else { X sprintf(top, "\\%03o", *fromp); X top += 3; X } X *top = '\0'; X return(buf); X} X Xprt_glyph(g) Xglyph g; { X register int i, j; X int val; X printf("\033&a-%dV", cX_height * 2); X printf("\033*t300R"); X for (i = 0; i < cX_height; i++) { X printf("\033*r1A"); X printf("\033*b%dW", g[i].size); X for (j = 0; j < g[i].size; j++) { X if (1 != sscanf(&(g[i].g_line[j*2]), "%2x", &val)) { X fprintf(stderr, "Scan failure\n"); X exit(1); X } X putc(val, stdout); X } X } X printf("\033*rB"); X} X Xusage() { X fprintf(stderr, "usage: lcat -f [-d] [-D]\n"); X} X Xdebugprintf(fmt, a1, a2, a3, a4, a5, a6, a7) Xchar *fmt; Xint a1, a2, a3, a4, a5, a6, a7; { X char buf[BUFSIZ]; X sprintf(buf, fmt, a1, a2, a3, a4, a5, a6, a7); X fprintf(diagFile, buf); X} / echo 'x - fastfonts.c' sed 's/^X//' > fastfonts.c << '/' X/***************************************************************** X X Copyright 1985. Chris Lewis X X Module : fastfonts.c 1.3 X Date submitted : 85/12/18 14:06:01 X Author : Chris Lewis X Origin : Permission to copy and further distribute is X freely given provided this copyright notice remains X intact and that this software is not sold for profit. X Description : Native Laser jet font where the index is the C/A/T X codes X X******************************************************************/ X X#ifndef lint Xstatic char SrcId[] = "@(#)fastfonts.c:1.3"; X#endif X X#define UNASS "\377" /* unassigned in C/A/T */ X#define UNREP "\377" /* unrepresentable on Laser fonts */ X/* Regular characters, fonts 1-3 */ X/* Note on native and specnative arrays: X you can create composite characters by using HP positionning X and characters. Only one proviso, because of the vertical X optimization, the net vertical motion MUST BE ZERO */ Xchar *native[108] = { X /* num howto name */ X /* 1 */ "h", /*h*/ X /* 2 */ "t", /*t*/ X /* 3 */ "n", /*n*/ X /* 4 */ "m", /*m*/ X /* 5 */ "l", /*l*/ X /* 6 */ "i", /*i*/ X /* 7 */ "z", /*z*/ X /* 8 */ "s", /*s*/ X /* 9 */ "d", /*d*/ X /* 10 */ "b", /*b*/ X /* 11 */ "x", /*x*/ X /* 12 */ "f", /*f*/ X /* 13 */ "j", /*j*/ X /* 14 */ "u", /*u*/ X /* 15 */ "k", /*k*/ X /* 16 */ UNASS, /*unassigned*/ X /* 17 */ "p", /*p*/ X /* 18 */ "\366", /*3/4 em*/ X /* 19 */ ";", /*;*/ X /* 20 */ UNASS, /*unassigned*/ X /* 21 */ "a", /*a*/ X /* 22 */ "\033&a-80V_\033&a-60H_\033&a+80V", /*horizontal rule*/ X /* 23 */ "c", /*c*/ X /* 24 */ "`", /*` open*/ X /* 25 */ "e", /*e*/ X /* 26 */ "'", /*' close*/ X /* 27 */ "o", /*o*/ X /* 28 */ "\367", /*1/4*/ X /* 29 */ "r", /*r*/ X /* 30 */ "\370", /*1/2*/ X /* 31 */ "v", /*v*/ X /* 32 */ "-", /*- hyphen*/ X /* 33 */ "w", /*w*/ X /* 34 */ "q", /*q*/ X /* 35 */ "/", /*/*/ X /* 36 */ ".", /*.*/ X /* 37 */ "g", /*g*/ X /* 38 */ "\377", /*3/4*/ X /* 39 */ ",", /*,*/ X /* 40 */ "&", /*&*/ X /* 41 */ "y", /*y*/ X /* 42 */ UNASS, /*unassigned*/ X /* 43 */ "%", /*%*/ X /* 44 */ UNASS, /*unassigned*/ X /* 45 */ "Q", /*Q*/ X /* 46 */ "T", /*T*/ X /* 47 */ "O", /*O*/ X /* 48 */ "H", /*H*/ X /* 49 */ "N", /*N*/ X /* 50 */ "M", /*M*/ X /* 51 */ "L", /*L*/ X /* 52 */ "R", /*R*/ X /* 53 */ "G", /*G*/ X /* 54 */ "I", /*I*/ X /* 55 */ "P", /*P*/ X /* 56 */ "C", /*C*/ X /* 57 */ "V", /*V*/ X /* 58 */ "E", /*E*/ X /* 59 */ "Z", /*Z*/ X /* 60 */ "D", /*D*/ X /* 61 */ "B", /*B*/ X /* 62 */ "S", /*S*/ X /* 63 */ "Y", /*Y*/ X /* from here on are actually code 1-45, upper half of font */ X /* 64 */ "F", /*F*/ X /* 65 */ "X", /*X*/ X /* 66 */ "A", /*A*/ X /* 67 */ "W", /*W*/ X /* 68 */ "J", /*J*/ X /* 69 */ "U", /*U*/ X /* 70 */ "K", /*K*/ X /* 71 */ "0", /*0*/ X /* 72 */ "1", /*1*/ X /* 73 */ "2", /*2*/ X /* 74 */ "3", /*3*/ X /* 75 */ "4", /*4*/ X /* 76 */ "5", /*5*/ X /* 77 */ "6", /*6*/ X /* 78 */ "7", /*7*/ X /* 79 */ "8", /*8*/ X /* 80 */ "9", /*9*/ X /* 81 */ "*", /***/ X /* 82 */ "-", /*minus*/ X /* 83 */ "\033&a-20Hf\033&a-45Hi", /*fi*/ X /* 84 */ "\033&a-20Hf\033&a-45Hl", /*fl*/ X /* 85 */ "\033&a-20Hf\033&a-45Hf", /*ff*/ X /* 86 */ "\277", /*cent sign*/ X /* 87 */ "\033&a-30Hf\033&a-45Hf\033&a-45Hl", /*ffl*/ X /* 88 */ "\033&a-30Hf\033&a-45Hf\033&a-45Hi", /*ffi*/ X /* 89 */ "(", /*(*/ X /* 90 */ ")", /*)*/ X /* 91 */ "[", /*[*/ X /* 92 */ "]", /*]*/ X /* 93 */ "\263", /*degree*/ X /* 94 */ "\377", /*dagger*/ X /* 95 */ "=", /*=*/ X /* 96 */ "\377", /*registered*/ X /* 97 */ ":", /*:*/ X /* 98 */ "+", /*+*/ X /* 99 */ UNASS, /*unassigned*/ X /* 100 */ "!", /*!*/ X#ifdef BLOTBULL X /* 101 */ "\374", /*bullet*/ X#else X /* Composite bullet */ X /* 101 */ "\033&a-15Vo\033&a-72h+15V*", X#endif X /* 102 */ "?", /*?*/ X /* 103 */ "\250", /*foot mark*/ X /* 104 */ "|", /*|*/ X /* 105 */ UNASS, /*unassigned*/ X /* 106 */ "\377", /*copyright*/ X /* 107 */ "\272", /*square*/ X /* 108 */ "$" /*$*/ X}; X Xchar *specnative[108] = { X /* 1*/ "psi", /*psi*/ X /* 2*/ "theta", /*theta*/ X /* 3*/ "nu", /*nu*/ X /* 4*/ "mu", /*mu*/ X /* 5*/ "lambda", /*lambda*/ X /* 6*/ "iota", /*iota*/ X /* 7*/ "zeta", /*zeta*/ X /* 8*/ "sigma", /*sigma*/ X /* 9*/ "delta", /*delta*/ X /* 10*/ "beta", /*beta*/ X /* 11*/ "xi", /*xi*/ X /* 12*/ "eta", /*eta*/ X /* 13*/ "phi", /*phi*/ X /* 14*/ "upsilon", /*upsilon*/ X /* 15*/ "kappa", /*kappa*/ X /* 16*/ UNASS, /*unassigned*/ X /* 17*/ "pi", /*pi*/ X /* 18*/ "@", /*@*/ X /* 19*/ "down arrow", /*down arrow*/ X /* 20*/ UNASS, /*unassigned*/ X /* 21*/ "alpha", /*alpha*/ X /* 22*/ "or (was star)", /*or (was star)*/ X /* 23*/ "chi", /*chi*/ X /* 24*/ "\033&a-9H'\033&a-90H'", /*double quote*/ X /* 25*/ "epsilon", /*epsilon*/ X /* 26*/ "equation equal", /*equation equal*/ X /* 27*/ "omicron", /*omicron*/ X /* 28*/ "left arrow", /*left arrow*/ X /* 29*/ "rho", /*rho*/ X /* 30*/ "up arrow", /*up arrow*/ X /* 31*/ "tau", /*tau*/ X /* 32*/ "_", /*_ underrule*/ X /* 33*/ "\\", /*\*/ X /* 34*/ "Psi", /*Psi*/ X /* 35*/ "bell system sign", /*bell system sign*/ X /* 36*/ "infinity", /*infinity*/ X /* 37*/ "gamma", /*gamma*/ X /* 38*/ " improper superset", /* improper superset*/ X /* 39*/ "proportional to", /*proportional to*/ X /* 40*/ "right hand", /*right hand*/ X /* 41*/ "omega", /*omega*/ X /* 42*/ "gradient", /*gradient*/ X /* 43*/ UNASS, /*unassigned*/ X /* 44*/ "Phi", /*Phi*/ X /* 45*/ "Theta", /*Theta*/ X /* 46*/ "Omega", /*Omega*/ X /* 47*/ "cup (union)", /*cup (union)*/ X /* 48*/ "root en", /*root en*/ X /* 49*/ "terminal sigma (was root em)", /*terminal sigma (was root em)*/ X /* 50*/ "Lambda", /*Lambda*/ X /* 51*/ "equation minus", /*equation minus*/ X /* 52*/ "Gamma", /*Gamma*/ X /* 53*/ "integral sign", /*integral sign*/ X /* 54*/ "Pi", /*Pi*/ X /* 55*/ "subset of", /*subset of*/ X /* 56*/ "superset of", /*superset of*/ X /* 57*/ "approximates", /*approximates*/ X /* 58*/ "partial derivative", /*partial derivative*/ X /* 59*/ "Delta", /*Delta*/ X /* 60*/ "square root", /*square root*/ X /* 61*/ "Sigma", /*Sigma*/ X /* 62*/ "approx =", /*approx =*/ X /* 63*/ UNASS, /*unassigned*/ X /* 64*/ ">", /*>*/ X /* 65*/ "Xi", /*Xi*/ X /* 66*/ "<", /*<*/ X /* 67*/ "slash (longer)", /*slash (longer)*/ X /* 68*/ "cap (intersection)", /*cap (intersection)*/ X /* 69*/ "Upsilon", /*Upsilon*/ X /* 70*/ "not", /*not*/ X /* 71*/ "right ceiling (rt of \")", /*right ceiling (rt of ")*/ X /* 72*/ "left top (of big curly)", /*left top (of big curly)*/ X /* 73*/ "bold vertical", /*bold vertical*/ X /* 74*/ "left center of big curly bracket", /*left center of big curly bracket*/ X /* 75*/ "left bottom", /*left bottom*/ X /* 76*/ "right top", /*right top*/ X /* 77*/ "right center of big curly bracket", /*right center of big curly bracket*/ X /* 78*/ "right bot", /*right bot*/ X /* 79*/ "right floor (rb of \")", /*right floor (rb of ")*/ X /* 80*/ "left floor (left bot of big sq bract)", /*left floor (left bot of big sq bract)*/ X /* 81*/ "left ceiling (lt of \")", /*left ceiling (lt of ")*/ X /* 82*/ "multiply", /*multiply*/ X /* 83*/ "divide", /*divide*/ X /* 84*/ "plus-minus", /*plus-minus*/ X /* 85*/ "<=", /*<=*/ X /* 86*/ ">=", /*>=*/ X /* 87*/ "identically equal", /*identically equal*/ X /* 88*/ "not equal", /*not equal*/ X /* 89*/ "{", /*{*/ X /* 90*/ "}", /*}*/ X /* 91*/ "acute accent", /*acute accent*/ X /* 92*/ "grave accent", /*grave accent*/ X /* 93*/ "^", /*^*/ X /* 94*/ "#", /*#*/ X /* 95*/ "left hand", /*left hand*/ X /* 96*/ "member of", /*member of*/ X /* 97*/ "~", /*~*/ X /* 98*/ "empty set", /*empty set*/ X /* 99*/ UNASS, /*unassigned*/ X /*100*/ "dbl dagger", /*dbl dagger*/ X /*101*/ "\033&a-30H|", /*box rule (was parallel sign)*/ X /*102*/ "math * ", /*math * */ X /*103*/ "improper subset", /*improper subset*/ X /*104*/ "circle", /*circle*/ X /*105*/ UNASS, /*unassigned*/ X /*106*/ "equation plus", /*equation plus*/ X /*107*/ "right arrow", /*right arrow*/ X /*108*/ "section" /*section*/ X}; / echo 'x - compfont.c' sed 's/^X//' > compfont.c << '/' X/***************************************************************** X X Copyright 1985. Chris Lewis X X Module : compfont.c 1.1 X Date submitted : 86/01/21 14:03:23 X Author : Chris Lewis X Origin : Permission to copy and further distribute is X freely given provided this copyright notice remains X intact and that this software is not sold for profit. X Description : Convert's vi'ed glyph file to lcat.c useable X raster description. X X******************************************************************/ X X#ifndef lint Xstatic char SrcId[] = "@(#)compfont.c:1.1"; X#endif X#include X#define tstbit(n, f) ((f) == ' ') ? (1 << n):0 Xmain(argc, argv) Xint argc; Xchar *argv[]; { X char buf[BUFSIZ]; X register int i,j, length; X register char *rp; X unsigned char v; X int cdef; X int lcount = 0; X if (argc != 1) X cdef = 1; X if (cdef) { X printf("glyph %s_glyph = {\n", argv[1]); X } else X printf("\033*t300R"); X while (gets(buf)) { X lcount++; X rp = buf + strlen(buf) - 1; X while(rp > buf && *rp == ' ') X *rp-- = '\0'; X if (!cdef) X printf("\033*r1A"); X length = (strlen(buf) + 7) / 8; X if (cdef) X printf("\t{%d, \"", length); X else X printf("\033*b%dW", length); X strcat(buf, " "); X for (i = 0, rp = buf; i < length; i++) { X v = 0; X for (j = 7; j >= 0; j--) X v |= (*rp++ != ' ') ? (1 << j):0; X if (cdef) X printf("%02x", v); X else X printf("%c", v); X } X printf("\"},\n"); X } X printf("\t{-1,NULL}\n"); X printf("};\n"); X if (cdef) X printf("#define %s_height %d\n", argv[1], lcount); X else { X printf("\033*rB"); X printf("\f"); X } X exit(0); X} / echo 'x - Makefile' sed 's/^X//' > Makefile << '/' X.SUFFIXES: .sh .sh~ X XBIN = /u1/cx/bin XTMAC = /usr/lib/tmac/tmac.lmm X XCFLAGS = -O -DDEBUG XOBJ = lcat.o fastfonts.o newfonts.o X Xall: lcat lroff X Xlcat: $(OBJ) X $(CC) -o lcat $(CFLAGS) $(OBJ) X Xlcat.o: bell.glyph.h X Xbell.glyph.h: bell.glyph compfont X compfont cX < bell.glyph > bell.glyph.h X Xpack: README lcat.c fastfonts.c compfont.c Makefile lroff bell.glyph \ X cat.5 lroff.1 lrofftest.m tmac.lmm X packmail README lcat.c fastfonts.c compfont.c Makefile lroff \ X bell.glyph cat.5 lroff.1 lrofftest.m tmac.lmm X Xtest: lcat lroff lrofftest.m X tbl lrofftest.m | lroff tmac.lmm - X Xinstall: lcat lroff tmac.lmm X echo "cp lcat lroff $(BIN)" | su X echo "cp tmac.lmm $(TMAC)" | su X X.sh~.sh: X $(GET) $(GFLAGS) $< X X.sh~: X rm -f $* $*.sh X $(GET) $(GFLAGS) $< X mv $*.sh $* X chmod 555 $* X X.sh: X rm -f $* X cp $*.sh $* X chmod 555 $* / echo 'x - lroff' sed 's/^X//' > lroff << '/' X#!/bin/sh X#***************************************************************** X# X# Copyright 1985. Chris Lewis X# X# Module : lroff.sh 1.6 X# Date submitted : 86/01/21 14:47:00 X# Author : C. Lewis X# Origin : This software may be freely distributed X# as long as it is not for profit, and that X# this copyright notice remains intact. X# Description : shell file for laserjet troff X# X#*****************************************************************/ X# Xprintcmd="lp -w -dlaser -op -ob" Xtrap "rm -f /tmp/$$; exit 1" 1 2 3 15 Xcat > /tmp/$$ <<\EOF X.\" Some of these commands are specific to MM, you may have to change X.\" the W, and trace down who fires the cut marks ")k" in MM. X.\" Tuning troff for HP. Some others are done in /usr/lib/tmac/tmac.lmm X.\" Minimum interword spacing (15 points) X.ss 15 X.\" Turn off ligatures (Ugly!). But, they *do* work. X.lg 0 X.\" Clobber cut marks. X.rm )k X.fp 1 CW \" constant width font 1 X.fp 2 CW \" constant width font 2 X.fp 3 CW \" constant width font 3 XEOF Xfor i Xdo X case $i in X -h) X largs="$largs $i" X ;; X -H) X largs="$largs $i" X ;; X -) X files="$files -" X ;; X -D) X test='-D' X ;; X -f*) X largs="$largs $i" X ;; X -*) X args="$args $i" X ;; X *) X files="$files $i" X ;; X esac Xdone Xif [ -n "$test" ] Xthen X troff -t $args /tmp/$$ $files | tee troffout | lcat $largs $test | tee lroffout | $printcmd X rc=$? Xelse X troff -t $args /tmp/$$ $files | lcat $largs | $printcmd X rc=$? Xfi Xrm -f /tmp/$$ Xexit $rc / echo 'x - bell.glyph' sed 's/^X//' > bell.glyph << '/' X ###################### ######################## X ###################### ###################### X ################# ################# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ############# ############# X ######################### X ######################### X ####################### X ##################### X ################### X ################### X ################# X ############### X ############# X ############# X ############### X ################# X ################### X ################### X ############# ##################### X ################## ####################### X ##################### ######################### X ####################### ######################### X ########################## ############# ############# X ######## ############## ############# ############# X ####### ############# ############# ############# X ####### ############# ############# ############# X ######## ############# ###### ############## ############# X ######## ################### ############## ############# X ######### ################# ############## ############# X ######## ################ ############### ############# X ######### ############## ############### ############# X ######### ############### ############# X ######### ############### ############# X ######### ################# ############# X ######### ################ ############# X ######### ################# ############# X ######### ################ ############# X ######### ################ ############# X ######### ################ ############# X ########## ################ ############# X ######### ############### ############# X ########## ############### ############# X ######### ############### ############# X ########### ############### ############# X ############ ################ ############# X ########### ################# ############# X ########## ################# ############# X ############ ################# ############# X ############################### ############# X ############################ ################### X ######################## ######################## X ################ ########################## / echo 'x - cat.5' sed 's/^X//' > cat.5 << '/' X.TH CAT 5 local writeup X.DA 4 April 1981 X.SH NAME Xcat \- C/A/T phototypesetter code X.SH DESCRIPTION XThe Graphic Systems C/A/T phototypesetter is driven by sending it a Xsequence of one-byte codes Xwhich specify characters, fonts, sizes, and other control information. X.PP XThe C/A/T's basic unit of length is 1/432 of an inch (6 units to a Xtypesetter's ``point''). XThe quantum of horizontal motion is one unit. XThe quantum of vertical motion is three units (1/144 of an inch, 1/2 point). X.PP XThe top two bits of the code classify it as one of three major Xtypes: Xan \fIescape\fR code (top bit 1), Xa \fIflash\fR code (top bits 00), Xor a control code (top bits 01). XA code of all zeros is ignored; a code of all ones is illegal. X.PP XA flash code specifies flashing one of 63 characters, as given by the Xremaining six bits. XSince this is not enough to specify all possible characters, or even Xall characters in a single font \(em there are 108 per font \(em Xvarious control codes (described later) select a font and either Xthe Lower or Upper half of the font. XThe Lower half is the first 63 characters of the font; the Upper Xhalf is the remaining 45. XA flash code of 46 or higher in the Upper half is illegal. X.PP XAn escape code specifies horizontal motion. XThe size of the motion, in horizontal quanta, is the one's-complement Xof the low seven bits of the code. XThe direction of the motion is set by control codes. XHitting the right or left margin limit switch is illegal and will Xcause the machine to stop. XThe machine starts out, after initialization, hard against the left Xmargin limit switch; an initial escape of 16 units \fImust\fR Xbe given before starting work, and the position after this motion Xshould be the limit of all future leftward motions. X>From this point, the distance to the right margin limit switch Xis about 7.5 inches. X.PP XA code with the top three bits 011 is a \fIlead\fR code, Xspecifying vertical motion. XThe remaining five bits are the one's-complement of the size of Xthe motion, in vertical quanta. XThe direction of motion is set by control codes. XThe amount of vertical motion is, in principle, limited only by Xrunning off the paper in the upward direction and by the limited Xcapacity of the output cartridge in the downward direction. X.PP XA code with the top four bits 0101 is a size-change code, which Xspecifies movement of the lens turret and the doubler lens to Xchange point size. XThese codes are as follows: X.PP X.RS X.nf X.ta 2c XSize Code X X6 0101\|1000 X7 0101\|0000 X8 0101\|0001 X9 0101\|0111 X10 0101\|0010 X11 0101\|0011 X12 0101\|0100 X14 0101\|0101 X16 0101\|1001 X18 0101\|0110 X20 0101\|1010 X22 0101\|1011 X24 0101\|1100 X28 0101\|1101 X36 0101\|1110 X.DT X.fi X.RE X.PP XSize changes involving the doubler lens alter the horizontal position. XChanges from single to double sizes should be followed by a forward Xescape of 55 quanta; changes from double to single sizes should be Xfollowed by a reverse escape of 55 quanta. XThe single sizes are 6, 7, 8, 9, 10, 11, 12, 14, and 18; Xthe double sizes are 16, 20, 22, 24, 28, and 36. X.PP XThe control codes with the top four bits 0100 specify miscellaneous Xcontrol codes, not all of which have valid meanings. XThey are: X.PP X.RS X.ta 6c X.nf Xinitialize 0100\|0000 Xstop 0100\|1001 Xupper rail 0100\|0010 Xlower rail 0100\|0001 Xupper mag 0100\|0011 Xlower mag 0100\|0100 Xtilt up 0100\|1110 Xtilt down 0100\|1111 Xupper font half 0100\|0110 Xlower font half 0100\|0101 Xescape forward 0100\|0111 Xescape backward 0100\|1000 Xlead forward 0100\|1010 Xlead backward 0100\|1100 Xsoftware cut 0100\|1011 X.fi X.DT X.RE X.PP XThe \fIinitialize\fR code causes leftward motion to the left margin limit Xswitch, Xand sets the following modes: Xescape forward, lead forward, lower font half, Xlower rail, lower mag, tilt down. XNote that the left margin limit switch does not define a precise Xposition, and hence reinitializing the machine Xwill destroy precise left-margin alignment. X.PP XThe \fIstop\fR code stops the machine, which must be manually Xrestarted (normally after changing output cartridges); Xthis code should be used only at the end of a run. X.PP XFonts are selected by the combination of \fIrail\fR, \fImag\fR, and \fItilt\fR. XThe tilt codes do not exist on the 4-font C/A/T; this is the only user-visible Xdifference between the 4-font and 8-font machines. XThe correspondence between rail/mag/tilt and font number is as follows: X.PP X.RS X.nf X.ta 2c 4c 6c 8c Xrail mag tilt 4font 8font X Xlower lower up 1 1 Xlower lower down 1 2 Xupper lower up 2 3 Xupper lower down 2 4 Xlower upper up 3 5 Xlower upper down 3 6 Xupper upper up 4 7 Xupper upper down 4 8 X.DT X.fi X.RE X.PP XThe \fIsoftware cut\fR code should not be issued to the hardware, but Xis used by local spooling software to indicate places where it is Xlegal for the spooler to break output between pages. XThis code should be followed by an \fIinitialize\fR code. X.PP XA complete C/A/T file should begin with an \fIinitialize\fR code followed Xby an \fIescape\fR-16 code, Xand should end with 14 inches of trailer and a \fIstop\fR code. X.SH HISTORY XThe \fIsoftware cut\fR code is a local invention. XThis manual page written at U of T by Henry Spencer. X.SH BUGS XThe documentation and the hardware disagree on the initial tilt setting; Xthe above describes the hardware. X.PP XIt's not the fastest or most modern typesetter. / echo 'x - lroff.1' sed 's/^X//' > lroff.1 << '/' X.TH LCAT 5 local X.SH NAME Xlroff,lcat \- Laserjet Troff Simulator X.SH SYNOPSIS X.I lroff X[-h | -H | -d] [-D] [-ffontname] [-t] [troff arguments] X.SH DESCRIPTION X.P X.I Lroff Xis effectively "troff" for output on HP Laserjets. XIt works by prepending some Laserjet-specific troff commands to a file, Xrunning it along with troff arguments through troff, invoking the Xtroff WANG C/A/T code to HP Laserjet converter filter "lcat", and Xsends the output to your HP laserjet printer. X.P X.I Lroff Xsets the default point size to 12, so as to use the Laserjet native fonts Xwherever possible. XHowever, "lcat" does support rasterized fonts. XA Macintosh to Berkeley vfont format converter is available. XThe filter also is capable of using the Berkeley /usr/lib/vfonts raster fonts Xfiles. X[This is untested, because our Pyramid does not have vfonts. XYou may encounter scaling problems, but the characters should be printed Xproperly] X.P XAn adapter to allow the use of MM macros is provided. XTo use MM macros, Xinstead of "nroff -mm", use "lroff -mlmm" X.P XOptions: X.IP -d XDo not use raster fonts. X.IP -h XUse raster fonts, only in the sizes available. XThese will be printed at 75DPI. X.IP -H XUse raster fonts. XIf a font is available in twice or four times the size, use it at 150 or X300 DPI respectively. X.IP -ffont XUse X.I font Xas the font name. XThe default is "newyork". XThis will be changed to "times" sometime in the future. X.IP -D XTurn on debug mode, a file called "diagnostics" will be created Xin the current directory containing debug output from lcat. X.IP -t XTurn on a higher level of debug mode. XOutput of "troff" is placed in a file called "troffout". XOutput of "lcat" is placed in a file called "lroffout". XAlso turns on -D option. X.I Lcat Xtakes the same parameters (except for -t), and assumes "troff -t" Xoutput as standard input, and produces Laserjet escape sequences Xon standard output. X.SH "Add Your own Logo" X.P X.I Lcat Xsupports the drawing of a symbol to replace the troff X"Bell System" character ("\e(bs"). XThis takes place no matter what the point size is, and no scaling Xis done. XWhen compiling "lcat", it includes a file called "bell.glyph.h". X"bell.glyph.h" is constructed by taking the file "bell.glyph" Xand running a utility called "compfont" on it. X"bell.glyph" can be constructed by using VI to draw out your logo. XRunning "make" will compile this logo into "bell.glyph.h", and Xinclude it into lcat.c XIt is always printed at 300DPI. XAn example logo is distributed with this software. X.SH BUGS X.P XThere is no italic or bold support on raster'd fonts (yet). X.P Xlcat does not know how to scale raster fonts to sizes other than those Xavailable (yet). XIt will use native fonts where necessary. X.P XEnd-of-page detection is kludgey. XSetting page length to other than the default 11 inches Xwill cause page breaks in the wrong place. XFurther, most of the troff macro packages insert "cut-marks" marking Xwhere the page should be chopped (because the WANG C/A/T is a "roll-paper" Xdevice). XLroff attempts to disable this feature, but this will not work on Xmacro packages other than MM, and even some differing versions of MM. X.P XThe output of lcat is *HUGE*, because it individually places each Xcharacter using Laserjet escape codes. XEven the rasterized characters. XLots of motion optimization is done, but it could do much more. XSet the Laserjet baud rate as high as you reasonably can. XNote: the Laserjet device must be set to 8 bit. XOur System V laserjet lp filters are using ^S/^Q. X.P XNope, "lroff" isn't slow, "troff" is. X.P XA "normal" HP Laserjet is only capable of printing about 1/4 page or Xless of raster at 75DPI. XParticularly if you are using a 300 DPI glyph (as we are) this doesn't Xleave you much room. XA HP Laserjet "Plus" should be able to do the entire page at 75DPI Xor 150DPI with room to spare. XIf you overrun the Laserjet's buffer, you will get a "21" error code. XHit "cont" button to continue, but you will have lost everything on the Xcurrent page after the overflow. X.P XWidths are set "CW" by Lroff for the native fonts. XHowever, the rasterized fonts won't be perfect with this. XMore work needs to be done to get proper width tables in for the raster Xfonts and the built-in Laserjet font. X.P XItalics and bold will work when the built-in laserjet font, provided that Xyou have HP font cartridge 92286A installed. X.P XDoes not support downloadable fonts. XIt will when we get our Plus. X.P XThe MAC fonts are designed towards 80DPI, but lcat assumes them to be X75DPI, so the fonts will be slightly bigger than you'd expect. X.SH FILES X$(somedir)/. Xcontains the raster font file (supposedly compatible with Berkeley X"vfonts") for font name "name", and point size "size". X.P X/usr/lib/tmac/tmac.lmm contains some definitions that must be made Xbefore the MM macros are read. X.SH "SEE ALSO" Xmacvfont(1L), lp (System V), lpr (Berkeley) / echo 'x - lrofftest.m' sed 's/^X//' > lrofftest.m << '/' X.P XThis line should be exactly 5 inches long: X.DS X\l'5i\&\(ru' X.DE X.P XThis is a test of the paragraphs and other things of lroff/lmm how do Xyou like it? XThis is some more of the test. XBullet list: X.BL X.LI X<- that was an Oreo cookie. X.LI XThis is 2 X.LI XThis is 3 X.LE X.P XHello there. X.P X" is a compound character, since nroff doesn't like double quotes too much. X"X" should look reasonable. XMore 'test` `test'\*F X.FS XThis here's a footnote - slightly smaller pitch. X.FE XThis is more of the paragraph. X.P XThis is normal\f3Bold\fP\f2italic\fPnormal. X.bd 2 3 X\f2This should be bold italics.\fP X.DS 0 F X.TS Xexpand doublebox allbox; Xl l l. XFirst field second third XXXXXX XXXXX XXXXX Xtbl is working rather nicely. XHowever, the vertical T{ Xlines may not butt perfectly. XThis is a known problem, because troff seems to Xuse slightly different vertical spacing each time. XThis will be fixed eventually XT} X.TE X.DE X.P X.S 36 38 X\(bs X.S P X.P X.S 24 26 Xthat was the logo at 300 DPI. X.S P X.P XThe Logo will be printed whether or not you have raster fonts. XThe original logo is a stylized "cX". XIf you don't have the vfonts installed, the rest of the line will be Xnormal characters with big spacing. XIf the fonts are installed, you will see 75DPI big print. / echo 'x - tmac.lmm' sed 's/^X//' > tmac.lmm << '/' X.\" Default point size X.nr S 12 X.\" Default page width (though this is not critical) X.nr W 6i X.so /usr/lib/tmac/tmac.m X.\" I think that this is a nicer bullet than MM uses. X.ds BU \(bu / echo 'Part 01 of pack.out complete.' exit