Update bwipp_dump; README: mention doc; some other tweaks

This commit is contained in:
gitlost 2022-08-21 15:15:27 +01:00
parent b42f456b88
commit 25c9582ae2
7 changed files with 58 additions and 462 deletions

View file

@ -1914,7 +1914,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "pharmacode", BARCODE_PHARMA, 51, 0, 0, 0, 1 /*linear_row_height*/, 0, },
{ "pzn", BARCODE_PZN, 52, 0, 0, 0, 0, 0, },
{ "pharmacode2", BARCODE_PHARMA_TWO, 53, 0, 0, 0, 0, 0, },
{ "", -1, 54, 0, 0, 0, 0, 0, },
{ "", BARCODE_CEPNET, 54, 0, 0, 0, 0, 0, },
{ "pdf417", BARCODE_PDF417, 55, 1, 1, 1, 0, 0, },
{ "pdf417compact", BARCODE_PDF417COMP, 56, 1, 1, 1, 0, 0, },
{ "maxicode", BARCODE_MAXICODE, 57, 1, 1, 0, 0, 0, },
@ -2998,6 +2998,9 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
testutil_pclose(fp);
return -1;
}
if (h * 2 == bwipp_row_height[r]) { /* Hack to use middle row (avoids add-on text offsets) */
memcpy(b - cnt, b, cnt);
}
}
}
*b = '\0';

View file

