Skip to content

Commit b958757

Browse files
committed
EAN/UPC composite variants: Comments
1 parent 1687716 commit b958757

4 files changed

Lines changed: 54 additions & 8 deletions

File tree

src/ean13composite.ps.src

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Barcode Writer in Pure PostScript
22
% https://bwipp.terryburton.co.uk
33
%
4-
% Copyright (c) 2004-2024 Terry Burton
4+
% Copyright (c) 2004-2025 Terry Burton
55
%
66
% $Id$
77
%
@@ -49,9 +49,10 @@ dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
4949
begin
5050
/ean13composite {
5151

52-
20 dict begin % Confine variables to local scope
52+
20 dict begin
5353

5454
/ctx null def
55+
5556
/dontdraw false def
5657
/usematrix false def
5758
/parse false def
@@ -63,7 +64,9 @@ begin
6364

6465
dontdraw { /usematrix true def } if
6566

67+
%
6668
% Split the linear and composite parts
69+
%
6770
barcode (|) search {
6871
/linear exch def
6972
pop
@@ -77,13 +80,17 @@ begin
7780
options (dontdraw) true put
7881
options (dontlint) true put
7982

83+
%
8084
% Lint with a fake AI (01)
85+
%
8186
comp length 18 add string
8287
dup 0 ((01)00000000000000) putinterval
8388
dup 18 comp putinterval
8489
/ai //gs1process exec pop pop pop
8590

91+
%
8692
% Plot the linear part
93+
%
8794
linear options //ean13 exec
8895
usematrix not {
8996
gsave
@@ -92,10 +99,14 @@ begin
9299

93100
currentpoint
94101

102+
%
95103
% Plot the 2D part
104+
%
96105
-3 78 rmoveto comp options //gs1-cc exec //renmatrix exec
97106

107+
%
98108
% Plot the separator
109+
%
99110
72 add exch 1 sub exch moveto <<
100111
/ren /renmatrix
101112
/pixs [

src/ean8composite.ps.src

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Barcode Writer in Pure PostScript
22
% https://bwipp.terryburton.co.uk
33
%
4-
% Copyright (c) 2004-2024 Terry Burton
4+
% Copyright (c) 2004-2025 Terry Burton
55
%
66
% $Id$
77
%
@@ -49,9 +49,10 @@ dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
4949
begin
5050
/ean8composite {
5151

52-
20 dict begin % Confine variables to local scope
52+
20 dict begin
5353

5454
/ctx null def
55+
5556
/dontdraw false def
5657
/usematrix false def
5758
/parse false def
@@ -63,7 +64,9 @@ begin
6364

6465
dontdraw { /usematrix true def } if
6566

67+
%
6668
% Split the linear and composite parts
69+
%
6770
barcode (|) search {
6871
/linear exch def
6972
pop
@@ -72,19 +75,25 @@ begin
7275
pop /bwipp.missingCompositeComponent (A Composite Component must be provided following a pipe character) //raiseerror exec
7376
} ifelse
7477

78+
%
7579
% Get the result of encoding with ean8 and gs1-cc
80+
%
7681
options (lintype) (ean8) put
7782
options (inkspreadv) 0.0 put
7883
options (dontdraw) true put
7984
options (dontlint) true put
8085

86+
%
8187
% Lint with a fake AI (01)
88+
%
8289
comp length 18 add string
8390
dup 0 ((01)00000000000000) putinterval
8491
dup 18 comp putinterval
8592
/ai //gs1process exec pop pop pop
8693

94+
%
8795
% Plot the linear part
96+
%
8897
linear options //ean8 exec
8998
usematrix not {
9099
gsave
@@ -93,12 +102,16 @@ begin
93102

94103
currentpoint
95104

105+
%
96106
% Plot the 2D part
107+
%
97108
comp options //gs1-cc exec
98109
dup (pixx) get 70 exch sub 78 rmoveto
99110
//renmatrix exec
100111

112+
%
101113
% Plot the separator
114+
%
102115
72 add exch 1 sub exch moveto <<
103116
/ren /renmatrix
104117
/pixs [

src/upcacomposite.ps.src

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Barcode Writer in Pure PostScript
22
% https://bwipp.terryburton.co.uk
33
%
4-
% Copyright (c) 2004-2024 Terry Burton
4+
% Copyright (c) 2004-2025 Terry Burton
55
%
66
% $Id$
77
%
@@ -49,9 +49,10 @@ dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
4949
begin
5050
/upcacomposite {
5151

52-
20 dict begin % Confine variables to local scope
52+
20 dict begin
5353

5454
/ctx null def
55+
5556
/dontdraw false def
5657
/usematrix false def
5758
/parse false def
@@ -63,7 +64,9 @@ begin
6364

6465
dontdraw { /usematrix true def } if
6566

67+
%
6668
% Split the linear and composite parts
69+
%
6770
barcode (|) search {
6871
/linear exch def
6972
pop
@@ -77,13 +80,17 @@ begin
7780
options (dontdraw) true put
7881
options (dontlint) true put
7982

83+
%
8084
% Lint with a fake AI (01)
85+
%
8186
comp length 18 add string
8287
dup 0 ((01)00000000000000) putinterval
8388
dup 18 comp putinterval
8489
/ai //gs1process exec pop pop pop
8590

91+
%
8692
% Plot the linear part
93+
%
8794
linear options //upca exec
8895
usematrix not {
8996
gsave
@@ -92,10 +99,14 @@ begin
9299

93100
currentpoint
94101

102+
%
95103
% Plot the 2D part
104+
%
96105
-3 78 rmoveto comp options //gs1-cc exec //renmatrix exec
97106

107+
%
98108
% Plot the separator
109+
%
99110
72 add exch 1 sub exch moveto <<
100111
/ren /renmatrix
101112
/pixs [

src/upcecomposite.ps.src

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Barcode Writer in Pure PostScript
22
% https://bwipp.terryburton.co.uk
33
%
4-
% Copyright (c) 2004-2024 Terry Burton
4+
% Copyright (c) 2004-2025 Terry Burton
55
%
66
% $Id$
77
%
@@ -49,9 +49,10 @@ dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
4949
begin
5050
/upcecomposite {
5151

52-
20 dict begin % Confine variables to local scope
52+
20 dict begin
5353

5454
/ctx null def
55+
5556
/dontdraw false def
5657
/usematrix false def
5758
/parse false def
@@ -63,7 +64,9 @@ begin
6364

6465
dontdraw { /usematrix true def } if
6566

67+
%
6668
% Split the linear and composite parts
69+
%
6770
barcode (|) search {
6871
/linear exch def
6972
pop
@@ -77,13 +80,17 @@ begin
7780
options (dontdraw) true put
7881
options (dontlint) true put
7982

83+
%
8084
% Lint with a fake AI (01)
85+
%
8186
comp length 18 add string
8287
dup 0 ((01)00000000000000) putinterval
8388
dup 18 comp putinterval
8489
/ai //gs1process exec pop pop pop
8590

91+
%
8692
% Plot the linear part
93+
%
8794
linear options //upce exec
8895
usematrix not {
8996
gsave
@@ -92,10 +99,14 @@ begin
9299

93100
currentpoint
94101

102+
%
95103
% Plot the 2D part
104+
%
96105
-3 78 rmoveto comp options //gs1-cc exec //renmatrix exec
97106

107+
%
98108
% Plot the separator
109+
%
99110
72 add exch 1 sub exch moveto <<
100111
/ren /renmatrix
101112
/pixs [

0 commit comments

Comments
 (0)