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