From a3bbebccba25273c5229d0904478a31eb9eecac9 Mon Sep 17 00:00:00 2001 From: Michael Jahn Date: Sun, 4 Mar 2018 22:17:40 +0100 Subject: [PATCH] =?UTF-8?q?ZXing=203.3.2=20snapshot=20still=20creates=20wr?= =?UTF-8?q?ong=20barcode=20for=20text=20with=20leadin=E2=80=A6=20(#967)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ZXing 3.3.2 snapshot still creates wrong barcode for text with leading asterisk #960 * missing spaces --- .../com/google/zxing/datamatrix/encoder/EdifactEncoder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/com/google/zxing/datamatrix/encoder/EdifactEncoder.java b/core/src/main/java/com/google/zxing/datamatrix/encoder/EdifactEncoder.java index 8affd2c44..424589af5 100644 --- a/core/src/main/java/com/google/zxing/datamatrix/encoder/EdifactEncoder.java +++ b/core/src/main/java/com/google/zxing/datamatrix/encoder/EdifactEncoder.java @@ -66,6 +66,11 @@ final class EdifactEncoder implements Encoder { context.updateSymbolInfo(); int available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount(); int remaining = context.getRemainingCharacters(); + // The following two lines are a hack inspired by the 'fix' from https://sourceforge.net/p/barcode4j/svn/221/ + if (remaining > available) { + context.updateSymbolInfo(context.getCodewordCount() + 1); + available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount(); + } if (remaining <= available && available <= 2) { return; //No unlatch }