luser droog
unread,Aug 25, 2022, 9:39:29 AM8/25/22You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Draws a one page menu using the contents of the /data data structure.
%!
% Menu generator program.
<<
/data [
{ (Coffee) }
{ (Caffe Latte) (5.50) (Espresso, Steamed milk, optional flavored syrup.) }
{ (Iced Latte) (5.50) (Espresso, Milk, Ice, optional flavored syrup.) }
{}
{}
{ (Beer) }
{ (Domestic) (6) (Budweiser, Bud Light, Bud Select, Busch) }
{ () () (Michelob Ultra, Michelob Golden Light, Rolling Rock) }
{ (Import / Craft) (8) () }
{ (Import) () (Corona, Modelo, Dos Equis, Stella Artois) }
{ (Lager) () (Urban Underdog) }
{ (IPAs and Pale Ales) ()
(City Wide APA, State Wide Hazy Pale Ale, Elysian Space Dust) }
{ (12oz Craft) (5.50) (Yeti Stout, Beach Doodad) }
]
/dispatch { dup length load exec }
0 { pop newline }
1 { section }
3 { item }
/section-font { /Palatino-BoldItalic section-size selectfont }
/section-size 22
/item-size 17
/leading -28
/item-font { /Palatino-Bold item-size selectfont }
/price-font { /Helvetica item-size selectfont }
/desc-font { /Palatino-Italic item-size selectfont }
/left 50
/nudge 10
/top { left 10.5 72 mul moveto }
/pos { currentpoint exch pop moveto }
/max { 2 copy lt { exch } if pop }
/newline { left currentpoint exch pop moveto
0 leading rmoveto }
/section { nudge 2 mul 0 rmoveto section-font 0 get show newline }
/item { multi-line-item }
/single-line-item {
item-font dup 0 get show gap1
price-font dup 1 get dup length 0 ne { ($) show show }{ pop } ifelse gap2
desc-font 2 get show newline }
/multi-line-item {
dup 0 get length 0 eq 1 index 1 get length 0 eq and not {
item-font dup 0 get show gap1
price-font dup 1 get dup length 0 ne { ($) show show }{ pop } ifelse
newline
} if
2 get dup length 0 ne {
desc-font nudge 2 mul 0 rmoveto show newline
}{ pop } ifelse }
/calc-gaps {
0 0 3 2 roll % max(col2) max(col1) data
{
dup length 3 eq { % mc2 mc1 item-data
dup 0 get stringwidth pop 3 -1 roll max exch % mc2 mc1' item-data
1 get stringwidth pop 3 -1 roll max exch % mc2' mc1'
}{ pop } ifelse % mc2 mc1
} forall % max(col2) max(col1)
exch 1 index add % max(col1) max(col1)+max(col2)
left add nudge 3 mul add /pos cvx 2 array astore cvx /gap2 exch def
left add nudge add /pos cvx 2 array astore cvx /gap1 exch def
}
>> begin
item-font data calc-gaps
top data {dispatch} forall
showpage quit