From 45f01c52b81853ec80715f4b7f576f07c6c79802 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 29 Jun 2005 20:59:27 +0000 Subject: [PATCH] Fix vertical placement of page-number and page-number-citation. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@202427 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/layoutmgr/LeafNodeLayoutManager.java | 13 ++++++++++--- .../layoutmgr/PageNumberCitationLayoutManager.java | 7 ++++++- .../fop/layoutmgr/PageNumberLayoutManager.java | 9 ++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java index 42339f1cc..04c9e3136 100644 --- a/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java @@ -122,12 +122,16 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager * Set the lead for this inline area. * The lead is the distance from the top of the object * to the baseline. - * Currently not used. * @param l the lead value */ public void setLead(int l) { lead = l; } + + /** @return the lead value (distance from the top of the object to the baseline) */ + public int getLead() { + return this.lead; + } /** * This is a leaf-node, so this method is never called. @@ -258,8 +262,11 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager case EN_BOTTOM : total = bpd; break; case EN_BASELINE: - default: lead = bpd; - break; + default: + //lead = bpd; + lead = getLead(); + total = bpd; + break; } // create the AreaInfo object to store the computed values diff --git a/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java index 743db69af..f8530b8b2 100644 --- a/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java @@ -33,7 +33,7 @@ import org.apache.fop.fonts.Font; public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { private PageNumberCitation fobj; - private Font font = null; + private Font font; // whether the page referred to by the citation has been resolved yet private boolean resolved = false; @@ -62,6 +62,11 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { } } + /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#getLead() */ + public int getLead() { + return font.getAscender(); + } + protected void offsetArea(InlineArea area, LayoutContext context) { area.setOffset(context.getBaseline()); } diff --git a/src/java/org/apache/fop/layoutmgr/PageNumberLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageNumberLayoutManager.java index 908ee58fc..bbe8b4f1e 100644 --- a/src/java/org/apache/fop/layoutmgr/PageNumberLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageNumberLayoutManager.java @@ -28,8 +28,9 @@ import org.apache.fop.fonts.Font; * LayoutManager for the fo:page-number formatting object */ public class PageNumberLayoutManager extends LeafNodeLayoutManager { + private PageNumber fobj; - private Font font = null; + private Font font; /** * Constructor @@ -64,6 +65,12 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager { return inline; } + + /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#getLead() */ + public int getLead() { + return font.getAscender(); + } + protected void offsetArea(InlineArea area, LayoutContext context) { area.setOffset(context.getBaseline()); } -- 2.39.5