Build barcode from left to right instead of right to left.

This commit is contained in:
Chris Gulley 2014-02-24 09:37:19 -06:00
parent c77b79d690
commit a4a9817065

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;
}
}