aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index d95525380..e2aec76bd 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -296,8 +296,14 @@ public class LineLayoutManager extends InlineStackingLayoutManager
removedElements = new LinkedList();
inlineLM = (InlineLevelLayoutManager)
((KnuthElement) this.get(this.size() - 1)).getLayoutManager();
- if (effectiveAlignment == EN_CENTER) {
- // centered text: the pattern is
+ if (effectiveAlignment == EN_CENTER
+ || this.size() > 6
+ && ((KnuthElement) this.get(this.size() - 6)).isGlue()
+ && ((KnuthElement) this.get(this.size() - 5)).isPenalty()
+ && ((KnuthElement) this.get(this.size() - 4)).isGlue()
+ && ((KnuthElement) this.get(this.size() - 3)).isBox()
+ && ((KnuthElement) this.get(this.size() - 2)).isPenalty()) {
+ // centered text (or text with inline borders and padding): the pattern is
// <glue> <penaly> <glue> <box> <penaly> <glue>
removedElements.addFirst((KnuthGlue) this.remove(this.size() - 1));
removedElements.addFirst((KnuthPenalty) this.remove(this.size() - 1));