From 0f17fab8c1eeb0bcc652dd5667f91f7c25c3087e Mon Sep 17 00:00:00 2001 From: Luca Furini Date: Fri, 14 Oct 2005 12:20:25 +0000 Subject: Fixing a ClassCastException due to the incorrect "pattern" of elements representing a space checked when there are inline borders and padding. Maybe not very elegant ... but at least it works; as Manuel suggested, the removal of trailing spaces should maybe happen somewhere else. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@321084 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/layoutmgr/inline/LineLayoutManager.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/java/org') 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 // removedElements.addFirst((KnuthGlue) this.remove(this.size() - 1)); removedElements.addFirst((KnuthPenalty) this.remove(this.size() - 1)); -- cgit v1.2.3