FIM: add support for FIM E; update bwipp_dump.ps

This commit is contained in:
gitlost 2022-01-02 23:22:22 +00:00
parent 25807ad43c
commit e9d5bf8d88
7 changed files with 69 additions and 59 deletions

View File

@ -52,6 +52,7 @@ Changes
algorithm (previous default)
- Matrix symbols: change horizontal boundary bars to appear outside any
vertical whitespace, as they're decorative rather than functional (#247)
- FIM: Add support for FIM E
Bugs
----

View File

@ -342,8 +342,12 @@ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length)
case 'D':
expand(symbol, "1111131311111", 13);
break;
case 'e':
case 'E':
expand(symbol, "1317131", 7);
break;
default:
strcpy(symbol->errtxt, "487: Invalid character in data (\"A\", \"B\", \"C\" or \"D\" only)");
strcpy(symbol->errtxt, "487: Invalid character in data (\"A\", \"B\", \"C\", \"D\" or \"E\" only)");
return ZINT_ERROR_INVALID_DATA;
break;
}

View File

@ -235,7 +235,8 @@ static void test_input(int index, int debug) {
/* 13*/ { BARCODE_FIM, -1, 0, "c", 0, 1, 17, 50 },
/* 14*/ { BARCODE_FIM, -1, 0, "d", 0, 1, 17, 50 },
/* 15*/ { BARCODE_FIM, -1, 0, "ad", ZINT_ERROR_TOO_LONG, -1, -1, -1 },
/* 16*/ { BARCODE_FIM, -1, 0, "e", ZINT_ERROR_INVALID_DATA, -1, -1, -1 },
/* 14*/ { BARCODE_FIM, -1, 0, "e", 0, 1, 17, 50 },
/* 16*/ { BARCODE_FIM, -1, 0, "f", ZINT_ERROR_INVALID_DATA, -1, -1, -1 },
/* 17*/ { BARCODE_RM4SCC, -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 3, 299, 8 },
/* 18*/ { BARCODE_RM4SCC, -1, 0, "a", 0, 3, 19, 8 }, // Converts to upper
/* 19*/ { BARCODE_RM4SCC, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1 },
@ -325,105 +326,108 @@ static void test_encode(int index, int generate, int debug) {
/* 3*/ { BARCODE_FIM, "C", 0, 1, 17, "USPS DMM Exhibit 8.2.0 FIM C",
"10100010001000101"
},
/* 4*/ { BARCODE_RM4SCC, "BX11LT1A", 0, 3, 75, "Verified manually against tec-it",
/* 4*/ { BARCODE_FIM, "E", 0, 1, 17, "",
"10001000000010001"
},
/* 5*/ { BARCODE_RM4SCC, "BX11LT1A", 0, 3, 75, "Verified manually against tec-it",
"100010001010100000000010100000101010000010100010000000101000100010100000101"
"101010101010101010101010101010101010101010101010101010101010101010101010101"
"001010000010000010001000100010001010000010101000000010001010001000000010101"
},
/* 5*/ { BARCODE_RM4SCC, "W1J0TR01", 0, 3, 75, "Verified manually against tec-it",
/* 6*/ { BARCODE_RM4SCC, "W1J0TR01", 0, 3, 75, "Verified manually against tec-it",
"101010000000001010100000100000101010001000100010000000101000001010101000001"
"101010101010101010101010101010101010101010101010101010101010101010101010101"
"000010100000100010001000100000101010100000100000100000101000100010001010001"
},
/* 6*/ { BARCODE_RM4SCC, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 3, 299, "Verified manually against tec-it",
/* 7*/ { BARCODE_RM4SCC, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 3, 299, "Verified manually against tec-it",
"10000010100000101000001010000010100000101000001010001000100010001000100010001000100010001000100010001010000010100000101000001010000010100000101000100000101000001010000010100000101000001010000010100010001000100010001000100010001000100010001000101000001010000010100000101000001010000010100000101000001"
"10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"00000010100010001000101000100000101000100010100000000010100010001000101000100000101000100010100000000010100010001000101000100000101000100010100000000010100010001000101000100000101000100010100000000010100010001000101000100000101000100010100000000010100010001000101000100000101000100010100000101000001"
},
/* 7*/ { BARCODE_JAPANPOST, "15400233-16-4-205", 0, 3, 133, "Zip/Barcode Manual p.6 1st example; verified manually against tec-it",
/* 8*/ { BARCODE_JAPANPOST, "15400233-16-4-205", 0, 3, 133, "Zip/Barcode Manual p.6 1st example; verified manually against tec-it",
"1000101000100010101000100000100000100010001010001010001000101000001010001000101000001000100010100000100010000010000010000010001010001"
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"1010101000100010100010100000100000101000101000101000001000101000100010001000100010001000101000100000100010001000001000001000100010101"
},
/* 8*/ { BARCODE_JAPANPOST, "350110622-1A308", 0, 3, 133, "Zip/Barcode Manual p.6 2nd example; verified manually against tec-it",
/* 9*/ { BARCODE_JAPANPOST, "350110622-1A308", 0, 3, 133, "Zip/Barcode Manual p.6 2nd example; verified manually against tec-it",
"1000001010100010100000101000101000100000001010100010100010001000101000001000100000001010100000100010000010000010000010000010100010001"
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"1010101000100010100000101000101000100000100010101000101000001000101000100000100000101000100000001010001000001000001000001000100010101"
},
/* 9*/ { BARCODE_JAPANPOST, "12345671-2-3", 0, 3, 133, "Verified manually against tec-it",
/* 10*/ { BARCODE_JAPANPOST, "12345671-2-3", 0, 3, 133, "Verified manually against tec-it",
"1000101000100010001010101000100010001010101000101000001000100010001000001010000010000010000010000010000010000010000010000010100010001"
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"1010101000101000101000100010100010100010001010101000001000101000001000101000001000001000001000001000001000001000001000001000100010101"
},
/* 10*/ { BARCODE_JAPANPOST, "1234567BCDEFG", 0, 3, 133, "Verified manually against tec-it",
/* 11*/ { BARCODE_JAPANPOST, "1234567BCDEFG", 0, 3, 133, "Verified manually against tec-it",
"1000101000100010001010101000100010001010101000001000101000001000100010001000001010001000101000001000100010001000001010000010101000001"
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"1010101000101000101000100010100010100010001010100000101000100000101000100000101000100000100010100000100010100000100010001000100010101"
},
/* 11*/ { BARCODE_JAPANPOST, "8901234HIJKLM", 0, 3, 133, "Verified manually against tec-it",
/* 12*/ { BARCODE_JAPANPOST, "8901234HIJKLM", 0, 3, 133, "Verified manually against tec-it",
"1000100010001010100000101000100010001010101000001000101000001000100010001000001010000010100000000010101000000010100010000010100000001"
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"1010001010001010100000101000101000101000100010100000001010100000001010100000001010100000100000100000101000100000101000001000000010101"
},
/* 12*/ { BARCODE_JAPANPOST, "0987654NOPQRS", 0, 3, 133, "Verified manually against tec-it",
/* 13*/ { BARCODE_JAPANPOST, "0987654NOPQRS", 0, 3, 133, "Verified manually against tec-it",
"1000100000001010100010101000001010100010101000000010001010000010101000000010100010000010001010000010101000000010100010000010100000001"
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"1010100000001010001010001010100010100010100010100000101000100000100010100000100010100000100010100000001010100000001010001000001000101"
},
/* 13*/ { BARCODE_JAPANPOST, "3210987TUVWXY", 0, 3, 133, "Verified manually against tec-it",
/* 14*/ { BARCODE_JAPANPOST, "3210987TUVWXY", 0, 3, 133, "Verified manually against tec-it",
"1000001010100010101000100000001010100010101000000010001010100000100000100000101000100000100010100000001010100000101000000010000010001"
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"1010101000101000101000100000001010001010001010100000001010001000100000001000101000001000101000001000101000001000100010001000100000101"
},
/* 14*/ { BARCODE_KOREAPOST, "010230", 0, 1, 167, "Verified manually against tec-it",
/* 15*/ { BARCODE_KOREAPOST, "010230", 0, 1, 167, "Verified manually against tec-it",
"10001000100000000000100010000000000010001000100000001000000010001000100010001000100000000000100000000001000100010001000100010001000000000001000000010001000000010001000"
},
/* 15*/ { BARCODE_KOREAPOST, "923457", 0, 1, 168, "Verified manually against tec-it",
/* 16*/ { BARCODE_KOREAPOST, "923457", 0, 1, 168, "Verified manually against tec-it",
"000010001000100000001000100000001000000010001000000010001000000010001000100000000000100010001000000010000000100010001000100010000000100000001000100010001000000000001000"
},
/* 16*/ { BARCODE_PLANET, "4012345235636", 0, 2, 143, "USPS Publication 197 (2004) Exhibit 4; verified manually against tec-it",
/* 17*/ { BARCODE_PLANET, "4012345235636", 0, 2, 143, "USPS Publication 197 (2004) Exhibit 4; verified manually against tec-it",
"10100010100000001010101010100000101000100010100000101000101000100010001010100010001010000010100010001010000010101010000010100000101010000010101"
"10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
},
/* 17*/ { BARCODE_PLANET, "40123452356", 0, 2, 123, "Verified manually against tec-it",
/* 18*/ { BARCODE_PLANET, "40123452356", 0, 2, 123, "Verified manually against tec-it",
"101000101000000010101010101000001010001000101000001010001010001000100010101000100010100000101000100010100000101010001000101"
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
},
/* 18*/ { BARCODE_PLANET, "5020140235635", 0, 2, 143, "USPS Publication 197 (2004) Exhibit 6; verified manually against tec-it",
/* 19*/ { BARCODE_PLANET, "5020140235635", 0, 2, 143, "USPS Publication 197 (2004) Exhibit 6; verified manually against tec-it",
"10100010001000001010101010001000000010101010101000001000101000000010101010100010001010000010100010001010000010101010000010100010001010001010001"
"10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
},
/* 19*/ { BARCODE_KIX, "2500GG30250", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 1",
/* 20*/ { BARCODE_KIX, "2500GG30250", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 1",
"000010100000101000001010000010100010100000101000000010100000101000001010000010100000101"
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"001010001010000000001010000010101000100010001000100000100000101000101000101000000000101"
},
/* 20*/ { BARCODE_KIX, "2130VA80430", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 2",
/* 21*/ { BARCODE_KIX, "2130VA80430", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 2",
"000010100000101000001010000010101010000000100010001000100000101000001010000010100000101"
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"001010000010001010000010000010100010001010001000001010000000101010001000100000100000101"
},
/* 21*/ { BARCODE_KIX, "1231GF156X2", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 3",
/* 22*/ { BARCODE_KIX, "1231GF156X2", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 3",
"000010100000101000001010000010100010100000101000000010100000101000100010101000000000101"
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"001000100010100010000010001000101000100010000010001000101010000000001010100000100010100"
},
/* 22*/ { BARCODE_KIX, "1231FZ13Xhs", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 4",
/* 23*/ { BARCODE_KIX, "1231FZ13Xhs", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 4",
"000010100000101000001010000010100010100010100000000010100000101010100000001010001000100"
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"001000100010100010000010001000101000001010100000001000101000001010000010101000001000100"
},
/* 23*/ { BARCODE_KIX, "1234567890ABCDEFGH", 0, 3, 143, "Verified manually against tec-it",
/* 24*/ { BARCODE_KIX, "1234567890ABCDEFGH", 0, 3, 143, "Verified manually against tec-it",
"00001010000010100000101000001010000010100010001000100010001000100010001000001010001000100010001000101000001010000010100000101000001010000010100"
"10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"00100010001010001000001010001000101000000000101000100010001010001000001000001010100010001010000000001010001000100010100010000010100010001010000"
},
/* 24*/ { BARCODE_KIX, "IJKLMNOPQRSTUVWXYZ", 0, 3, 143, "Verified manually against tec-it",
/* 25*/ { BARCODE_KIX, "IJKLMNOPQRSTUVWXYZ", 0, 3, 143, "Verified manually against tec-it",
"10000010100000101000001010000010100000101000001010001000100010001000100010001000100010001000100010100000101000001010000010100000101000001010000"
"10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
"00001010001000100010100010000010100010001010000000001010001000100010100010000010100010001010000000001010001000100010100010000010100010001010000"
},
/* 25*/ { BARCODE_DAFT, "DAFTTFADFATDTATFT", 0, 3, 33, "Verified manually against tec-it",
/* 26*/ { BARCODE_DAFT, "DAFTTFADFATDTATFT", 0, 3, 33, "Verified manually against tec-it",
"001010000010100010100000001000100"
"101010101010101010101010101010101"
"100010000010001010000010000000100"

View File

@ -2881,8 +2881,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbology == BARCODE_FIM) {
/* Ratio 2 width bar/space -> 1 width */
char adj[8] = " -sr=0.5";
/* Ratio 2.25 width bar/space -> 1 width */
char adj[10] = " -sr=0.444";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}

View File

@ -1,6 +1,6 @@
--- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2021-09-29 13:06:28.204962959 +0100
+++ backend/tests/tools/bwipp_dump.ps 2021-09-29 13:09:29.965621202 +0100
@@ -26338,34 +26338,80 @@
--- /home/mburke/code/gitlost/postscriptbarcode/build/monolithic/barcode.ps 2022-01-02 22:06:30.483037379 +0000
+++ backend/tests/tools/bwipp_dump.ps 2022-01-02 22:17:33.468917090 +0000
@@ -26437,34 +26437,80 @@
pop
} ifelse
@ -100,7 +100,7 @@
end
@@ -26424,7 +26470,7 @@
@@ -26523,7 +26569,7 @@
pop
} ifelse
@ -109,7 +109,7 @@
% Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put
@@ -26432,29 +26478,75 @@
@@ -26531,29 +26577,75 @@
options (dontdraw) true put
% Plot the linear part
@ -205,7 +205,7 @@
end
@@ -26513,34 +26605,80 @@
@@ -26612,34 +26704,80 @@
pop
} ifelse
@ -305,7 +305,7 @@
end
@@ -26614,34 +26752,80 @@
@@ -26713,34 +26851,80 @@
/opt options
>> def
@ -405,7 +405,7 @@
end
@@ -26700,7 +26884,7 @@
@@ -26799,7 +26983,7 @@
pop
} ifelse
@ -414,7 +414,7 @@
options (lintype) (databaromni) put
options (linkage) true put
@@ -26711,7 +26895,7 @@
@@ -26810,7 +26994,7 @@
linear options //databaromni exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -423,7 +423,7 @@
% Plot the separator
/sepfinder {
@@ -26742,20 +26926,66 @@
@@ -26841,20 +27025,66 @@
sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder
@ -502,7 +502,7 @@
end
@@ -26813,7 +27043,7 @@
@@ -26912,7 +27142,7 @@
pop
} ifelse
@ -511,7 +511,7 @@
options (lintype) (databarstacked) put
options (linkage) true put
@@ -26824,7 +27054,7 @@
@@ -26923,7 +27153,7 @@
linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -520,7 +520,7 @@
% Plot the separator
/sepfinder {
@@ -26852,20 +27082,52 @@
@@ -26951,20 +27181,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -585,7 +585,7 @@
end
@@ -26923,7 +27185,7 @@
@@ -27022,7 +27284,7 @@
pop
} ifelse
@ -594,7 +594,7 @@
options (lintype) (databarstackedomni) put
options (linkage) true put
@@ -26934,7 +27196,7 @@
@@ -27033,7 +27295,7 @@
linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -603,7 +603,7 @@
% Plot the separator
/sepfinder {
@@ -26962,20 +27224,52 @@
@@ -27061,20 +27323,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -668,7 +668,7 @@
end
@@ -27148,7 +27442,7 @@
@@ -27247,7 +27541,7 @@
pop
} ifelse
@ -677,7 +677,7 @@
options (lintype) (databarlimited) put
options (linkage) true put
@@ -27159,7 +27453,7 @@
@@ -27258,7 +27552,7 @@
linear options //databarlimited exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -686,7 +686,7 @@
% Plot the separator
mark
@@ -27167,22 +27461,68 @@
@@ -27266,22 +27560,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
@ -769,7 +769,7 @@
end
@@ -27241,7 +27581,7 @@
@@ -27340,7 +27680,7 @@
pop
} ifelse
@ -778,7 +778,7 @@
options (lintype) (databarexpanded) put
options (linkage) true put
@@ -27252,7 +27592,7 @@
@@ -27351,7 +27691,7 @@
linear options //databarexpanded exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -787,7 +787,7 @@
% Plot the separator
/sepfinder {
@@ -27281,20 +27621,60 @@
@@ -27380,20 +27720,60 @@
18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for
] {sepfinder} forall
@ -860,7 +860,7 @@
end
@@ -27352,7 +27732,7 @@
@@ -27451,7 +27831,7 @@
pop
} ifelse
@ -869,7 +869,7 @@
options (lintype) (databarexpandedstacked) put
options (linkage) true put
@@ -27363,7 +27743,7 @@
@@ -27462,7 +27842,7 @@
linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -878,7 +878,7 @@
% Plot the separator
/sepfinder {
@@ -27389,21 +27769,49 @@
@@ -27488,21 +27868,49 @@
19 98 bot length 13 sub {} for
70 98 bot length 13 sub {} for
] {sepfinder} forall
@ -941,7 +941,7 @@
end
@@ -27462,7 +27870,7 @@
@@ -27561,7 +27969,7 @@
pop
} ifelse
@ -950,7 +950,7 @@
options (inkspread) (0) put
options (dontdraw) true put
@@ -27489,35 +27897,87 @@
@@ -27588,35 +27996,87 @@
linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -1052,7 +1052,7 @@
end
@@ -28950,3 +29410,189 @@
@@ -29049,3 +29509,189 @@
% --END ENCODER hibcazteccode--
% --END TEMPLATE--

View File

@ -3163,18 +3163,19 @@ not given, no ID is encoded.
6.7.1 Facing Identification Mark (FIM)
--------------------------------------
Used by the United States Postal Service (USPS), the FIM symbology is used to
assist automated mail processing. There are only 4 valid symbols which can be
generated using the characters A-D as shown in the table below.
assist automated mail processing. There are only 5 valid symbols which can be
generated using the characters A-E as shown in the table below.
----------------------------------------------------------------------------
------------------------------------------------------------------------------
Code Letter | Usage
----------------------------------------------------------------------------
------------------------------------------------------------------------------
A | Used for courtesy reply mail and metered reply mail with a
| pre-printed POSTNET symbol.
B | Used for business reply mail without a pre-printed zip code.
C | Used for business reply mail with a pre-printed zip code.
D | Used for Information Based Indicia (IBI) postage.
----------------------------------------------------------------------------
E | Used for customized mail with a USPS Intelligent Mail barcode.
------------------------------------------------------------------------------
6.7.2 Flattermarken
-------------------