@@ -136,13 +136,31 @@ begin
136136 /barlen barcode length def
137137 options (parse) undef
138138
139+ %
140+ % Check numeric for DLE (ASCII 16) indicating switch to trailing ASCII
141+ %
142+ /trailasclen 0 def
143+ numeric {
144+ barcode <10> search {
145+ /barcode exch def
146+ /trailasc barlen barcode length sub string def
147+ trailasc exch 0 exch putinterval % DLE
148+ trailasc exch 1 exch putinterval
149+ /barlen barcode length def
150+ barlen 0 eq {
151+ /bwipp.telepenNumericDLEFirstCharacter (DLE cannot be first character in Telepen Numeric) //raiseerror exec
152+ } if
153+ /trailasclen trailasc length def
154+ } { pop } ifelse
155+ } if
156+
139157 %
140158 % Apply AST spec overrides and resolve physical specification
141159 %
142160 /telepen ast /apply_ast //render exec not { //raiseerror exec } if
143161 /resolve_strictspec //render exec
144162
145- /sbs barlen 16 mul 48 add string def
163+ /sbs barlen trailasclen add 16 mul 48 add string def
146164
147165 %
148166 % Put the start character ASCII 95
@@ -196,6 +214,17 @@ begin
196214 /l l enc length add def
197215 } loop
198216
217+ 0 1 trailasclen 1 sub {
218+ trailasc exch get /indx exch def
219+ indx 127 gt {
220+ /bwipp.telepenInvalidAlphaCharacter (Telepen Alpha characters must have ordinal values 0 to 127) //raiseerror exec
221+ } if
222+ /checksum checksum indx add def
223+ /enc //telepen.encs indx get def
224+ sbs l enc putinterval
225+ /l l enc length add def
226+ } for
227+
199228 %
200229 % Put the checksum character
201230 %
@@ -217,12 +246,17 @@ begin
217246 /sbs sbs 0 l getinterval def
218247
219248 % Build display text: replace non-printable chars with spaces
220- /text barcode length string def
249+ /text barcode length trailasclen add string def
221250 0 1 barcode length 1 sub {
222251 /i exch def
223252 /c barcode i get def
224253 text i c 32 ge c 126 le and { c } { 32 } ifelse put
225254 } for
255+ 1 1 trailasclen 1 sub { % Skip initial DLE
256+ /i exch def
257+ /c trailasc i get def
258+ text i 1 sub barcode length add c 32 ge c 126 le and { c } { 32 } ifelse put
259+ } for
226260
227261 /sbs [sbs {48 sub} forall] def
228262
0 commit comments