%! %%%% %%%% %%%% fontpage.PS %%%% %%%% Mark W. Eichin 1/10/88 %%%% %%%% Prints a sorted index of the fonts in the printer, with the %%%% printername and product along the side (with a reference to %%%% where this file is, for those questions "Where did you get %%%% that from?") %%%% %%%% Built around 's sort routine, with %%%% many of my pieces squished in and around. This file is also %%%% included in fontbook.PS and prints this coverpage after it %%%% prints all of the fonts. %%%% %%%% % Sort Routine in PostScript (R) % % by Andrew Marc Greene % Dec. 1987 % Pieces ripped out to fit into font cataloguer (Mark W. Eichin Jan 1988) % % [PostScript is a trademark of Adobe Systems, Inc.] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% STANDARD DEFINITIONS /pica { 12 mul } def /inch { 72 mul } def /over %%%% a b ==> a b a { 1 index } bind def /pageside 11 inch def /pagetop 8.5 inch def %%%% Specific local definitions /sidelen 9 inch def %%%% the height of the box of chars /toplen 6 inch def %%%% the width of the box of chars /nrowsofboxes 32 1 add def %%%% Number of rows (chars + labels) /ncolsofboxes 8 1 add def %%%% Number of columns (chars + labels) /xbox toplen ncolsofboxes div def %%%% x dimension of the box /ybox sidelen nrowsofboxes div def %%%% y dimension of the box /underpad 2 def %%%% padding under the characters /boxfontsize ybox underpad 2 mul sub def %%%% the font size is a bit smaller than the box % Initialize num, which will contain number of items to sort /num 0 def % Get list of items to sort FontDirectory { pop %%%% punt value (font), just keep key (fontname) /st 70 string def %%%% alloc space for name /num num 1 add def %%%% count the fontname st cvs } %%%% save the fontname on the stack forall %%%% stub test: % (Times-Bold) % (Helvetica) % (Symbol) % (AvantGarde-DemiOblique) % /num 4 def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Sort Routines % Compare top element to current "best" % If top element is "better," switch them, % otherwise leave top element on top; % then roll the stack /OneComp { /elt exch def elt best gt {best /best elt def} {elt} ifelse n 1 roll } def % Go through n items one time, leaving "best" item on bottom % Then decrement n and, if n>0, recursively call NComp /NComp { /best exch def /n n 1 sub def 1 1 n {pop OneComp} for best n 1 add 1 roll n 0 gt {NComp} if } def % Initialize n to the number of elements to sort (num) % and begin the sort /n num def NComp % Display the sorted elements /labelfont /Times-Roman findfont boxfontsize scalefont def %%%% 1 1 num {pop dup MAIN num 1 roll} for %%%% build an index page too gsave 7 inch 1 inch translate 90 rotate 1.5 dup scale labelfont setfont 0 0 moveto statusdict begin (Fonts for the ) show product show ( named ) show 32 string printername show end 0 boxfontsize neg moveto ($Source: postscript:/mit/postscript/fontpage.PS$) show grestore labelfont setfont 2 inch sidelen 1 inch add translate 0 0 moveto 1 1 num { ( ) cvs %%%% (name) (##) gsave show (: ) show show %%%% ##. name grestore 0 ybox neg rmoveto %%%% moved down the next line } for showpage %%%% Local Variables: %%%% mode: C %%%% comment-column:0 %%%% comment-start: "%%%% " %%%% comment-end: " " %%%% End: .