Skip to content

Commit

Permalink
Fix PDF/A conformance when data item contains TAB character (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
hvbtup authored Oct 24, 2024
1 parent ce5ac95 commit a26bf12
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a26bf12

Please sign in to comment.