You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by lf...@apache.org on 2005/09/08 12:48:12 UTC

svn commit: r279551 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java test/layoutengine/testcases/wrapper_text-transform_1.xml

Author: lfurini
Date: Thu Sep  8 03:47:57 2005
New Revision: 279551

URL: http://svn.apache.org/viewcvs?rev=279551&view=rev
Log:
Removing trailing spaces at the end of text areas: this is done by storing the Position, whose value points to the AreaInfo created for a space, inside the glue element that is ignored if there is a line break.

This fixes item 2) in bug 36533.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
    xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transform_1.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=279551&r1=279550&r2=279551&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Thu Sep  8 03:47:57 2005
@@ -458,14 +458,14 @@
                                       wordSpaceIPD, false));
                     sequence.add
                         (new KnuthGlue(0, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
-                                       new LeafPosition(this, vecAreaInfo.size() - 1), false));
+                                       new LeafPosition(this, -1), false));
                     sequence.add
                         (new KnuthPenalty(0, 0, false,
                                           new LeafPosition(this, -1), true));
                     sequence.add
                         (new KnuthGlue(wordSpaceIPD.opt,
                                        - 6 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
-                                       new LeafPosition(this, -1), true));
+                                       new LeafPosition(this, vecAreaInfo.size() - 1), true));
                     sequence.add
                         (new KnuthInlineBox(0, 0, 0, 0,
                                       new LeafPosition(this, -1), true));
@@ -486,14 +486,14 @@
                                       wordSpaceIPD, false));
                     sequence.add
                         (new KnuthGlue(0, 3 * wordSpaceIPD.opt, 0,
-                                       new LeafPosition(this, vecAreaInfo.size() - 1), false));
+                                       new LeafPosition(this, -1), false));
                     sequence.add
                         (new KnuthPenalty(0, 0, false,
                                           new LeafPosition(this, -1), true));
                     sequence.add
                         (new KnuthGlue(wordSpaceIPD.opt,
                                        - 3 * wordSpaceIPD.opt, 0,
-                                       new LeafPosition(this, -1), true));
+                                       new LeafPosition(this, vecAreaInfo.size() - 1), true));
                     iNextStart ++;
                     break;
 

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transform_1.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transform_1.xml?rev=279551&r1=279550&r2=279551&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transform_1.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transform_1.xml Thu Sep  8 03:47:57 2005
@@ -41,7 +41,8 @@
   <checks>
     <eval expected="none: This tExT is left as-IS." xpath="//flow/block[1]"/>
     <eval expected="capitalize: This TExT Is Capitalized." xpath="//flow/block[2]"/>
-    <eval expected="uppercase: THIS TEXT IS CONVERTED TO UPPERCASE. LIBERTÉ, ÉGALITÉ, FRATERNITÉ UND KÄSE." xpath="//flow/block[3]"/>
-    <eval expected="lowercase: this text is converted to lowercase. liberté, égalité, fraternité und käse." xpath="//flow/block[4]"/>
+    <!-- spaces are discarded when around a line break -->
+    <eval expected="uppercase: THIS TEXT IS CONVERTED TO UPPERCASE.LIBERTÉ, ÉGALITÉ, FRATERNITÉ UND KÄSE." xpath="//flow/block[3]"/>
+    <eval expected="lowercase: this text is converted to lowercase. liberté, égalité,fraternité und käse." xpath="//flow/block[4]"/>
   </checks>
 </testcase>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: svn commit: r279551 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java test/layoutengine/testcases/wrapper_text-transform_1.xmlLuca,

Posted by Manuel Mall <mm...@arcus.com.au>.
Luca,

can you have a look at this please - this is my code after integrating 
your patch to add the knuth elements for line end / start 
border/padding for the common justify="start" or "end" case. What I am 
getting now is a space at the beginning of each line break!:

if (lineStartBAP != 0 || lineEndBAP != 0) {
    sequence.add
        (new KnuthGlue(lineEndBAP, 0, 0,
                                new LeafPosition(this, -1), true));
    sequence.add
        (new KnuthPenalty(0, 0, false,
                                   new LeafPosition(this, -1), true));
   sequence.add
       (new KnuthGlue(wordSpaceIPD.opt - (lineStartBAP + lineEndBAP),
                               wordSpaceIPD.max - wordSpaceIPD.opt,
                               wordSpaceIPD.opt - wordSpaceIPD.min,
        new LeafPosition(this, -1), true));
    sequence.add
        (new KnuthInlineBox(0, 0, 0, 0,
                  notifyPos(new LeafPosition(this, -1)), true));
    sequence.add
        (new KnuthPenalty(0, KnuthElement.INFINITE, false,
                                   new LeafPosition(this, -1), true));
    sequence.add
        (new KnuthGlue(lineStartBAP, 0, 0,
               new LeafPosition(this, vecAreaInfo.size() - 1), false));
} else {
...
}

