From 35926f02b2498910d7fa80d7ca7076c278334ad2 Mon Sep 17 00:00:00 2001 From: Glenn Adams Date: Sat, 12 Jan 2013 05:59:08 +0000 Subject: [PATCH] FOP-2184: optimize inefficient position adjustment array allocation in non-CS path. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1432383 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/intermediate/IFRenderer.java | 39 ++++++++----------- status.xml | 3 ++ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java index d1e2217c7..01adec08d 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java @@ -1048,12 +1048,16 @@ public class IFRenderer extends AbstractPathOrientedRenderer { int[][] dp = word.getGlyphPositionAdjustments(); if ( dp == null ) { - dp = IFUtil.convertDXToDP ( word.getLetterAdjustArray() ); + renderTextWithAdjustments(s, word.getLetterAdjustArray(), word.isReversed(), + font, (AbstractTextArea)word.getParentArea()); + } else if ( IFUtil.isDPOnlyDX ( dp ) ) { + renderTextWithAdjustments(s, IFUtil.convertDPToDX ( dp ), word.isReversed(), + font, (AbstractTextArea)word.getParentArea()); + } else { + renderTextWithAdjustments(s, dp, word.isReversed(), + font, (AbstractTextArea)word.getParentArea()); } - renderText(s, dp, word.isReversed(), - font, (AbstractTextArea)word.getParentArea()); - super.renderWord(word); } @@ -1063,7 +1067,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { String s = space.getSpace(); AbstractTextArea textArea = (AbstractTextArea)space.getParentArea(); - renderText(s, null, false, font, textArea); + renderTextWithAdjustments(s, (int[]) null, false, font, textArea); if (textUtil.combined && space.isAdjustable()) { //Used for justified text, for example @@ -1076,17 +1080,6 @@ public class IFRenderer extends AbstractPathOrientedRenderer { super.renderSpace(space); } - private void renderText(String s, - int[][] dp, boolean reversed, - Font font, AbstractTextArea parentArea) { - if ( ( dp == null ) || IFUtil.isDPOnlyDX ( dp ) ) { - int[] dx = IFUtil.convertDPToDX ( dp ); - renderTextWithAdjustments ( s, dx, reversed, font, parentArea ); - } else { - renderTextWithAdjustments ( s, dp, reversed, font, parentArea ); - } - } - /** * Does low-level rendering of text using DX only position adjustments. * @param s text to render @@ -1154,12 +1147,14 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } void adjust(int dx) { - adjust ( new int[] { - dx, // xPlaAdjust - 0, // yPlaAdjust - dx, // xAdvAdjust - 0 // yAdvAdjust - } ); + if (dx != 0) { + adjust ( new int[] { + dx, // xPlaAdjust + 0, // yPlaAdjust + dx, // xAdvAdjust + 0 // yAdvAdjust + } ); + } } void adjust(int[] pa) { diff --git a/status.xml b/status.xml index ace670a02..db0b5f688 100644 --- a/status.xml +++ b/status.xml @@ -59,6 +59,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Optimize inefficient position adjustment array allocation in non-CS path. + TTFReader: Output bounding box information for glyphs. -- 2.39.5