diff options
author | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 19:21:41 +0000 |
---|---|---|
committer | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 19:21:41 +0000 |
commit | 71bdb35d52747e6d7d9f55df4524d57c2966be94 (patch) | |
tree | 480ee5eefccc40d5f3331cc52d66f722fd19bfb9 /include/bsf.lpg | |
parent | b41263ea7578fa9742486135c762803b52794105 (diff) | |
download | lout-71bdb35d52747e6d7d9f55df4524d57c2966be94.tar.gz |
Lout 3.17.
git-svn-id: http://svn.savannah.nongnu.org/svn/lout/trunk@2 9365b830-b601-4143-9ba8-b4a8e2c3339c
Diffstat (limited to 'include/bsf.lpg')
-rw-r--r-- | include/bsf.lpg | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/include/bsf.lpg b/include/bsf.lpg new file mode 100644 index 0000000..8eb6c02 --- /dev/null +++ b/include/bsf.lpg @@ -0,0 +1,140 @@ +%%BeginResource: procset LoutBasicSetup + +% width height linethickness louteuro - +% draw a Euro symbol of this width and height with this line thickness +% Author: Jeff Kingston, based on code from Andrew Beardsley +/louteuro { + 20 dict begin + /eurothick exch def + /euroheight exch def + /eurowidth exch def + /eurostrokewidth euroheight 0.8 mul def + /eurostep eurothick 60 cos mul 60 sin div def + /eurotheta 40 def + + % llx lly width thickness louteurobox - + % draw angled box starting at (llx, lly) with given width and thickness + /louteurobox + { + /euroboxthick exch def + /euroboxwidth exch def + newpath moveto euroboxwidth 0 rlineto + eurostep euroboxthick rlineto + euroboxwidth neg 0 rlineto closepath fill + } def + + % lower cross stroke + 0 euroheight 2 div eurothick 1.5 mul sub + eurostrokewidth eurothick louteurobox + + % upper cross stroke + 0 euroheight 2 div eurothick 0.5 mul add + eurostrokewidth eurostep 2 mul add eurothick louteurobox + + % circular part + /eurohctr eurowidth euroheight 2 div eurotheta cos mul sub def + /eurovctr euroheight 2 div def + newpath + eurohctr eurovctr eurovctr eurotheta 350 eurotheta sub arc + eurohctr eurovctr eurovctr eurothick sub 365 eurotheta sub eurotheta arcn + closepath fill + end +} def + +% path for @FullWidthRule symbol +/LoutRule +{ 0 0 moveto xsize 0 lineto +} def + +% path for @Box symbol +/LoutBox +{ 0 0 moveto xsize 0 lineto + xsize ysize lineto 0 ysize lineto + closepath +} def + +% path for @CurveBox symbol +/LoutCurveBox +{ xmark 0 moveto + xsize xmark sub xmark xmark 270 360 arc + xsize xmark sub ysize xmark sub xmark 0 90 arc + xmark ysize xmark sub xmark 90 180 arc + xmark xmark xmark 180 270 arc + closepath +} def + +% path for @ShadowBox symbol +/LoutShadowBox +{ xmark 2 mul 0 moveto xsize 0 lineto + xsize ysize xmark 2 mul sub lineto + xsize xmark sub ysize xmark 2 mul sub lineto + xsize xmark sub xmark lineto + xmark 2 mul xmark lineto + closepath +} def + +% set up dictionary containing margin note data: parity LoutMargSet - +/LoutMargSet +{ /LoutMargDict 12 dict def + LoutMargDict begin + /parity exch def + /matr matrix currentmatrix def + /rightx xsize def + /lefty ysize def % highest allowable point for top of next left note + /righty ysize def % highest allowable point for top of next right note + /max { 2 copy gt { pop } { exch pop } ifelse } def + /min { 2 copy lt { pop } { exch pop } ifelse } def + end +} def + +%translate coordinate system for marginal notes: type LoutMargShift - +% where type 0 is left margin, 1 is right margin, 2 is outer, 3 is inner +/LoutMargShift +{ LoutMargDict begin + + % y coordinate of top of note, in margin coords, before vertical adjust + 0 ysize transform matr itransform exch pop + + % decide whether left or right margin based on type and parity + exch [ 0 1 parity 1 parity sub ] exch get 0 eq + { + % left margin: adjust top of note downwards if overlaps previous note + lefty min + + % bottom of note is new lefty position and also translate position + ysize sub dup /lefty exch def + + % want right edge of note at coordinate zero + xsize neg exch + } + { + % right margin: adjust top of note downwards if overlaps previous note + righty min + + % bottom of note is new righty position and also translate position + ysize sub dup /righty exch def + + % want left edge of note at coordinate rightx + rightx exch + } ifelse + + % stack now contains coord of bottom left corner in margin coordinates + matr setmatrix translate + end +} def + +% create LoutPageDict with left, right, foot, top for @Place symbol users +/LoutPageSet +{ + /LoutPageDict 5 dict def + LoutPageDict begin + /matr matrix currentmatrix def + /left 0 def + /right xsize def + /foot 0 def + /top ysize def + end + +} def + +%%EndResource |