9base

revived minimalist port of Plan 9 userland to Unix
git clone git://git.suckless.org/9base
Log | Files | Refs | README | LICENSE

shell.lib (22924B)


      1 #
      2 # Shell library - for building devutf tables.
      3 #
      4 
      5 RESOLUTION=720
      6 UNITWIDTH=10
      7 
      8 OCTALESCAPES=${OCTALESCAPES:-160}	# <= code means add \0ddd names
      9 DOWNLOADVECTOR=FALSE			# TRUE can mean incomplete tables
     10 
     11 #
     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
     16 # font.
     17 #
     18 
     19 BuiltinTables() {
     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
     50 		FixedWidth	C	Courier
     51 		FixedWidth	CB	Courier-Bold
     52 		FixedWidth	CI	Courier-Oblique
     53 		FixedWidth	CO	Courier
     54 		FixedWidth	CW	Courier
     55 		FixedWidth	CX	Courier-BoldOblique
     56 		Dingbats	ZD	ZapfDingbats
     57 		Greek		GR	Symbol
     58 		Symbol		S	Symbol
     59 		Special		S1	Times-Roman
     60 		Description	DESC	---
     61 	//End of BuiltinTables
     62 }
     63 
     64 #
     65 # AllTables prints the complete list of builtin font names.
     66 #
     67 
     68 AllTables() {
     69 	BuiltinTables | awk '{print $2}'
     70 }
     71 
     72 #
     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.
     82 #
     83 # The 18 characters missing from ROM resident fonts on older printers are
     84 # flagged with the PostScript comment "% missing".
     85 #
     86 
     87 StandardCharset() {
     88 	cat <<-'//End of StandardCharset'
     89 		(!)	/exclam
     90 		(")	/quotedbl
     91 		(dq)	(")			% synonym
     92 		(#)	/numbersign
     93 		($)	/dollar
     94 		(%)	/percent
     95 		(&)	/ampersand
     96 		(')	/quoteright
     97 		(\()	/parenleft
     98 		(\))	/parenright
     99 		(*)	/asterisk
    100 		(+)	/plus
    101 		(,)	/comma
    102 		(-)	/hyphen			% changed from minus by request
    103 		(.)	/period
    104 		(/)	/slash
    105 		(0)	/zero
    106 		(1)	/one
    107 		(2)	/two
    108 		(3)	/three
    109 		(4)	/four
    110 		(5)	/five
    111 		(6)	/six
    112 		(7)	/seven
    113 		(8)	/eight
    114 		(9)	/nine
    115 		(:)	/colon
    116 		(;)	/semicolon
    117 		(<)	/less
    118 		(=)	/equal
    119 		(>)	/greater
    120 		(?)	/question
    121 		(@)	/at
    122 		(A)	/A
    123 		(B)	/B
    124 		(C)	/C
    125 		(D)	/D
    126 		(E)	/E
    127 		(F)	/F
    128 		(G)	/G
    129 		(H)	/H
    130 		(I)	/I
    131 		(J)	/J
    132 		(K)	/K
    133 		(L)	/L
    134 		(M)	/M
    135 		(N)	/N
    136 		(O)	/O
    137 		(P)	/P
    138 		(Q)	/Q
    139 		(R)	/R
    140 		(S)	/S
    141 		(T)	/T
    142 		(U)	/U
    143 		(V)	/V
    144 		(W)	/W
    145 		(X)	/X
    146 		(Y)	/Y
    147 		(Z)	/Z
    148 		([)	/bracketleft
    149 		(\\)	/backslash
    150 		(bs)	(")			% synonym
    151 		(])	/bracketright
    152 		(^)	/asciicircum
    153 		(_)	/underscore
    154 		(`)	/quoteleft
    155 		(a)	/a
    156 		(b)	/b
    157 		(c)	/c
    158 		(d)	/d
    159 		(e)	/e
    160 		(f)	/f
    161 		(g)	/g
    162 		(h)	/h
    163 		(i)	/i
    164 		(j)	/j
    165 		(k)	/k
    166 		(l)	/l
    167 		(m)	/m
    168 		(n)	/n
    169 		(o)	/o
    170 		(p)	/p
    171 		(q)	/q
    172 		(r)	/r
    173 		(s)	/s
    174 		(t)	/t
    175 		(u)	/u
    176 		(v)	/v
    177 		(w)	/w
    178 		(x)	/x
    179 		(y)	/y
    180 		(z)	/z
    181 		({)	/braceleft
    182 		(|)	/bar
    183 		(})	/braceright
    184 		(~)	/asciitilde
    185 		(\\`)	/grave			% devpost character
    186 		(ga)	(")			% synonym
    187 		(!!)	/exclamdown
    188 		(c|)	/cent
    189 		(ct)	(")			% devpost synonym
    190 		(L-)	/sterling
    191 		(ps)	(")			% devpost synonym
    192 		(xo)	/currency
    193 		(cr)	(")			% devpost synonym
    194 		(Y-)	/yen
    195 		(yn)	(")			% devpost synonym
    196 		(||)	/brokenbar		% missing
    197 		(so)	/section
    198 		(sc)	(")			% devpost synonym
    199 		("")	/dieresis
    200 		(:a)	(")			% devpost synonym
    201 		(co)	/copyright
    202 		(a_)	/ordfeminine
    203 		(<<)	/guillemotleft
    204 		(-,)	/logicalnot
    205 		(hy)	/hyphen
    206 		(--)	/minus
    207 		(ro)	/registered
    208 		(rg)	(")			% devpost synonym
    209 		(-^)	/macron
    210 		(-a)	(")			% devpost synonym
    211 		(0^)	/degree			% missing
    212 		(+-)	/plusminus		% missing
    213 		(2^)	/twosuperior		% missing
    214 		(3^)	/threesuperior		% missing
    215 		(\\')	/acute
    216 		(aa)	(")			% devpost synonym
    217 		(/u)	/mu			% missing
    218 		(P!)	/paragraph
    219 		(pg)	(")			% devpost synonym
    220 		(.^)	/periodcentered
    221 		(,,)	/cedilla
    222 		(,a)	(")			% devpost synonym
    223 		(1^)	/onesuperior		% missing
    224 		(o_)	/ordmasculine
    225 		(>>)	/guillemotright
    226 		(14)	/onequarter		% missing
    227 		(12)	/onehalf		% missing
    228 		(34)	/threequarters		% missing
    229 		(??)	/questiondown
    230 		(A`)	/Agrave
    231 		(A')	/Aacute
    232 		(A^)	/Acircumflex
    233 		(A~)	/Atilde
    234 		(A")	/Adieresis
    235 		(A*)	/Aring
    236 		(AE)	/AE
    237 		(C,)	/Ccedilla
    238 		(E`)	/Egrave
    239 		(E')	/Eacute
    240 		(E^)	/Ecircumflex
    241 		(E")	/Edieresis
    242 		(I`)	/Igrave
    243 		(I')	/Iacute
    244 		(I^)	/Icircumflex
    245 		(I")	/Idieresis
    246 		(D-)	/Eth			% missing
    247 		(N~)	/Ntilde
    248 		(O`)	/Ograve
    249 		(O')	/Oacute
    250 		(O^)	/Ocircumflex
    251 		(O~)	/Otilde
    252 		(O")	/Odieresis
    253 		(xx)	/multiply		% missing
    254 		(O/)	/Oslash
    255 		(U`)	/Ugrave
    256 		(U')	/Uacute
    257 		(U^)	/Ucircumflex
    258 		(U")	/Udieresis
    259 		(Y')	/Yacute			% missing
    260 		(TH)	/Thorn			% missing
    261 		(ss)	/germandbls
    262 		(a`)	/agrave
    263 		(a')	/aacute
    264 		(a^)	/acircumflex
    265 		(a~)	/atilde
    266 		(a")	/adieresis
    267 		(a*)	/aring
    268 		(ae)	/ae
    269 		(c,)	/ccedilla
    270 		(e`)	/egrave
    271 		(e')	/eacute
    272 		(e^)	/ecircumflex
    273 		(e")	/edieresis
    274 		(i`)	/igrave
    275 		(i')	/iacute
    276 		(i^)	/icircumflex
    277 		(i")	/idieresis
    278 		(d-)	/eth			% missing
    279 		(n~)	/ntilde
    280 		(o`)	/ograve
    281 		(o')	/oacute
    282 		(o^)	/ocircumflex
    283 		(o~)	/otilde
    284 		(o")	/odieresis
    285 		(-:)	/divide			% missing
    286 		(o/)	/oslash
    287 		(u`)	/ugrave
    288 		(u')	/uacute
    289 		(u^)	/ucircumflex
    290 		(u")	/udieresis
    291 		(y')	/yacute			% missing
    292 		(th)	/thorn			% missing
    293 		(y")	/ydieresis
    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
    303 }
    304 
    305 #
    306 # DingbatsCharset guarantees changes in StandardCharset don't show up in ZD.
    307 #
    308 
    309 DingbatsCharset() {
    310 	cat <<-'//End of DingbatsCharset'
    311 		(!)	/exclam
    312 		(")	/quotedbl
    313 		(#)	/numbersign
    314 		($)	/dollar
    315 		(%)	/percent
    316 		(&)	/ampersand
    317 		(')	/quoteright
    318 		(\()	/parenleft
    319 		(\))	/parenright
    320 		(*)	/asterisk
    321 		(+)	/plus
    322 		(,)	/comma
    323 		(-)	/minus		% also hyphen in devpost
    324 		(.)	/period
    325 		(/)	/slash
    326 		(0)	/zero
    327 		(1)	/one
    328 		(2)	/two
    329 		(3)	/three
    330 		(4)	/four
    331 		(5)	/five
    332 		(6)	/six
    333 		(7)	/seven
    334 		(8)	/eight
    335 		(9)	/nine
    336 		(:)	/colon
    337 		(;)	/semicolon
    338 		(<)	/less
    339 		(=)	/equal
    340 		(>)	/greater
    341 		(?)	/question
    342 		(@)	/at
    343 		(A)	/A
    344 		(B)	/B
    345 		(C)	/C
    346 		(D)	/D
    347 		(E)	/E
    348 		(F)	/F
    349 		(G)	/G
    350 		(H)	/H
    351 		(I)	/I
    352 		(J)	/J
    353 		(K)	/K
    354 		(L)	/L
    355 		(M)	/M
    356 		(N)	/N
    357 		(O)	/O
    358 		(P)	/P
    359 		(Q)	/Q
    360 		(R)	/R
    361 		(S)	/S
    362 		(T)	/T
    363 		(U)	/U
    364 		(V)	/V
    365 		(W)	/W
    366 		(X)	/X
    367 		(Y)	/Y
    368 		(Z)	/Z
    369 		([)	/bracketleft
    370 		(\\)	/backslash
    371 		(])	/bracketright
    372 		(^)	/asciicircum
    373 		(_)	/underscore
    374 		(`)	/quoteleft
    375 		(a)	/a
    376 		(b)	/b
    377 		(c)	/c
    378 		(d)	/d
    379 		(e)	/e
    380 		(f)	/f
    381 		(g)	/g
    382 		(h)	/h
    383 		(i)	/i
    384 		(j)	/j
    385 		(k)	/k
    386 		(l)	/l
    387 		(m)	/m
    388 		(n)	/n
    389 		(o)	/o
    390 		(p)	/p
    391 		(q)	/q
    392 		(r)	/r
    393 		(s)	/s
    394 		(t)	/t
    395 		(u)	/u
    396 		(v)	/v
    397 		(w)	/w
    398 		(x)	/x
    399 		(y)	/y
    400 		(z)	/z
    401 		({)	/braceleft
    402 		(|)	/bar
    403 		(})	/braceright
    404 		(~)	/asciitilde
    405 		(\\`)	/grave			% devpost character
    406 		(!!)	/exclamdown
    407 		(c|)	/cent
    408 		(L-)	/sterling
    409 		(xo)	/currency
    410 		(Y-)	/yen
    411 		(||)	/brokenbar		% missing
    412 		(so)	/section
    413 		("")	/dieresis
    414 		(co)	/copyright
    415 		(a_)	/ordfeminine
    416 		(<<)	/guillemotleft
    417 		(-,)	/logicalnot
    418 		(hy)	/hyphen
    419 		(ro)	/registered
    420 		(-^)	/macron
    421 		(0^)	/degree			% missing
    422 		(+-)	/plusminus		% missing
    423 		(2^)	/twosuperior		% missing
    424 		(3^)	/threesuperior		% missing
    425 		(\\')	/acute
    426 		(/u)	/mu			% missing
    427 		(P!)	/paragraph
    428 		(.^)	/periodcentered
    429 		(,,)	/cedilla
    430 		(1^)	/onesuperior		% missing
    431 		(o_)	/ordmasculine
    432 		(>>)	/guillemotright
    433 		(14)	/onequarter		% missing
    434 		(12)	/onehalf		% missing
    435 		(34)	/threequarters		% missing
    436 		(??)	/questiondown
    437 		(A`)	/Agrave
    438 		(A')	/Aacute
    439 		(A^)	/Acircumflex
    440 		(A~)	/Atilde
    441 		(A")	/Adieresis
    442 		(A*)	/Aring
    443 		(AE)	/AE
    444 		(C,)	/Ccedilla
    445 		(E`)	/Egrave
    446 		(E')	/Eacute
    447 		(E^)	/Ecircumflex
    448 		(E")	/Edieresis
    449 		(I`)	/Igrave
    450 		(I')	/Iacute
    451 		(I^)	/Icircumflex
    452 		(I")	/Idieresis
    453 		(D-)	/Eth			% missing
    454 		(N~)	/Ntilde
    455 		(O`)	/Ograve
    456 		(O')	/Oacute
    457 		(O^)	/Ocircumflex
    458 		(O~)	/Otilde
    459 		(O")	/Odieresis
    460 		(xx)	/multiply		% missing
    461 		(O/)	/Oslash
    462 		(U`)	/Ugrave
    463 		(U')	/Uacute
    464 		(U^)	/Ucircumflex
    465 		(U")	/Udieresis
    466 		(Y')	/Yacute			% missing
    467 		(TH)	/Thorn			% missing
    468 		(ss)	/germandbls
    469 		(a`)	/agrave
    470 		(a')	/aacute
    471 		(a^)	/acircumflex
    472 		(a~)	/atilde
    473 		(a")	/adieresis
    474 		(a*)	/aring
    475 		(ae)	/ae
    476 		(c,)	/ccedilla
    477 		(e`)	/egrave
    478 		(e')	/eacute
    479 		(e^)	/ecircumflex
    480 		(e")	/edieresis
    481 		(i`)	/igrave
    482 		(i')	/iacute
    483 		(i^)	/icircumflex
    484 		(i")	/idieresis
    485 		(d-)	/eth			% missing
    486 		(n~)	/ntilde
    487 		(o`)	/ograve
    488 		(o')	/oacute
    489 		(o^)	/ocircumflex
    490 		(o~)	/otilde
    491 		(o")	/odieresis
    492 		(-:)	/divide			% missing
    493 		(o/)	/oslash
    494 		(u`)	/ugrave
    495 		(u')	/uacute
    496 		(u^)	/ucircumflex
    497 		(u")	/udieresis
    498 		(y')	/yacute			% missing
    499 		(th)	/thorn			% missing
    500 		(y")	/ydieresis
    501 	//End of DingbatsCharset
    502 }
    503 
    504 SymbolCharset() {
    505 	cat <<-'//End of SymbolCharset'
    506 		(---)		/exclam
    507 		(fa)		/universal
    508 		(---)		/numbersign
    509 		(te)		/existential
    510 		(---)		/percent
    511 		(---)		/ampersand
    512 		(st)		/suchthat
    513 		(---)		/parenleft
    514 		(---)		/parenright
    515 		(**)		/asteriskmath
    516 		(pl)		/plus
    517 		(---)		/comma
    518 		(mi)		/minus
    519 		(---)		/period
    520 		(sl)		/slash
    521 		(---)		/zero
    522 		(---)		/one
    523 		(---)		/two
    524 		(---)		/three
    525 		(---)		/four
    526 		(---)		/five
    527 		(---)		/six
    528 		(---)		/seven
    529 		(---)		/eight
    530 		(---)		/nine
    531 		(---)		/colon
    532 		(---)		/semicolon
    533 		(<)		/less
    534 		(eq)		/equal
    535 		(>)		/greater
    536 		(---)		/question
    537 		(cg)		/congruent
    538 		(*A)		/Alpha
    539 		(\244x)		(")
    540 		(*B)		/Beta
    541 		(\244y)		(")
    542 		(*X)		/Chi
    543 		(\244\257)	(")
    544 		(*D)		/Delta
    545 		(\244{)		(")
    546 		(*E)		/Epsilon
    547 		(\244|)		(")
    548 		(*F)		/Phi
    549 		(\244\256)	(")
    550 		(*G)		/Gamma
    551 		(\244z)		(")
    552 		(*Y)		/Eta
    553 		(\244~)		(")
    554 		(*I)		/Iota
    555 		(\244\241)	(")
    556 		(---)		/theta1
    557 		(\244\331)	(")
    558 		(*K)		/Kappa
    559 		(\244\242)	(")
    560 		(*L)		/Lambda
    561 		(\244\243)	(")
    562 		(*M)		/Mu
    563 		(\244\244)	(")
    564 		(*N)		/Nu
    565 		(\244\245)	(")
    566 		(*O)		/Omicron
    567 		(\244\247)	(")
    568 		(*P)		/Pi
    569 		(\244\250)	(")
    570 		(*H)		/Theta
    571 		(\244\240)	(")
    572 		(*R)		/Rho
    573 		(\244\251)	(")
    574 		(*S)		/Sigma
    575 		(\244\253)	(")
    576 		(*T)		/Tau
    577 		(\244\254)	(")
    578 		(*U)		/Upsilon
    579 		(\244\255)	(")
    580 		(ts)		/sigma1
    581 		(\244\312)	(")
    582 		(*W)		/Omega
    583 		(\244\261)	(")
    584 		(*C)		/Xi
    585 		(\244\246)	(")
    586 		(*Q)		/Psi
    587 		(\244\260)	(")
    588 		(*Z)		/Zeta
    589 		(\244})		(")
    590 		(---)		/bracketleft
    591 		(tf)		/therefore
    592 		(---)		/bracketright
    593 		(pp)		/perpendicular
    594 		(ul)		/underscore
    595 		(_)		(")			% synonym
    596 		(rn)		/radicalex
    597 		(*a)		/alpha
    598 		(\244\271)	(")
    599 		(*b)		/beta
    600 		(\244\272)	(")
    601 		(*x)		/chi
    602 		(\244\317)	(")
    603 		(*d)		/delta
    604 		(\244\274)	(")
    605 		(*e)		/epsilon
    606 		(\244\275)	(")
    607 		(*f)		/phi
    608 		(\244\316)	(")
    609 		(*g)		/gamma
    610 		(\244\273)	(")
    611 		(*y)		/eta
    612 		(\244\277)	(")
    613 		(*i)		/iota
    614 		(\244\301)	(")
    615 		(---)		/phi1
    616 		(\244\335)	(")
    617 		(*k)		/kappa
    618 		(\244\302)	(")
    619 		(*l)		/lambda
    620 		(\244\303)	(")
    621 		(*m)		/mu
    622 		(\244\304)	(")
    623 		(*n)		/nu
    624 		(\244\305)	(")
    625 		(*o)		/omicron
    626 		(\244\307)	(")
    627 		(*p)		/pi
    628 		(\244\310)	(")
    629 		(*h)		/theta
    630 		(\244\300)	(")
    631 		(*r)		/rho
    632 		(\244\311)	(")
    633 		(*s)		/sigma
    634 		(\244\313)	(")
    635 		(*t)		/tau
    636 		(\244\314)	(")
    637 		(*u)		/upsilon
    638 		(\244\315)	(")
    639 		(---)		/omega1
    640 		(\244\336)	(")
    641 		(*w)		/omega
    642 		(\244\321)	(")
    643 		(*c)		/xi
    644 		(\244\306)	(")
    645 		(*q)		/psi
    646 		(\244\320)	(")
    647 		(*z)		/zeta
    648 		(\244\276)	(")
    649 		(---)		/braceleft
    650 		(or)		/bar
    651 		(---)		/braceright
    652 		(ap)		/similar
    653 		(---)		/Upsilon1
    654 		(fm)		/minute
    655 		(<=)		/lessequal
    656 		(fr)		/fraction		% devpost character
    657 		(if)		/infinity
    658 		(fn)		/florin			% devpost character
    659 		(---)		/club
    660 		(---)		/diamond
    661 		(---)		/heart
    662 		(---)		/spade
    663 		(ab)		/arrowboth
    664 		(<-)		/arrowleft
    665 		(ua)		/arrowup
    666 		(->)		/arrowright
    667 		(da)		/arrowdown
    668 		(de)		/degree
    669 		(+-)		/plusminus
    670 		(---)		/second
    671 		(>=)		/greaterequal
    672 		(mu)		/multiply
    673 		(pt)		/proportional
    674 		(pd)		/partialdiff
    675 		(bu)		/bullet
    676 		(di)		/divide
    677 		(!=)		/notequal
    678 		(==)		/equivalence
    679 		(~~)		/approxequal
    680 		(el)		/ellipsis
    681 		(av)		/arrowvertex
    682 		(ah)		/arrowhorizex
    683 		(CR)		/carriagereturn
    684 		(af)		/aleph
    685 		(If)		/Ifraktur
    686 		(Rf)		/Rfraktur
    687 		(ws)		/weierstrass
    688 		(Ox)		/circlemultiply
    689 		(O+)		/circleplus
    690 		(es)		/emptyset
    691 		(ca)		/intersection
    692 		(cu)		/union
    693 		(sp)		/propersuperset
    694 		(ip)		/reflexsuperset
    695 		(!b)		/notsubset
    696 		(sb)		/propersubset
    697 		(ib)		/reflexsubset
    698 		(mo)		/element
    699 		(!m)		/notelement
    700 		(an)		/angle
    701 		(gr)		/gradient
    702 		(rg)		/registerserif
    703 		(co)		/copyrightserif
    704 		(tm)		/trademarkserif
    705 		(---)		/product
    706 		(sr)		/radical
    707 		(c.)		/dotmath
    708 		(no)		/logicalnot
    709 		(l&)		/logicaland
    710 		(l|)		/logicalor
    711 		(---)		/arrowdblboth
    712 		(---)		/arrowdblleft
    713 		(---)		/arrowdblup
    714 		(---)		/arrowdblright
    715 		(---)		/arrowdbldown
    716 		(lz)		/lozenge
    717 		(b<)		/angleleft
    718 		(RG)		/registersans
    719 		(CO)		/copyrightsans
    720 		(TM)		/trademarksans
    721 		(---)		/summation
    722 		(LT)		/parenlefttp
    723 		(br)		/parenleftex
    724 		(LX)		(")			% synonym
    725 		(LB)		/parenleftbt
    726 		(lc)		/bracketlefttp
    727 		(lx)		/bracketleftex
    728 		(lf)		/bracketleftbt
    729 		(lt)		/bracelefttp
    730 		(lk)		/braceleftmid
    731 		(lb)		/braceleftbt
    732 		(bv)		/braceex
    733 		(|)		(")			% synonym
    734 		(b>)		/angleright
    735 		(is)		/integral
    736 		(---)		/integraltp
    737 		(---)		/integralex
    738 		(---)		/integralbt
    739 		(RT)		/parenrighttp
    740 		(RX)		/parenrightex
    741 		(RB)		/parenrightbt
    742 		(rc)		/bracketrighttp
    743 		(rx)		/bracketrightex
    744 		(rf)		/bracketrightbt
    745 		(rt)		/bracerighttp
    746 		(rk)		/bracerightmid
    747 		(rb)		/bracerightbt
    748 		(~=)		(55	0	1)	% charlib
    749 	//End of SymbolCharset
    750 }
    751 
    752 SpecialCharset() {
    753 	cat <<-'//End of SpecialCharset'
    754 		(ru)	/underscore
    755 		('')	/quotedblright		% devpost character
    756 		(``)	/quotedblleft		% devpost character
    757 		(dg)	/dagger			% devpost character
    758 		(dd)	/daggerdbl		% devpost character
    759 		(en)	/endash			% devpost character
    760 		(\\-)	(")			% synonym
    761 		(em)	/emdash
    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
    784 }
    785 
    786 #
    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.
    792 #
    793 
    794 Latin1() {
    795 	if [ "$DOWNLOADVECTOR" = TRUE ]; then
    796 		cat <<-'//End of ISOLatin1Encoding'
    797 			/ISOLatin1Encoding [
    798 				/.notdef
    799 				/.notdef
    800 				/.notdef
    801 				/.notdef
    802 				/.notdef
    803 				/.notdef
    804 				/.notdef
    805 				/.notdef
    806 				/.notdef
    807 				/.notdef
    808 				/.notdef
    809 				/.notdef
    810 				/.notdef
    811 				/.notdef
    812 				/.notdef
    813 				/.notdef
    814 				/.notdef
    815 				/.notdef
    816 				/.notdef
    817 				/.notdef
    818 				/.notdef
    819 				/.notdef
    820 				/.notdef
    821 				/.notdef
    822 				/.notdef
    823 				/.notdef
    824 				/.notdef
    825 				/.notdef
    826 				/.notdef
    827 				/.notdef
    828 				/.notdef
    829 				/.notdef
    830 				/space
    831 				/exclam
    832 				/quotedbl
    833 				/numbersign
    834 				/dollar
    835 				/percent
    836 				/ampersand
    837 				/quoteright
    838 				/parenleft
    839 				/parenright
    840 				/asterisk
    841 				/plus
    842 				/comma
    843 				/minus
    844 				/period
    845 				/slash
    846 				/zero
    847 				/one
    848 				/two
    849 				/three
    850 				/four
    851 				/five
    852 				/six
    853 				/seven
    854 				/eight
    855 				/nine
    856 				/colon
    857 				/semicolon
    858 				/less
    859 				/equal
    860 				/greater
    861 				/question
    862 				/at
    863 				/A
    864 				/B
    865 				/C
    866 				/D
    867 				/E
    868 				/F
    869 				/G
    870 				/H
    871 				/I
    872 				/J
    873 				/K
    874 				/L
    875 				/M
    876 				/N
    877 				/O
    878 				/P
    879 				/Q
    880 				/R
    881 				/S
    882 				/T
    883 				/U
    884 				/V
    885 				/W
    886 				/X
    887 				/Y
    888 				/Z
    889 				/bracketleft
    890 				/backslash
    891 				/bracketright
    892 				/asciicircum
    893 				/underscore
    894 				/quoteleft
    895 				/a
    896 				/b
    897 				/c
    898 				/d
    899 				/e
    900 				/f
    901 				/g
    902 				/h
    903 				/i
    904 				/j
    905 				/k
    906 				/l
    907 				/m
    908 				/n
    909 				/o
    910 				/p
    911 				/q
    912 				/r
    913 				/s
    914 				/t
    915 				/u
    916 				/v
    917 				/w
    918 				/x
    919 				/y
    920 				/z
    921 				/braceleft
    922 				/bar
    923 				/braceright
    924 				/asciitilde
    925 				/.notdef
    926 				/.notdef
    927 				/.notdef
    928 				/.notdef
    929 				/.notdef
    930 				/.notdef
    931 				/.notdef
    932 				/.notdef
    933 				/.notdef
    934 				/.notdef
    935 				/.notdef
    936 				/.notdef
    937 				/.notdef
    938 				/.notdef
    939 				/.notdef
    940 				/.notdef
    941 				/.notdef
    942 				/dotlessi
    943 				/grave
    944 				/acute
    945 				/circumflex
    946 				/tilde
    947 				/macron
    948 				/breve
    949 				/dotaccent
    950 				/dieresis
    951 				/.notdef
    952 				/ring
    953 				/cedilla
    954 				/.notdef
    955 				/hungarumlaut
    956 				/ogonek
    957 				/caron
    958 				/space
    959 				/exclamdown
    960 				/cent
    961 				/sterling
    962 				/currency
    963 				/yen
    964 				/brokenbar
    965 				/section
    966 				/dieresis
    967 				/copyright
    968 				/ordfeminine
    969 				/guillemotleft
    970 				/logicalnot
    971 				/hyphen
    972 				/registered
    973 				/macron
    974 				/degree
    975 				/plusminus
    976 				/twosuperior
    977 				/threesuperior
    978 				/acute
    979 				/mu
    980 				/paragraph
    981 				/periodcentered
    982 				/cedilla
    983 				/onesuperior
    984 				/ordmasculine
    985 				/guillemotright
    986 				/onequarter
    987 				/onehalf
    988 				/threequarters
    989 				/questiondown
    990 				/Agrave
    991 				/Aacute
    992 				/Acircumflex
    993 				/Atilde
    994 				/Adieresis
    995 				/Aring
    996 				/AE
    997 				/Ccedilla
    998 				/Egrave
    999 				/Eacute
   1000 				/Ecircumflex
   1001 				/Edieresis
   1002 				/Igrave
   1003 				/Iacute
   1004 				/Icircumflex
   1005 				/Idieresis
   1006 				/Eth
   1007 				/Ntilde
   1008 				/Ograve
   1009 				/Oacute
   1010 				/Ocircumflex
   1011 				/Otilde
   1012 				/Odieresis
   1013 				/multiply
   1014 				/Oslash
   1015 				/Ugrave
   1016 				/Uacute
   1017 				/Ucircumflex
   1018 				/Udieresis
   1019 				/Yacute
   1020 				/Thorn
   1021 				/germandbls
   1022 				/agrave
   1023 				/aacute
   1024 				/acircumflex
   1025 				/atilde
   1026 				/adieresis
   1027 				/aring
   1028 				/ae
   1029 				/ccedilla
   1030 				/egrave
   1031 				/eacute
   1032 				/ecircumflex
   1033 				/edieresis
   1034 				/igrave
   1035 				/iacute
   1036 				/icircumflex
   1037 				/idieresis
   1038 				/eth
   1039 				/ntilde
   1040 				/ograve
   1041 				/oacute
   1042 				/ocircumflex
   1043 				/otilde
   1044 				/odieresis
   1045 				/divide
   1046 				/oslash
   1047 				/ugrave
   1048 				/uacute
   1049 				/ucircumflex
   1050 				/udieresis
   1051 				/yacute
   1052 				/thorn
   1053 				/ydieresis
   1054 			] def
   1055 		//End of ISOLatin1Encoding
   1056 	fi
   1057 
   1058 	echo "ISOLatin1Encoding /$1 ReEncode"
   1059 }
   1060 
   1061 #
   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
   1066 # all available.
   1067 #
   1068 
   1069 Proportional() {
   1070 	echo "/unitwidth $UNITWIDTH def"
   1071 	echo "/resolution $RESOLUTION def"
   1072 	echo "/octalescapes $OCTALESCAPES def"
   1073 	echo "/charset ["
   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"
   1082 				$1 = "(---)"
   1083 			}
   1084 			$1 == "(~)" && $2 == "/asciitilde" {
   1085 				printf "(~)\t/tilde\n"
   1086 				$1 = "(---)"
   1087 			}
   1088 			{printf "%s\t%s\n", $1, $2}
   1089 		'
   1090 	echo "] def"
   1091 
   1092 	Latin1 $2
   1093 	echo "/$2 SelectFont"
   1094 	echo "(opO) SetAscender"
   1095 
   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"
   1102 }
   1103 
   1104 FixedWidth() {
   1105 	echo "/unitwidth $UNITWIDTH def"
   1106 	echo "/resolution $RESOLUTION def"
   1107 	echo "/octalescapes $OCTALESCAPES def"
   1108 	echo "/charset ["
   1109 		StandardCharset
   1110 	echo "] def"
   1111 
   1112 	Latin1 $2
   1113 	echo "/$2 SelectFont"
   1114 	echo "(opO) SetAscender"
   1115 
   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"
   1122 }
   1123 
   1124 Dingbats() {
   1125 	echo "/unitwidth $UNITWIDTH def"
   1126 	echo "/resolution $RESOLUTION def"
   1127 	echo "/octalescapes $OCTALESCAPES def"
   1128 	echo "/charset ["
   1129 		DingbatsCharset | awk '$1 != "(---)" && $2 ~ /^\/[a-zA-Z]/ {
   1130 			printf "%s\tISOLatin1Encoding %s GetCode\n", $1, $2
   1131 		}'
   1132 	echo "] def"
   1133 
   1134 	echo "/$2 SelectFont"
   1135 	echo "(   ) SetAscender"
   1136 
   1137 	echo "(name $1\\\\n) Print"
   1138 	echo "(fontname $2\\\\n) Print"
   1139 	echo "/$1 NamedInPrologue"
   1140 	echo "(charset\\\\n) Print"
   1141 	echo "BuildFontCharset"
   1142 }
   1143 
   1144 Greek() {
   1145 	echo "/unitwidth $UNITWIDTH def"
   1146 	echo "/resolution $RESOLUTION def"
   1147 	echo "/charset ["
   1148 		SymbolCharset | awk '
   1149 			BEGIN {hit = -1}
   1150 			$1 ~ /\(\*[a-zA-Z]\)/ {print; hit = NR}
   1151 			$2 == "(\")" && hit == NR-1 {print; hit = NR}
   1152 		'
   1153 	echo "] def"
   1154 
   1155 	echo "/$2 SelectFont"
   1156 	echo "(orO) SetAscender"
   1157 
   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"
   1164 }
   1165 
   1166 Symbol() {
   1167 	echo "/unitwidth $UNITWIDTH def"
   1168 	echo "/resolution $RESOLUTION def"
   1169 	echo "/charset ["
   1170 		SymbolCharset
   1171 	echo "] def"
   1172 
   1173 	echo "ChangeMetrics"
   1174 	echo "/S SelectFont"
   1175 	echo "(orO) SetAscender"
   1176 
   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"
   1183 }
   1184 
   1185 Special() {
   1186 	echo "/unitwidth $UNITWIDTH def"
   1187 	echo "/resolution $RESOLUTION def"
   1188 	echo "/charset ["
   1189 		SpecialCharset
   1190 	echo "] def"
   1191 
   1192 	echo "ChangeMetrics"
   1193 	echo "/S1 SelectFont"
   1194 
   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"
   1202 }
   1203 
   1204 #
   1205 # The DESC file doesn't have to be built on a printer. It's only here for
   1206 # consistency.
   1207 #
   1208 
   1209 Description() {
   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}'
   1214 	echo "] def"
   1215 
   1216 	cat <<-//DESC
   1217 		(#Device Description - utf character set
   1218 
   1219 		PDL PostScript
   1220 		Encoding Latin1
   1221 
   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
   1227 		res $RESOLUTION
   1228 		hor 1
   1229 		vert 1
   1230 		unitwidth $UNITWIDTH
   1231 
   1232 		) Print
   1233 	//DESC
   1234 	echo "(charset\\\\n) Print"
   1235 	echo "BuildDescCharset"
   1236 	echo "(\\\\n) Print"
   1237 }
   1238