##set pageNumFont="Beteckna" ##set dirNameFont="Beteckna-Bold" ##set fontsNeeded="${font} Beteckna Beteckna-Bold" ##set includeFontComments=<<"END" %%IncludeResource: font ${font} %%IncludeResource: font Beteckna %%IncludeResource: font Beteckna-Bold END ##if ${font} eq Courier ##set charShrinkFactor=0.93 ##set zeroGlyph=Oslash ##set underscoreGlyph=underscore ##set bulletGlyph=bullet ##set tabGlyph=currency ##set leftQuoteGlyph=quoteleft ##set rightQuoteGlyph=quoteright ##set pilcrowGlyph=paragraph ##set barGlyph=bar ##else ##set charShrinkFactor=1 ##set zeroGlyph=Oslash ##set underscoreGlyph=underscore2 ##set bulletGlyph=bullet2 ##set tabGlyph=tabsym ##set leftQuoteGlyph=grave ##set rightQuoteGlyph=quoteright ### was "acute" ##set pilcrowGlyph=erase ##set barGlyph=orsym ##set do_custom_chars=1 ##endif %!PS-Adobe-3.0 %%Orientation: Portrait %%Pages: (atend) %%DocumentNeededResources: font ${fontsNeeded} %%DocumentMedia: Letter 612 792 74 white () %%EndComments %%BeginDefaults %%PageMedia: Letter %%PageResources: font ${fontsNeeded} %%EndDefaults %%BeginProlog %%BeginResource: procset Custom-Preamble 0 0 % % Document definitions % (Upper case to avoid collisions) % % 8.5x11 paper is 612x792 points, but 24 points near the edge or so % shouldn't be used. /Topmargin 770 def /Leftmargin 30 def /Rightmargin 612 Leftmargin sub def /Botmargin 22 def /Bindoffset 40 def /Lineskip -10 def % How much to shrink characters by? /Factor ${charShrinkFactor} def /Fontsize 9.5 Factor mul def % (1000 units is std height, so Courier at 6/10 aspect ratio is 600. % Widen to make up for scaling loss. /Charwidth Rightmargin Leftmargin sub Bindoffset sub 87 div Fontsize div 1000 mul def % Print a header (expects page number on stack) /OddPageStart { save exch /MyFont findfont Fontsize scalefont setfont /CurrentLeft Leftmargin Bindoffset add def /CurrentRight Rightmargin def CurrentLeft Topmargin moveto } def /EvenPageStart { save exch /MyFont findfont Fontsize scalefont setfont /CurrentLeft Leftmargin def /CurrentRight Rightmargin Bindoffset sub def CurrentLeft Topmargin moveto } def % /MyFont findfont [Fontsize 0 0 Fontsize 0 0] makefont setfont % Print the name of the directory in a large font /DirPage { /${dirNameFont} findfont 14 scalefont setfont 0 -10 rmoveto (Directory) show CurrentLeft 30 add currentpoint exch pop 20 sub moveto show } def % Advance a line /L {show CurrentLeft currentpoint exch pop Lineskip add moveto} bind def % Print the "inside" footer line using P (string font => ) % We do some magic involving redefining P to first measure the % width of this string and then print it, so you must use it % to do all printing. /Foot { ##ifdef footerFile ##include "${footerFile}" ##endif } def % /P is defined in the Setup section % Print an odd footer /OddPageEnd { CurrentLeft Botmargin moveto CurrentRight Botmargin lineto 1 setlinewidth stroke CurrentLeft Botmargin 10 sub moveto Foot 10 string cvs dup stringwidth pop CurrentRight exch sub currentpoint exch pop moveto /${pageNumFont} P showpage restore } def % Print an even footer /EvenPageEnd { CurrentLeft Botmargin moveto CurrentRight Botmargin lineto 1 setlinewidth stroke Leftmargin Botmargin 10 sub moveto /${pageNumFont} P CurrentRight FootWidth sub currentpoint exch pop moveto Foot showpage restore } def ##ifdef do_custom_chars % A 1000-point OCRB discunderline consists of: % 111.45 -173.688 moveto % 609.356 -173.688 lineto % 609.356 -70.9227 lineto % 111.45 -70.9227 lineto % closepath % 720.0 -0.0 moveto % Line thickness is % 102.7653 pts. % This would suggest the following values: /underleft 111.45 def /underright 609.356 def /underthick 102.7643 def /underup underthick def /underdown 0 def /underserif 25 def % These look better in GhostScript, but not on a real Adobe rasterizer %/underright 600 def %/underleft 100 def %/underthick 75 def 171 211 36081 % The default bullet character is % 254.0 341.0 moveto % 254.0 170.0 lineto % 465.0 170.0 lineto % 465.0 341.0 lineto % closepath % Our modified version is based on: /bullwid 204 def /bullht 176.75 def /bullleft 254 341 add bullwid sub 2 div def /bullright 254 341 add bullwid add 2 div def /bullbot 254 def /bulltop bullbot bullht add def % And a custom-created tab symbol /tableft 250 def /tabright 550 def /tabtop 550 def /tabbot 50 def /tablinewidth 35 def % Let's try a vertical bar % OCRB defines (|) % 411.062 -173.688 moveto % 411.062 741.043 lineto % 308.297 741.043 lineto % 308.297 -173.688 lineto % closepath % 720.0 -0.0 moveto /orleft 308.297 def /orright 411.062 def /orbot -173.688 def /ortop 741.043 def /orbreak 150 def % Width of break /orbbot ortop orbot add orbreak sub 2 div def % Bottom of break /orbtop ortop orbot add orbreak add 2 div def % Top of break ##endif % newfontname encoding-vec fontname -> - make a new encoded font /MF2 { % Make a dict for the new font, with room for the /Metrics findfont dup length 1 add dict begin % Copy everything except the FID entry {1 index /FID eq {pop pop} {def} ifelse} forall % Set the encoding vector /Encoding exch def ##ifdef do_custom_chars % Create a new expanded CharStrings dictionary CharStrings dup length 5 add dict begin { def } forall % Create a custom underscore character /underscore2 { pop //Charwidth 0 % width, bounding box follows //underleft //underdown neg //underright //underthick //underup add setcachedevice //underleft //underthick //underup add moveto //underleft //underserif add //underthick //underup add lineto //underleft //underserif add //underthick lineto //underright //underserif sub //underthick lineto //underright //underserif sub //underthick //underup add lineto //underright //underthick //underup add lineto //underright //underdown neg lineto //underright //underserif sub //underdown neg lineto //underright //underserif sub 0 lineto //underleft //underserif add 0 lineto //underleft //underserif add //underdown neg lineto //underleft //underdown neg lineto closepath fill } bind def % Create a custom bullet character. /bullet2 { pop //Charwidth 0 % width, bounding box follows //bullleft //bullbot //bullright //bulltop setcachedevice //bullleft //bullbot moveto //bullleft bullright add 2 div bulltop lineto //bullright //bullbot lineto closepath fill } bind def % Create a custom tab character. /tabsym { pop //Charwidth 0 % width, bounding box follows //tableft //tablinewidth sub //tabbot //tablinewidth sub //tabright //tablinewidth add //tabtop //tablinewidth add setcachedevice //tablinewidth setlinewidth true setstrokeadjust 0 setlinejoin //tableft //tabbot moveto //tabright //tabtop //tabbot add 2 div lineto //tableft //tabtop lineto closepath stroke } bind def /orsym { pop //Charwidth 0 % width, bounding box follows //orleft //orbot //orright //ortop setcachedevice //orleft //orbot moveto //orleft //orbbot lineto //orright //orbbot lineto //orright //orbot lineto closepath //orleft //ortop moveto //orleft //orbtop lineto //orright //orbtop lineto //orright //ortop lineto closepath fill } bind def /CharStrings currentdict end def ##endif % Create a new dict to be the /Metrics values CharStrings dup length dict % Now fill in the metrics dict with the desired width begin { pop Charwidth def } forall /Metrics currentdict end def % End of definitions currentdict end % Define the font definefont pop } bind def % Check PostScript language level. /gs_languagelevel /languagelevel where { pop languagelevel } { 1 } ifelse def %%EndResource ##include "charmap.ps" ${includeFontComments} %%EndProlog %%BeginSetup /MyFont Latin1-vec /${font} MF2 /#copies 1 def % Compute the width of the /Foot string, by defining P to % add up the x-width of the characters. /P { findfont 9 scalefont setfont stringwidth pop add } def /FootWidth 0 Foot def % Redefine P to print, as usual /P { findfont 9 scalefont setfont show } def %%BeginResource: procset foo 0 0 % This is an example %%EndResource %%EndSetup