diff options
author | Luca Furini <lfurini@apache.org> | 2005-10-14 12:20:25 +0000 |
---|---|---|
committer | Luca Furini <lfurini@apache.org> | 2005-10-14 12:20:25 +0000 |
commit | 0f17fab8c1eeb0bcc652dd5667f91f7c25c3087e (patch) | |
tree | 0e7e6fd3baccf4c5121aab131adf7fed0c92f3df /src/java/org | |
parent | 7e12b241fc151f2152be0780638421cb7e409df9 (diff) | |
download | xmlgraphics-fop-0f17fab8c1eeb0bcc652dd5667f91f7c25c3087e.tar.gz xmlgraphics-fop-0f17fab8c1eeb0bcc652dd5667f91f7c25c3087e.zip |
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
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java | 10 |
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)); |