aboutsummaryrefslogtreecommitdiffstats
path: root/include/bsf.lpg
blob: 9183b69edd4595b2b88869b4fce94afd6441ec49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
%%BeginResource: procset LoutBasicSetup

% width height linethickness louteuro -
% draw a Euro symbol of this width and height with this line thickness
/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