2
# Shell library - for building devutf tables.
8
OCTALESCAPES=${OCTALESCAPES:-160} # <= code means add \0ddd names
9
DOWNLOADVECTOR=FALSE # TRUE can mean incomplete tables
12
# BuiltinTables returns command lines that generate PostScript programs
13
# for building a typesetter description file and font width tables for
14
# a relatively standard collection of fonts. Use awk to select a command
15
# line or modify an existing command to build a width table for a new
20
cat <<-'//End of BuiltinTables'
21
Proportional R Times-Roman
22
Proportional I Times-Italic
23
Proportional B Times-Bold
24
Proportional BI Times-BoldItalic
25
Proportional AB AvantGarde-Demi
26
Proportional AI AvantGarde-BookOblique
27
Proportional AR AvantGarde-Book
28
Proportional AX AvantGarde-DemiOblique
29
Proportional H Helvetica
30
Proportional HB Helvetica-Bold
31
Proportional HI Helvetica-Oblique
32
Proportional HX Helvetica-BoldOblique
33
Proportional Hb Helvetica-Narrow-Bold
34
Proportional Hi Helvetica-Narrow-Oblique
35
Proportional Hr Helvetica-Narrow
36
Proportional Hx Helvetica-Narrow-BoldOblique
37
Proportional KB Bookman-Demi
38
Proportional KI Bookman-LightItalic
39
Proportional KR Bookman-Light
40
Proportional KX Bookman-DemiItalic
41
Proportional NB NewCenturySchlbk-Bold
42
Proportional NI NewCenturySchlbk-Italic
43
Proportional NR NewCenturySchlbk-Roman
44
Proportional NX NewCenturySchlbk-BoldItalic
45
Proportional PA Palatino-Roman
46
Proportional PB Palatino-Bold
47
Proportional PI Palatino-Italic
48
Proportional PX Palatino-BoldItalic
49
Proportional ZI ZapfChancery-MediumItalic
51
FixedWidth CB Courier-Bold
52
FixedWidth CI Courier-Oblique
55
FixedWidth CX Courier-BoldOblique
56
Dingbats ZD ZapfDingbats
59
Special S1 Times-Roman
61
//End of BuiltinTables
65
# AllTables prints the complete list of builtin font names.
69
BuiltinTables | awk '{print $2}'
73
# Charset functions generate keyword/value pairs (as PostScript objects)
74
# that describe the character set available in a font. The keyword is a
75
# PostScript string that represents troff's name for the character. The
76
# value is usually the literal name (i.e. begins with a /) assigned to
77
# the character in the PostScript font. The value can also be an integer
78
# or a PostScript string. An integer value is used as an index in the
79
# current font's Encoding array. A string value is returned to the host
80
# unchanged when the entry for the character is constructed. Entries that
81
# have (") as their value are synonyms for the preceeding character.
83
# The 18 characters missing from ROM resident fonts on older printers are
84
# flagged with the PostScript comment "% missing".
88
cat <<-'//End of StandardCharset'
102
(-) /hyphen % changed from minus by request
185
(\\`) /grave % devpost character
189
(ct) (") % devpost synonym
191
(ps) (") % devpost synonym
193
(cr) (") % devpost synonym
195
(yn) (") % devpost synonym
196
(||) /brokenbar % missing
198
(sc) (") % devpost synonym
200
(:a) (") % devpost synonym
208
(rg) (") % devpost synonym
210
(-a) (") % devpost synonym
211
(0^) /degree % missing
212
(+-) /plusminus % missing
213
(2^) /twosuperior % missing
214
(3^) /threesuperior % missing
216
(aa) (") % devpost synonym
219
(pg) (") % devpost synonym
222
(,a) (") % devpost synonym
223
(1^) /onesuperior % missing
226
(14) /onequarter % missing
227
(12) /onehalf % missing
228
(34) /threequarters % missing
253
(xx) /multiply % missing
259
(Y') /Yacute % missing
260
(TH) /Thorn % missing
285
(-:) /divide % missing
291
(y') /yacute % missing
292
(th) /thorn % missing
294
(^a) /circumflex % devpost accent
295
(~a) /tilde % devpost accent
296
(Ua) /breve % devpost accent
297
(.a) /dotaccent % devpost accent
298
(oa) /ring % devpost accent
299
("a) /hungarumlaut % devpost accent
300
(Ca) /ogonek % devpost accent
301
(va) /caron % devpost accent
302
//End of StandardCharset
306
# DingbatsCharset guarantees changes in StandardCharset don't show up in ZD.
310
cat <<-'//End of DingbatsCharset'
323
(-) /minus % also hyphen in devpost
405
(\\`) /grave % devpost character
411
(||) /brokenbar % missing
421
(0^) /degree % missing
422
(+-) /plusminus % missing
423
(2^) /twosuperior % missing
424
(3^) /threesuperior % missing
430
(1^) /onesuperior % missing
433
(14) /onequarter % missing
434
(12) /onehalf % missing
435
(34) /threequarters % missing
460
(xx) /multiply % missing
466
(Y') /Yacute % missing
467
(TH) /Thorn % missing
492
(-:) /divide % missing
498
(y') /yacute % missing
499
(th) /thorn % missing
501
//End of DingbatsCharset
505
cat <<-'//End of SymbolCharset'
656
(fr) /fraction % devpost character
658
(fn) /florin % devpost character
748
(~=) (55 0 1) % charlib
749
//End of SymbolCharset
753
cat <<-'//End of SpecialCharset'
755
('') /quotedblright % devpost character
756
(``) /quotedblleft % devpost character
757
(dg) /dagger % devpost character
758
(dd) /daggerdbl % devpost character
759
(en) /endash % devpost character
762
% (ff) (60 2 1) % charlib
763
% (Fi) (84 2 1) % charlib
764
% (Fl) (84 2 1) % charlib
765
(14) (75 2 1) % charlib
766
(12) (75 2 1) % charlib
767
(34) (75 2 1) % charlib
768
(bx) (50 2 1) % charlib
769
(ob) (38 2 1) % charlib
770
(ci) (75 0 1) % charlib
771
(sq) (50 2 1) % charlib
772
(Sl) (50 2 1) % charlib
773
(L1) (110 1 1) % charlib
774
(LA) (110 1 1) % charlib
775
(LV) (110 3 1) % charlib
776
(LH) (210 1 1) % charlib
777
(lh) (100 0 1) % charlib
778
(rh) (100 0 1) % charlib
779
(lH) (100 0 1) % charlib
780
(rH) (100 0 1) % charlib
781
(PC) (220 2 1) % charlib
782
(DG) (185 2 1) % charlib
783
//End of SpecialCharset
787
# Latin1 ensures a font uses the ISOLatin1Encoding vector, although only
788
# text fonts should be re-encoded. Downloading the Encoding vector doesn't
789
# often make sense. No ISOLatin1Encoding array likely means ROM based fonts
790
# on your printer are incomplete. Type 1 fonts with a full Latin1 character
791
# set appeared sometime after Version 50.0.
795
if [ "$DOWNLOADVECTOR" = TRUE ]; then
796
cat <<-'//End of ISOLatin1Encoding'
1055
//End of ISOLatin1Encoding
1058
echo "ISOLatin1Encoding /$1 ReEncode"
1062
# Generating functions output PostScript programs that build font width
1063
# tables or a typesetter description file. Send the program to a printer
1064
# and the complete table will come back on the serial port. All write on
1065
# stdout and assume the prologue and other required PostScript files are
1070
echo "/unitwidth $UNITWIDTH def"
1071
echo "/resolution $RESOLUTION def"
1072
echo "/octalescapes $OCTALESCAPES def"
1074
# Get <>_ and | from S. Use accents for ascii ^ and ~.
1075
StandardCharset | awk '
1076
$1 == "(<)" && $2 == "/less" {$1 = "(---)"}
1077
$1 == "(>)" && $2 == "/greater" {$1 = "(---)"}
1078
$1 == "(_)" && $2 == "/underscore" {$1 = "(---)"}
1079
$1 == "(|)" && $2 == "/bar" {$1 = "(---)"}
1080
$1 == "(^)" && $2 == "/asciicircum" {
1081
printf "(^)\t/circumflex\n"
1084
$1 == "(~)" && $2 == "/asciitilde" {
1085
printf "(~)\t/tilde\n"
1088
{printf "%s\t%s\n", $1, $2}
1093
echo "/$2 SelectFont"
1094
echo "(opO) SetAscender"
1096
echo "(name $1\\\\n) Print"
1097
echo "(fontname $2\\\\n) Print"
1098
echo "/$1 NamedInPrologue"
1099
echo "(spacewidth ) Print 32 GetWidth Print (\n) Print"
1100
echo "(charset\\\\n) Print"
1101
echo "BuildFontCharset"
1105
echo "/unitwidth $UNITWIDTH def"
1106
echo "/resolution $RESOLUTION def"
1107
echo "/octalescapes $OCTALESCAPES def"
1113
echo "/$2 SelectFont"
1114
echo "(opO) SetAscender"
1116
echo "(name $1\\\\n) Print"
1117
echo "(fontname $2\\\\n) Print"
1118
echo "/$1 NamedInPrologue"
1119
echo "(spacewidth ) Print 32 GetWidth Print (\n) Print"
1120
echo "(charset\\\\n) Print"
1121
echo "BuildFontCharset"
1125
echo "/unitwidth $UNITWIDTH def"
1126
echo "/resolution $RESOLUTION def"
1127
echo "/octalescapes $OCTALESCAPES def"
1129
DingbatsCharset | awk '$1 != "(---)" && $2 ~ /^\/[a-zA-Z]/ {
1130
printf "%s\tISOLatin1Encoding %s GetCode\n", $1, $2
1134
echo "/$2 SelectFont"
1135
echo "( ) SetAscender"
1137
echo "(name $1\\\\n) Print"
1138
echo "(fontname $2\\\\n) Print"
1139
echo "/$1 NamedInPrologue"
1140
echo "(charset\\\\n) Print"
1141
echo "BuildFontCharset"
1145
echo "/unitwidth $UNITWIDTH def"
1146
echo "/resolution $RESOLUTION def"
1148
SymbolCharset | awk '
1150
$1 ~ /\(\*[a-zA-Z]\)/ {print; hit = NR}
1151
$2 == "(\")" && hit == NR-1 {print; hit = NR}
1155
echo "/$2 SelectFont"
1156
echo "(orO) SetAscender"
1158
echo "(name $1\\\\n) Print"
1159
echo "(fontname $2\\\\n) Print"
1160
echo "/$1 NamedInPrologue"
1161
echo "(spacewidth ) Print 32 GetWidth Print (\n) Print"
1162
echo "(charset\\\\n) Print"
1163
echo "BuildFontCharset"
1167
echo "/unitwidth $UNITWIDTH def"
1168
echo "/resolution $RESOLUTION def"
1173
echo "ChangeMetrics"
1174
echo "/S SelectFont"
1175
echo "(orO) SetAscender"
1177
echo "(name $1\\\\n) Print"
1178
echo "(fontname $2\\\\n) Print"
1179
echo "/$1 NamedInPrologue"
1180
echo "(special\\\\n) Print"
1181
echo "(charset\\\\n) Print"
1182
echo "BuildFontCharset"
1186
echo "/unitwidth $UNITWIDTH def"
1187
echo "/resolution $RESOLUTION def"
1192
echo "ChangeMetrics"
1193
echo "/S1 SelectFont"
1195
echo "(# Times-Roman special font\\\\n) Print"
1196
echo "(name $1\\\\n) Print"
1197
echo "(fontname $2\\\\n) Print"
1198
echo "/$1 NamedInPrologue"
1199
echo "(special\\\\n) Print"
1200
echo "(charset\\\\n) Print"
1201
echo "BuildFontCharset"
1205
# The DESC file doesn't have to be built on a printer. It's only here for
1210
echo "/charset [" # awk - so the stack doesn't overflow
1211
StandardCharset | awk '$1 !~ /\(\\[0-9]/ {print $1}'
1212
SymbolCharset | awk '$1 !~ /\(\\[0-9]/ {print $1}'
1213
SpecialCharset | awk '$1 !~ /\(\\[0-9]/ {print $1}'
1217
(#Device Description - utf character set
1222
fonts 10 R I B BI CW H HI HB S1 S
1223
sizes 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1224
23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 40 42 44 46
1225
48 50 52 54 56 58 60 64 68 72 78 84 90 96 100 105 110 115
1226
120 125 130 135 140 145 150 155 160 0
1230
unitwidth $UNITWIDTH
1234
echo "(charset\\\\n) Print"
1235
echo "BuildDescCharset"
1236
echo "(\\\\n) Print"