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/06/14 18:12:08 UTC

cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr LineLayoutManager.java

lfurini     2005/06/14 09:12:08

  Modified:    src/java/org/apache/fop/layoutmgr LineLayoutManager.java
  Log:
  The bpd of lines with no real content must collapse to 0
  
  Revision  Changes    Path
  1.49      +27 -11    xml-fop/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
  
  Index: LineLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- LineLayoutManager.java	10 Jun 2005 03:56:49 -0000	1.48
  +++ LineLayoutManager.java	14 Jun 2005 16:12:08 -0000	1.49
  @@ -354,6 +354,10 @@
               int maxtb = follow;
               // max size of middle alignment before and after the middle baseline
               int middlefollow = maxtb;
  +            // true if this line contains only zero-height, auxiliary boxes
  +            // and the actual line width is 0; in this case, the line "collapses"
  +            // i.e. the line area will have bpd = 0
  +            boolean bZeroHeightLine = (difference == iLineWidth);
   
               // if line-stacking-strategy is "font-height", the line height
               // is not affected by its content
  @@ -379,6 +383,13 @@
                               middlefollow += ((KnuthInlineBox) element).getMiddle()
                                               - middlefollow + middleShift;
                           }
  +                        if (bZeroHeightLine
  +                            && (!element.isAuxiliary()
  +                                || ((KnuthInlineBox) element).getTotal() > 0
  +                                || ((KnuthInlineBox) element).getLead() > 0
  +                                || ((KnuthInlineBox) element).getMiddle() > 0)) {
  +                            bZeroHeightLine = false;
  +                        }
                       }
                   }
   
  @@ -387,19 +398,24 @@
                   }
               }
   
  -            //lineLead += halfLeading;
  -            //middlefollow += lineHeight - lead - follow - halfLeading;
  -
               constantLineHeight = lineLead + middlefollow + (lineHeight - lead - follow);
  -            //System.out.println("desired height: " + lineHeight + " actual height: " + (lineLead + middlefollow + (lineHeight - lead - follow)) + " halfleading = " + halfLeading + " and " + (lineHeight - lead - follow - halfLeading));
   
  -            return new LineBreakPosition(thisLLM,
  -                                         knuthParagraphs.indexOf(par),
  -                                         lastElementIndex,
  -                                         availableShrink, availableStretch, difference, ratio, 0, indent,
  -                                         lineLead + middlefollow + (lineHeight - lead - follow), iLineWidth,
  -                                         lineLead + halfLeading,
  -                                         - lineLead, middlefollow);
  +            if (bZeroHeightLine) {
  +                return new LineBreakPosition(thisLLM,
  +                                             knuthParagraphs.indexOf(par),
  +                                             lastElementIndex,
  +                                             availableShrink, availableStretch, difference, ratio, 0, indent,
  +                                             0, iLineWidth,
  +                                             0, 0, 0);
  +            } else {
  +                return new LineBreakPosition(thisLLM,
  +                                             knuthParagraphs.indexOf(par),
  +                                             lastElementIndex,
  +                                             availableShrink, availableStretch, difference, ratio, 0, indent,
  +                                             lineLead + middlefollow + (lineHeight - lead - follow), iLineWidth,
  +                                             lineLead + halfLeading,
  +                                             - lineLead, middlefollow);
  +            }
           }
   
           public int findBreakingPoints(Paragraph par, int lineWidth,
  
  
  

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