Manuel
On Thu, 8 Sep 2005 06:48 pm, you wrote:
> Author: lfurini
> Date: Thu Sep  8 03:47:57 2005
> New Revision: 279551
>
> URL: http://svn.apache.org/viewcvs?rev=279551&view=rev
> Log:
> Removing trailing spaces at the end of text areas: this is done by
> storing the Position, whose value points to the AreaInfo created for
> a space, inside the glue element that is ignored if there is a line
> break.
>
> This fixes item 2) in bug 36533.
>
> Modified:
>    
> xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLa
>youtManager.java
> xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transf
>orm_1.xml
>
> Modified:
> xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLa
>youtManager.java URL:
> http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apac
>he/fop/layoutmgr/inline/TextLayoutManager.java?rev=279551&r1=279550&r2
>=279551&view=diff
> =====================================================================
>========= ---
> xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLa
>youtManager.java (original) +++
> xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLa
>youtManager.java Thu Sep  8 03:47:57 2005 @@ -458,14 +458,14 @@
>                                        wordSpaceIPD, false));
>                      sequence.add
>                          (new KnuthGlue(0, 3 *
> LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, -                          
>             new LeafPosition(this, vecAreaInfo.size() - 1), false));
> +                                       new LeafPosition(this, -1),
> false)); sequence.add
>                          (new KnuthPenalty(0, 0, false,
>                                            new LeafPosition(this,
> -1), true)); sequence.add
>                          (new KnuthGlue(wordSpaceIPD.opt,
>                                         - 6 *
> LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, -                          
>             new LeafPosition(this, -1), true)); +                    
>                   new LeafPosition(this, vecAreaInfo.size() - 1),
> true)); sequence.add
>                          (new KnuthInlineBox(0, 0, 0, 0,
>                                        new LeafPosition(this, -1),
> true)); @@ -486,14 +486,14 @@
>                                        wordSpaceIPD, false));
>                      sequence.add
>                          (new KnuthGlue(0, 3 * wordSpaceIPD.opt, 0,
> -                                       new LeafPosition(this,
> vecAreaInfo.size() - 1), false)); +                                  
>     new LeafPosition(this, -1), false)); sequence.add
>                          (new KnuthPenalty(0, 0, false,
>                                            new LeafPosition(this,
> -1), true)); sequence.add
>                          (new KnuthGlue(wordSpaceIPD.opt,
>                                         - 3 * wordSpaceIPD.opt, 0,
> -                                       new LeafPosition(this, -1),
> true)); +                                       new
> LeafPosition(this, vecAreaInfo.size() - 1), true)); iNextStart ++;
>                      break;
>
>
> Modified:
> xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transf
>orm_1.xml URL:
> http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine
>/testcases/wrapper_text-transform_1.xml?rev=279551&r1=279550&r2=279551
>&view=diff
> =====================================================================
>========= ---
> xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transf
>orm_1.xml (original) +++
> xmlgraphics/fop/trunk/test/layoutengine/testcases/wrapper_text-transf
>orm_1.xml Thu Sep  8 03:47:57 2005 @@ -41,7 +41,8 @@
>    <checks>
>      <eval expected="none: This tExT is left as-IS."
> xpath="//flow/block[1]"/> <eval expected="capitalize: This TExT Is
> Capitalized." xpath="//flow/block[2]"/> -    <eval
> expected="uppercase: THIS TEXT IS CONVERTED TO UPPERCASE. LIBERTÉ,
> ÉGALITÉ, FRATERNITÉ UND KÄSE." xpath="//flow/block[3]"/> -   
> <eval expected="lowercase: this text is converted to lowercase.
> liberté, égalité, fraternité und käse."
> xpath="//flow/block[4]"/> +    <!-- spaces are discarded when around
> a line break -->
> +    <eval expected="uppercase: THIS TEXT IS CONVERTED TO
> UPPERCASE.LIBERTÉ, ÉGALITÉ, FRATERNITÉ UND KÄSE."
> xpath="//flow/block[3]"/> +    <eval expected="lowercase: this text
> is converted to lowercase. liberté, égalité,fraternité und
> käse." xpath="//flow/block[4]"/> </checks>
>  </testcase>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-commits-unsubscribe@xmlgraphics.apache.org For additional
> commands, e-mail: fop-commits-help@xmlgraphics.apache.org