mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Issue 1820 add Code 128 FNC4 support
git-svn-id: https://zxing.googlecode.com/svn/trunk@2992 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
4aa5348526
commit
cce6d80637
1
AUTHORS
1
AUTHORS
|
@ -89,6 +89,7 @@ Ralf Kistner
|
|||
Randy Shen (Acer)
|
||||
Rasmus Schrøder Sørensen
|
||||
Richard Hřivňák
|
||||
robert@prog.olsztyn
|
||||
Romain Pechayre
|
||||
Roman Nurik (Google)
|
||||
Rustam Abdullaev
|
||||
|
|
|
@ -273,6 +273,8 @@ public final class Code128Reader extends OneDReader {
|
|||
int checksumTotal = startCode;
|
||||
int multiplier = 0;
|
||||
boolean lastCharacterWasPrintable = true;
|
||||
boolean upperMode = false;
|
||||
boolean shiftUpperMode = false;
|
||||
|
||||
while (!done) {
|
||||
|
||||
|
@ -316,9 +318,19 @@ public final class Code128Reader extends OneDReader {
|
|||
|
||||
case CODE_CODE_A:
|
||||
if (code < 64) {
|
||||
if (shiftUpperMode == upperMode) {
|
||||
result.append((char) (' ' + code));
|
||||
} else {
|
||||
result.append((char) (' ' + code + 128));
|
||||
}
|
||||
shiftUpperMode = false;
|
||||
} else if (code < 96) {
|
||||
if (shiftUpperMode == upperMode) {
|
||||
result.append((char) (code - 64));
|
||||
} else {
|
||||
result.append((char) (code + 64));
|
||||
}
|
||||
shiftUpperMode = false;
|
||||
} else {
|
||||
// Don't let CODE_STOP, which always appears, affect whether whether we think the last
|
||||
// code was printable or not.
|
||||
|
@ -340,9 +352,19 @@ public final class Code128Reader extends OneDReader {
|
|||
break;
|
||||
case CODE_FNC_2:
|
||||
case CODE_FNC_3:
|
||||
case CODE_FNC_4_A:
|
||||
// do nothing?
|
||||
break;
|
||||
case CODE_FNC_4_A:
|
||||
if (!upperMode && shiftUpperMode) {
|
||||
upperMode = true;
|
||||
shiftUpperMode = false;
|
||||
} else if (upperMode && shiftUpperMode) {
|
||||
upperMode = false;
|
||||
shiftUpperMode = false;
|
||||
} else {
|
||||
shiftUpperMode = true;
|
||||
}
|
||||
break;
|
||||
case CODE_SHIFT:
|
||||
isNextShifted = true;
|
||||
codeSet = CODE_CODE_B;
|
||||
|
@ -361,7 +383,12 @@ public final class Code128Reader extends OneDReader {
|
|||
break;
|
||||
case CODE_CODE_B:
|
||||
if (code < 96) {
|
||||
if (shiftUpperMode == upperMode) {
|
||||
result.append((char) (' ' + code));
|
||||
} else {
|
||||
result.append((char) (' ' + code + 128));
|
||||
}
|
||||
shiftUpperMode = false;
|
||||
} else {
|
||||
if (code != CODE_STOP) {
|
||||
lastCharacterWasPrintable = false;
|
||||
|
@ -381,9 +408,19 @@ public final class Code128Reader extends OneDReader {
|
|||
break;
|
||||
case CODE_FNC_2:
|
||||
case CODE_FNC_3:
|
||||
case CODE_FNC_4_B:
|
||||
// do nothing?
|
||||
break;
|
||||
case CODE_FNC_4_B:
|
||||
if (!upperMode && shiftUpperMode) {
|
||||
upperMode = true;
|
||||
shiftUpperMode = false;
|
||||
} else if (upperMode && shiftUpperMode) {
|
||||
upperMode = false;
|
||||
shiftUpperMode = false;
|
||||
} else {
|
||||
shiftUpperMode = true;
|
||||
}
|
||||
break;
|
||||
case CODE_SHIFT:
|
||||
isNextShifted = true;
|
||||
codeSet = CODE_CODE_A;
|
||||
|
|
|
@ -27,8 +27,8 @@ public final class Code128BlackBox1TestCase extends AbstractBlackBoxTestCase {
|
|||
|
||||
public Code128BlackBox1TestCase() {
|
||||
super("src/test/resources/blackbox/code128-1", new MultiFormatReader(), BarcodeFormat.CODE_128);
|
||||
addTest(5, 5, 0.0f);
|
||||
addTest(5, 5, 180.0f);
|
||||
addTest(6, 6, 0.0f);
|
||||
addTest(6, 6, 180.0f);
|
||||
}
|
||||
|
||||
}
|
BIN
core/src/test/resources/blackbox/code128-1/6.png
Normal file
BIN
core/src/test/resources/blackbox/code128-1/6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
1
core/src/test/resources/blackbox/code128-1/6.txt
Normal file
1
core/src/test/resources/blackbox/code128-1/6.txt
Normal file
|
@ -0,0 +1 @@
|
|||
óóóó1234óóabózz
|
Loading…
Reference in a new issue