diff options
Diffstat (limited to 'src/java/org/apache/fop/render/intermediate')
6 files changed, 64 insertions, 66 deletions
diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java index 12dd46c20..2dd046fa9 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java +++ b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java @@ -460,7 +460,7 @@ public abstract class AbstractIFPainter<T extends IFDocumentHandler> implements } /** {@inheritDoc} */ - public boolean isBackgroundRequired( BorderProps bpsBefore, BorderProps bpsAfter, + public boolean isBackgroundRequired(BorderProps bpsBefore, BorderProps bpsAfter, BorderProps bpsStart, BorderProps bpsEnd) { return true; } diff --git a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java b/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java index 8c3f998a9..cc7015a71 100644 --- a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java +++ b/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java @@ -57,7 +57,7 @@ public class IFGraphicContext extends GraphicContext { * {@inheritDoc} */ public Object clone() { - return new IFGraphicContext ( this ); + return new IFGraphicContext (this); } /** @param group a group */ diff --git a/src/java/org/apache/fop/render/intermediate/IFParser.java b/src/java/org/apache/fop/render/intermediate/IFParser.java index 484e8d559..c0fef8423 100644 --- a/src/java/org/apache/fop/render/intermediate/IFParser.java +++ b/src/java/org/apache/fop/render/intermediate/IFParser.java @@ -643,8 +643,8 @@ public class IFParser implements IFConstants { int[][] dp = XMLUtil.getAttributeAsPositionAdjustments(lastAttributes, "dp"); // if only DX present, then convert DX to DP; otherwise use only DP, // effectively ignoring DX - if ( ( dp == null ) && ( dx != null ) ) { - dp = IFUtil.convertDXToDP ( dx ); + if ((dp == null) && (dx != null)) { + dp = IFUtil.convertDXToDP (dx); } establishStructureTreeElement(lastAttributes); boolean isHyphenated = Boolean.valueOf(lastAttributes.getValue("hyphenated")); diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java index f429efb2c..5cdac7c88 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java @@ -1046,11 +1046,11 @@ public class IFRenderer extends AbstractPathOrientedRenderer { String s = word.getWord(); int[][] dp = word.getGlyphPositionAdjustments(); - if ( dp == null ) { + if (dp == null) { renderTextWithAdjustments(s, word.getLetterAdjustArray(), word.isReversed(), font, (AbstractTextArea)word.getParentArea()); - } else if ( IFUtil.isDPOnlyDX ( dp ) ) { - renderTextWithAdjustments(s, IFUtil.convertDPToDX ( dp ), word.isReversed(), + } else if (IFUtil.isDPOnlyDX (dp)) { + renderTextWithAdjustments(s, IFUtil.convertDPToDX (dp), word.isReversed(), font, (AbstractTextArea)word.getParentArea()); } else { renderTextWithAdjustments(s, dp, word.isReversed(), @@ -1122,10 +1122,10 @@ public class IFRenderer extends AbstractPathOrientedRenderer { int[][] dp, boolean reversed, Font font, AbstractTextArea parentArea) { assert !textUtil.combined; - for ( int i = 0, n = s.length(); i < n; i++ ) { - textUtil.addChar ( s.charAt ( i ) ); - if ( dp != null ) { - textUtil.adjust ( dp[i] ); + for (int i = 0, n = s.length(); i < n; i++) { + textUtil.addChar (s.charAt (i)); + if (dp != null) { + textUtil.adjust (dp[i]); } } } @@ -1146,17 +1146,17 @@ public class IFRenderer extends AbstractPathOrientedRenderer { void adjust(int dx) { if (dx != 0) { - adjust ( new int[] { + adjust (new int[] { dx, // xPlaAdjust 0, // yPlaAdjust dx, // xAdvAdjust 0 // yAdvAdjust - } ); + }); } } void adjust(int[] pa) { - if ( !IFUtil.isPAIdentity ( pa ) ) { + if (!IFUtil.isPAIdentity (pa)) { int idx = text.length(); if (idx > dp.length - 1) { int newSize = Math.max(dp.length, idx + 1) + INITIAL_BUFFER_SIZE; @@ -1166,17 +1166,17 @@ public class IFRenderer extends AbstractPathOrientedRenderer { // switch to new DP, leaving DP[dp.length]...DP[newDP.length-1] unpopulated dp = newDP; } - if ( dp[idx - 1] == null ) { + if (dp[idx - 1] == null) { dp[idx - 1] = new int[4]; } - IFUtil.adjustPA ( dp[idx - 1], pa ); + IFUtil.adjustPA (dp[idx - 1], pa); } } void reset() { if (text.length() > 0) { text.setLength(0); - for ( int i = 0, n = dp.length; i < n; i++ ) { + for (int i = 0, n = dp.length; i < n; i++) { dp[i] = null; } } @@ -1197,10 +1197,10 @@ public class IFRenderer extends AbstractPathOrientedRenderer { try { if (combined) { painter.drawText(startx, starty, 0, 0, - trimAdjustments ( dp, text.length() ), text.toString()); + trimAdjustments (dp, text.length()), text.toString()); } else { painter.drawText(startx, starty, tls, tws, - trimAdjustments ( dp, text.length() ), text.toString()); + trimAdjustments (dp, text.length()), text.toString()); } } catch (IFException e) { handleIFException(e); @@ -1219,23 +1219,23 @@ public class IFRenderer extends AbstractPathOrientedRenderer { * no greater than text length, and the last entry has a non-zero * adjustment. */ - private int[][] trimAdjustments ( int[][] dp, int textLength ) { - if ( dp != null ) { + private int[][] trimAdjustments (int[][] dp, int textLength) { + if (dp != null) { int tl = textLength; int pl = dp.length; - int i = ( tl < pl ) ? tl : pl; - while ( i > 0 ) { + int i = (tl < pl) ? tl : pl; + while (i > 0) { int[] pa = dp [ i - 1 ]; - if ( ( pa != null ) && !IFUtil.isPAIdentity ( pa ) ) { + if ((pa != null) && !IFUtil.isPAIdentity (pa)) { break; } else { i--; } } - if ( i == 0 ) { + if (i == 0) { dp = null; - } else if ( i < pl ) { - dp = IFUtil.copyDP ( dp, 0, i ); + } else if (i < pl) { + dp = IFUtil.copyDP (dp, 0, i); } } return dp; @@ -1328,7 +1328,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { pushGroup(new IFGraphicContext.Group()); Rectangle rect = toMillipointRectangle(startx, starty, width, height); try { - painter.clipBackground( rect, + painter.clipBackground(rect, bpsBefore, bpsAfter, bpsStart, bpsEnd); } catch (IFException ife) { handleIFException(ife); @@ -1353,8 +1353,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } /** {@inheritDoc} */ - protected void drawBorders( // CSOK: ParameterNumber - float startx, float starty, + protected void drawBorders(float startx, float starty, float width, float height, BorderProps bpsBefore, BorderProps bpsAfter, BorderProps bpsStart, BorderProps bpsEnd, int level, Color innerBackgroundColor) { @@ -1364,7 +1363,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { BorderProps bpsBottom = bpsAfter; BorderProps bpsLeft; BorderProps bpsRight; - if ( ( level == -1 ) || ( ( level & 1 ) == 0 ) ) { + if ((level == -1) || ((level & 1) == 0)) { bpsLeft = bpsStart; bpsRight = bpsEnd; } else { @@ -1378,8 +1377,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } /** {@inheritDoc} */ - protected void drawBorderLine( // CSOK: ParameterNumber - float x1, float y1, float x2, float y2, boolean horz, + protected void drawBorderLine(float x1, float y1, float x2, float y2, boolean horz, boolean startOrBefore, int style, Color col) { //Simplified implementation that is only used by renderTextDecoration() //drawBorders() is overridden and uses the Painter's high-level method drawBorderRect() diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java index bba8c744d..62e4cc67d 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java @@ -678,9 +678,9 @@ implements IFConstants, IFPainter, IFDocumentNavigationHandler { addAttribute(atts, "word-spacing", Integer.toString(wordSpacing)); } if (dp != null) { - if ( IFUtil.isDPIdentity(dp) ) { + if (IFUtil.isDPIdentity(dp)) { // don't add dx or dp attribute - } else if ( IFUtil.isDPOnlyDX(dp) ) { + } else if (IFUtil.isDPOnlyDX(dp)) { // add dx attribute only int[] dx = IFUtil.convertDPToDX(dp); addAttribute(atts, "dx", IFUtil.toString(dx)); diff --git a/src/java/org/apache/fop/render/intermediate/IFUtil.java b/src/java/org/apache/fop/render/intermediate/IFUtil.java index 8906e901b..1b9223913 100644 --- a/src/java/org/apache/fop/render/intermediate/IFUtil.java +++ b/src/java/org/apache/fop/render/intermediate/IFUtil.java @@ -212,12 +212,12 @@ public final class IFUtil { * @return if <code>dp</code> is not null, then an array of adjustments to the current * x position prior to rendering individual glyphs; otherwise, null */ - public static int[] convertDPToDX ( int[][] dp, int count ) { + public static int[] convertDPToDX (int[][] dp, int count) { int[] dx; - if ( dp != null ) { + if (dp != null) { dx = new int [ count ]; - for ( int i = 0, n = count; i < n; i++ ) { - if ( dp [ i ] != null ) { + for (int i = 0, n = count; i < n; i++) { + if (dp [ i ] != null) { dx [ i ] = dp [ i ] [ 0 ]; // xPlaAdjust[i] } } @@ -236,8 +236,8 @@ public final class IFUtil { * @return if <code>dp</code> is not null, then an array of adjustments to the current * x position prior to rendering individual glyphs; otherwise, null */ - public static int[] convertDPToDX ( int[][] dp ) { - return convertDPToDX ( dp, ( dp != null ) ? dp.length : 0 ); + public static int[] convertDPToDX (int[][] dp) { + return convertDPToDX (dp, (dp != null) ? dp.length : 0); } /** @@ -250,11 +250,11 @@ public final class IFUtil { * @return if <code>dx</code> is not null, then an array of 4-tuples, expressing [X,Y] * placment adjustments and [X,Y] advancement adjustments, in that order; otherwise, null */ - public static int[][] convertDXToDP ( int[] dx, int count ) { + public static int[][] convertDXToDP (int[] dx, int count) { int[][] dp; - if ( dx != null ) { + if (dx != null) { dp = new int [ count ] [ 4 ]; - for ( int i = 0, n = count; i < n; i++ ) { + for (int i = 0, n = count; i < n; i++) { int[] pa = dp [ i ]; int d = dx [ i ]; pa [ 0 ] = d; // xPlaAdjust[i] @@ -275,8 +275,8 @@ public final class IFUtil { * @return if <code>dx</code> is not null, then an array of 4-tuples, expressing [X,Y] * placment adjustments and [X,Y] advancement adjustments, in that order; otherwise, null */ - public static int[][] convertDXToDP ( int[] dx ) { - return convertDXToDP ( dx, ( dx != null ) ? dx.length : 0 ); + public static int[][] convertDXToDP (int[] dx) { + return convertDXToDP (dx, (dx != null) ? dx.length : 0); } /** @@ -284,12 +284,12 @@ public final class IFUtil { * @param pa a 4-tuple, expressing [X,Y] placment and [X,Y] advance adjuustments (may be null) * @return true if <code>dp</code> is null or contains no non-zero adjustment */ - public static boolean isPAIdentity ( int[] pa ) { - if ( pa == null ) { + public static boolean isPAIdentity (int[] pa) { + if (pa == null) { return true; } else { - for ( int k = 0; k < 4; k++ ) { - if ( pa[k] != 0 ) { + for (int k = 0; k < 4; k++) { + if (pa[k] != 0) { return false; } } @@ -303,12 +303,12 @@ public final class IFUtil { * adjustments and [X,Y] advancement adjustments, in that order (may be null) * @return true if <code>dp</code> is null or contains no non-zero adjustment */ - public static boolean isDPIdentity ( int[][] dp ) { - if ( dp == null ) { + public static boolean isDPIdentity (int[][] dp) { + if (dp == null) { return true; } else { - for ( int i = 0, n = dp.length; i < n; i++ ) { - if ( !isPAIdentity ( dp[i] ) ) { + for (int i = 0, n = dp.length; i < n; i++) { + if (!isPAIdentity (dp[i])) { return false; } } @@ -326,13 +326,13 @@ public final class IFUtil { * @return true if <code>dp</code> is not null and contains only xPlaAdjust * and xAdvAdjust values consistent with the output of {@link #convertDPToDX}. */ - public static boolean isDPOnlyDX ( int[][] dp ) { - if ( dp == null ) { + public static boolean isDPOnlyDX (int[][] dp) { + if (dp == null) { return false; } else { - for ( int i = 0, n = dp.length; i < n; i++ ) { + for (int i = 0, n = dp.length; i < n; i++) { int[] pa = dp[i]; - if ( ( pa != null ) && ( pa[0] != pa[2] ) ) { + if ((pa != null) && (pa[0] != pa[2])) { return false; } } @@ -348,11 +348,11 @@ public final class IFUtil { * @param paSrc a 4-tuple, expressing [X,Y] placment * and [X,Y] advance adjuustments (may be null) */ - public static void adjustPA ( int[] paDst, int[] paSrc ) { - if ( ( paDst != null ) && ( paSrc != null ) ) { + public static void adjustPA (int[] paDst, int[] paSrc) { + if ((paDst != null) && (paSrc != null)) { assert paDst.length == 4; assert paSrc.length == 4; - for ( int i = 0; i < 4; i++ ) { + for (int i = 0; i < 4; i++) { paDst[i] += paSrc[i]; } } @@ -367,16 +367,16 @@ public final class IFUtil { * @return a deep copy of the count position adjustment entries start at * offset */ - public static int[][] copyDP ( int[][] dp, int offset, int count ) { - if ( ( dp == null ) || ( offset > dp.length ) || ( ( offset + count ) > dp.length ) ) { + public static int[][] copyDP (int[][] dp, int offset, int count) { + if ((dp == null) || (offset > dp.length) || ((offset + count) > dp.length)) { throw new IllegalArgumentException(); } else { int[][] dpNew = new int [ count ] []; - for ( int i = 0, n = count; i < n; i++ ) { + for (int i = 0, n = count; i < n; i++) { int[] paSrc = dp [ i + offset ]; - if ( paSrc != null ) { + if (paSrc != null) { int[] paDst = new int [ 4 ]; - for ( int k = 0; k < 4; k++ ) { + for (int k = 0; k < 4; k++) { paDst [ k ] = paSrc [ k ]; } dpNew [ i ] = paDst; |