3636% --DESC: GS1 DataBar Expanded Composite
3737% --EXAM: (01)09521234543213(3103)001234|(91)1A2B3C4D5E
3838% --EXOP:
39- % --RNDR: renlinear renmatrix
39+ % --RNDR: renmatrix
4040% --FMLY: GS1 Composite Symbols
4141currentglobal
4242true setglobal
@@ -47,7 +47,6 @@ dup /processoptions dup /uk.co.terryburton.bwipp findresource put
4747dup /databarexpanded dup /uk.co.terryburton.bwipp findresource put
4848dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
4949dup /gs1process dup /uk.co.terryburton.bwipp findresource put
50- dup /renlinear dup /uk.co.terryburton.bwipp findresource put
5150dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
5251begin
5352/databarexpandedcomposite {
5655 {
5756
5857 /dontdraw false def
59- /usematrix false def
6058 /parse false def
6159 /dontlint false def
6260 /lintreqs true def
6967 /uk.co.terryburton.bwipp._dontdraw dup where {exch get} {pop false} ifelse or not
7068 def
7169
72- _render not { /usematrix true def } if
73-
7470 %
7571 % Split the linear and composite parts
7672 %
10298 linear options //databarexpanded exec
10399 dup (sbs) get /linsbs exch def
104100 dup (bhs) get 0 get 72 mul /linheight exch def
105- usematrix not { //renlinear exec } { / linsym exch def } ifelse
101+ / linsym exch def
106102
107103 %
108104 % Plot the separator
@@ -134,86 +130,65 @@ begin
134130 69 98 bot length 13 sub {} for
135131 ] {sepfinder} forall
136132
137- usematrix not {
133+ comp options //gs1-cc exec /compsym exch def
134+ /ccpixs compsym /pixs get def
135+ /ccpixx compsym /pixx get def
138136
139- currentpoint
137+ /linpixs [ 0 % Begin with left guard space
138+ linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates i 1/0's
139+ ] def
140+ /sep [ 0 sep aload pop ] def % Offset by 1
140141
141- %
142- % Plot the 2D part
143- %
144- 1 linheight 1 add rmoveto comp options //gs1-cc exec //renmatrix exec
142+ /linheight linheight cvi def
143+ /diff linpixs length ccpixx sub def % Minimum linpixs length is 102, ccpixx is 99
144+ /ccrpad [ diff 2 sub {0} repeat ] def
145+ /pixs [
146+ 0 ccpixx ccpixs length 1 sub {
147+ /i exch def
148+ 0 0 ccpixs i ccpixx getinterval aload pop ccrpad aload pop
149+ } for
150+ sep aload pop linheight { linpixs aload pop } repeat
151+ ] def
145152
146- linheight add moveto <<
147- /ren /renmatrix
148- /pixs sep
149- /pixx sep length
150- /pixy 1
151- /height 1 72 div
152- /width sep length 72 div
153- /opt options
154- >> //renmatrix exec
153+ /pixx linpixs length def
155154
156- } {
157- comp options //gs1-cc exec /compsym exch def
158- /ccpixs compsym /pixs get def
159- /ccpixx compsym /pixx get def
160-
161- /linpixs [ 0 % Begin with left guard space
162- linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates i 1/0's
163- ] def
164- /sep [ 0 sep aload pop ] def % Offset by 1
165-
166- /linheight linheight cvi def
167- /diff linpixs length ccpixx sub def % Minimum linpixs length is 102, ccpixx is 99
168- /ccrpad [ diff 2 sub {0} repeat ] def
169- /pixs [
170- 0 ccpixx ccpixs length 1 sub {
171- /i exch def
172- 0 0 ccpixs i ccpixx getinterval aload pop ccrpad aload pop
173- } for
174- sep aload pop linheight { linpixs aload pop } repeat
175- ] def
176-
177- /pixx linpixs length def
178-
179- /txt [
180- linsym /txt 2 copy known { get {
181- aload pop 4 -1 roll pixx linpixs length sub 1 add add 4 1 roll 5 array astore
182- } forall } { pop pop } ifelse
183- ] def
184-
185- /pixy pixs length pixx idiv def
186-
187- /borderleft
188- linsym /borderleft 2 copy known { get } { pop pop 10 } ifelse pixx linpixs length sub 1 add sub
189- 1 2 sub % CC QZ; left inset 2
190- 2 copy lt { exch } if pop dup 0 lt { pop 0 } if
191- def
192- /borderright
193- linsym /borderright 2 copy known { get } { pop pop 10 } ifelse % right inset 0
194- 1 ccrpad length sub % CC QZ; right inset ccrpad
195- 2 copy lt { exch } if pop dup 0 lt { pop 0 } if
196- def
197- /bordertop 1 def
198- /borderbottom linsym /borderbottom 2 copy known { get } { pop pop 0 } ifelse def
199-
200- <<
201- /ren /renmatrix
202- /pixs pixs
203- /pixx pixx
204- /pixy pixy
205- /height pixy 72 div
206- /width pixx 72 div
207- /borderleft borderleft
208- /borderright borderright
209- /bordertop bordertop
210- /borderbottom borderbottom
211- /txt txt
212- /opt options
213- >>
214-
215- _render //renmatrix if
216- } ifelse
155+ /txt [
156+ linsym /txt 2 copy known { get {
157+ aload pop 4 -1 roll pixx linpixs length sub 1 add add 4 1 roll 5 array astore
158+ } forall } { pop pop } ifelse
159+ ] def
160+
161+ /pixy pixs length pixx idiv def
162+
163+ /borderleft
164+ linsym /borderleft 2 copy known { get } { pop pop 10 } ifelse pixx linpixs length sub 1 add sub
165+ 1 2 sub % CC QZ; left inset 2
166+ 2 copy lt { exch } if pop dup 0 lt { pop 0 } if
167+ def
168+ /borderright
169+ linsym /borderright 2 copy known { get } { pop pop 10 } ifelse % right inset 0
170+ 1 ccrpad length sub % CC QZ; right inset ccrpad
171+ 2 copy lt { exch } if pop dup 0 lt { pop 0 } if
172+ def
173+ /bordertop 1 def
174+ /borderbottom linsym /borderbottom 2 copy known { get } { pop pop 0 } ifelse def
175+
176+ <<
177+ /ren /renmatrix
178+ /pixs pixs
179+ /pixx pixx
180+ /pixy pixy
181+ /height pixy 72 div
182+ /width pixx 72 div
183+ /borderleft borderleft
184+ /borderright borderright
185+ /bordertop bordertop
186+ /borderbottom borderbottom
187+ /txt txt
188+ /opt options
189+ >>
190+
191+ _render //renmatrix if
217192
218193 } stopped {end stop} if
219194 end
0 commit comments