From dd8891583eb347173ca359067098aafd2b7115f0 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Mon, 9 Sep 2002 10:35:09 +0000 Subject: [PATCH] fixes some vertical alignment 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 | 4 +++ .../fop/fo/flow/PageNumberCitation.java | 4 +++ .../fop/layoutmgr/ContentLayoutManager.java | 33 +++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/src/org/apache/fop/fo/flow/PageNumber.java b/src/org/apache/fop/fo/flow/PageNumber.java index 449413488..58654a866 100644 --- a/src/org/apache/fop/fo/flow/PageNumber.java +++ b/src/org/apache/fop/fo/flow/PageNumber.java @@ -72,6 +72,10 @@ public class PageNumber extends FObj { return inline; } + + protected void offsetArea(LayoutContext context) { + curArea.setOffset(context.getBaseline()); + } } ); } diff --git a/src/org/apache/fop/fo/flow/PageNumberCitation.java b/src/org/apache/fop/fo/flow/PageNumberCitation.java index 3093dfc37..b6ac87fad 100644 --- a/src/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/org/apache/fop/fo/flow/PageNumberCitation.java @@ -75,6 +75,10 @@ public class PageNumberCitation extends FObj { (Resolveable) inline); } } + + protected void offsetArea(LayoutContext context) { + curArea.setOffset(context.getBaseline()); + } } ); } diff --git a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java index 27204bedc..bf7c364c7 100644 --- a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java @@ -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)); -- 2.39.5