keiron 01/09/25 04:59:18 Modified: src/org/apache/fop/layout LineArea.java test/xml/bugtests wrap.fo Log: fixed some text wrapping problems and improved the wrapping test Revision Changes Path 1.51 +32 -25 xml-fop/src/org/apache/fop/layout/LineArea.java Index: LineArea.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/LineArea.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- LineArea.java 2001/08/31 12:55:05 1.50 +++ LineArea.java 2001/09/25 11:59:18 1.51 @@ -1,5 +1,5 @@ /* - * $Id: LineArea.java,v 1.50 2001/08/31 12:55:05 keiron Exp $ + * $Id: LineArea.java,v 1.51 2001/09/25 11:59:18 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -432,42 +432,49 @@ 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)); - - } - - - 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; + // 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; } - return ret; } } } - } // end of iteration over text - + } // end of iteration over text if (prev == TEXT) { 1.2 +141 -35 xml-fop/test/xml/bugtests/wrap.fo Index: wrap.fo =================================================================== RCS file: /home/cvs/xml-fop/test/xml/bugtests/wrap.fo,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- wrap.fo 2001/05/22 13:05:21 1.1 +++ wrap.fo 2001/09/25 11:59:18 1.2 @@ -1,35 +1,141 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> - <fo:layout-master-set> - <fo:simple-page-master master-name="simplePM" - page-height="25cm" - page-width="20cm" - margin-top="1cm" - margin-bottom="1cm" - margin-left="1.5cm" - margin-right="1.5cm"> - <fo:region-before extent="2.5cm"/> - <fo:region-body margin-top="3cm" margin-bottom="3cm"/> - <fo:region-after extent="2.5cm"/> - </fo:simple-page-master> - </fo:layout-master-set> - - <fo:page-sequence master-name="simplePM"> - <fo:flow flow-name="xsl-region-body"> - <fo:block wrap-option="no-wrap"> - <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> - <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> - <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> - <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> - - <fo:block space-before.optimum="1cm" wrap-option="wrap"> - <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> - <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> - <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> - </fo:block> - This is simple fo block.This is simple fo block.This is simple fo block.This is simple fo block. - This is simple fo block.This is simple fo block.This is simple fo block.This is simple fo block. - </fo:block> - </fo:flow> - </fo:page-sequence> -</fo:root> +<?xml version="1.0" encoding="UTF-8"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="simplePM" + page-height="25cm" + page-width="20cm" + margin-top="1cm" + margin-bottom="1cm" + margin-left="1.5cm" + margin-right="1.5cm"> + <fo:region-before extent="2.5cm"/> + <fo:region-body margin-top="3cm" margin-bottom="3cm"/> + <fo:region-after extent="2.5cm"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="no-overflow" + page-height="25cm" + page-width="20cm" + margin-top="1cm" + margin-bottom="1cm" + margin-left="1.5cm" + margin-right="1.5cm"> + <fo:region-before extent="2.5cm"/> + <fo:region-body overflow="hidden" margin-top="3cm" margin-bottom="3cm"/> + <fo:region-after extent="2.5cm"/> + </fo:simple-page-master> + </fo:layout-master-set> + + <fo:page-sequence master-name="simplePM"> + <fo:flow flow-name="xsl-region-body"> + <fo:block> +This test is to check a number of different possibilities when dealing with +text being wrapped at the end of an area. + </fo:block> + <fo:block wrap-option="no-wrap"> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + + <fo:block space-before.optimum="1cm" wrap-option="wrap"> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + </fo:block> + This is simple fo block.This is simple fo block.This is simple fo block.This is simple fo block. + This is simple fo block.This is simple fo block.This is simple fo block.This is simple fo block. + </fo:block> + <fo:block space-before.optimum="10pt"> +Some examples in a table. + </fo:block> +<fo:table border-style="solid" border-width="1pt" border-color="blue"> +<fo:table-column column-width="50pt"/> +<fo:table-body> +<fo:table-row> +<fo:table-cell> + <fo:block> +a normal paragraph with spaces and normal words + </fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row> +<fo:table-cell> + <fo:block wrap-option="no-wrap" space-before.optimum="5pt"> +a normal paragraph with spaces and normal words + </fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row> +<fo:table-cell> + <fo:block space-before.optimum="5pt"> +areallylongwordwhichisreallymanywords + </fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row> +<fo:table-cell> + <fo:block wrap-option="no-wrap" space-before.optimum="5pt"> +areallylongwordwhichisreallymanywords + </fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row> +<fo:table-cell> + <fo:block space-before.optimum="5pt" + language="en" + country="GB" + hyphenate="true" + hyphenation-push-character-count="2" + hyphenation-remain-character-count="2"> +words with hypenation the activated when doing lots of wrapping + </fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row> +<fo:table-cell> + <fo:block space-before.optimum="5pt" + language="en" + country="GB" + hyphenate="true" + hyphenation-push-character-count="2" + hyphenation-remain-character-count="2"> +interdependancy is a nice long word + </fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row> +<fo:table-cell> + <fo:block space-before.optimum="5pt" + wrap-option="no-wrap" + language="en" + country="UK" + hyphenate="true" + hyphenation-push-character-count="2" + hyphenation-remain-character-count="2"> +words with hypenation the activated when not doing lots of wrapping + </fo:block> +</fo:table-cell> +</fo:table-row> +</fo:table-body> +</fo:table> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-name="no-overflow"> + <fo:flow flow-name="xsl-region-body"> + <fo:block wrap-option="no-wrap"> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + + <fo:block space-before.optimum="1cm" wrap-option="wrap"> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + <fo:inline>This is a simple fo block.This is a simple fo block.This is a simple fo block.</fo:inline> + </fo:block> + This is simple fo block.This is simple fo block.This is simple fo block.This is simple fo block. + This is simple fo block.This is simple fo block.This is simple fo block.This is simple fo block. + </fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]