Merge pull request #70 from chriskeyring/master

Code 39 Barcodes Generated Backwards
This commit is contained in:
Sean Owen 2014-02-25 09:38:23 +00:00
commit a5e1f2b197

View file

@ -68,7 +68,7 @@ public final class Code39Writer extends OneDimensionalCodeWriter {
int[] narrowWhite = {1};
pos += appendPattern(result, pos, narrowWhite, false);
//append next character to bytematrix
for(int i = length-1; i >= 0; i--) {
for (int i = 0; i < length; i++) {
int indexInString = Code39Reader.ALPHABET_STRING.indexOf(contents.charAt(i));
toIntArray(Code39Reader.CHARACTER_ENCODINGS[indexInString], widths);
pos += appendPattern(result, pos, widths, true);
@ -81,7 +81,7 @@ public final class Code39Writer extends OneDimensionalCodeWriter {
private static void toIntArray(int a, int[] toReturn) {
for (int i = 0; i < 9; i++) {
int temp = a & (1 << i);
int temp = a & (1 << (8 - i));
toReturn[i] = temp == 0 ? 1 : 2;
}
}