diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-07-21 09:21:11 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-07-21 09:21:11 +0000 |
commit | c442df1c208fd7eeb17a3bc1eb1aad750d9be333 (patch) | |
tree | a93cbe7747a273b396c167febc1445ec94e325cc /src | |
parent | c1d4667ff7e31f2228b3fb3fa15d24f4b35baadc (diff) | |
download | xmlgraphics-fop-c442df1c208fd7eeb17a3bc1eb1aad750d9be333.tar.gz xmlgraphics-fop-c442df1c208fd7eeb17a3bc1eb1aad750d9be333.zip |
Tidy up.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@678371 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
5 files changed, 42 insertions, 51 deletions
diff --git a/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java b/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java index 30d59c4ae..3b3a1c522 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java +++ b/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java @@ -57,16 +57,17 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator { throws ConfigurationException { Configuration[] triple = fontCfg.getChildren("font-triplet"); - List tripleList = new java.util.ArrayList(); + List/*<FontTriplet>*/ tripletList = new java.util.ArrayList(); if (triple.length == 0) { log.error("Mandatory font configuration element '<font-triplet...' is missing"); return null; } for (int j = 0; j < triple.length; j++) { int weight = FontUtil.parseCSS2FontWeight(triple[j].getAttribute("weight")); - tripleList.add(new FontTriplet(triple[j].getAttribute("name"), - triple[j].getAttribute("style"), - weight)); + FontTriplet triplet = new FontTriplet(triple[j].getAttribute("name"), + triple[j].getAttribute("style"), + weight); + tripletList.add(triplet); } //build the fonts @@ -140,7 +141,7 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator { codepage, encoding, characterset, path)); } } - return new AFPFontInfo(font, tripleList); + return new AFPFontInfo(font, tripletList); } else if ("outline".equalsIgnoreCase(type)) { String characterset = afpFontCfg.getAttribute("characterset"); @@ -174,7 +175,7 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator { } // Create a new font object OutlineFont font = new OutlineFont(name, characterSet); - return new AFPFontInfo(font, tripleList); + return new AFPFontInfo(font, tripletList); } else { log.error("No or incorrect type attribute"); } @@ -244,16 +245,6 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator { afpRenderer.setResolution(rendererResolutionCfg.getValueAsInteger(240)); } - // TODO: provide support for different MO:DCA interchange sets - // the MO:DCA interchange set in use (defaults to MO:DCA-L) -// Configuration modcaCfg = cfg.getChild("modca", false); -// if (modcaCfg != null) { -// String interchangeSetString = cfg.getAttribute( -// "interchange-set", InterchangeSet.MODCA_PRESENTATION_INTERCHANGE_SET_2); -// InterchangeSet interchangeSet = InterchangeSet.valueOf(interchangeSetString); -// afpRenderer.getAFPDataStream().setInterchangeSet(interchangeSet); -// } - // a default external resource group file setting Configuration resourceGroupFileCfg = cfg.getChild("resource-group-file", false); @@ -274,6 +265,16 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator { + resourceGroupDest + "'"); } } + + // TODO: provide support for different MO:DCA interchange sets + // the MO:DCA interchange set in use (defaults to MO:DCA-L) +// Configuration modcaCfg = cfg.getChild("modca", false); +// if (modcaCfg != null) { +// String interchangeSetString = cfg.getAttribute( +// "interchange-set", InterchangeSet.MODCA_PRESENTATION_INTERCHANGE_SET_2); +// InterchangeSet interchangeSet = InterchangeSet.valueOf(interchangeSetString); +// afpRenderer.getAFPDataStream().setInterchangeSet(interchangeSet); +// } } } } diff --git a/src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java b/src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java index 55953daf0..9ee169d80 100644 --- a/src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java +++ b/src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java @@ -57,13 +57,14 @@ public class AFPFontCollection implements FontCollection { int num = 1; if (embedFontInfoList != null && embedFontInfoList.size() > 0) { for (Iterator it = embedFontInfoList.iterator(); it.hasNext();) { - AFPFontInfo afi = (AFPFontInfo)it.next(); - AFPFont bf = (AFPFont)afi.getAFPFont(); - for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext();) { - FontTriplet ft = (FontTriplet)it2.next(); - fontInfo.addFontProperties("F" + num, ft.getName() - , ft.getStyle(), ft.getWeight()); - fontInfo.addMetrics("F" + num, bf); + AFPFontInfo afpFontInfo = (AFPFontInfo)it.next(); + AFPFont afpFont = (AFPFont)afpFontInfo.getAFPFont(); + List/*<FontTriplet>*/ tripletList = afpFontInfo.getFontTriplets(); + for (Iterator it2 = tripletList.iterator(); it2.hasNext();) { + FontTriplet triplet = (FontTriplet)it2.next(); + fontInfo.addFontProperties("F" + num, + triplet.getName(), triplet.getStyle(), triplet.getWeight()); + fontInfo.addMetrics("F" + num, afpFont); num++; } } @@ -71,6 +72,8 @@ public class AFPFontCollection implements FontCollection { AFPEventProducer eventProducer = AFPEventProducer.Provider.get(eventBroadcaster); eventProducer.warnDefaultFontSetup(this); } + + // note: these fonts may not exist on your AFP installation if (fontInfo.fontLookup("sans-serif", Font.STYLE_NORMAL, Font.WEIGHT_NORMAL) == null) { CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500", "CZH200 ", 1, new Helvetica()); diff --git a/src/java/org/apache/fop/render/afp/fonts/AFPFontInfo.java b/src/java/org/apache/fop/render/afp/fonts/AFPFontInfo.java index 42f333a66..a70dce4b9 100644 --- a/src/java/org/apache/fop/render/afp/fonts/AFPFontInfo.java +++ b/src/java/org/apache/fop/render/afp/fonts/AFPFontInfo.java @@ -27,20 +27,22 @@ import java.util.List; public class AFPFontInfo { private AFPFont font; - private List fontTriplets; + private List/*<FontTriplet>*/ tripletList; /** * Main constructor + * * @param afpFont The AFP Font - * @param fontTriplets List of font triplets to associate with this font + * @param tripletList List of font triplets to associate with this font */ - public AFPFontInfo(AFPFont afpFont, List fontTriplets) { + public AFPFontInfo(AFPFont afpFont, List/*<FontTriplet>*/ tripletList) { this.font = afpFont; - this.fontTriplets = fontTriplets; + this.tripletList = tripletList; } /** * Returns the afp font + * * @return the afp font */ public AFPFont getAFPFont() { @@ -49,10 +51,11 @@ public class AFPFontInfo { /** * Returns the list of font triplets associated with this font. + * * @return List of font triplets */ - public List getFontTriplets() { - return fontTriplets; + public List/*<FontTriplet>*/ getFontTriplets() { + return tripletList; } } diff --git a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java index 73c4b6821..d3b4d10a9 100644 --- a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java +++ b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java @@ -382,12 +382,4 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject { objects.add(obj); } -// /** {@inheritDoc} */ -// protected void addObject(AbstractAFPObject obj) { -// if (obj instanceof DataObjectAccessor) { -// DataObjectAccessor dataObjectAccessor = (DataObjectAccessor)obj; -// getActiveEnvironmentGroup().createMapDataResource(dataObjectAccessor); -// } -// endPresentationObject(); -// } } diff --git a/src/java/org/apache/fop/render/afp/modca/AbstractResourceGroupContainer.java b/src/java/org/apache/fop/render/afp/modca/AbstractResourceGroupContainer.java index 55f3a89b1..b1d4980a8 100644 --- a/src/java/org/apache/fop/render/afp/modca/AbstractResourceGroupContainer.java +++ b/src/java/org/apache/fop/render/afp/modca/AbstractResourceGroupContainer.java @@ -22,12 +22,11 @@ package org.apache.fop.render.afp.modca; import java.io.IOException; import java.io.OutputStream; -//import org.apache.fop.render.afp.DataObjectInfo; - /** * An abstract container of resource objects */ public abstract class AbstractResourceGroupContainer extends AbstractPageObject { + /** * The resource group object */ @@ -72,6 +71,8 @@ public abstract class AbstractResourceGroupContainer extends AbstractPageObject } /** + * Return the number of resources in this container + * * @return the number of resources in this container */ protected int getResourceCount() { @@ -82,6 +83,8 @@ public abstract class AbstractResourceGroupContainer extends AbstractPageObject } /** + * Returns true if this resource group container contains resources + * * @return true if this resource group container contains resources */ protected boolean hasResources() { @@ -98,18 +101,7 @@ public abstract class AbstractResourceGroupContainer extends AbstractPageObject return resourceGroup; } -// /** -// * Creates and returns a new data object -// * @param dataObjectInfo the data object info -// * @return a newly created data object -// */ -// public AbstractNamedAFPObject createObject(DataObjectInfo dataObjectInfo) { -// return dataObjectFactory.create(dataObjectInfo); -// } - - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ protected void writeContent(OutputStream os) throws IOException { if (resourceGroup != null) { resourceGroup.write(os); |