%! % config.psgrid % Configuration and header file for dvips. Load with: dvips -P psgrid % % Draw a line grid in PostScript's standard coordinate grid. % The resulting grid can be used for measuring BoundingBoxes. % % This code is based on code from the book % % @Book{Merz:PostscriptAcrobatBibel, % author = "Thomas Merz", % title = "Die PostScript- und Acrobat-Bibel. Was Sie schon % immer {\"u}ber PostScript und Acrobat/{PDF} wissen % wollten", % publisher = "Thomas Merz Verlag", % year = "1996", % address = "M{\"u}nchen", % edition = "1", % ISBN = "3-9804943-0-6", % } % @Book{Merz:PostscriptAcrobatBible, % author = "Thomas Merz", % title = "PostScript & acrobat/{PDF}: applications, % troubleshooting, and cross-platform publishing", % publisher = "Springer", % year = "1997", % address = "Berlin", % ISBN = "3-540-60854-0", % } % % The original code can be found in file ps/eps/gitter.ps on the CD which % accompanies the German edition. % The original code is copyright (C) Thomas Merz 1994-96. % Incorporation of the original code into this file is with permission of % Thomas Merz. % For further information about the book see http://www.pdflib.com/ % % This file is built so it can be used both as the header file for % PostScript and as the configuration file for dvips. % (Note that dvips ignores any lines beginning with a space or a "%".) % % Copyright (C) 1995-2006 by Volker Kuhlmann. % Released under the terms of the GNU General Public License (GPL) Version 2. % See http://www.gnu.org/ for details. % % Volker Kuhlmann % 25, 26 Oct 1997; 25 Jan 1998; 9 Mar 2000; 11 May 2006 % /dr@wgrid { save 25 dict begin /step 10 def % grid line increment, in PostScript point /medstep 50 def % solid grid lines every this often /numstep 100 def % numbered grid lines every this often /FontSize 10 def % font size of numbers %initgraphics % don't use - can stuff things up and is not necessary newpath 0 setlinecap 0 setlinejoin 10 setmiterlimit clippath pathbbox newpath cvi /ury exch def cvi /urx exch def 10 div floor 10 mul cvi /lly exch def 10 div floor 10 mul cvi /llx exch def urx llx sub /lenx exch def ury lly sub /leny exch def /snaptopixel { transform .25 sub round .25 add exch .25 sub round .25 add exch itransform } bind def 0.01 setlinewidth [1 2] 0 setdash % dashed line 0 setgray /set-line-style { dup medstep mod 0 eq { [ ] 0 setdash } if %dup 100 mod 0 eq { 0.75 setlinewidth 0.35 setgray } if %dup 0 eq { 1.25 setlinewidth } if %dup 0 eq { 0.8 setlinewidth } if dup numstep mod 0 eq { 0.4 setlinewidth } if dup 0 eq { 0.6 setlinewidth } if } bind def llx step urx { % draw vertical lines gsave set-line-style lly snaptopixel moveto 0 leny snaptopixel rlineto stroke grestore } for lly step ury { % draw horizontal lines gsave set-line-style llx exch snaptopixel moveto lenx 0 snaptopixel rlineto stroke grestore } for % circle at (0,0) [ ] 0 setdash 1 setlinewidth newpath 15 0 moveto 0 0 15 0 360 arc stroke /kreis { % clip light circle from existing lines gsave 1 setgray %/d (500) stringwidth pop def dup stringwidth pop /d exch def % adjust circle size to string width currentpoint FontSize 3 div add exch d 2 div add exch d 0.6 mul 0 360 arc fill grestore } def % axes labelling font /Helvetica-Bold findfont FontSize scalefont setfont 0.5 setgray % print axis labelling, X llx numstep div floor numstep mul cvi numstep urx { % for dup 0 eq { pop }{ dup 20 moveto ( ) cvs dup stringwidth pop 2 div neg 0 rmoveto kreis show } ifelse } bind for % print axis labelling, Y lly numstep div floor numstep mul cvi numstep ury { % for dup 0 eq { pop }{ 40 1 index moveto ( ) cvs dup stringwidth pop neg 3 sub FontSize 3 div neg rmoveto kreis show } ifelse } bind for end restore } bind def % dr@wgrid % %% Hook into dvips-generated PS % at start of page: %/bop-hook where % { % pop % /@ldbophookgrid /bop-hook load def % /bop-hook { @ldbophookgrid dr@wgrid } def % }{ % /bop-hook { dr@wgrid } def % } ifelse % at end of page: /eop-hook where { pop /@ldeophookgrid /eop-hook load def /eop-hook { @ldeophookgrid dr@wgrid } def }{ /eop-hook { dr@wgrid } def } ifelse % { % start a procedure so PostScript `ignores' the dvips configuration part. h config.psgrid } pop % PostScript cleanup % % EOF config.psgrid