summaryrefslogtreecommitdiff
path: root/fonts/utilities/t1tools/gpreview
blob: dbeed59505d4138d867e8966343ef20c30122536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#! /bin/sh

case `basename $0` in
	gprev*)	show="cat > /tmp/gs$$.ps; gs /tmp/gs$$.ps < /dev/tty; rm -f /tmp/gs$$.ps"; prep="erasepage 20 780 sethome" ;;
	prev*)	show=psh ; prep="erasepage 20 780 sethome" ;;
	pspre*)	show=cat ; prep="12 setfontsize" ;;
	*)	show=lpr ; prep="12 setfontsize" ;;
esac

psatops () {
#	3 further transformations on decomp's output:
#	^M -> ^J : to edit it on unix machines
#	< > -> { } : to make it a PostScript program
#	remove access restriction operators to play around with it in an 
#		interactive PostScript interpreter
	sed -e 'y/
<>/\n{}/' -e 's/executeonly//g' -e 's/noaccess//g' -e 's/readonly//g'
	}

pfbtops () {
	if t1disasm $1
	then true	# t1disasm did the job
	elif decrypt $1 | decomp | psatops
	then true	# decrypt, decomp did the job
	else false	# no one found to do the job
	fi
	}

pfbtopfa () {
	if t1ascii $1
	then true	# t1ascii did the job
	elif pfb2ps < $1
	then true	# one of numerous PD programs could do this simple job
	else	case $1 in
		*.pfb)	fmAdobePCFont $1 ${TMPDIR-/tmp}/$$.pfa ;;
		*.pfe|*.rsrc)	fmAdobeMacFont $1 ${TMPDIR-/tmp}/$$.pfa ;;
		esac
		# this should be found in $FMHOME/bin
		# it runs slower than others
		cat ${TMPDIR-/tmp}/$$.pfa
		/bin/rm ${TMPDIR-/tmp}/$$.pfa
	fi
	}

