summaryrefslogtreecommitdiff
path: root/fonts/utilities/psposter/fontshow.ps
blob: 9e626223d0dad71b4d77a35983217cb1399a4f07 (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
%!PS-Adobe-3.0
%=======================================================================
% Send this file to a PostScript device to list the names of all of
% the resident fonts, in ascending order, together with a small sample
% of each font.
%=======================================================================
%%Title: fontshow.ps
%%CreationDate: Thu Dec 15 09:31:00 MST 1994
%%Creator: Nelson H. F. Beebe <beebe@sunrise>
%%For: Nelson H. F. Beebe <beebe@sunrise>
%%BoundingBox: 0 0 612 792
%%DocumentMedia: A 612 792 () () ()
%%DocumentData: Clean7Bit
%%DocumentFonts: font Courier Times-Bold
%%DocumentNeededResources: font Courier Times-Bold
%%DocumentSuppliedResources:
%%Orientation: Portrait
%%PageOrder: Ascend
%%Pages: 1
% NB: The number of pages depends on the number of resident fonts
%%EndComments
%=======================================================================
%%BeginProlog
/fontshowdict 50 dict def
fontshowdict begin

/inch { 72 mul } def

/PointSize 10 def

/ColumnWidth 3.24 inch def	% slightly less than (8.5 - 2)/2

/Courier findfont PointSize scalefont setfont

/BaselineSkipFactor 1.2 def

/BaselineSkip { PointSize BaselineSkipFactor mul } def

/BottomOfColumn { y 1 inch lt } def

/ColumnOffPage { x ColumnWidth add 7.5 inch gt } def

/Bubblesort % Here is the sorting routine, courtesy of ulfis@nada.kth.se
{ % Usage: array Bubblesort
  % This code may be used for arrays of strings and arrays of numbers
  /TheArray exch def
  /num TheArray length def
  num 1 gt 
  {
    1 1 num 1 sub
    {
      /localcount exch def
      num 1 sub -1 localcount
      {
        /innercount exch def
        /firststring TheArray innercount 1 sub get def
        /secondstring TheArray innercount get def
        firststring secondstring gt
        {
           TheArray innercount 1 sub secondstring put
           TheArray innercount firststring put
        } if
      } for
    } for
  } if
} def

/ColumnSpaceCheck
{ % Usage: vertical-space-needed ColumnSpaceCheck
    y exch
    neg y add /y exch def
    BottomOfColumn { pop NewColumn } { /y exch def } ifelse
} def

/FontShow
{ % Usage: fontname FontShow
    currentfont exch
    findfont 0.8 PointSize mul scalefont setfont
    (ABCDEFGHIJKLMNOPQRSTUVWXYZ) show NewLine
    (abcdefghijklmnopqrstuvwxyz) show NewLine
    (0123456789 !@#$%^&*()_+|~-=\\`{}[]:";'<>?,./) show NewLine
    (The quick brown fox jumps over the lazy dog.) show NewLine
    NewLine
    setfont
} def

/NewColumn
{
    /x x ColumnWidth add def
    /y Y def
    ColumnOffPage { showpage NewPage } if
    x y moveto
} def

/NewLine
{
    /y y BaselineSkip sub def
    BottomOfColumn { NewColumn } if
    x y moveto
} def

/NewPage
{
    /x 1 inch def
    /Y 10 inch PointSize BaselineSkipFactor mul sub def % top of column
    /y Y def
    x y moveto
} def

end % fontshowdict
%%EndProlog
%=======================================================================
%%BeginSetup
/#copies 1  def
fontshowdict begin

% Count the fonts available, while putting all of the font names on
% the stack.  We need to create a new string for each of them, because
% scratch gets reused on each loop iteration.
/n 0 def
systemdict /resourceforall known
  {				% Level 2 PostScript
    /scratch 256 string def
    (*) { /n n 1 add def dup length string cvs } scratch /Font resourceforall
  }
  { 				% Level 1 PostScript
    FontDirectory { pop /n n 1 add def dup length string cvs } forall 
  }
ifelse

% Make an array to hold the font names and then store them from the stack
/FontArray n array def
FontArray astore

% Sort the font array (astore left FontArray on the stack)
Bubblesort

end %fontshowdict
%%EndSetup
%=======================================================================
%%Page: 1 1
%%BeginPageSetup
fontshowdict begin
NewPage
%%EndPageSetup

% Display the sorted fonts: this make take several pages
/n 0 def
/nstr 10 string def
FontArray
{
    dup
    BaselineSkip 2 mul BaselineSkip 0.8 mul 5 mul add ColumnSpaceCheck
    /n n 1 add def
    n   10 lt { ( ) show } if
    n  100 lt { ( ) show } if
    n 1000 lt { ( ) show } if
    n nstr cvs show
    (: ) show
    show
    NewLine
    cvn FontShow
}
forall

/Times-Bold findfont PointSize scalefont setfont
(Total memory: ) show
vmstatus 40 string cvs show
NewLine

(Memory used: ) show
40 string cvs show
NewLine

pop				% discard 3rd vmstatus value

(Free memory: ) show
vmstatus exch sub 40 string cvs show
NewLine

pop				% discard 3rd vmstatus value

end % fontshowdict

showpage
%%PageTrailer
%=======================================================================
%%Trailer
%%EOF