From 8cc035ac9300935c73ddfa5f4ba73d62bd7be048 Mon Sep 17 00:00:00 2001 From: Henning von Bargen Date: Wed, 23 Oct 2024 11:29:44 +0200 Subject: [PATCH] Fix PDF/A conformance when data item contains TAB character --- .../nLayout/area/impl/TextAreaLayout.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextAreaLayout.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextAreaLayout.java index dc083bfab7..282e51dab8 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextAreaLayout.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextAreaLayout.java @@ -84,7 +84,7 @@ public TextAreaLayout(ContainerArea parent, LayoutContext context, IContent cont parentLM.setTextIndent(textContent); String text = textContent.getText(); if (text != null && text.length() != 0) { - transform(textContent); + transform(textContent, context); } else { textContent.setText(" "); blankText = true; @@ -252,17 +252,26 @@ public int getFreeSpace() { * * @param textContent text content */ - public void transform(ITextContent textContent) { + public void transform(ITextContent textContent, LayoutContext context) { + String originalText = textContent.getText(); + + // If we want to create PDF, replace TAB characters with spaces + boolean mustReplaceTabs = "pdf".equals(context.getFormat()); + if (mustReplaceTabs && originalText != null) { + originalText = originalText.replace('\t', ' '); + textContent.setText((originalText)); + } + String transformType = textContent.getComputedStyle().getTextTransform(); if (transformType.equalsIgnoreCase("uppercase")) //$NON-NLS-1$ { - textContent.setText(textContent.getText().toUpperCase()); + textContent.setText(originalText.toUpperCase()); } else if (transformType.equalsIgnoreCase("lowercase")) //$NON-NLS-1$ { - textContent.setText(textContent.getText().toLowerCase()); + textContent.setText(originalText.toLowerCase()); } else if (transformType.equalsIgnoreCase("capitalize")) //$NON-NLS-1$ { - textContent.setText(capitalize(textContent.getText())); + textContent.setText(capitalize(originalText)); } ArabicShaping shaping = new ArabicShaping(ArabicShaping.LETTERS_SHAPE);