mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Fix Issue 1133, PDF417 issues with alpha mode after other modes
git-svn-id: https://zxing.googlecode.com/svn/trunk@2181 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
d6dc4bb237
commit
e1c71e464b
|
@ -232,6 +232,10 @@ final class DecodedBitStreamParser {
|
|||
subMode = Mode.PUNCT_SHIFT;
|
||||
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
|
||||
result.append((char) byteCompactionData[i]);
|
||||
// the pdf417 specs say we have to return to the last latched
|
||||
// sub-mode. But I checked different encoder implementations and
|
||||
// all of them return to alpha sub-mode after Shift-to-Byte
|
||||
subMode = Mode.ALPHA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -255,6 +259,10 @@ final class DecodedBitStreamParser {
|
|||
subMode = Mode.PUNCT_SHIFT;
|
||||
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
|
||||
result.append((char) byteCompactionData[i]);
|
||||
// the pdf417 specs say we have to return to the last latched
|
||||
// sub-mode. But I checked different encoder implementations and
|
||||
// all of them return to alpha sub-mode after Shift-to-Byte
|
||||
subMode = Mode.ALPHA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -278,6 +286,10 @@ final class DecodedBitStreamParser {
|
|||
subMode = Mode.PUNCT_SHIFT;
|
||||
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
|
||||
result.append((char) byteCompactionData[i]);
|
||||
// the pdf417 specs say we have to return to the last latched
|
||||
// sub-mode. But I checked different encoder implementations and
|
||||
// all of them return to alpha sub-mode after Shift-to-Byte
|
||||
subMode = Mode.ALPHA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -291,6 +303,10 @@ final class DecodedBitStreamParser {
|
|||
subMode = Mode.ALPHA;
|
||||
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
|
||||
result.append((char) byteCompactionData[i]);
|
||||
// the pdf417 specs say we have to return to the last latched
|
||||
// sub-mode. But I checked different encoder implementations and
|
||||
// all of them return to alpha sub-mode after Shift-to-Byte
|
||||
subMode = Mode.ALPHA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -317,6 +333,14 @@ final class DecodedBitStreamParser {
|
|||
} else {
|
||||
if (subModeCh == PAL) {
|
||||
subMode = Mode.ALPHA;
|
||||
} else if (subModeCh == MODE_SHIFT_TO_BYTE_COMPACTION_MODE) {
|
||||
// PS before Shift-to-Byte is used as a padding character,
|
||||
// see 5.4.2.4 of the specification
|
||||
result.append((char) byteCompactionData[i]);
|
||||
// the pdf417 specs say we have to return to the last latched
|
||||
// sub-mode. But I checked different encoder implementations and
|
||||
// all of them return to alpha sub-mode after Shift-to-Byte
|
||||
subMode = Mode.ALPHA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -423,6 +447,7 @@ final class DecodedBitStreamParser {
|
|||
value >>= 8;
|
||||
}
|
||||
result.append(decodedData);
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
core/test/data/blackbox/pdf417/08.gif
Normal file
BIN
core/test/data/blackbox/pdf417/08.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
1
core/test/data/blackbox/pdf417/08.txt
Normal file
1
core/test/data/blackbox/pdf417/08.txt
Normal file
|
@ -0,0 +1 @@
|
|||
nä jag menar det där som sitter fast i din dörrkarm
|
|
@ -29,8 +29,8 @@ public final class PDF417BlackBox1TestCase extends AbstractBlackBoxTestCase {
|
|||
|
||||
public PDF417BlackBox1TestCase() {
|
||||
super("test/data/blackbox/pdf417", new MultiFormatReader(), BarcodeFormat.PDF_417);
|
||||
addTest(3, 3, 0.0f);
|
||||
addTest(3, 3, 180.0f);
|
||||
addTest(4, 4, 0.0f);
|
||||
addTest(4, 4, 180.0f);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue