diff options
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
19 files changed, 151 insertions, 158 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java index 9f94b4f49..2cdcf4505 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java @@ -420,7 +420,7 @@ public abstract class AbstractBreaker { alg.setConstantLineWidth(flowBPD); int optimalPageCount = alg.findBreakingPoints(effectiveList, 1, true, BreakingAlgorithm.ALL_BREAKS); - if ( Math.abs ( alg.getIPDdifference() ) > 1 ) { + if (Math.abs (alg.getIPDdifference()) > 1) { addAreas(alg, optimalPageCount, blockList, effectiveList); // *** redo Phase 1 *** log.trace("IPD changes after page " + optimalPageCount); @@ -911,7 +911,7 @@ public abstract class AbstractBreaker { KnuthElement firstElement; while (sequenceIterator.hasNext()) { firstElement = sequenceIterator.next(); - if ( !firstElement.isBox() ) { + if (!firstElement.isBox()) { log.debug("PLM> ignoring glue or penalty element " + "at the beginning of the sequence"); if (firstElement.isGlue()) { diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java index 5233bcd77..0285a41e7 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -214,7 +214,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager im return null; } List<LayoutManager> newLMs = new ArrayList<LayoutManager>(size); - while (fobjIter.hasNext() && newLMs.size() < size ) { + while (fobjIter.hasNext() && newLMs.size() < size) { Object theobj = fobjIter.next(); if (theobj instanceof FONode) { FONode foNode = (FONode) theobj; diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 78fd8893f..979868183 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -351,7 +351,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager impl contentRectOffsetY = 0; int level = fo.getBidiLevel(); - if ( ( level < 0 ) || ( ( level & 1 ) == 0 ) ) { + if ((level < 0) || ((level & 1) == 0)) { contentRectOffsetX += fo.getCommonMarginBlock().startIndent.getValue(this); } else { contentRectOffsetX += fo.getCommonMarginBlock().endIndent.getValue(this); @@ -855,8 +855,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager impl viewportBlockArea = new BlockViewport(allowBPDUpdate); viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE); - if ( level >= 0 ) { - viewportBlockArea.setBidiLevel ( level ); + if (level >= 0) { + viewportBlockArea.setBidiLevel (level); } viewportBlockArea.setIPD(getContentAreaIPD()); if (allowBPDUpdate) { @@ -892,8 +892,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager impl referenceArea = new Block(); referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); - if ( level >= 0 ) { - referenceArea.setBidiLevel ( level ); + if (level >= 0) { + referenceArea.setBidiLevel (level); } TraitSetter.setProducerID(referenceArea, getBlockContainerFO().getId()); diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 1420d1b98..317623cd5 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -360,7 +360,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager implements Co curBlockArea.setIPD(super.getContentAreaIPD()); - curBlockArea.setBidiLevel ( getBlockFO().getBidiLevel() ); + curBlockArea.setBidiLevel (getBlockFO().getBidiLevel()); TraitSetter.addBreaks(curBlockArea, getBlockFO().getBreakBefore(), getBlockFO().getBreakAfter()); diff --git a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java index 02c3db6a8..8a7142084 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java @@ -285,8 +285,7 @@ public abstract class BreakingAlgorithm { * @param totalDemerits a real number * @param previous a node */ - public KnuthNode( // CSOK: ParameterNumber - int position, int line, int fitness, + public KnuthNode(int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink, double adjustRatio, int availableShrink, int availableStretch, int difference, double totalDemerits, KnuthNode previous) { @@ -686,8 +685,7 @@ public abstract class BreakingAlgorithm { * @param previous active node for the preceding breakpoint * @return a new node */ - protected KnuthNode createNode( // CSOK: ParameterNumber - int position, int line, int fitness, + protected KnuthNode createNode(int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink, double adjustRatio, int availableShrink, int availableStretch, int difference, double totalDemerits, KnuthNode previous) { diff --git a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java index 684977b9c..df84aff20 100644 --- a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java +++ b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java @@ -141,7 +141,7 @@ public class InlineKnuthSequence extends KnuthSequence { .addALetterSpaceTo(oldList)); // prevBox may not be a KnuthInlineBox; // this may happen if it is a padding box; see bug 39571. - if ( prevBox instanceof KnuthInlineBox && ((KnuthInlineBox) prevBox).isAnchor()) { + if (prevBox instanceof KnuthInlineBox && ((KnuthInlineBox) prevBox).isAnchor()) { // prevBox represents a footnote citation: copy footnote info // from prevBox to the new box KnuthInlineBox newBox = (KnuthInlineBox) getLast(); diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java index 5f4aa5725..292251a84 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java @@ -248,7 +248,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker { public static class BidiOverrideLayoutManagerMaker extends Maker { /** {@inheritDoc} */ public void make(FONode node, List lms) { - if ( node instanceof BidiOverride ) { + if (node instanceof BidiOverride) { lms.add(new BidiLayoutManager((BidiOverride) node)); } } diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index b5e21aa63..c589e4766 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -80,7 +80,7 @@ public class PageSequenceLayoutManager extends AbstractPageSequenceLayoutManager initialize(); // perform step 5.8 of refinement process (Unicode BIDI Processing) - if ( areaTreeHandler.isComplexScriptFeaturesEnabled() ) { + if (areaTreeHandler.isComplexScriptFeaturesEnabled()) { BidiResolver.resolveInlineDirectionality(getPageSequence()); } @@ -198,13 +198,13 @@ public class PageSequenceLayoutManager extends AbstractPageSequenceLayoutManager */ protected int getForcedLastPageNum(final int lastPageNum) { int forcedLastPageNum = lastPageNum; - if ( lastPageNum % 2 != 0 - && ( getPageSequence().getForcePageCount() == Constants.EN_EVEN - || getPageSequence().getForcePageCount() == Constants.EN_END_ON_EVEN )) { + if (lastPageNum % 2 != 0 + && (getPageSequence().getForcePageCount() == Constants.EN_EVEN + || getPageSequence().getForcePageCount() == Constants.EN_END_ON_EVEN)) { forcedLastPageNum++; - } else if ( lastPageNum % 2 == 0 && ( + } else if (lastPageNum % 2 == 0 && ( getPageSequence().getForcePageCount() == Constants.EN_ODD - || getPageSequence().getForcePageCount() == Constants.EN_END_ON_ODD )) { + || getPageSequence().getForcePageCount() == Constants.EN_END_ON_ODD)) { forcedLastPageNum++; } return forcedLastPageNum; diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java index c3026e5e7..8afec46e1 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java @@ -78,7 +78,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage placement.y += beforeBPD; //Determine extra IPD from borders and padding - if ( ( bidiLevel == -1 ) || ( ( bidiLevel & 1 ) == 0 ) ) { + if ((bidiLevel == -1) || ((bidiLevel & 1) == 0)) { int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START, false, this); startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START, false); placement.x += startIPD; diff --git a/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java index 593003d55..3a630f9be 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java @@ -69,7 +69,7 @@ public class BasicLinkLayoutManager extends InlineLayoutManager { res.resolveIDRef(idref, pslm.getFirstPVWithID(idref)); if (!res.isResolved()) { pslm.addUnresolvedArea(idref, res); - if ( area instanceof BasicLinkArea ) { + if (area instanceof BasicLinkArea) { // establish back-pointer from BasicLinkArea to LinkResolver to // handle inline area unflattening during line bidi reordering; // needed to create internal link trait on synthesized basic link area diff --git a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java index 212170eae..3b4b84346 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java @@ -86,7 +86,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { blockProgressionOffset, level); } } else { - int[] levels = ( level >= 0 ) ? new int[] {level} : null; + int[] levels = (level >= 0) ? new int[] {level} : null; text.addWord(String.valueOf(ch), ipd, null, levels, null, blockProgressionOffset); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java index 3e9b85742..a1c50d45f 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java @@ -183,8 +183,8 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager Space ls = new Space(); ls.setIPD(iAdjust); int level = parentArea.getBidiLevel(); - if ( level >= 0 ) { - ls.setBidiLevel ( level ); + if (level >= 0) { + ls.setBidiLevel (level); } parentArea.addChildArea(ls); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java index aa2f79759..c19519ec8 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java @@ -125,26 +125,26 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { leaderArea = leader; } else { leaderArea = new Space(); - if ( level >= 0 ) { - leaderArea.setBidiLevel ( level ); + if (level >= 0) { + leaderArea.setBidiLevel (level); } } leaderArea.setBPD(fobj.getRuleThickness().getValue(this)); leaderArea.addTrait(Trait.COLOR, fobj.getColor()); - if ( level >= 0 ) { - leaderArea.setBidiLevel ( level ); + if (level >= 0) { + leaderArea.setBidiLevel (level); } } else if (fobj.getLeaderPattern() == EN_SPACE) { leaderArea = new Space(); leaderArea.setBPD(fobj.getRuleThickness().getValue(this)); - if ( level >= 0 ) { - leaderArea.setBidiLevel ( level ); + if (level >= 0) { + leaderArea.setBidiLevel (level); } } else if (fobj.getLeaderPattern() == EN_DOTS) { TextArea t = new TextArea(); char dot = '.'; // userAgent.getLeaderDotCharacter(); int width = font.getCharWidth(dot); - int[] levels = ( level < 0 ) ? null : new int[] {level}; + int[] levels = (level < 0) ? null : new int[] {level}; t.addWord("" + dot, width, null, levels, null, 0); t.setIPD(width); t.setBPD(width); @@ -156,8 +156,8 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { if (widthLeaderPattern > width) { spacer = new Space(); spacer.setIPD(widthLeaderPattern - width); - if ( level >= 0 ) { - spacer.setBidiLevel ( level ); + if (level >= 0) { + spacer.setBidiLevel (level); } width = widthLeaderPattern; } @@ -200,8 +200,8 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { if (fobj.getLeaderPatternWidth().getValue(this) > width) { spacer = new Space(); spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width); - if ( level >= 0 ) { - spacer.setBidiLevel ( level ); + if (level >= 0) { + spacer.setBidiLevel (level); } width = fobj.getLeaderPatternWidth().getValue(this); } @@ -214,7 +214,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { //Content collapsed to nothing, so use a space leaderArea = new Space(); leaderArea.setBPD(fobj.getRuleThickness().getValue(this)); - leaderArea.setBidiLevel ( fobj.getBidiLevelRecursive() ); + leaderArea.setBidiLevel (fobj.getBidiLevelRecursive()); } } TraitSetter.setProducerID(leaderArea, fobj.getId()); diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index 6623b6319..5a191e922 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -120,8 +120,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager private final int spaceAfter; private final int baseline; - LineBreakPosition( // CSOK: ParameterNumber - LayoutManager lm, int index, int startIndex, int breakIndex, + LineBreakPosition(LayoutManager lm, int index, int startIndex, int breakIndex, int shrink, int stretch, int diff, double ipdA, double adjust, int si, int ei, int lh, int lw, int sb, int sa, int bl) { super(lm, breakIndex); @@ -311,8 +310,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager private final int follow; private static final double MAX_DEMERITS = 10e6; - public LineBreakingAlgorithm( // CSOK: ParameterNumber - int pageAlign, int textAlign, int textAlignLast, int indent, int fillerWidth, + public LineBreakingAlgorithm(int pageAlign, int textAlign, int textAlignLast, int indent, int fillerWidth, int lh, int ld, int fl, boolean first, int maxFlagCount, LineLayoutManager llm) { super(textAlign, textAlignLast, first, false, maxFlagCount); pageAlignment = pageAlign; @@ -343,7 +341,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager int difference = bestActiveNode.difference; int textAlign = (bestActiveNode.line < total) ? alignment : alignmentLast; - switch ( textAlign ) { + switch (textAlign) { case Constants.EN_START: startIndent = 0; endIndent = difference > 0 ? difference : 0; @@ -425,10 +423,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager activePossibility = -1; } - private LineBreakPosition makeLineBreakPosition( // CSOK: ParameterNumber - KnuthSequence par, int firstElementIndex, int lastElementIndex, int availableShrink, - int availableStretch, int difference, double ratio, int startIndent, - int endIndent) { + private LineBreakPosition makeLineBreakPosition(KnuthSequence par, int firstElementIndex, int lastElementIndex, + int availableShrink, int availableStretch, int difference, double ratio, + int startIndent, int endIndent) { // line height calculation - spaceBefore may differ from spaceAfter // by 1mpt due to rounding int spaceBefore = (lineHeight - lead - follow) / 2; @@ -453,7 +450,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager j <= lastElementIndex; j++) { KnuthElement element = (KnuthElement) inlineIterator.next(); - if (element instanceof KnuthInlineBox ) { + if (element instanceof KnuthInlineBox) { AlignmentContext ac = ((KnuthInlineBox) element).getAlignmentContext(); if (ac != null && lastAC != ac) { if (!ac.usesInitialBaselineTable() @@ -1555,8 +1552,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager lineArea.setBPD(lineArea.getBPD() + context.getSpaceAfter()); } lineArea.finish(); - if ( lineArea.getBidiLevel() >= 0 ) { - BidiResolver.reorder ( lineArea ); + if (lineArea.getBidiLevel() >= 0) { + BidiResolver.reorder (lineArea); } parentLayoutManager.addChildArea(lineArea); } @@ -1607,8 +1604,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager blocklc.setTrailingSpace(new SpaceSpecifier(false)); } lineArea.updateExtentsFromChildren(); - if ( lineArea.getBidiLevel() >= 0 ) { - BidiResolver.reorder ( lineArea ); + if (lineArea.getBidiLevel() >= 0) { + BidiResolver.reorder (lineArea); } parentLayoutManager.addChildArea(lineArea); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index fc7110efa..2bfe65d13 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -111,9 +111,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager { * memoize thius length upon first invocation of this method. */ private int getWordLength() { - if ( wordCharLength == -1 ) { - if ( foText.hasMapping ( startIndex, breakIndex ) ) { - wordCharLength = foText.getMapping ( startIndex, breakIndex ).length(); + if (wordCharLength == -1) { + if (foText.hasMapping (startIndex, breakIndex)) { + wordCharLength = foText.getMapping (startIndex, breakIndex).length(); } else { assert breakIndex >= startIndex; wordCharLength = breakIndex - startIndex; @@ -293,8 +293,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { if (tbpNext.getLeafPos() != -1) { areaInfo = (AreaInfo) areaInfos.get(tbpNext.getLeafPos()); if (lastAreaInfo == null - || ( areaInfo.font != lastAreaInfo.font ) - || ( areaInfo.level != lastAreaInfo.level ) ) { + || (areaInfo.font != lastAreaInfo.font) + || (areaInfo.level != lastAreaInfo.level)) { if (lastAreaInfo != null) { addAreaInfoAreas(lastAreaInfo, wordSpaceCount, letterSpaceCount, firstAreaInfoIndex, @@ -567,7 +567,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { AreaInfo wordAreaInfo = getAreaInfo(i); addWordChars(wordAreaInfo); addLetterAdjust(wordAreaInfo); - if ( addGlyphPositionAdjustments(wordAreaInfo) ) { + if (addGlyphPositionAdjustments(wordAreaInfo)) { gposAdjusted = true; } } @@ -575,7 +575,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { // TODO may be problematic in some I18N contexts [GA] addHyphenationChar(); } - if ( !gposAdjusted ) { + if (!gposAdjusted) { gposAdjustments = null; } textArea.addWord(wordChars.toString(), wordIPD, letterSpaceAdjust, @@ -583,11 +583,11 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } private int[] getNonEmptyLevels() { - if ( wordLevels != null ) { + if (wordLevels != null) { assert wordLevelsIndex <= wordLevels.length; boolean empty = true; - for ( int i = 0, n = wordLevelsIndex; i < n; i++ ) { - if ( wordLevels [ i ] >= 0 ) { + for (int i = 0, n = wordLevelsIndex; i < n; i++) { + if (wordLevels [ i ] >= 0) { empty = false; break; } @@ -610,7 +610,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { letterSpaceAdjustIndex = 0; wordLevels = new int[wordLength]; wordLevelsIndex = 0; - Arrays.fill ( wordLevels, -1 ); + Arrays.fill (wordLevels, -1); gposAdjustments = new int[wordLength][4]; gposAdjustmentsIndex = 0; wordIPD = 0; @@ -637,14 +637,14 @@ public class TextLayoutManager extends LeafNodeLayoutManager { private void addWordChars(AreaInfo wordAreaInfo) { int s = wordAreaInfo.startIndex; int e = wordAreaInfo.breakIndex; - if ( foText.hasMapping ( s, e ) ) { - wordChars.append ( foText.getMapping ( s, e ) ); - addWordLevels ( foText.getMappingBidiLevels ( s, e ) ); + if (foText.hasMapping (s, e)) { + wordChars.append (foText.getMapping (s, e)); + addWordLevels (foText.getMappingBidiLevels (s, e)); } else { for (int i = s; i < e; i++) { wordChars.append(foText.charAt(i)); } - addWordLevels ( foText.getBidiLevels ( s, e ) ); + addWordLevels (foText.getBidiLevels (s, e)); } wordIPD += wordAreaInfo.areaIPD.getOpt(); } @@ -654,16 +654,16 @@ public class TextLayoutManager extends LeafNodeLayoutManager { * concatenante (possibly mapped) word bidi levels to levels buffer. * @param levels bidi levels array or null */ - private void addWordLevels ( int[] levels ) { - int numLevels = ( levels != null ) ? levels.length : 0; - if ( numLevels > 0 ) { + private void addWordLevels (int[] levels) { + int numLevels = (levels != null) ? levels.length : 0; + if (numLevels > 0) { int need = wordLevelsIndex + numLevels; - if ( need <= wordLevels.length ) { - System.arraycopy ( levels, 0, wordLevels, wordLevelsIndex, numLevels ); + if (need <= wordLevels.length) { + System.arraycopy (levels, 0, wordLevels, wordLevelsIndex, numLevels); } else { throw new IllegalStateException - ( "word levels array too short: expect at least " - + need + " entries, but has only " + wordLevels.length + " entries" ); + ("word levels array too short: expect at least " + + need + " entries, but has only " + wordLevels.length + " entries"); } } wordLevelsIndex += numLevels; @@ -678,15 +678,15 @@ public class TextLayoutManager extends LeafNodeLayoutManager { int letterSpaceCount = wordAreaInfo.letterSpaceCount; int wordLength = wordAreaInfo.getWordLength(); int taAdjust = textArea.getTextLetterSpaceAdjust(); - for ( int i = 0, n = wordLength; i < n; i++ ) { + for (int i = 0, n = wordLength; i < n; i++) { int j = letterSpaceAdjustIndex + i; - if ( j > 0 ) { + if (j > 0) { int k = wordAreaInfo.startIndex + i; - MinOptMax adj = ( k < letterSpaceAdjustArray.length ) + MinOptMax adj = (k < letterSpaceAdjustArray.length) ? letterSpaceAdjustArray [ k ] : null; - letterSpaceAdjust [ j ] = ( adj == null ) ? 0 : adj.getOpt(); + letterSpaceAdjust [ j ] = (adj == null) ? 0 : adj.getOpt(); } - if ( letterSpaceCount > 0 ) { + if (letterSpaceCount > 0) { letterSpaceAdjust [ j ] += taAdjust; letterSpaceCount--; } @@ -703,18 +703,18 @@ public class TextLayoutManager extends LeafNodeLayoutManager { private boolean addGlyphPositionAdjustments(AreaInfo wordAreaInfo) { boolean adjusted = false; int[][] gpa = wordAreaInfo.gposAdjustments; - int numAdjusts = ( gpa != null ) ? gpa.length : 0; + int numAdjusts = (gpa != null) ? gpa.length : 0; int wordLength = wordAreaInfo.getWordLength(); - if ( numAdjusts > 0 ) { + if (numAdjusts > 0) { int need = gposAdjustmentsIndex + numAdjusts; - if ( need <= gposAdjustments.length ) { - for ( int i = 0, n = wordLength, j = 0; i < n; i++ ) { - if ( i < numAdjusts ) { + if (need <= gposAdjustments.length) { + for (int i = 0, n = wordLength, j = 0; i < n; i++) { + if (i < numAdjusts) { int[] wpa1 = gposAdjustments [ gposAdjustmentsIndex + i ]; int[] wpa2 = gpa [ j++ ]; - for ( int k = 0; k < 4; k++ ) { + for (int k = 0; k < 4; k++) { int a = wpa2 [ k ]; - if ( a != 0 ) { + if (a != 0) { wpa1 [ k ] += a; adjusted = true; } @@ -723,9 +723,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } } else { throw new IllegalStateException - ( "gpos adjustments array too short: expect at least " + ("gpos adjustments array too short: expect at least " + need + " entries, but has only " + gposAdjustments.length - + " entries" ); + + " entries"); } } gposAdjustmentsIndex += wordLength; @@ -750,32 +750,32 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } } int numSpaces = areaInfo.breakIndex - areaInfo.startIndex - numZeroWidthSpaces; - int spaceIPD = areaInfo.areaIPD.getOpt() / ( ( numSpaces > 0 ) ? numSpaces : 1 ); + int spaceIPD = areaInfo.areaIPD.getOpt() / ((numSpaces > 0) ? numSpaces : 1); // add space area children, one for each non-zero-width space character for (int i = areaInfo.startIndex; i < areaInfo.breakIndex; i++) { char spaceChar = foText.charAt(i); int level = foText.bidiLevelAt(i); if (!CharUtilities.isZeroWidthSpace(spaceChar)) { textArea.addSpace - ( spaceChar, spaceIPD, + (spaceChar, spaceIPD, CharUtilities.isAdjustableSpace(spaceChar), - blockProgressionOffset, level ); + blockProgressionOffset, level); } } } } - private void addAreaInfo ( AreaInfo ai ) { - addAreaInfo ( areaInfos.size(), ai ); + private void addAreaInfo (AreaInfo ai) { + addAreaInfo (areaInfos.size(), ai); } - private void addAreaInfo ( int index, AreaInfo ai ) { - areaInfos.add ( index, ai ); + private void addAreaInfo (int index, AreaInfo ai) { + areaInfos.add (index, ai); } - private void removeAreaInfo ( int index ) { - areaInfos.remove ( index ); + private void removeAreaInfo (int index) { + areaInfos.remove (index); } private AreaInfo getAreaInfo(int index) { @@ -815,7 +815,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { returnList.add(sequence); if (LOG.isDebugEnabled()) { - LOG.debug ( "GK: [" + nextStart + "," + foText.length() + "]" ); + LOG.debug ("GK: [" + nextStart + "," + foText.length() + "]"); } LineBreakStatus lineBreakStatus = new LineBreakStatus(); thisStart = nextStart; @@ -846,20 +846,20 @@ public class TextLayoutManager extends LeafNodeLayoutManager { TextLayoutManager.LOG.error("Unexpected breakAction: " + breakAction); } if (LOG.isDebugEnabled()) { - LOG.debug ( "GK: {" + LOG.debug ("GK: {" + " index = " + nextStart - + ", char = " + CharUtilities.charToNCRef ( ch ) + + ", char = " + CharUtilities.charToNCRef (ch) + ", level = " + level + ", levelPrev = " + prevLevel + ", inWord = " + inWord + ", inSpace = " + inWhitespace - + "}" ); + + "}"); } if (inWord) { - if ( breakOpportunity + if (breakOpportunity || TextLayoutManager.isSpace(ch) || CharUtilities.isExplicitBreak(ch) - || ( ( prevLevel != -1 ) && ( level != prevLevel ) ) ) { + || ((prevLevel != -1) && (level != prevLevel))) { // this.foText.charAt(lastIndex) == CharUtilities.SOFT_HYPHEN prevAreaInfo = processWord(alignment, sequence, prevAreaInfo, ch, breakOpportunity, true, prevLevel); @@ -960,16 +960,16 @@ public class TextLayoutManager extends LeafNodeLayoutManager { final KnuthSequence sequence, final boolean breakOpportunity, int level) { if (LOG.isDebugEnabled()) { - LOG.debug ( "PS: [" + thisStart + "," + nextStart + "]" ); + LOG.debug ("PS: [" + thisStart + "," + nextStart + "]"); } // End of whitespace // create the AreaInfo object assert nextStart >= thisStart; AreaInfo areaInfo = new AreaInfo - ( thisStart, nextStart, nextStart - thisStart, 0, + (thisStart, nextStart, nextStart - thisStart, 0, wordSpaceIPD.mult(nextStart - thisStart), - false, true, breakOpportunity, spaceFont, level, null ); + false, true, breakOpportunity, spaceFont, level, null); addAreaInfo(areaInfo); @@ -981,8 +981,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } private AreaInfo processWordMapping - ( int lastIndex, final Font font, AreaInfo prevAreaInfo, final char breakOpportunityChar, - final boolean endsWithHyphen, int level ) { + (int lastIndex, final Font font, AreaInfo prevAreaInfo, final char breakOpportunityChar, + final boolean endsWithHyphen, int level) { int s = this.thisStart; // start index of word in FOText character buffer int e = lastIndex; // end index of word in FOText character buffer int nLS = 0; // # of letter spaces @@ -990,68 +990,68 @@ public class TextLayoutManager extends LeafNodeLayoutManager { String language = foText.getLanguage(); if (LOG.isDebugEnabled()) { - LOG.debug ( "PW: [" + thisStart + "," + lastIndex + "]: {" + LOG.debug ("PW: [" + thisStart + "," + lastIndex + "]: {" + " +M" + ", level = " + level - + " }" ); + + " }"); } // 1. extract unmapped character sequence - CharSequence ics = foText.subSequence ( s, e ); + CharSequence ics = foText.subSequence (s, e); // 2. if script is not specified (by FO property) or it is specified as 'auto', // then compute dominant script - if ( ( script == null ) || "auto".equals(script) ) { - script = CharScript.scriptTagFromCode ( CharScript.dominantScript ( ics ) ); + if ((script == null) || "auto".equals(script)) { + script = CharScript.scriptTagFromCode (CharScript.dominantScript (ics)); } - if ( ( language == null ) || "none".equals(language) ) { + if ((language == null) || "none".equals(language)) { language = "dflt"; } // 3. perform mapping of chars to glyphs ... to glyphs ... to chars - CharSequence mcs = font.performSubstitution ( ics, script, language ); + CharSequence mcs = font.performSubstitution (ics, script, language); // 4. compute glyph position adjustments on (substituted) characters int[][] gpa; - if ( font.performsPositioning() ) { + if (font.performsPositioning()) { // handle GPOS adjustments - gpa = font.performPositioning ( mcs, script, language ); - } else if ( font.hasKerning() ) { + gpa = font.performPositioning (mcs, script, language); + } else if (font.hasKerning()) { // handle standard (non-GPOS) kerning adjustments - gpa = getKerningAdjustments ( mcs, font ); + gpa = getKerningAdjustments (mcs, font); } else { gpa = null; } // 5. reorder combining marks so that they precede (within the mapped char sequence) the // base to which they are applied; N.B. position adjustments (gpa) are reordered in place - mcs = font.reorderCombiningMarks ( mcs, gpa, script, language ); + mcs = font.reorderCombiningMarks (mcs, gpa, script, language); // 6. if mapped sequence differs from input sequence, then memoize mapped sequence - if ( !CharUtilities.isSameSequence ( mcs, ics ) ) { - foText.addMapping ( s, e, mcs ); + if (!CharUtilities.isSameSequence (mcs, ics)) { + foText.addMapping (s, e, mcs); } // 7. compute word ipd based on final position adjustments MinOptMax ipd = MinOptMax.ZERO; - for ( int i = 0, n = mcs.length(); i < n; i++ ) { - int c = mcs.charAt ( i ); + for (int i = 0, n = mcs.length(); i < n; i++) { + int c = mcs.charAt (i); // TODO !BMP - int w = font.getCharWidth ( c ); - if ( w < 0 ) { + int w = font.getCharWidth (c); + if (w < 0) { w = 0; } - if ( gpa != null ) { + if (gpa != null) { w += gpa [ i ] [ GlyphPositioningTable.Value.IDX_X_ADVANCE ]; } - ipd = ipd.plus ( w ); + ipd = ipd.plus (w); } // [TBD] - handle letter spacing return new AreaInfo - ( s, e, 0, nLS, ipd, endsWithHyphen, false, - breakOpportunityChar != 0, font, level, gpa ); + (s, e, 0, nLS, ipd, endsWithHyphen, false, + breakOpportunityChar != 0, font, level, gpa); } /** @@ -1061,31 +1061,31 @@ public class TextLayoutManager extends LeafNodeLayoutManager { * @param font applicable font * @return glyph position adjustments (or null if no kerning) */ - private int[][] getKerningAdjustments ( CharSequence mcs, final Font font ) { + private int[][] getKerningAdjustments (CharSequence mcs, final Font font) { int nc = mcs.length(); // extract kerning array int[] ka = new int [ nc ]; // kerning array - for ( int i = 0, n = nc, cPrev = -1; i < n; i++ ) { - int c = mcs.charAt ( i ); + for (int i = 0, n = nc, cPrev = -1; i < n; i++) { + int c = mcs.charAt (i); // TODO !BMP - if ( cPrev >= 0 ) { - ka[i] = font.getKernValue ( cPrev, c ); + if (cPrev >= 0) { + ka[i] = font.getKernValue (cPrev, c); } cPrev = c; } // was there a non-zero kerning? boolean hasKerning = false; - for ( int i = 0, n = nc; i < n; i++ ) { - if ( ka[i] != 0 ) { + for (int i = 0, n = nc; i < n; i++) { + if (ka[i] != 0) { hasKerning = true; break; } } // if non-zero kerning, then create and return glyph position adjustment array - if ( hasKerning ) { + if (hasKerning) { int[][] gpa = new int [ nc ] [ 4 ]; - for ( int i = 0, n = nc; i < n; i++ ) { - if ( i > 0 ) { + for (int i = 0, n = nc; i < n; i++) { + if (i > 0) { gpa [ i - 1 ] [ GlyphPositioningTable.Value.IDX_X_ADVANCE ] = ka [ i ]; } } @@ -1101,10 +1101,10 @@ public class TextLayoutManager extends LeafNodeLayoutManager { MinOptMax wordIPD = MinOptMax.ZERO; if (LOG.isDebugEnabled()) { - LOG.debug ( "PW: [" + thisStart + "," + lastIndex + "]: {" + LOG.debug ("PW: [" + thisStart + "," + lastIndex + "]: {" + " -M" + ", level = " + level - + " }" ); + + " }"); } for (int i = thisStart; i < lastIndex; i++) { @@ -1132,7 +1132,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } } if (kerning - && ( breakOpportunityChar != 0 ) + && (breakOpportunityChar != 0) && !TextLayoutManager.isSpace(breakOpportunityChar) && lastIndex > 0 && endsWithHyphen) { @@ -1151,7 +1151,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { // if there is a break opportunity and the next one (break character) // is not a space, it could be used as a line end; // add one more letter space, in case other text follows - if (( breakOpportunityChar != 0 ) && !TextLayoutManager.isSpace(breakOpportunityChar)) { + if ((breakOpportunityChar != 0) && !TextLayoutManager.isSpace(breakOpportunityChar)) { letterSpaces++; } } @@ -1177,14 +1177,14 @@ public class TextLayoutManager extends LeafNodeLayoutManager { final boolean endsWithHyphen = checkEndsWithHyphen && foText.charAt(lastIndex) == CharUtilities.SOFT_HYPHEN; Font font = FontSelector.selectFontForCharactersInText - ( foText, thisStart, lastIndex, foText, this ); + (foText, thisStart, lastIndex, foText, this); AreaInfo areaInfo; - if ( font.performsSubstitution() || font.performsPositioning() ) { + if (font.performsSubstitution() || font.performsPositioning()) { areaInfo = processWordMapping - ( lastIndex, font, prevAreaInfo, breakOpportunity ? ch : 0, endsWithHyphen, level ); + (lastIndex, font, prevAreaInfo, breakOpportunity ? ch : 0, endsWithHyphen, level); } else { areaInfo = processWordNoMapping - ( lastIndex, font, prevAreaInfo, breakOpportunity ? ch : 0, endsWithHyphen, level ); + (lastIndex, font, prevAreaInfo, breakOpportunity ? ch : 0, endsWithHyphen, level); } prevAreaInfo = areaInfo; addAreaInfo(areaInfo); @@ -1296,8 +1296,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { if (!(nothingChanged && stopIndex == areaInfo.breakIndex && !hyphenFollows)) { // the new AreaInfo object is not equal to the old one changeList.add - ( new PendingChange - ( new AreaInfo(startIndex, stopIndex, 0, + (new PendingChange + (new AreaInfo(startIndex, stopIndex, 0, letterSpaceCount, newIPD, hyphenFollows, false, false, font, -1, null), ((LeafPosition) pos).getLeafPos() + changeOffset)); @@ -1704,7 +1704,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { public String toString() { return super.toString() + "{" + "chars = \'" - + CharUtilities.toNCRefs ( foText.getCharSequence().toString() ) + + CharUtilities.toNCRefs (foText.getCharSequence().toString()) + "\'" + ", len = " + foText.length() + "}"; diff --git a/src/java/org/apache/fop/layoutmgr/table/CellPart.java b/src/java/org/apache/fop/layoutmgr/table/CellPart.java index cde19e67b..7dd2bc201 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CellPart.java +++ b/src/java/org/apache/fop/layoutmgr/table/CellPart.java @@ -61,8 +61,7 @@ class CellPart { * @param bpAfterLast width of (possibly optional) border- and padding-after if this * part will be the last one on the page */ - protected CellPart( // CSOK: ParameterNumber - PrimaryGridUnit pgu, int start, int end, boolean last, + protected CellPart(PrimaryGridUnit pgu, int start, int end, boolean last, int condBeforeContentLength, int length, int condAfterContentLength, int bpBeforeNormal, int bpBeforeFirst, int bpAfterNormal, int bpAfterLast) { diff --git a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java index 88b89e1db..f2a87b75a 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java +++ b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java @@ -63,7 +63,7 @@ public abstract class CollapsingBorderModel { } return collapse; case Constants.EN_COLLAPSE_WITH_PRECEDENCE: - throw new UnsupportedOperationException ( "collapse-with-precedence not yet supported" ); + throw new UnsupportedOperationException ("collapse-with-precedence not yet supported"); default: throw new IllegalArgumentException("Illegal border-collapse mode."); } diff --git a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java index b0ad22386..bb5661a07 100644 --- a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java +++ b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java @@ -59,7 +59,7 @@ public class ColumnSetup { public ColumnSetup(Table table) { assert table != null; this.table = table; - this.wmTraits = WritingModeTraits.getWritingModeTraitsGetter ( table ); + this.wmTraits = WritingModeTraits.getWritingModeTraitsGetter (table); prepareColumns(); initializeColumnWidths(); } @@ -251,7 +251,7 @@ public class ColumnSetup { */ public int getXOffset(int col, int nrColSpan, PercentBaseContext context) { // TODO handle vertical WMs [GA] - if ( (wmTraits != null) && (wmTraits.getColumnProgressionDirection() == Direction.RL) ) { + if ((wmTraits != null) && (wmTraits.getColumnProgressionDirection() == Direction.RL)) { return getXOffsetRTL(col, nrColSpan, context); } else { return getXOffsetLTR(col, context); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java index fbd753d58..878a1285a 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java @@ -390,8 +390,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager * this row is placed on a previous page). Used to calculate the placement of the * row's background image if any */ - public void addAreas( // CSOK: ParameterNumber - PositionIterator parentIter, LayoutContext layoutContext, int[] spannedGridRowHeights, + public void addAreas(PositionIterator parentIter, LayoutContext layoutContext, int[] spannedGridRowHeights, int startRow, int endRow, int borderBeforeWhich, int borderAfterWhich, boolean firstOnPage, boolean lastOnPage, RowPainter painter, int firstRowHeight) { getParentArea(null); |