home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / ps / videot.ape < prev    next >
Text File  |  1991-03-13  |  6KB  |  237 lines

  1.  
  2. %!PS-Adobe-1
  3. %%Creator: Jamie Zawinski <jwz@lucid.com>
  4. %%Title: video-tape.ps
  5. %%CreationDate: 1-mar-91
  6. %%
  7. %%  PostScript code to generate VHS video cassette labels.  Version 2.0.
  8. %%  Copyright (c) 1991 Jamie Zawinski <jwz@lucid.com>.  Comments welcome.
  9. %%
  10. %%  Permission granted for non-commercial use and distribution so long as
  11. %%  this notice of copyright remains intact.
  12. %%
  13. %%  There are examples of how to use this code at the end of this file.
  14. %%
  15. %%  I find that rubber cement works best for attaching these labels to
  16. %%  video cassettes.  A water-based glue or epoxy will cause the paper
  17. %%  to warp eventually.
  18. %%
  19. %%EndComments
  20.  
  21. % Set this to any (short) string you like.
  22. /ID (JWZ) def
  23. /side-font   /Helvetica-Bold def
  24. /top-font    /Helvetica-Bold def
  25. /header-font /Helvetica-Bold def
  26. /number-font /Helvetica-Bold def
  27.  
  28. % swap the values of FG and BG if you want black-on-white.
  29. /FG 1   def
  30. /MG 0.5 def
  31. /BG 0   def
  32.  
  33. /bdef { bind readonly def } bind readonly def
  34.  
  35. /box {
  36.   4 2 roll
  37.   newpath moveto
  38.     exch dup 0 rlineto
  39.     exch 0 exch neg rlineto
  40.     neg 0 rlineto
  41.   closepath
  42. } bdef
  43.  
  44. /rightshow
  45.  {dup stringwidth pop
  46.   neg 0 rmoveto
  47.   show } bdef
  48.  
  49. /centershow
  50.  {dup stringwidth pop
  51.   2 div neg 0 rmoveto
  52.   show } bdef
  53.  
  54. /inch { 72 mul } bdef
  55.  
  56. /internal-draw-side-label {
  57.   gsave
  58.     1 setlinejoin
  59.     MG setgray
  60.     0 0 5.75 inch 0.75 inch  box fill
  61.     0 setgray
  62.     0 0 5.75 inch  0.75 inch  box stroke
  63.     BG setgray
  64.     1 inch -0.1 inch  4.25 inch 0.55 inch box fill
  65.     0.1 inch -0.1 inch  0.25 inch 0.55 inch box fill
  66.     FG setgray
  67.     1 inch -0.1 inch  4.25 inch 0.55 inch box stroke
  68.     0.1 inch -0.1 inch  0.25 inch 0.55 inch box stroke
  69.     gsave
  70.       number-font findfont [21 0 0 18 0 0] makefont setfont
  71.       0.324 inch -0.375 inch moveto
  72.       90 rotate
  73.       dup stringwidth pop /sw exch def
  74.       sw 0.54 inch gt { 0.54 inch sw div 1 scale } if
  75.       centershow
  76.     grestore
  77. } bdef
  78.  
  79. /draw-side-label {
  80.   gsave
  81.     0 0 moveto
  82.     translate
  83.     internal-draw-side-label
  84.     /names exch def
  85.     /height 0.5 inch names length div def
  86.     side-font findfont [height 0.9 mul 0 0 height 0 0] makefont setfont
  87.     FG setgray
  88.     1.05 inch -0.1 inch height sub moveto
  89.     names {
  90.       dup type /arraytype eq
  91.       { dup 0 get gsave show grestore
  92.     1 get gsave 4.1 inch 0 rmoveto rightshow grestore }
  93.       { gsave show grestore }
  94.       ifelse
  95.       0 height neg rmoveto
  96.     } forall
  97.   grestore
  98. } bdef
  99.  
  100.  
  101. /internal-draw-top-label {
  102.   gsave
  103.      1 setlinejoin
  104.      MG setgray
  105.      0 0 3.1 inch 1.75 inch box fill
  106.      0 setgray 
  107.      0 0 3.1 inch 1.75 inch box stroke
  108.      BG setgray 
  109.      0.1 inch  -0.5 inch  2.9 inch  1.15 inch  box fill
  110.      0.1 inch  -0.1 inch  2.9 inch  0.3 inch   box fill
  111.      FG setgray
  112.      0.1 inch  -0.5 inch  2.9 inch  1.15 inch  box stroke
  113.      0.1 inch  -0.1 inch  2.9 inch  0.3 inch   box stroke
  114.      
  115.      header-font findfont [12 0 0 15 0 0] makefont setfont
  116.      0.2 inch -0.3 inch moveto   (Tape )show show
  117.      header-font findfont [8 0 0 15 0 0] makefont setfont
  118.      2.9 inch -0.3 inch moveto   ID rightshow
  119.   grestore
  120. } bdef
  121.  
  122. /draw-top-label {
  123.   gsave
  124.     0 0 moveto
  125.     translate
  126.     internal-draw-top-label
  127.     /names exch def
  128.     top-font findfont [9 0 0 10 0 0] makefont setfont
  129.     FG setgray
  130.     0.2 inch -0.5 inch 9 dup add sub moveto
  131.     names {
  132.       dup type /arraytype eq
  133.       { dup 0 get gsave show grestore
  134.     1 get gsave 2.7 inch 0 rmoveto rightshow grestore }
  135.       { gsave show grestore }
  136.       ifelse
  137.       0 -9 rmoveto
  138.     } forall
  139.   grestore
  140. } bdef
  141.  
  142. /flag false def
  143. /count 0 def
  144.  
  145. /showpage {
  146.   initgraphics
  147.   0 setgray
  148.   8 inch 0.25 inch moveto 90 rotate
  149.   /Helvetica findfont 6 scalefont setfont
  150.   (video-tape.ps, version 2.0 (c) 1991 Jamie Zawinski <jwz@lucid.com>) show
  151.   systemdict begin showpage end
  152. } bdef
  153.  
  154. /draw-label {
  155.   /names exch def
  156.   /number exch def
  157.   names number 0.5 inch
  158.     flag { 3.58 inch } { 1.02 inch } ifelse
  159.   names number
  160.     flag { 3.63 inch } { 0.5 inch } ifelse
  161.   2.8 inch
  162.   gsave draw-top-label grestore
  163.   gsave draw-side-label grestore
  164.   flag {
  165.     0 3.35 inch translate
  166.     /count count 1 add def
  167.     count 3 eq { showpage /count 0 def } if
  168.   } if
  169.   /flag flag not def
  170. } bdef
  171.  
  172. %%EndProlog
  173.  
  174. %% Examples.
  175.  
  176.  
  177. (006)    [[(DEFCON-4)                (0)]
  178.      [(Videodrome)                ()]
  179.      [(An American Werewolf in London)    ()]]
  180. draw-label
  181.  
  182. (008)    [(Birdy)
  183.      (Rosemary's Baby)
  184.      (Repo Man)
  185.      (How the Grinch Stole Christmas)]
  186. draw-label
  187.  
  188. (023)    [[(The Art of Noise Live)        (0)]
  189.      [(Duran Duran)                (1117)]
  190.      [(Depeche Mode Live in Hamburg)    (1880)]
  191.      [(The The: Infected)            (2548)]
  192.      [(Sugarcubes Live)            (3487)]
  193.      [(Siouxsie and the Banshees: Once Upon a Time)    ()]]
  194. draw-label
  195.  
  196. (028)    [[(The Thing)                (0)]
  197.      [(Attack of the Killer Tomatoes)    (1844)]
  198.      [(Time Bandits)            (2840)]
  199.      [(Max Headroom)            (3922)]
  200.      [()                    (4410)]]
  201. draw-label
  202.  
  203. (057)    [[(Someone to Watch Over Me)        (0:00)]
  204.      [(The Abyss)                (1:46)]
  205.      [(Internal Affairs)            (4:11)]
  206.      [()                    (6:04)]]
  207. draw-label
  208.  
  209. (002)    [(Logan's Run)
  210.      (The Terminator)
  211.      (The Hunger)
  212.      (New Twilight Zone: "Aqua Vita")]
  213. draw-label
  214.  
  215. (051)    [[(The Blob)                (0)]
  216.      [(Straight to Hell)            (1653)]
  217.      [(Legend)                (2679)]
  218.      [(The Company of Wolves)        (4:29)]]
  219. draw-label
  220.  
  221. (053)    [[(Tapeheads)                (0)]
  222.      [(Hellbound: Hellraiser 2)        (1:33)]
  223.      [(The Kiss)                (3:11)]
  224.      (Penn and Teller's Cruel Tricks)
  225.      [(  for Dear Friends)            (4:56)]]
  226. draw-label
  227.  
  228.  
  229. %%Trailer
  230. %
  231. % This line must always be at the end of the file to ensure 
  232. % that the last page is forced out even if it's not full.
  233. %
  234. count 0 eq not { showpage } if
  235.  
  236.  
  237.