CODE128: allow for extended latching (double FNC4) spanning

intermediate CodeC sequence by setting `f_state` only if in
  CodeA/B & checking before adding extended mode switch (cf
  OkapiBarcode commit [9ce6dcc], props Daniel Gredler)
DATAMATRIX: in FAST_MODE re-process any buffered X12 characters
  when mode changes from X12 (cf OkapiBarcode commit [fb7981e],
  props Daniel Gredler)
CODABLOCKF: allow for FNC4 when estimating no. of rows required
CODE16K: make sure row calculation accurate by dispensing with
  glyph estimate & using actual codeword count
CODE16K: ensure initial mode selection allows for extended
  characters
vector.c: add `z_alloca()` cast for `first_row_rects` (ticket
  #272)
MSVC project files: remove incorrect "CompileACpp" setting from
  libzint project files (ticket #272)
bwipp_dump.ps: fix 2/4-track processing; update to latest BWIPP
manual/man page/GUI: Code 16k -> Code 16K
This commit is contained in:
gitlost 2022-10-13 13:33:59 +01:00
parent 92a4a25ed2
commit ada19fc079
32 changed files with 804 additions and 561 deletions

View file

@ -116,36 +116,84 @@ ret /pixs known {
sbs length 1 sub
} ifelse def
% If should use bhs/bbs to emulate rows (DAFT/pharmacode2) (hacky)
/nosbs false def
/minh 999999 def
/midh 0 def
/maxh 0 def
/maxb 0 def
systemdict /hs known ret /bhs known and ret /bbs known and {
% Check for pharmacode2
b (pharmacode2) eq {
/nosbs true def
/bhs ret /bhs get def
/bbs ret /bbs get def
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.1 lt {
bhs i get 0.3 gt { (1) print } { (0) print } ifelse
} {
bhs i get 0.1 gt { (1) print } { (0) print } ifelse
} ifelse
} for
n { (\n) print } if
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.1 lt {
bhs i get 0.1 gt { (1) print } { (0) print } ifelse
} {
bhs i get 0.3 gt { (1) print } { (0) print } ifelse
} ifelse
} for
n { (\n) print } if
} if
% Check for 2-track postal
b (postnet) eq b (planet) eq or {
/nosbs true def
/bhs ret /bhs get def
0 1 bhs length 1 sub {
/i exch def
/h bhs i get def
/b bbs i get def
h minh lt { /minh h def } if
h maxh gt { /maxh h def } if
h minh ne h maxh ne and { /midh h def } if
b maxb gt { /maxb b def } if
i 0 ne { (0) print } if
bhs i get 0.1 gt { (1) print } { (0) print } ifelse
} for
0 1 limit {
n { (\n) print } if
0 1 bhs length 1 sub {
/i exch def
i 2 mod 0 eq { % i is even
/h bhs i 2 idiv get def
/b bbs i 2 idiv get def
h maxh eq h midh eq b maxb eq and or maxb 0 ne b maxb eq and midh 0 eq and h minh eq and or { (1) } { (0) } ifelse print % Yeah, me too
i 0 ne { (0) print } if
bhs i get 0.01 lt { (0) print } { (1) print } ifelse
} for
n { (\n) print } if
} if
% Check for 4-track postal
b (auspost) eq b (kix) eq or b (royalmail) eq or b (onecode) eq or b (japanpost) eq or b (daft) eq or {
/nosbs true def
/bhs ret /bhs get def
/bbs ret /bbs get def
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.05 lt {
bhs i get 0.14 gt { (1) print } { (0) print } ifelse
} {
bhs i get 0.09 gt { (1) print } { (0) print } ifelse
} ifelse
} for
n { (\n) print } if
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
(1) print
} for
n { (\n) print } if
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.05 lt {
bhs i get 0.09 gt { (1) print } { (0) print } ifelse
} {
(0) print
} ifelse
} for
n { (\n) print } if
maxb 0 ne midh 0 eq and maxb 0 eq minh maxh eq and or { /nosbs true def } if % No tracker (pharmacode2)
} if
% Process sbs
@ -162,20 +210,6 @@ ret /pixs known {
} for
n { (\n) print } if
} if
% Third row if DAFT, second row if no tracker (pharmacode2)
maxb 0 ne midh 0 ne or minh maxh eq or {
0 1 limit {
/i exch def
i 2 mod 0 eq { % i is even
/b bbs i 2 idiv get def
b 0 eq { (1) } { (0) } ifelse print
} {
(0) print
} ifelse
} for
n { (\n) print } if
} if
} if
} ifelse

View file

@ -14,17 +14,22 @@ function run_bwipp_test() {
}
run_bwipp_test "test_2of5" "encode"
run_bwipp_test "test_auspost" "input"
run_bwipp_test "test_auspost" "encode"
run_bwipp_test "test_aztec" "encode"
run_bwipp_test "test_aztec" "encode_segs"
run_bwipp_test "test_bc412"
run_bwipp_test "test_channel" "encode"
run_bwipp_test "test_codablock" "input"
run_bwipp_test "test_codablock" "encode"
run_bwipp_test "test_code" "encode"
run_bwipp_test "test_code1" "encode"
run_bwipp_test "test_code1" "encode_segs"
run_bwipp_test "test_code128" "input"
run_bwipp_test "test_code128" "encode"
run_bwipp_test "test_code16k" "input"
run_bwipp_test "test_code16k" "encode"
run_bwipp_test "test_code49" "input"
run_bwipp_test "test_code49" "encode"
run_bwipp_test "test_composite"
run_bwipp_test "test_dmatrix" "input"
@ -34,15 +39,18 @@ run_bwipp_test "test_dotcode" "input"
run_bwipp_test "test_dotcode" "encode"
run_bwipp_test "test_dotcode" "encode_segs"
run_bwipp_test "test_gs1" "gs1_reduce"
run_bwipp_test "test_imail" "input"
run_bwipp_test "test_imail" "encode"
run_bwipp_test "test_maxicode" "input"
run_bwipp_test "test_maxicode" "encode"
run_bwipp_test "test_maxicode" "encode_segs"
run_bwipp_test "test_medical" "input"
run_bwipp_test "test_medical" "encode"
run_bwipp_test "test_pdf417" "input"
run_bwipp_test "test_pdf417" "encode"
run_bwipp_test "test_pdf417" "encode_segs"
run_bwipp_test "test_plessey" "encode"
run_bwipp_test "test_postal" "input"
run_bwipp_test "test_postal" "encode"
run_bwipp_test "test_qr"
run_bwipp_test "test_rss"

View file

@ -16,8 +16,13 @@ function run_zxingcpp_test() {
run_zxingcpp_test "test_2of5" "encode"
run_zxingcpp_test "test_aztec" "encode"
run_zxingcpp_test "test_aztec" "encode_segs"
run_zxingcpp_test "test_codablock" "input"
run_zxingcpp_test "test_codablock" "encode"
run_zxingcpp_test "test_code" "encode"
run_zxingcpp_test "test_code128" "input"
run_zxingcpp_test "test_code128" "encode"
run_zxingcpp_test "test_code16k" "input"
run_zxingcpp_test "test_code16k" "encode"
run_zxingcpp_test "test_dmatrix" "input"
run_zxingcpp_test "test_dmatrix" "encode"
run_zxingcpp_test "test_dmatrix" "encode_segs"