There is still a problem with hypenation.

When a non letter character is derectly before a word with hyphens in the 
word, fop runs into a infinite loop
I've attached a Patch and the testfile. The testfile also includes a 
demonstration for some other bugs with hyphenation but I don't know how to 
resolve them.

Enrico


<?xml version="1.0" encoding="ISO-8859-1" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
	<fo:layout-master-set>
		<fo:simple-page-master master-name="first"
                               margin-top="1cm"
                               margin-left="1cm"
                               margin-right="1cm"
                               margin-bottom="1cm"
                               page-width="21cm"
                               page-height="29.7cm">
			<fo:region-body/>
		</fo:simple-page-master>
	</fo:layout-master-set>
	<fo:page-sequence master-name="first" language="en" hyphenate="true">
		<fo:flow flow-name="xsl-region-body">
            <fo:block>
            	1. The first cell causes an infinite loop if there is a incorrect hyphenation function. With patch the result is still not correct but it runs through.
            </fo:block>
            <fo:block>
                2. The second cell is to show how special chars handleld with hypenation.
            </fo:block>
            <fo:block>
                3. The third cell is to demonstrate the inlinespace before the first hyphenated word in line.
            </fo:block>
            <fo:block>
                4. cell 1 and 3 should contain completly underlined blue text.
            </fo:block>
            <fo:block>
                4.1. within the first cell both properies are specified for &lt;fo:inline&gt;.
				The addWord function should set the underlined property.
            </fo:block>
            <fo:block>
                4.2. within the third cell both properies are specified for &lt;fo:block&gt;.
                The underlined property is not handled.
            </fo:block>
            <fo:table>
                <fo:table-column column-width="3.5cm"/>
                <fo:table-body>
                    <fo:table-row>
                        <fo:table-cell border-width="1pt" border-style="solid">
                            <fo:block>
                	            <fo:inline text-decoration="underline" color="blue">beginning "test-text-for-filling-three-lines"</fo:inline>
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                        <fo:table-cell border-width="1pt" border-style="solid">
                            <fo:block>
                	            &lt;testtext&gt; &lt;testtext&gt; - &lt;testtext&gt; - &lt;testtext&gt; - &lt;testtext&gt;
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                        <fo:table-cell border-width="1pt" border-style="solid">
                            <fo:block font-size="14pt" text-decoration="underline" color="blue">
             	               LongTextLongText LongTextLongText LongTextLongText LongTextLongText
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>
            <fo:block>
            	The following table has the same content but full page width.
            </fo:block>
            <fo:table>
                <fo:table-column column-width="19cm"/>
                <fo:table-body>
                    <fo:table-row>
                        <fo:table-cell border-width="1pt" border-style="solid">
                            <fo:block>
                	            <fo:inline text-decoration="underline" color="blue">beginning "test-text-for-filling-three-lines"</fo:inline>
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                        <fo:table-cell border-width="1pt" border-style="solid">
                            <fo:block>
                	            &lt;testtext&gt; &lt;testtext&gt; - &lt;testtext&gt; - &lt;testtext&gt; - &lt;testtext&gt;
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                        <fo:table-cell border-width="1pt" border-style="solid">
                            <fo:block font-size="14pt" text-decoration="underline" color="blue">
             	               LongTextLongText LongTextLongText LongTextLongText LongTextLongText
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>
		</fo:flow>
	</fo:page-sequence>
</fo:root>

? diff
? LineArea.java.diff
Index: LineArea.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/layout/LineArea.java,v
retrieving revision 1.50
diff -u -r1.50 LineArea.java
--- LineArea.java	2001/08/31 12:55:05	1.50
+++ LineArea.java	2001/08/31 22:09:18
@@ -941,14 +941,15 @@
         // we will only handle hard hyphens and slashes
         if (getWordWidth(wordToHyphenate) < remainingWidth) {
             inwordPunctuation =
-                characters[wordStart + wordToHyphenate.length()];
+                characters[wordStart + remainingString.length()
+                    + wordToHyphenate.length()];
             if (inwordPunctuation == '-' || inwordPunctuation == '/') {
                 preString = new StringBuffer(wordToHyphenate);
                 preString = preString.append(inwordPunctuation);
                 wordToHyphenate =
                     getHyphenationWord(characters,
-                                       wordStart + wordToHyphenate.length()
-                                       + 1);
+                                       wordStart + remainingString.length()
+                                       + wordToHyphenate.length() + 1);
                 remainingWidth -=
                     (getWordWidth(wordToHyphenate)
                      + this.currentFontState.width(currentFontState.mapChar(inwordPunctuation)));
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to