]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
fixes some vertical alignment
authorKeiron Liddle <keiron@apache.org>
Mon, 9 Sep 2002 10:35:09 +0000 (10:35 +0000)
committerKeiron Liddle <keiron@apache.org>
Mon, 9 Sep 2002 10:35:09 +0000 (10:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195160 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/flow/PageNumber.java
src/org/apache/fop/fo/flow/PageNumberCitation.java
src/org/apache/fop/layoutmgr/ContentLayoutManager.java

index 449413488475da7fedc6fe20bddd74f2cf019e3a..58654a866ad6af6ef7624cda42e618c18ea3e94c 100644 (file)
@@ -72,6 +72,10 @@ public class PageNumber extends FObj {
 
                         return inline;
                     }
+
+                    protected void offsetArea(LayoutContext context) {
+                        curArea.setOffset(context.getBaseline());
+                    }
                 }
                );
     }
index 3093dfc37085cb5b3496c99d576622121abc31ed..b6ac87fad9fbc012848dfe32f3e4971833659abd 100644 (file)
@@ -75,6 +75,10 @@ public class PageNumberCitation extends FObj {
                                                        (Resolveable) inline);
                         }
                     }
+
+                    protected void offsetArea(LayoutContext context) {
+                        curArea.setOffset(context.getBaseline());
+                    }
                 }
                );
     }
index 27204bedc4914493ecaa3d25f3a912dfc40f166b..bf7c364c77fe73356685fab2aca517f6c956c01c 100644 (file)
@@ -43,14 +43,47 @@ public class ContentLayoutManager implements LayoutManager {
         childLC.setStackLimit(new MinOptMax(ipd));
         childLC.setRefIPD(ipd);
 
+        int lineHeight = 14000;
+        int lead = 12000;
+        int follow = 2000;
+
+        int halfLeading = (lineHeight - lead - follow) / 2;
+        // height before baseline
+        int lineLead = lead + halfLeading;
+        // maximum size of top and bottom alignment
+        int maxtb = follow + halfLeading;
+        // max size of middle alignment below baseline
+        int middlefollow = maxtb;
+
         while (!curLM.isFinished()) {
             if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
                 stack.add(bp.getStackingSize());
                 childBreaks.add(bp);
+
+            if(bp.getLead() > lineLead) {
+                lineLead = bp.getLead();
+            }
+            if(bp.getTotal() > maxtb) {
+                maxtb = bp.getTotal();
+            }
+            if(bp.getMiddle() > middlefollow) {
+                middlefollow = bp.getMiddle();
+            }
             }
         }
 
+        if(maxtb - lineLead > middlefollow) {
+            middlefollow = maxtb - lineLead;
+        }
+
+        //if(holder instanceof InlineParent) {
+        //    ((InlineParent)holder).setHeight(lineHeight);
+        //}
+
         LayoutContext lc = new LayoutContext(0);
+        lc.setBaseline(lineLead);
+        lc.setLineHeight(lineHeight);
+
         lc.setFlags(LayoutContext.RESOLVE_LEADING_SPACE, true);
         lc.setLeadingSpace(new SpaceSpecifier(false));
         lc.setTrailingSpace(new SpaceSpecifier(false));