diff options
author | Keiron Liddle <keiron@apache.org> | 2001-09-25 11:59:18 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-09-25 11:59:18 +0000 |
commit | e8ebf0309db50be59038219c1b88d0c50d12621b (patch) | |
tree | d157ff708eeddecf34dc26c76afc091287c9b27a /src/org/apache/fop/layout | |
parent | cc10c67344520bcb395569dbc739cfb308acee27 (diff) | |
download | xmlgraphics-fop-e8ebf0309db50be59038219c1b88d0c50d12621b.tar.gz xmlgraphics-fop-e8ebf0309db50be59038219c1b88d0c50d12621b.zip |
fixed some text wrapping problems
and improved the wrapping test
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194482 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/layout')
-rw-r--r-- | src/org/apache/fop/layout/LineArea.java | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/src/org/apache/fop/layout/LineArea.java b/src/org/apache/fop/layout/LineArea.java index a3129feb5..1a424470f 100644 --- a/src/org/apache/fop/layout/LineArea.java +++ b/src/org/apache/fop/layout/LineArea.java @@ -432,42 +432,49 @@ public class LineArea extends Area { if (this.wrapOption == WrapOption.WRAP) { - int ret=wordStart; - if (hyphProps.hyphenate == Hyphenate.TRUE) { + int ret = wordStart; ret = this.doHyphenation(dataCopy, i, wordStart, this.getContentWidth() - (finalWidth + spaceWidth + pendingWidth)); + // current word couldn't be hypenated + // couldn't fit first word + // I am at the beginning of my line + if ((ret == wordStart) && + (wordStart == start) && + (finalWidth == 0)) { + + MessageHandler.error(">"); + addSpacedWord(new String(data, wordStart, wordLength - 1), + ls, + finalWidth + spaceWidth + + embeddedLinkStart, + spaceWidth, textState, false); + + finalWidth += wordWidth; + wordWidth = 0; + ret = i; + } + return ret; + } else if (wordStart == start) { + // first word + overrun = true; + // if not at start of line, return word start + // to try again on a new line + if (finalWidth > 0) { + return wordStart; + } + } else { + return wordStart; } - - if ((ret == wordStart) && // current word couldn't be hypenated - (wordStart == start) && // couldn't fit first word - (finalWidth == 0)) { // I am at the beginning of my line - - MessageHandler.error(">"); - - addSpacedWord(new String(data, wordStart, wordLength - 1), - ls, - finalWidth + spaceWidth - + embeddedLinkStart, - spaceWidth, textState, false); - - finalWidth += wordWidth; - wordWidth = 0; - - ret = i; - } - - return ret; } } } - } // end of iteration over text - + } // end of iteration over text if (prev == TEXT) { |