From bbf90f6de6cc8f32cb634cbdae44d01bcd7f40a1 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 28 Sep 2016 12:40:09 +0200 Subject: [PATCH] IDEMPIERE-3200 PDF report engine: Can't add attribute to 0-length text --- .../src/org/compiere/print/layout/TableElement.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java index 884e88bafd..d49fd59123 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java +++ b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java @@ -1509,7 +1509,10 @@ public class TableElement extends PrintElement String[] lines = Pattern.compile("\n", Pattern.MULTILINE).split(str); for (int lineNo = 0; lineNo < lines.length; lineNo++) { - aString = new AttributedString(lines[lineNo]); + String thisLine = lines[lineNo]; + if (thisLine.length() == 0) + thisLine = " "; + aString = new AttributedString(thisLine); aString.addAttribute(TextAttribute.FONT, getFont(row, col)); if (isView && printItems[index] instanceof NamePair) // ID { @@ -1521,7 +1524,7 @@ public class TableElement extends PrintElement // iter = aString.getIterator(); boolean fastDraw = LayoutEngine.s_FASTDRAW; - if (fastDraw && !isView && !Util.is8Bit(lines[lineNo])) + if (fastDraw && !isView && !Util.is8Bit(thisLine)) fastDraw = false; measurer = new LineBreakMeasurer(iter, g2D.getFontRenderContext()); while (measurer.getPosition() < iter.getEndIndex()) // print element