|
|
1.1 root 1: #
2: # Shell library - for building devpost tables. Original collection was
3: # built on a Version 47.0 PS-810.
4: #
5:
6: RESOLUTION=720
7: UNITWIDTH=10
8:
9: #
10: # BuiltinTables returns command lines that generate PostScript programs
11: # for building a typesetter description file and font width tables for
12: # a relatively standard collection of fonts. Use awk to select a command
13: # line or modify an existing command to build a width table for a new
14: # font.
15: #
16:
17: BuiltinTables() {
18: cat <<-'//End of BuiltinTables'
19: Proportional R Times-Roman
20: Proportional I Times-Italic
21: Proportional B Times-Bold
22: Proportional BI Times-BoldItalic
23: Proportional AB AvantGarde-Demi
24: Proportional AI AvantGarde-BookOblique
25: Proportional AR AvantGarde-Book
26: Proportional AX AvantGarde-DemiOblique
27: Proportional H Helvetica
28: Proportional HB Helvetica-Bold
29: Proportional HI Helvetica-Oblique
30: Proportional HX Helvetica-BoldOblique
31: Proportional Hb Helvetica-Narrow-Bold
32: Proportional Hi Helvetica-Narrow-Oblique
33: Proportional Hr Helvetica-Narrow
34: Proportional Hx Helvetica-Narrow-BoldOblique
35: Proportional KB Bookman-Demi
36: Proportional KI Bookman-LightItalic
37: Proportional KR Bookman-Light
38: Proportional KX Bookman-DemiItalic
39: Proportional NB NewCenturySchlbk-Bold
40: Proportional NI NewCenturySchlbk-Italic
41: Proportional NR NewCenturySchlbk-Roman
42: Proportional NX NewCenturySchlbk-BoldItalic
43: Proportional PA Palatino-Roman
44: Proportional PB Palatino-Bold
45: Proportional PI Palatino-Italic
46: Proportional PX Palatino-BoldItalic
47: Proportional ZI ZapfChancery-MediumItalic
48: FixedWidth C Courier
49: FixedWidth CB Courier-Bold
50: FixedWidth CI Courier-Oblique
51: FixedWidth CO Courier
52: FixedWidth CW Courier
53: FixedWidth CX Courier-BoldOblique
54: Dingbats ZD ZapfDingbats
55: Greek GR Symbol
56: Symbol S Symbol
57: Special S1 Times-Roman
58: Description DESC ---
59: //End of BuiltinTables
60: }
61:
62: #
63: # AllTables prints the complete list of builtin font names.
64: #
65:
66: AllTables() {
67: BuiltinTables | awk '{print $2}'
68: }
69:
70: #
71: # Charset functions generate keyword/value pairs (as PostScript objects)
72: # that describe the character set available in a font. The keyword is a
73: # PostScript string that represents troff's name for the character. The
74: # value is usually the literal name (i.e. begins with a /) assigned to
75: # the character in the PostScript font. The value can also be an integer
76: # or a PostScript string. An integer value is used as an index in the
77: # current font's Encoding array. A string value is returned to the host
78: # unchanged when the entry for the character is constructed. Entries that
79: # have (") as their value are synonyms for the preceeding character.
80: #
81:
82: StandardCharset() {
83: cat <<-'//End of StandardCharset'
84: (!) /exclam
85: (") /quotedbl
86: (dq) (")
87: (#) /numbersign
88: ($) /dollar
89: (%) /percent
90: (&) /ampersand
91: (') /quoteright
92: (\() /parenleft
93: (\)) /parenright
94: (*) /asterisk
95: (+) /plus
96: (,) /comma
97: (hy) /hyphen
98: (-) (") % synonym
99: (.) /period
100: (/) /slash
101: (0) /zero
102: (1) /one
103: (2) /two
104: (3) /three
105: (4) /four
106: (5) /five
107: (6) /six
108: (7) /seven
109: (8) /eight
110: (9) /nine
111: (:) /colon
112: (;) /semicolon
113: (<) /less
114: (=) /equal
115: (>) /greater
116: (?) /question
117: (@) /at
118: (A) /A
119: (B) /B
120: (C) /C
121: (D) /D
122: (E) /E
123: (F) /F
124: (G) /G
125: (H) /H
126: (I) /I
127: (J) /J
128: (K) /K
129: (L) /L
130: (M) /M
131: (N) /N
132: (O) /O
133: (P) /P
134: (Q) /Q
135: (R) /R
136: (S) /S
137: (T) /T
138: (U) /U
139: (V) /V
140: (W) /W
141: (X) /X
142: (Y) /Y
143: (Z) /Z
144: ([) /bracketleft
145: (\\) /backslash
146: (bs) (")
147: (]) /bracketright
148: (^) /asciicircum
149: (_) /underscore
150: (`) /quoteleft
151: (a) /a
152: (b) /b
153: (c) /c
154: (d) /d
155: (e) /e
156: (f) /f
157: (g) /g
158: (h) /h
159: (i) /i
160: (j) /j
161: (k) /k
162: (l) /l
163: (m) /m
164: (n) /n
165: (o) /o
166: (p) /p
167: (q) /q
168: (r) /r
169: (s) /s
170: (t) /t
171: (u) /u
172: (v) /v
173: (w) /w
174: (x) /x
175: (y) /y
176: (z) /z
177: ({) /braceleft
178: (|) /bar
179: (}) /braceright
180: (~) /asciitilde
181: (!!) /exclamdown
182: (ct) /cent
183: (ps) /sterling
184: (fr) /fraction
185: (yn) /yen
186: (fn) /florin
187: (sc) /section
188: (cr) /currency
189: (---) /quotesingle
190: (``) /quotedblleft
191: (---) /guillemotleft
192: (---) /guilsinglleft
193: (---) /guilsinglright
194: (fi) /fi
195: (fl) /fl
196: (en) /endash
197: (\\-) (")
198: (dg) /dagger
199: (dd) /daggerdbl
200: (---) /periodcentered
201: (pg) /paragraph
202: (---) /bullet
203: (---) /quotesinglbase
204: (---) /quotedblbase
205: ('') /quotedblright
206: (---) /guillemotright
207: (---) /ellipsis
208: (---) /perthousand
209: (??) /questiondown
210: (ga) /grave
211: (\\`) (")
212: (aa) /acute
213: (\\') (")
214: (^a) /circumflex
215: (~a) /tilde
216: (-a) /macron
217: (Ua) /breve
218: (.a) /dotaccent
219: (:a) /dieresis
220: (oa) /ring
221: (,a) /cedilla
222: ("a) /hungarumlaut
223: (Ca) /ogonek
224: (va) /caron
225: (em) /emdash
226: (---) /AE
227: (---) /ordfeminine
228: (---) /Lslash
229: (---) /Oslash
230: (---) /OE
231: (---) /ordmasculine
232: (---) /ae
233: (---) /dotlessi
234: (---) /lslash
235: (---) /oslash
236: (---) /oe
237: (---) /germandbls
238: //End of StandardCharset
239: }
240:
241: SymbolCharset() {
242: cat <<-'//End of SymbolCharset'
243: (---) /exclam
244: (fa) /universal
245: (---) /numbersign
246: (te) /existential
247: (---) /percent
248: (---) /ampersand
249: (st) /suchthat
250: (---) /parenleft
251: (---) /parenright
252: (**) /asteriskmath
253: (pl) /plus
254: (---) /comma
255: (mi) /minus
256: (---) /period
257: (sl) /slash
258: (---) /zero
259: (---) /one
260: (---) /two
261: (---) /three
262: (---) /four
263: (---) /five
264: (---) /six
265: (---) /seven
266: (---) /eight
267: (---) /nine
268: (---) /colon
269: (---) /semicolon
270: (<) /less
271: (eq) /equal
272: (>) /greater
273: (---) /question
274: (cg) /congruent
275: (*A) /Alpha
276: (*B) /Beta
277: (*X) /Chi
278: (*D) /Delta
279: (*E) /Epsilon
280: (*F) /Phi
281: (*G) /Gamma
282: (*Y) /Eta
283: (*I) /Iota
284: (---) /theta1
285: (*K) /Kappa
286: (*L) /Lambda
287: (*M) /Mu
288: (*N) /Nu
289: (*O) /Omicron
290: (*P) /Pi
291: (*H) /Theta
292: (*R) /Rho
293: (*S) /Sigma
294: (*T) /Tau
295: (*U) /Upsilon
296: (ts) /sigma1
297: (*W) /Omega
298: (*C) /Xi
299: (*Q) /Psi
300: (*Z) /Zeta
301: (---) /bracketleft
302: (tf) /therefore
303: (---) /bracketright
304: (pp) /perpendicular
305: (ul) /underscore
306: (_) (") % synonym
307: (rn) /radicalex
308: (*a) /alpha
309: (*b) /beta
310: (*x) /chi
311: (*d) /delta
312: (*e) /epsilon
313: (*f) /phi
314: (*g) /gamma
315: (*y) /eta
316: (*i) /iota
317: (---) /phi1
318: (*k) /kappa
319: (*l) /lambda
320: (*m) /mu
321: (*n) /nu
322: (*o) /omicron
323: (*p) /pi
324: (*h) /theta
325: (*r) /rho
326: (*s) /sigma
327: (*t) /tau
328: (*u) /upsilon
329: (---) /omega1
330: (*w) /omega
331: (*c) /xi
332: (*q) /psi
333: (*z) /zeta
334: (---) /braceleft
335: (or) /bar
336: (---) /braceright
337: (ap) /similar
338: (---) /Upsilon1
339: (fm) /minute
340: (<=) /lessequal
341: (---) /fraction
342: (if) /infinity
343: (---) /florin
344: (---) /club
345: (---) /diamond
346: (---) /heart
347: (---) /spade
348: (ab) /arrowboth
349: (<-) /arrowleft
350: (ua) /arrowup
351: (->) /arrowright
352: (da) /arrowdown
353: (de) /degree
354: (+-) /plusminus
355: (---) /second
356: (>=) /greaterequal
357: (mu) /multiply
358: (pt) /proportional
359: (pd) /partialdiff
360: (bu) /bullet
361: (di) /divide
362: (!=) /notequal
363: (==) /equivalence
364: (~~) /approxequal
365: (el) /ellipsis
366: (av) /arrowvertex
367: (ah) /arrowhorizex
368: (CR) /carriagereturn
369: (af) /aleph
370: (If) /Ifraktur
371: (Rf) /Rfraktur
372: (ws) /weierstrass
373: (Ox) /circlemultiply
374: (O+) /circleplus
375: (es) /emptyset
376: (ca) /intersection
377: (cu) /union
378: (sp) /propersuperset
379: (ip) /reflexsuperset
380: (!b) /notsubset
381: (sb) /propersubset
382: (ib) /reflexsubset
383: (mo) /element
384: (!m) /notelement
385: (an) /angle
386: (gr) /gradient
387: (rg) /registerserif
388: (co) /copyrightserif
389: (tm) /trademarkserif
390: (---) /product
391: (sr) /radical
392: (c.) /dotmath
393: (no) /logicalnot
394: (l&) /logicaland
395: (l|) /logicalor
396: (---) /arrowdblboth
397: (---) /arrowdblleft
398: (---) /arrowdblup
399: (---) /arrowdblright
400: (---) /arrowdbldown
401: (lz) /lozenge
402: (b<) /angleleft
403: (RG) /registersans
404: (CO) /copyrightsans
405: (TM) /trademarksans
406: (---) /summation
407: (LT) /parenlefttp
408: (br) /parenleftex
409: (LX) (") % synonym
410: (LB) /parenleftbt
411: (lc) /bracketlefttp
412: (lx) /bracketleftex
413: (lf) /bracketleftbt
414: (lt) /bracelefttp
415: (lk) /braceleftmid
416: (lb) /braceleftbt
417: (bv) /braceex
418: (|) (") % synonym
419: (b>) /angleright
420: (is) /integral
421: (---) /integraltp
422: (---) /integralex
423: (---) /integralbt
424: (RT) /parenrighttp
425: (RX) /parenrightex
426: (RB) /parenrightbt
427: (rc) /bracketrighttp
428: (rx) /bracketrightex
429: (rf) /bracketrightbt
430: (rt) /bracerighttp
431: (rk) /bracerightmid
432: (rb) /bracerightbt
433: (~=) (55 0 1) % charlib
434: //End of SymbolCharset
435: }
436:
437: SpecialCharset() {
438: cat <<-'//End of SpecialCharset'
439: (ru) /underscore
440: (ff) (60 2 1) % charlib
441: (Fi) (84 2 1) % charlib
442: (Fl) (84 2 1) % charlib
443: (14) (75 2 1) % charlib
444: (12) (75 2 1) % charlib
445: (34) (75 2 1) % charlib
446: (bx) (50 2 1) % charlib
447: (ob) (38 2 1) % charlib
448: (ci) (75 0 1) % charlib
449: (sq) (50 2 1) % charlib
450: (Sl) (50 2 1) % charlib
451: (L1) (110 1 1) % charlib
452: (LA) (110 1 1) % charlib
453: (LV) (110 3 1) % charlib
454: (LH) (210 1 1) % charlib
455: (lh) (100 0 1) % charlib
456: (rh) (100 0 1) % charlib
457: (lH) (100 0 1) % charlib
458: (rH) (100 0 1) % charlib
459: (PC) (220 2 1) % charlib
460: (DG) (185 2 1) % charlib
461: //End of SpecialCharset
462: }
463:
464: DingbatsCharset() {
465: cat <<-'//End of DingbatsCharset'
466: (!) 33
467: (") 34
468: (#) 35
469: ($) 36
470: (%) 37
471: (&) 38
472: (') 39
473: (\() 40
474: (\)) 41
475: (*) 42
476: (+) 43
477: (,) 44
478: (-) 45
479: (.) 46
480: (/) 47
481: (0) 48
482: (1) 49
483: (2) 50
484: (3) 51
485: (4) 52
486: (5) 53
487: (6) 54
488: (7) 55
489: (8) 56
490: (9) 57
491: (:) 58
492: (;) 59
493: (<) 60
494: (=) 61
495: (>) 62
496: (?) 63
497: (@) 64
498: (A) 65
499: (B) 66
500: (C) 67
501: (D) 68
502: (E) 69
503: (F) 70
504: (G) 71
505: (H) 72
506: (I) 73
507: (J) 74
508: (K) 75
509: (L) 76
510: (M) 77
511: (N) 78
512: (O) 79
513: (P) 80
514: (Q) 81
515: (R) 82
516: (S) 83
517: (T) 84
518: (U) 85
519: (V) 86
520: (W) 87
521: (X) 88
522: (Y) 89
523: (Z) 90
524: ([) 91
525: (\\) 92
526: (]) 93
527: (^) 94
528: (_) 95
529: (`) 96
530: (a) 97
531: (b) 98
532: (c) 99
533: (d) 100
534: (e) 101
535: (f) 102
536: (g) 103
537: (h) 104
538: (i) 105
539: (j) 106
540: (k) 107
541: (l) 108
542: (m) 109
543: (n) 110
544: (o) 111
545: (p) 112
546: (q) 113
547: (r) 114
548: (s) 115
549: (t) 116
550: (u) 117
551: (v) 118
552: (w) 119
553: (x) 120
554: (y) 121
555: (z) 122
556: ({) 123
557: (|) 124
558: (}) 125
559: (~) 126
560: (hy) 161
561: (em) 162
562: (de) 163
563: (\\-) 164
564: (en) 165
565: (ff) 166
566: (fi) 167
567: (fl) 168
568: (Fi) 169
569: (Fl) 170
570: (fm) 171
571: (ru) 172
572: (dg) 173
573: (bu) 174
574: (14) 175
575: (34) 176
576: (12) 177
577: (ct) 178
578: (rg) 179
579: (sq) 180
580: (sl) 181
581: (ul) 182
582: (or) 183
583: (no) 184
584: (->) 185
585: (<-) 186
586: (da) 187
587: (lh) 188
588: (ua) 189
589: (ab) 190
590: (!b) 191
591: (aa) 192
592: (!m) 193
593: (ga) 194
594: (pl) 195
595: (mi) 196
596: (mu) 197
597: (di) 198
598: (eq) 199
599: (==) 200
600: (>=) 201
601: (<=) 202
602: (!=) 203
603: (+-) 204
604: (-+) 205
605: (ap) 206
606: (~=) 207
607: (gr) 208
608: (is) 209
609: (pd) 210
610: (if) 211
611: (sr) 212
612: (rn) 213
613: (sb) 214
614: (sp) 215
615: (cu) 216
616: (ca) 217
617: (ib) 218
618: (ip) 219
619: (mo) 220
620: (es) 221
621: (sc) 222
622: (dd) 223
623: (lc) 224
624: (rc) 225
625: (lf) 226
626: (rf) 227
627: (bv) 228
628: (**) 229
629: (br) 230
630: (ci) 231
631: (ts) 232
632: (co) 233
633: (lt) 234
634: (rt) 235
635: (lb) 236
636: (rb) 237
637: (lk) 238
638: (rk) 239
639: (rh) 241
640: (tm) 242
641: (Sl) 243
642: (ps) 244
643: (cs) 245
644: (cy) 246
645: (as) 247
646: (os) 248
647: (=.) 249
648: (ld) 250
649: (rd) 251
650: (le) 252
651: (ge) 253
652: (pp) 254
653: //End of DingbatsCharset
654: }
655:
656: #
657: # Generating functions output PostScript programs that build font width
658: # tables or a typesetter description file. Send the program to a printer
659: # and the complete table will come back on the serial port. All write on
660: # stdout and assume the prologue and other required PostScript files are
661: # all available.
662: #
663:
664: Proportional() {
665: echo "/unitwidth $UNITWIDTH def"
666: echo "/resolution $RESOLUTION def"
667: echo "/charset ["
668: # Get <>_ and | from S. Use accents for ascii ^ and ~.
669: StandardCharset | awk '
670: $1 == "(<)" && $2 == "/less" {$1 = "(---)"}
671: $1 == "(>)" && $2 == "/greater" {$1 = "(---)"}
672: $1 == "(_)" && $2 == "/underscore" {$1 = "(---)"}
673: $1 == "(|)" && $2 == "/bar" {$1 = "(---)"}
674: $1 == "(^)" && $2 == "/asciicircum" {$1 = "(---)"}
675: $1 == "(~)" && $2 == "/asciitilde" {$1 = "(---)"}
676: {printf "%s\t%s\n", $1, $2}
677: $2 == "/circumflex" {printf "(^)\t(\")\n"}
678: $2 == "/tilde" {printf "(~)\t(\")\n"}
679: '
680: echo "] def"
681:
682: echo "/$2 SelectFont"
683: echo "(opO) SetAscender"
684:
685: echo "(name $1\\\\n) Print"
686: echo "(fontname $2\\\\n) Print"
687: echo "/$1 NamedInPrologue"
688: echo "(ligatures fi fl 0\\\\n) Print"
689: echo "(spacewidth ) Print 32 GetWidth Print (\n) Print"
690: echo "(charset\\\\n) Print"
691: echo "BuildFontCharset"
692: }
693:
694: FixedWidth() {
695: echo "/unitwidth $UNITWIDTH def"
696: echo "/resolution $RESOLUTION def"
697: echo "/charset ["
698: # awk is not important - it's only here for compatibility
699: StandardCharset | awk '
700: $1 == "(fi)" || $1 == "(fl)" {next}
701: {printf "%s\t%s\n", $1, $2}
702: $2 == "/circumflex" {printf "(^)\t(\")\n"}
703: $2 == "/tilde" {printf "(~)\t(\")\n"}
704: '
705: echo "] def"
706:
707: echo "/$2 SelectFont"
708: echo "(opO) SetAscender"
709:
710: echo "(name $1\\\\n) Print"
711: echo "(fontname $2\\\\n) Print"
712: echo "/$1 NamedInPrologue"
713: echo "(spacewidth ) Print 32 GetWidth Print (\n) Print"
714: echo "(charset\\\\n) Print"
715: echo "BuildFontCharset"
716: }
717:
718: Dingbats() {
719: echo "/unitwidth $UNITWIDTH def"
720: echo "/resolution $RESOLUTION def"
721: echo "/charset ["
722: DingbatsCharset
723: echo "] def"
724:
725: echo "/$2 SelectFont"
726: echo "( ) SetAscender"
727:
728: echo "(name $1\\\\n) Print"
729: echo "(fontname $2\\\\n) Print"
730: echo "/$1 NamedInPrologue"
731: echo "(charset\\\\n) Print"
732: echo "BuildFontCharset"
733: }
734:
735: Greek() {
736: echo "/unitwidth $UNITWIDTH def"
737: echo "/resolution $RESOLUTION def"
738: echo "/charset ["
739: SymbolCharset | awk '$1 ~ /\(\*[a-zA-Z]\)/'
740: echo "] def"
741:
742: echo "/$2 SelectFont"
743: echo "(orO) SetAscender"
744:
745: echo "(name $1\\\\n) Print"
746: echo "(fontname $2\\\\n) Print"
747: echo "/$1 NamedInPrologue"
748: echo "(spacewidth ) Print 32 GetWidth Print (\n) Print"
749: echo "(charset\\\\n) Print"
750: echo "BuildFontCharset"
751: }
752:
753: Symbol() {
754: echo "/unitwidth $UNITWIDTH def"
755: echo "/resolution $RESOLUTION def"
756: echo "/charset ["
757: SymbolCharset
758: echo "] def"
759:
760: echo "ChangeMetrics"
761: echo "/S SelectFont"
762: echo "(orO) SetAscender"
763:
764: echo "(name $1\\\\n) Print"
765: echo "(fontname $2\\\\n) Print"
766: echo "/$1 NamedInPrologue"
767: echo "(special\\\\n) Print"
768: echo "(charset\\\\n) Print"
769: echo "BuildFontCharset"
770: }
771:
772: Special() {
773: echo "/unitwidth $UNITWIDTH def"
774: echo "/resolution $RESOLUTION def"
775: echo "/charset ["
776: SpecialCharset
777: echo "] def"
778:
779: echo "ChangeMetrics"
780: echo "/S1 SelectFont"
781:
782: echo "(# Times-Roman special font\\\\n) Print"
783: echo "(name $1\\\\n) Print"
784: echo "(fontname $2\\\\n) Print"
785: echo "/$1 NamedInPrologue"
786: echo "(special\\\\n) Print"
787: echo "(charset\\\\n) Print"
788: echo "BuildFontCharset"
789: }
790:
791: #
792: # The DESC file doesn't have to be built on a printer. It's only here for
793: # consistency.
794: #
795:
796: Description() {
797: echo "/charset [" # awk - so the stack doesn't overflow
798: StandardCharset | awk '$1 != "(---)" {print $1}'
799: SymbolCharset | awk '$1 != "(---)" {print $1}'
800: SpecialCharset | awk '$1 != "(---)" {print $1}'
801: DingbatsCharset | awk '$1 != "(---)" {print $1}'
802: echo "] def"
803:
804: cat <<-//DESC
805: (#Device Description - original PostScript character set
806:
807: PDL PostScript
808:
809: fonts 10 R I B BI CW H HI HB S1 S
810: sizes 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
811: 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 40 42 44 46
812: 48 50 52 54 56 58 60 64 68 72 78 84 90 96 100 105 110 115
813: 120 125 130 135 140 145 150 155 160 0
814:
815: res $RESOLUTION
816: hor 1
817: vert 1
818: unitwidth $UNITWIDTH
819:
820: ) Print
821: //DESC
822: echo "(charset\\\\n) Print"
823: echo "BuildDescCharset"
824: echo "(\\\\n) Print"
825: }
826:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.