package org.apache.fop.configuration;
+import org.apache.fop.render.pdf.EmbedFontInfo;
+import org.apache.fop.render.pdf.FontTriplet;
+
// sax
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.Attributes;
private ArrayList fontList = null;
// stores information on one font
- private FontInfo fontInfo = null;
+ private EmbedFontInfo fontInfo = null;
// stores information on a font triplet
private FontTriplet fontTriplet = null;
} else if (localName.equals("fonts")) {
this.store("standard", "fonts", fontList);
} else if (localName.equals("font")) {
- fontInfo = new FontInfo(fontName, metricsFile, kerning,
+ fontInfo = new EmbedFontInfo(fontName, metricsFile, kerning,
fontTriplets, embedFile);
fontList.add(fontInfo);
fontTriplets = null;
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-
-package org.apache.fop.configuration;
-
-import java.util.ArrayList;
-
-/**
- * FontInfo contains meta information on fonts (where is the metrics file etc.)
- */
-
-public class FontInfo {
- private String metricsFile, embedFile, name;
- private boolean kerning;
- private ArrayList fontTriplets;
-
- public FontInfo(String name, String metricsFile, boolean kerning,
- ArrayList fontTriplets, String embedFile) {
- this.name = name;
- this.metricsFile = metricsFile;
- this.embedFile = embedFile;
- this.kerning = kerning;
- this.fontTriplets = fontTriplets;
- }
-
- public String getMetricsFile() {
- return metricsFile;
- }
-
- public String getEmbedFile() {
- return embedFile;
- }
-
- public boolean getKerning() {
- return kerning;
- }
-
- public ArrayList getFontTriplets() {
- return fontTriplets;
- }
-
-}
-
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-
-package org.apache.fop.configuration;
-
-/**
- * FontTriplet contains information on name, weight, style of one font
- */
-
-
-public class FontTriplet {
- private String name, weight, style;
- public FontTriplet(String name, String weight, String style) {
- this.name = name;
- this.weight = weight;
- this.style = style;
- }
-
- public String getName() {
- return name;
- }
-
- public String getWeight() {
- return weight;
- }
-
- public String getStyle() {
- return style;
- }
-
-}
-
-
-
-
public MIFHandler(OutputStream os) {
outStream = os;
// use pdf fonts for now, this is only for resolving names
- org.apache.fop.render.pdf.FontSetup.setup(fontInfo);
+ org.apache.fop.render.pdf.FontSetup.setup(fontInfo, org.apache.fop.configuration.Configuration.getFonts());
}
public FontInfo getFontInfo() {
* time to work out, and is so obvious now. Sigh.
* mark-fop@inomial.com. Maybe I should do a PDF course.
*/
- public PDFDocument() {
+ public PDFDocument(String prod) {
/* create the /Root, /Info and /Resources objects */
this.pages = makePages();
this.resources = makeResources();
// Make the /Info record
- this.info = makeInfo();
+ this.info = makeInfo(prod);
}
/**
* @param producer string indicating application producing the PDF
* @return the created /Info object
*/
- protected PDFInfo makeInfo() {
+ protected PDFInfo makeInfo(String prod) {
/*
* create a PDFInfo with the next object number and add to
*/
PDFInfo pdfInfo = new PDFInfo(++this.objectcount);
// set the default producer
- pdfInfo.setProducer(org.apache.fop.apps.Version.getVersion());
+ pdfInfo.setProducer(prod);
this.objects.add(pdfInfo);
return pdfInfo;
}
* Create a PDFICCStream
@see PDFXObject
@see org.apache.fop.image.JpegImage
- @see org.apache.fop.datatypes.ColorSpace
+ @see org.apache.fop.pdf.PDFColorSpace
*/
public PDFICCStream makePDFICCStream() {
PDFICCStream iccStream = new PDFICCStream(++this.objectcount);
*/
public void setupFontInfo(FontInfo fontInfo) {
this.fontInfo = fontInfo;
- FontSetup.setup(fontInfo);
+ FontSetup.setup(fontInfo, org.apache.fop.configuration.Configuration.getFonts());
}
/**
--- /dev/null
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
+
+package org.apache.fop.render.pdf;
+
+import java.util.ArrayList;
+
+/**
+ * FontInfo contains meta information on fonts (where is the metrics file etc.)
+ */
+public class EmbedFontInfo {
+ private String metricsFile, embedFile, name;
+ private boolean kerning;
+ private ArrayList fontTriplets;
+
+ public EmbedFontInfo(String name, String metricsFile, boolean kerning,
+ ArrayList fontTriplets, String embedFile) {
+ this.name = name;
+ this.metricsFile = metricsFile;
+ this.embedFile = embedFile;
+ this.kerning = kerning;
+ this.fontTriplets = fontTriplets;
+ }
+
+ public String getMetricsFile() {
+ return metricsFile;
+ }
+
+ public String getEmbedFile() {
+ return embedFile;
+ }
+
+ public boolean getKerning() {
+ return kerning;
+ }
+
+ public ArrayList getFontTriplets() {
+ return fontTriplets;
+ }
+
+}
+
import org.apache.fop.layout.FontDescriptor;
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFResources;
-import org.apache.fop.configuration.Configuration;
-import org.apache.fop.configuration.FontTriplet;
// Java
import java.util.HashMap;
*
* @param fontInfo the font info object to set up
*/
- public static void setup(FontInfo fontInfo) {
+ public static void setup(FontInfo fontInfo, ArrayList embedList) {
fontInfo.addMetrics("F1", new Helvetica());
fontInfo.addMetrics("F2", new HelveticaOblique());
"normal", FontInfo.NORMAL);
/* Add configured fonts */
- addConfiguredFonts(fontInfo, 15);
+ addConfiguredFonts(fontInfo, embedList, 15);
}
/**
* Add fonts from configuration file starting with
* internalnames F<num>
*/
- public static void addConfiguredFonts(FontInfo fontInfo, int num) {
+ public static void addConfiguredFonts(FontInfo fontInfo, ArrayList fontInfos, int num) {
+ if (fontInfos == null)
+ return;
String internalName = null;
FontReader reader = null;
- ArrayList fontInfos = Configuration.getFonts();
- if (fontInfos == null)
- return;
-
for (int count = 0; count < fontInfos.size(); count++) {
- org.apache.fop.configuration.FontInfo configFontInfo =
- (org.apache.fop.configuration.FontInfo)fontInfos.get(count);
+ EmbedFontInfo configFontInfo =
+ (EmbedFontInfo)fontInfos.get(count);
- try {
String metricsFile = configFontInfo.getMetricsFile();
if (metricsFile != null) {
internalName = "F" + num;
weight);
}
}
- } catch (Exception ex) {
- //log.error("Failed to read font metrics file "
- // + configFontInfo.getMetricsFile()
- // + " : " + ex.getMessage());
- }
}
}
font.encoding(), font, desc));
}
}
-
}
+
--- /dev/null
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
+
+package org.apache.fop.render.pdf;
+
+/**
+ * FontTriplet contains information on name, weight, style of one font
+ */
+public class FontTriplet {
+ private String name, weight, style;
+ public FontTriplet(String name, String weight, String style) {
+ this.name = name;
+ this.weight = weight;
+ this.style = style;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getWeight() {
+ return weight;
+ }
+
+ public String getStyle() {
+ return style;
+ }
+}
+
import org.apache.fop.fo.FOUserAgent;
import org.apache.fop.image.*;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.Version;
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.pdf.*;
public void startRenderer(OutputStream stream) throws IOException {
ostream = stream;
- this.pdfDoc = new PDFDocument();
+ this.pdfDoc = new PDFDocument(Version.getVersion());
this.pdfDoc.setProducer(producer);
pdfDoc.outputHeader(stream);
}
*/
public void setupFontInfo(FontInfo fontInfo) {
/* use PDF's font setup to get PDF metrics */
- org.apache.fop.render.pdf.FontSetup.setup(fontInfo);
+ org.apache.fop.render.pdf.FontSetup.setup(fontInfo, org.apache.fop.configuration.Configuration.getFonts());
this.fontInfo = fontInfo;
}
public void setupFontInfo(FontInfo fontInfo) {
/* use PDF's font setup to get PDF metrics */
- org.apache.fop.render.pdf.FontSetup.setup(fontInfo);
+ org.apache.fop.render.pdf.FontSetup.setup(fontInfo, org.apache.fop.configuration.Configuration.getFonts());
}
private boolean isCoarseXml() {
if(!textAsShapes) {
fontInfo = new FontInfo();
- FontSetup.setup(fontInfo);
+ FontSetup.setup(fontInfo, null);
//FontState fontState = new FontState("Helvetica", "normal",
// FontInfo.NORMAL, 12, 0);
}
standalone = true;
- this.pdfDoc = new PDFDocument();
- this.pdfDoc.setProducer("FOP SVG Renderer");
+ this.pdfDoc = new PDFDocument("FOP SVG Renderer");
graphicsState = new PDFState();
Rectangle2D rect = pp.getPatternRect();
FontInfo fi = new FontInfo();
- FontSetup.setup(fi);
+ FontSetup.setup(fi, null);
PDFResources res = pdfDoc.makeResources();
PDFResourceContext context = new PDFResourceContext(0, pdfDoc, res);