Skip to content

Commit 4aca7c7

Browse files
committed
code128: Fix raw mode encoder
1 parent bb64824 commit 4aca7c7

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

src/code128.ps.src

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ dup /renlinear dup /uk.co.terryburton.bwipp findresource put
4646
begin
4747
/code128 {
4848

49-
20 dict begin % Confine variables to local scope
49+
20 dict begin
5050

5151
/ctx null def
5252
/dontdraw false def
53-
/includetext false def % Enable/disable text
53+
/includetext false def
5454
/textfont /Courier def
5555
/textsize 10.0 def
5656
/textxoffset 0.0 def
@@ -107,7 +107,13 @@ begin
107107
} loop
108108
/cws cws 0 j getinterval def
109109
/text () def
110-
} if
110+
} {
111+
/text msglen string def
112+
0 1 msglen 1 sub {
113+
/i exch def
114+
text i msg i get dup 0 lt { pop 32 } if put
115+
} for
116+
} ifelse
111117

112118
% Character maps for each state, used by the legacy encoder
113119
{
@@ -171,12 +177,6 @@ begin
171177
/setb charvals 1 get def setb lka setb swc get put setb lkc setb swa get put
172178
/setc charvals 2 get def setc lka setc swa get put setc lkc setc swb get put
173179

174-
/text msglen string def
175-
0 1 msglen 1 sub {
176-
/i exch def
177-
text i msg i get dup 0 lt { pop 32 } if put
178-
} for
179-
180180
% Standard and extended ASCII runlength at position
181181
/numSA [ msglen {0} repeat 0 ] def
182182
/numEA [ msglen {0} repeat 0 ] def
@@ -403,12 +403,6 @@ begin
403403
/setb <<fn3 96 fn2 97 fn1 102 stp 106 lka 99 lkc 101>> def
404404
/setc << fn1 102 stp 106 lka 101 lkc 100>> def
405405

406-
/text msglen string def
407-
0 1 msglen 1 sub {
408-
/i exch def
409-
text i msg i get dup 0 lt { pop 32 } if put
410-
} for
411-
412406
% Encoder states are named A0, B0, C0, A1, B1, and C1.
413407
% A, B, and C are the Code 128 code sets.
414408
% 0 is for ASCII and 1 is for extended ASCII range.
@@ -575,7 +569,7 @@ begin
575569
} for
576570
/csum csum 103 mod def
577571
cws j csum put
578-
cws j 1 add seta stp get put
572+
cws j 1 add 106 put % stp
579573

580574
options /debugcws known { /bwipp.debugcws cws //raiseerror exec } if
581575

0 commit comments

Comments
 (0)