((cat
echo $prep
if [ "$show" = "psh" ]
then	cat $HOME/ps/emulate.ps - << \*EOP*
%!
% (emulate.ps) run % alternatively to cat-ting it in
/eexec {pop} def
/*definefont /definefont load def
/definefont {dup /FontType get 1 eq
	{dup length 3 add dict copy
	 dup /FontType 3 put
	 dup /Type1EmuDict dup load put
	 dup /BuildChar dup load put
	} if
	1 index registername	% this could be left out if only
			% new fonts (not preloaded into NeWS) are displayed
	*definefont
	} def
/*closefile /closefile load def
/closefile {pop} def % NeWS's closefile crashes
/executeonly {} def
/noaccess {} def
/readonly {} def
*EOP*
fi
for param in $*
do if [ `dirname $param` = / ]
   then echo $param registername
	# take this as explicitly specified fontname instead of filename
   else
	case $param in
	*.pfb|*.pfe|*.rsrc)
		if [ "$show" = "psh" ]
		then	pfbtops $param
		else	pfbtopfa $param
		fi
		echo appendnewfont ;;
	*.pfa)	if [ "$show" = "psh" ]
		then	pfbtops $param
		else	cat $param
		fi
		echo appendnewfont ;;
	*.Z)	zcat $param
		echo appendnewfont ;;
	*.zip)	unzip -p $param
		echo appendnewfont ;;
	*)	cat $param
		echo appendnewfont ;;
	esac
   fi
done ; echo "    " showallfonts showpage quit) | eval $show) << \*EOP*
%! print font samples and character sets
/home {leftborder top moveto} def
/sethome {/top exch def /leftborder exch def} def
/setfontsize {/fontsize exch def} def
/setrightborder {/rightborder exch def} def
40 790 sethome
18 setfontsize
550 setrightborder
/leading 4 def
/nl {currentpoint exch pop leftborder exch fontsize sub leading sub moveto} def

/fontN {fontN} def
/fontB {fontN} def
/fontI {fontB} def
/fontBI {fontB} def
/N {fontN setfont} def
/B {fontB setfont} def
/I {fontI setfont} def
/BI {fontBI setfont} def
/pushfont {/fontBI /fontI load def
	/fontI /fontB load def
	/fontB /fontN load def
	/fontN currentfont def
	} def
/nextfonti 0 def
/setnextfont {[/fontN /fontI /fontB /fontBI] nextfonti get currentfont def
	/nextfonti nextfonti 1 add def
	} def

/namefont {currentfont} def
/showtext {
  N
  (Scoloplos ist euryk. Er ist in der gesamten borealen Region ) show nl
  (in fast allen marinen Sedimenten zu finden, die einen sandigen ) show nl
  (Anteil aufweisen. Man findet ihn von ) show B (Grnland ) show 
	N (bis zum ) show I (Mittelmeer) show N (, ) show nl
  (in der ) show BI (Nordsee) show 
	N (, an der kanadischen Kste und im Weien Meer. ) show nl
  (Er besiedelt sowohl das Eulitoral als auch das Bathyal.) show nl
	} def
/showcset {[cs1 cs2 cs3 cs4 cs5 cs6 cs7] {show nl} forall
	currentfont
	currentpoint
	dup fontsize leading add 3 mul add
		currentfont /FontName get findfont 50 scalefont setfont
		rightborder (Forqen) stringwidth pop sub exch moveto
		(Forqen) show
	moveto
	setfont
	} def
/showcsetbig {
	2 2 scale
	[cs1 cs2 cs3 cs4 cs5 cs6 cs7] {show nl} forall
	.5 .5 scale
	currentfont
	currentpoint
	dup fontsize leading add -2 mul add
		currentfont /FontName get findfont 100 scalefont setfont
		rightborder (Forqen) stringwidth pop sub exch moveto
		(Forqen) show
	moveto
	setfont
	} def
/showname {currentfont namefont setfont
	dup /FontName get dup length string cvs show
	setfont nl
	} def
/showfont { % param: fontname
	fontsize ff
	home
	showtext
	showname
	showcset	% or: showcsetbig
	} def
/showallfonts {
	% if registername was used, replace the automatically generated 
	% fontlist with the explicit one:
	fontlistr length 0 ne {/fontlist fontlistr def} if

	fontlist {fontsize ff setnextfont} forall
	home showtext
	[fontN fontI fontB fontBI] 0 fontlist length getinterval
	{nl setfont (    ) show showname nl
	 showcset	% or: showcsetbig
	} forall
	} def

/findfontISO {dup findfont
	dup maxlength dict begin
	{1 index /FID ne {def} {pop pop } ifelse} forall
	Encoding StandardEncoding eq
	%	pop true
		{/Encoding ISO-Latin-1 def} if
	currentdict end
	definefont
	} def
/ff {exch findfontISO exch dup /fontsize exch def scalefont
	setfont} def

/fontlist [] def
/fontlistr [] def
/FontDirectoryKnown FontDirectory dup length 20 add dict begin
	{def}
	forall
	currentdict end def
/appendnewfont {
	/fontlist [ fontlist aload pop
	FontDirectoryKnown begin
	FontDirectory
	{FontDirectoryKnown 2 index known {pop pop} {2 copy def pop} ifelse
	} forall
	end
	] def
	} def
/registerfont {run appendnewfont} def
/registername {/newfont exch def
	/fontlistr [ fontlistr aload pop newfont ] def
	} def

/=dict { % for debugging
	{2 array astore ==} forall
	} def

/cs1	( !"#$%&'()*+,-./0123456789:;<=>?) def
/cs2	(@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_) def
/cs3	(`abcdefghijklmnopqrstuvwxyz{|}~) def
/cs4	() def
/cs5	() def
/cs6	() def
/cs7	() def

/ISO-Latin-1 [
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
%							     or: /quotesingle
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash
/zero /one /two /three /four /five /six /seven
/eight /nine /colon /semicolon /less /equal /greater /question
/at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O
/P /Q /R /S /T /U /V /W
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
/quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o
% or: /grave
/p /q /r /s /t /u /v /w
/x /y /z /braceleft /bar /braceright /asciitilde /fraction
% accents not in ISO-Latin-1:
/dotlessi /ring /circumflex /tilde /breve /dotaccent
/grave % see comment below
% FrameMaker characters:
/quotesingle % comment: must have /quoteleft instead of /grave, or
		%	/quoteright instead of /quotesingle, resp.,
		%	depending on which is already present above
/quotesinglbase /quotedblbase /quotedblleft /quotedblright
/guilsinglleft /guilsinglright
/trademark
/caron /hungarumlaut /ogonek
/OE /oe
/fi /fl
/dagger /daggerdbl /ellipsis /emdash /florin /periodcentered /perthousand
% DEC-supplemental (also /OE /oe):
/Ydieresis
% further PostScript chars:
/Lslash /lslash

% this must align with 240 octal
/space /exclamdown /cent /sterling /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /endash /registered /macron
/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /bullet
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis
] def

*EOP*