diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-12-22 10:51:29 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-12-22 10:51:29 +0000 |
commit | e6f94a6d688b3150056a1b6842ae45a29b723923 (patch) | |
tree | a2ae7268e6b5451011b7d4196dcc1c794e177f10 /src/java/org/apache/fop/layoutmgr | |
parent | eb2dae3ff914bad79818905ed699e18124dfd5c5 (diff) | |
download | xmlgraphics-fop-e6f94a6d688b3150056a1b6842ae45a29b723923.tar.gz xmlgraphics-fop-e6f94a6d688b3150056a1b6842ae45a29b723923.zip |
More work on preparing for the intermediate format.
Font traits are added in a single place in TraitSetter so it will be easier to change those.
Remove direct references on FObjs in the area tree for regions.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@358555 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
7 files changed, 22 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/Page.java b/src/java/org/apache/fop/layoutmgr/Page.java index 568defb0b..e33230c68 100644 --- a/src/java/org/apache/fop/layoutmgr/Page.java +++ b/src/java/org/apache/fop/layoutmgr/Page.java @@ -32,15 +32,23 @@ public class Page { private SimplePageMaster spm; private PageViewport pageViewport; - public Page(SimplePageMaster spm, String pageStr, boolean blank) { + /** + * Main constructor + * @param spm the simple-page-master used for this page + * @param pageNumberStr the page number (as a String) + * @param blank true if this is a blank page + */ + public Page(SimplePageMaster spm, String pageNumberStr, boolean blank) { this.spm = spm; - this.pageViewport = new PageViewport(spm, pageStr, blank); + this.pageViewport = new PageViewport(spm, pageNumberStr, blank); } + /** @return the simple-page-master that created this page */ public SimplePageMaster getSimplePageMaster() { return this.spm; } + /** @return the page viewport representing this page in the area tree */ public PageViewport getPageViewport() { return this.pageViewport; } diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java index e67075976..482373ad7 100644 --- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java +++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java @@ -31,6 +31,7 @@ import org.apache.fop.fo.Constants; import org.apache.fop.fo.properties.CommonMarginBlock; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.CommonTextDecoration; +import org.apache.fop.fonts.Font; /** * This is a helper class used for setting common traits on areas. @@ -443,6 +444,11 @@ public class TraitSetter { area.addTrait(Trait.BREAK_BEFORE, new Integer(breakBefore)); } + public static void addFontTraits(Area area, Font font) { + area.addTrait(Trait.FONT_NAME, font.getFontName()); + area.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize())); + } + /** * Adds the text-decoration traits to the area. * @param area the area to set the traits on diff --git a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java index d51b2fa15..302e82c26 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java @@ -97,8 +97,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { curArea.setIPD(ipd.opt); curArea.setBPD(font.getAscender() - font.getDescender()); - curArea.addTrait(Trait.FONT_NAME, font.getFontName()); - curArea.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize())); + TraitSetter.addFontTraits(curArea, font); curArea.addTrait(Trait.COLOR, fobj.getColor()); // TODO: may need some special handling for fo:character diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java index 5ee42bac8..44009ed51 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java @@ -135,8 +135,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { t.setIPD(width); t.setBPD(width); t.setBaselineOffset(width); - t.addTrait(Trait.FONT_NAME, font.getFontName()); - t.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize())); + TraitSetter.addFontTraits(t, font); t.addTrait(Trait.COLOR, fobj.getColor()); Space spacer = null; if (fobj.getLeaderPatternWidth().getValue(this) > width) { diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java index 37f23c947..79c2d487d 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java @@ -119,8 +119,7 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { TraitSetter.setProducerID(inline, fobj.getId()); inline.setBPD(font.getAscender() - font.getDescender()); inline.setBaselineOffset(font.getAscender()); - inline.addTrait(Trait.FONT_NAME, font.getFontName()); - inline.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize())); + TraitSetter.addFontTraits(inline, font); inline.addTrait(Trait.COLOR, fobj.getColor()); TraitSetter.addTextDecoration(inline, fobj.getTextDecoration()); diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java index 09daeb212..39a8d08ec 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java @@ -78,9 +78,7 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager { text.setIPD(width); text.setBPD(font.getAscender() - font.getDescender()); text.setBaselineOffset(font.getAscender()); - text.addTrait(Trait.FONT_NAME, font.getFontName()); - text.addTrait(Trait.FONT_SIZE, - new Integer(font.getFontSize())); + TraitSetter.addFontTraits(text, font); text.addTrait(Trait.COLOR, fobj.getColor()); TraitSetter.addTextDecoration(text, fobj.getTextDecoration()); @@ -100,7 +98,7 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager { ta.setBPD(baseArea.getBPD()); ta.setOffset(baseArea.getOffset()); ta.setBaselineOffset(baseArea.getBaselineOffset()); - ta.addTrait(Trait.FONT_NAME, font.getFontName()); //only to initialize the trait map + ta.addTrait(Trait.COLOR, fobj.getColor()); //only to initialize the trait map ta.getTraits().putAll(baseArea.getTraits()); updateContent(ta); return ta; diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index b9730b583..4816f5c02 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -444,8 +444,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } } } - textArea.addTrait(Trait.FONT_NAME, font.getFontName()); - textArea.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize())); + TraitSetter.addFontTraits(textArea, font); textArea.addTrait(Trait.COLOR, foText.getColor()); TraitSetter.addTextDecoration(textArea, foText.getTextDecoration()); |