% name of textfile: P15 Menu justify (DL/Synergetics May 91 v1.0) % .... % ========= % This file requires the previous download of gonzo.ps % available from http://www.tinaja.com/post01.asp % Make sure the following line agrees with your gonzo.ps location % Use DOUBLE SLASHES anytime you want a single slash in a PS string. (C:/Users/don/Desktop/gonzo/gonzo.psl) run % use internal gonzo % ========== % Gives you a fast and accurate menu ............ justify % Also includes a simple but stunning border. % Here are two needed routines for the menu justify below .... % (A) WIDTH CALCULATIONS 2.20.91 % A new curwide variable lets you calculate the gonzo string % width independent of printing it. Handy for menu justify, etc.. % Use has to be bracketed with /oktoprint false def /oktoadvance % false def --- stuff --- and then true. Works with any justify mode. % make this change to main code so lengths can be extracted. Note that % roomleft gets flushed at line end. gonzo begin /endtheline {/curwide txtwide roomleft sub def justx cvx exec oktoprint {printline} if} bind def % calloutwidth calculates only the width of the string, returning it % to the top of the stack. For consistency with other callouts, use % 0 0 (string) cw. This INCLUDES all stretching and font changes! /cw {save /snapc1 exch def /oktoprint false def /oktoadvance false def /linestring linestring2 def /justx (justL) def 3 1 roll /ypos exch def /xpos exch def stringgonzo curwide snapc1 restore} def end % ///////// (A) WEB FRIENDLY COLOR UTILITIES ///////////// % tintmat is a self-generating list of 216 triple color values /webtintmat [ 0 1 5 { /a exch store 0 1 5 { /b exch store 0 1 5 { 5 div b 5 div a 5 div }for } for } for ] def % setwebtint accepts a color number 0 to 215 and then % sets the PostScript color generator for later use... /setwebtint { abs cvi 216 cvi mod % restrict range webtintmat exch 3 mul 3 getinterval % get values from table aload pop setrgbcolor} def % and set them %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (B) MENU JUSTIFY 2.20.91 % The cm routine takes a leading string and a trailing string seperated % by a delimiter and places a row of CONSTANT WIDTH, PRECISELY SPACED, % VERTICALLY ALIGNED and WHOLE dots (or whatever) between the two. It % is based on putting down the dots first and ERASING only whole dots % that are not wanted. % This has been modified specially for a 10X grid /menudots ( . ) def /menufont {font1} def /mdoteht 0.3 def /menudelim ( ) def /cropleadingspaces true def % drawmdots draws a line of menu dots, using plain old show /drawmdots { gsave menufont xxm yym moveto txtwide menudots stringwidth pop dup /mdot1 exch def div floor cvi {menudots show} repeat grestore } def % spchomp takes a string and conditionally removes all leading spaces, % returning the truncated string /spchomp {cropleadingspaces {dup 0 exch {32 eq {1 add}{exit} ifelse } forall} if exch dup length 2 index sub 3 -1 roll exch getinterval} def % mlineproc takes the mline string and processes it into a leading string, % the dot row, and a trailing string. Unused dots are erased with logic % to insure whole dots only. Null strings are ignored. /mlineproc {mline length 0 gt {drawmdots mline menudelim search {/lmstr exch def pop spchomp /rmstr exch def } if gsave 1 setgray xxm yym moveto mdoteht setlinewidth 0 0 lmstr cw mdot1 div 10 mul ceiling 10 div % for 10X grid mdot1 mul 0 rlineto 137 setwebtint stroke xxm txtwide mdot1 div floor mdot1 mul add yym moveto 0 0 rmstr cw mdot1 div 10 mul ceiling 10 div mdot1 mul % for 10X grid only neg 0 rlineto stroke grestore xxm yym lmstr cl xxm txtwide add yym rmstr cr /yym yym yinc sub def} if} def % mj menujustify accepts tabbed string pairs and converts them into % dotted menu listings.. /cm {gsave /msg exch def /yym exch def /xxm exch def { msg (\n) search {/mline exch def pop /msg exch def mlineproc} {/mline exch def mlineproc exit } ifelse} loop grestore} def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % //// demo - remove or alter before reuse. /// gonzo begin % turn on the preloaded gonzo justification gutility begin % turn on the preloaded gonzo utilities printerror % show any errors to the page nuisance begin % activate the nuisance dictionary /showthegrid false def % view the layout grid? 20 20 10 setgrid % get on the layout grid showthegrid {50 50 showgrid} if % and maybe show it 9 41 mt 5 pu 29 pr 5 pd closepath bestgray 29 setwebtint fill black % title fill goes UNDER border 9 41 mt 29 pd 29 pr 29 pu closepath bestgray 137 setwebtint fill black % body fill goes UNDER border % This is the "magic" border. For other effects, change the roundpath % radius to 0.01, 0.8, 1, 1.5, 2.5, 3.5, 5 or 8. Or -2 or -6 (!) % DO NOT USE 3.0. Use 2.99 instead. 1 setlinejoin 1 setlinecap 2.99 [20 12 6 12 6 9 9 9 9 49 6 49 6 46 41 46 41 49 38 49 38 9 41 9 41 12 20 12] roundpath closepath [0.8 0 0.5 1 0.28 0 0.1 1] superstroke % this draws the title bar and autoerases the ends 0 setlinejoin 0 setlinecap 0.01 [ 9 42 9 41 38 41 38 42 38 40 38 41 9 41 9 40] roundpath closepath [0.8 0 0.5 1 0.28 0 0.1 1] superstroke % set up the menu stuff ... /txtwide 22 def % textwidth /cstretch 0.01 def % extra character kerning /sstretch 0.05 def % extra space kerning /yinc 2.6 def % line spacing /font1 /Palatino-Bold 1.2 gonzofont % two nice yuppy fonts /font2 /Palatino-BoldItalic 1.2 gonzofont % Use Bensquat if you have it /font3 /ZapfChancery-MediumItalic 2.5 gonzofont % for header % Trick to cure Mitzi's anoxerism ... font3 8 setwebtint 23.5 42.7 (Mitzi's Yuppy Fare) cc 23.5 42.75 (Mitzi's Yuppy Fare) cc 23.5 42.8 (Mitzi's Yuppy Fare) cc font1 7 setwebtint 12.5 36.5 (Knockwurst Ala King $3.27 Hot Clam Sundae $1.15 Coconut Anchovy Pizza $8.35 Butterscotch Pudding |2au gratin|1 $1.25 Pastrami & Kiwi Blintz $4.50 Sopapillas, Enchilada Style $2.46 Grape Chili |2au jus|1 $4.45 Avocado & Liver Surprise .15 Chocolate Sushi $25.50) cm showpage % eof