Sfoglia il codice sorgente

Bugfix: Introduced a new member variable in LayoutContext holding the alignment in BP direction. Now that we have mixed inline/block capabilities the alignment must always be properly set depending on the direction we fetch the element lists for. Holding the BP alignment in the LayoutContext makes sure this information doesn't get lost when directions are mixed.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/inlineblock@231042 13f79535-47bb-0310-9956-ffa450edef68
inlineblock
Jeremias Maerki 19 anni fa
parent
commit
78376e8f2c

+ 1
- 0
src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Vedi File

@@ -187,6 +187,7 @@ public abstract class AbstractBreaker {
alignment = Constants.EN_START;
}
alignmentLast = Constants.EN_START;
childLC.setBPAlignment(alignment);

BlockSequence blockList;
blockLists = new java.util.ArrayList();

+ 17
- 0
src/java/org/apache/fop/layoutmgr/LayoutContext.java Vedi File

@@ -91,6 +91,9 @@ public class LayoutContext {
/** Current hyphenation context. May be null. */
private HyphContext hyphContext = null;

/** Alignment in BP direction */
private int bpAlignment = Constants.EN_START;
/** Stretch or shrink value when making areas. */
private double ipdAdjust = 0.0;

@@ -112,6 +115,7 @@ public class LayoutContext {
this.leadingSpace = parentLC.leadingSpace; //???
this.trailingSpace = parentLC.trailingSpace; //???
this.hyphContext = parentLC.hyphContext;
this.bpAlignment = parentLC.bpAlignment;
this.dSpaceAdjust = parentLC.dSpaceAdjust;
this.ipdAdjust = parentLC.ipdAdjust;
this.iLineHeight = parentLC.iLineHeight;
@@ -224,6 +228,19 @@ public class LayoutContext {
return ((this.flags & TRY_HYPHENATE) != 0);
}

/**
* Sets the currently applicable alignment in BP direction.
* @param alignment one of EN_START, EN_JUSTIFY etc.
*/
public void setBPAlignment(int alignment) {
this.bpAlignment = alignment;
}
/** @return the currently applicable alignment in BP direction (EN_START, EN_JUSTIFY...) */
public int getBPAlignment() {
return this.bpAlignment;
}
public void setSpaceAdjust(double adjust) {
dSpaceAdjust = adjust;
}

+ 8
- 2
src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Vedi File

@@ -546,6 +546,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
initialize(); // Normally done when started by parent!
}

/** @see org.apache.fop.layoutmgr.LayoutManager */
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
// Get a break from currently active child LM
// Set up constraints for inline level managers
@@ -582,7 +583,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}

//PHASE 2: Create line breaks
return createLineBreaks(alignment);
return createLineBreaks(context.getBPAlignment());
/*
LineBreakPosition lbp = null;
if (breakpoints == null) {
@@ -903,7 +904,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
/**
* Phase 2 of Knuth algorithm: find optimal break points.
* @param alignment alignment of the paragraph
* @param alignment alignment in BP direction of the paragraph
* @return a list of Knuth elements representing broken lines
*/
private LinkedList createLineBreaks(int alignment) {
@@ -1057,6 +1058,11 @@ public class LineLayoutManager extends InlineStackingLayoutManager
return lineLayouts;
}

/**
* Creates the element list in BP direction for the broken lines.
* @param alignment the currently applicable vertical alignment
* @return the newly built element list
*/
private LinkedList postProcessLineBreaks(int alignment) {
LinkedList returnList = new LinkedList();

Loading…
Annulla
Salva