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
codepage, encoding, characterset, path));
}
}
- return new AFPFontInfo(font, tripleList);
+ return new AFPFontInfo(font, tripletList);
} else if ("outline".equalsIgnoreCase(type)) {
String characterset = afpFontCfg.getAttribute("characterset");
}
// 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");
}
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);
+ 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);
+// }
}
}
}
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++;
}
}
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());
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() {
/**
* 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;
}
}
objects.add(obj);
}
-// /** {@inheritDoc} */
-// protected void addObject(AbstractAFPObject obj) {
-// if (obj instanceof DataObjectAccessor) {
-// DataObjectAccessor dataObjectAccessor = (DataObjectAccessor)obj;
-// getActiveEnvironmentGroup().createMapDataResource(dataObjectAccessor);
-// }
-// endPresentationObject();
-// }
}
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
*/
}
/**
+ * Return the number of resources in this container
+ *
* @return the number of resources in this container
*/
protected int getResourceCount() {
}
/**
+ * Returns true if this resource group container contains resources
+ *
* @return true if this resource group container contains resources
*/
protected boolean hasResources() {
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);