@ -1,425 +1,6 @@
--- /home/mburke/code/gitlost/postscriptbarcode/build/monolithic/barcode.ps 2022-08-07 21:25:25.243853138 +0100
+++ backend/tests/tools/bwipp_dump.ps 2022-08-07 21:28:28.580645899 +0100
@@ -16846,8 +16846,8 @@
} bind
/fime {
/sbs [2.25 6.75 2.25 15.75 2.25 6.75 2.25] def
- /bhs [.625 .625 .625 .625 .625 .625 .625] def
- /bbs [0 0 0 0 0 0 0] def
+ /bhs [.625 .625 .625 .625] def
+ /bbs [0 0 0 0] def
} bind
>> def
@@ -28303,7 +28303,7 @@
pop
} ifelse
- gsave
+ dontdraw not { gsave } if
options (lintype) (ean13) put
options (inkspread) (0) put
@@ -28317,27 +28317,73 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //ean13 exec //renlinear exec
+ linear options //ean13 exec
+ dontdraw not {
+ //renlinear exec
- % Plot the separator
- -1 72 rmoveto <<
- /ren //renmatrix
- /pixs [
- 0 1 93 {0} repeat 1 0
- 1 0 93 {0} repeat 0 1
- 0 1 93 {0} repeat 1 0
- ]
- /pixx 97
- /pixy 3
- /height 6 72 div
- /width 97 72 div
- /opt options
- >> //renmatrix exec
+ % Plot the separator
+ -1 72 rmoveto <<
+ /ren //renmatrix
+ /pixs [
+ 0 1 93 {0} repeat 1 0
+ 1 0 93 {0} repeat 0 1
+ 0 1 93 {0} repeat 1 0
+ ]
+ /pixx 97
+ /pixy 3
+ /height 6 72 div
+ /width 97 72 div
+ /opt options
+ >> //renmatrix exec
- % Plot the 2D part
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
+ % Plot the 2D part
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
- grestore
+ grestore
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
+
+ /compsym comp options //gs1-cc exec def
+ /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def
+
+ /linpad [ ccpixx 97 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
+ /pixs pixs
+ /pixx pixx
+ /pixy pixy
+ /height pixy 72 div
+ /width pixx 72 div
+ /opt options
+ >>
+ } ifelse
end
@@ -28401,7 +28447,7 @@
pop
} ifelse
- gsave
+ dontdraw not { gsave } if
% Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put
@@ -28416,29 +28462,75 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //ean8 exec //renlinear exec
+ linear options //ean8 exec
+ dontdraw not {
+ //renlinear exec
- % Plot the separator
- -1 72 rmoveto <<
- /ren //renmatrix
- /pixs [
- 0 1 65 {0} repeat 1 0
- 1 0 65 {0} repeat 0 1
- 0 1 65 {0} repeat 1 0
- ]
- /pixx 69
- /pixy 3
- /height 6 72 div
- /width 69 72 div
- /opt options
- >> //renmatrix exec
+ % Plot the separator
+ -1 72 rmoveto <<
+ /ren //renmatrix
+ /pixs [
+ 0 1 65 {0} repeat 1 0
+ 1 0 65 {0} repeat 0 1
+ 0 1 65 {0} repeat 1 0
+ ]
+ /pixx 69
+ /pixy 3
+ /height 6 72 div
+ /width 69 72 div
+ /opt options
+ >> //renmatrix exec
+
+ % Plot the 2D part
+ comp options //gs1-cc exec
+ dup (pixx) get 69 exch sub 6 rmoveto
+ //renmatrix exec
- % Plot the 2D part
- comp options //gs1-cc exec
- dup (pixx) get 69 exch sub 6 rmoveto
- //renmatrix exec
+ grestore
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
- grestore
+ /compsym comp options //gs1-cc exec def
+ /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def
+
+ /linpad [ ccpixx 69 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 65 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
+ /pixs pixs
+ /pixx pixx
+ /pixy pixy
+ /height pixy 72 div
+ /width pixx 72 div
+ /opt options
+ >>
+ } ifelse
end
@@ -28502,7 +28594,7 @@
pop
} ifelse
- gsave
+ dontdraw not { gsave } if
options (lintype) (ean13) put
options (inkspread) (0) put
@@ -28516,27 +28608,73 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //upca exec //renlinear exec
+ linear options //upca exec
+ dontdraw not {
+ //renlinear exec
- % Plot the separator
- -1 72 rmoveto <<
- /ren //renmatrix
- /pixs [
- 0 1 93 {0} repeat 1 0
- 1 0 93 {0} repeat 0 1
- 0 1 93 {0} repeat 1 0
- ]
- /pixx 97
- /pixy 3
- /height 6 72 div
- /width 97 72 div
- /opt options
- >> //renmatrix exec
+ % Plot the separator
+ -1 72 rmoveto <<
+ /ren //renmatrix
+ /pixs [
+ 0 1 93 {0} repeat 1 0
+ 1 0 93 {0} repeat 0 1
+ 0 1 93 {0} repeat 1 0
+ ]
+ /pixx 97
+ /pixy 3
+ /height 6 72 div
+ /width 97 72 div
+ /opt options
+ >> //renmatrix exec
- % Plot the 2D part
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
+ % Plot the 2D part
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
- grestore
+ grestore
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
+
+ /compsym comp options //gs1-cc exec def
+ /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def
+
+ /linpad [ ccpixx 97 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
+ /pixs pixs
+ /pixx pixx
+ /pixy pixy
+ /height pixy 72 div
+ /width pixx 72 div
+ /opt options
+ >>
+ } ifelse
end
@@ -28615,7 +28753,7 @@
/opt options
>> def
- gsave
+ dontdraw not { gsave } if
options (lintype) (upce) put
options (inkspread) (0) put
@@ -28629,27 +28767,73 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //upce exec //renlinear exec
+ linear options //upce exec
+ dontdraw not {
+ //renlinear exec
- % Plot the separator
- -1 72 rmoveto <<
- /ren //renmatrix
- /pixs [
- 0 1 49 {0} repeat 1 0
- 1 0 49 {0} repeat 0 1
- 0 1 49 {0} repeat 1 0
- ]
- /pixx 53
- /pixy 3
- /height 6 72 div
- /width 53 72 div
- /opt options
- >> //renmatrix exec
+ % Plot the separator
+ -1 72 rmoveto <<
+ /ren //renmatrix
+ /pixs [
+ 0 1 49 {0} repeat 1 0
+ 1 0 49 {0} repeat 0 1
+ 0 1 49 {0} repeat 1 0
+ ]
+ /pixx 53
+ /pixy 3
+ /height 6 72 div
+ /width 53 72 div
+ /opt options
+ >> //renmatrix exec
- % Plot the 2D part
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
+ % Plot the 2D part
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
- grestore
+ grestore
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
+
+ /compsym comp options //gs1-cc exec def
+ /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def
+
+ /linpad [ ccpixx 53 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 49 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
+ /pixs pixs
+ /pixx pixx
+ /pixy pixy
+ /height pixy 72 div
+ /width pixx 72 div
+ /opt options
+ >>
+ } ifelse
end
@@ -28713,7 +28897,7 @@
--- /home/mburke/code/gitlost/postscriptbarcode/build/monolithic/barcode.ps 2022-08-21 02:09:58.212358116 +0100
+++ backend/tests/tools/bwipp_dump.ps 2022-08-21 02:18:52.142394720 +0100
@@ -29000,7 +29000,7 @@
pop
} ifelse
@ -428,7 +9,7 @@
options (lintype) (databaromni) put
options (linkage) true put
@@ -28731,7 +28915,7 @@
@@ -29018,7 +29018,7 @@
linear options //databaromni exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -437,7 +18,7 @@
% Plot the separator
/sepfinder {
@@ -28762,20 +28946,66 @@
@@ -29049,20 +29049,66 @@
sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder
@ -516,7 +97,7 @@
end
@@ -28838,7 +29068,7 @@
@@ -29125,7 +29171,7 @@
pop
} ifelse
@ -525,7 +106,7 @@
options (lintype) (databarstacked) put
options (linkage) true put
@@ -28856,7 +29086,7 @@
@@ -29143,7 +29189,7 @@
linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -534,7 +115,7 @@
% Plot the separator
/sepfinder {
@@ -28884,20 +29114,52 @@
@@ -29171,20 +29217,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -599,7 +180,7 @@
end
@@ -28960,7 +29222,7 @@
@@ -29247,7 +29325,7 @@
pop
} ifelse
@ -608,7 +189,7 @@
options (lintype) (databarstackedomni) put
options (linkage) true put
@@ -28978,7 +29240,7 @@
@@ -29265,7 +29343,7 @@
linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -617,7 +198,7 @@
% Plot the separator
/sepfinder {
@@ -29006,20 +29268,52 @@
@@ -29293,20 +29371,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -682,7 +263,7 @@
end
@@ -29209,7 +29503,7 @@
@@ -29496,7 +29606,7 @@
pop
} ifelse
@ -691,7 +272,7 @@
options (lintype) (databarlimited) put
options (linkage) true put
@@ -29227,7 +29521,7 @@
@@ -29514,7 +29624,7 @@
linear options //databarlimited exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -700,7 +281,7 @@
% Plot the separator
mark
@@ -29235,22 +29529,68 @@
@@ -29522,22 +29632,68 @@
counttomark 1 sub array astore /sep exch def pop pop
sep 0 [0 0 0] putinterval
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
@ -738,8 +319,7 @@
+ /compsym comp options //gs1-cc exec def
+ /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def
- grestore
+
+ /linpixs [ 0 % Begin with left guard space
+ linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
@ -768,7 +348,8 @@
+ ] def
+ /pixx ccpixx 1 add def
+ } ifelse
+
- grestore
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
@ -783,7 +364,7 @@
end
@@ -29314,7 +29654,7 @@
@@ -29601,7 +29757,7 @@
pop
} ifelse
@ -792,7 +373,7 @@
options (lintype) (databarexpanded) put
options (linkage) true put
@@ -29332,7 +29672,7 @@
@@ -29619,7 +29775,7 @@
linear options //databarexpanded exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -801,7 +382,7 @@
% Plot the separator
/sepfinder {
@@ -29361,20 +29701,60 @@
@@ -29648,20 +29804,60 @@
18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for
] {sepfinder} forall
@ -874,7 +455,7 @@
end
@@ -29437,7 +29817,7 @@
@@ -29724,7 +29920,7 @@
pop
} ifelse
@ -883,7 +464,7 @@
options (lintype) (databarexpandedstacked) put
options (linkage) true put
@@ -29455,7 +29835,7 @@
@@ -29742,7 +29938,7 @@
linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -892,7 +473,7 @@
% Plot the separator
/sepfinder {
@@ -29481,21 +29861,49 @@
@@ -29768,21 +29964,49 @@
19 98 bot length 13 sub {} for
70 98 bot length 13 sub {} for
] {sepfinder} forall
@ -955,7 +536,7 @@
end
@@ -29559,7 +29967,7 @@
@@ -29846,7 +30070,7 @@
pop
} ifelse
@ -964,7 +545,7 @@
options (inkspread) (0) put
options (dontdraw) true put
@@ -29593,35 +30001,87 @@
@@ -29880,35 +30104,87 @@
linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -1066,7 +647,7 @@
end
@@ -31105,3 +31565,189 @@
@@ -31392,3 +31668,189 @@
% --END ENCODER hibcazteccode--
% --END TEMPLATE--