@@ -97,17 +97,51 @@ begin
9797 {def} forall
9898 opt currentdict /opt undef //processoptions exec pop
9999
100- textsize 0 le {
101- /bwipp.renlinearBadTextsize (The font size must be greater than zero) //raiseerror exec
102- } if
103-
104100 /uk.co.terryburton.bwipp.global_ctx dup where {
105101 exch get /ctx exch def
106102 barcolor (unset) eq { ctx /default_barcolor 2 copy known {get /barcolor exch def} {pop pop} ifelse } if
107103 backgroundcolor (unset) eq { ctx /default_backgroundcolor 2 copy known {get /backgroundcolor exch def} {pop pop} ifelse } if
108104 bordercolor (unset) eq { ctx /default_bordercolor 2 copy known {get /bordercolor exch def} {pop pop} ifelse } if
109105 } { pop } ifelse
110106
107+ % Input validation
108+
109+ textxalign (unset) ne {
110+ << /offleft dup /left dup /center dup /right dup /offright dup >> textxalign known not {
111+ /bwipp.renmatrixBadTextxalign (textxalign must be offleft, left, center, right or offright) //raiseerror exec
112+ } if
113+ } if
114+
115+ textyalign (unset) ne {
116+ << /above dup /top dup /center dup /bottom dup /below dup >> textyalign known not {
117+ /bwipp.renmatrixBadTextyalign (textyalign must be above, top, center, bottom or below) //raiseerror exec
118+ } if
119+ } if
120+
121+ << /forward dup /backward dup /upward dup /downward dup >> textdirection known not {
122+ /bwipp.renmatrixBadTextdirection (textdirection must be forward, backward, upward or downward) //raiseerror exec
123+ } if
124+
125+ textsize 0 le textsize 25 ge or {
126+ /bwipp.renmatrixBadTextsize (textsize must be greater than zero and less that 25) //raiseerror exec
127+ } if
128+
129+ << /offleft dup /left dup /center dup /right dup /offright dup >> extratextxalign known not {
130+ /bwipp.renmatrixBadExtratextxalign (extratextxalign must be offleft, left, center, right or offright) //raiseerror exec
131+ } if
132+
133+ << /above dup /top dup /center dup /bottom dup /below dup >> extratextyalign known not {
134+ /bwipp.renmatrixBadExtratextyalign (extratextyalign must be above, top, center, bottom or below) //raiseerror exec
135+ } if
136+
137+ << /forward dup /backward dup /upward dup /downward dup >> extratextdirection known not {
138+ /bwipp.renmatrixBadExtratextdirection (extratextdirection must be forward, backward, upward or downward) //raiseerror exec
139+ } if
140+
141+ extratextsize 0 le extratextsize 25 ge or {
142+ /bwipp.renmatrixBadTextsize (extratextsize must be greater than zero and less that 25) //raiseerror exec
143+ } if
144+
111145 % Create bar elements and put them into the bars array
112146 /bars sbs length 1 add 2 idiv array def
113147 /pixx 0 def /pixy 0 def
0 commit comments