keiron 2002/07/31 01:20:41
Modified: src/org/apache/fop/render/pdf FontSetup.java
PDFRenderer.java
src/org/apache/fop/configuration ConfigurationParser.java
src/org/apache/fop/mif MIFHandler.java
src/org/apache/fop/pdf PDFDocument.java
src/org/apache/fop/render PrintRenderer.java
src/org/apache/fop/render/ps PSRenderer.java
src/org/apache/fop/render/xml XMLRenderer.java
src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java
Added: src/org/apache/fop/render/pdf FontTriplet.java
EmbedFontInfo.java
Removed: src/org/apache/fop/configuration FontInfo.java
FontTriplet.java
Log:
moved embed font info into the render.pdf package
reduced dependancy on Configuration
Revision Changes Path
1.19 +9 -19 xml-fop/src/org/apache/fop/render/pdf/FontSetup.java
Index: FontSetup.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/FontSetup.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- FontSetup.java 23 Jul 2002 11:06:51 -0000 1.18
+++ FontSetup.java 31 Jul 2002 08:20:40 -0000 1.19
@@ -13,8 +13,6 @@
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;
@@ -37,7 +35,7 @@
*
* @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());
@@ -129,27 +127,24 @@
"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;
@@ -184,11 +179,6 @@
weight);
}
}
- } catch (Exception ex) {
- //log.error("Failed to read font metrics file "
- // + configFontInfo.getMetricsFile()
- // + " : " + ex.getMessage());
- }
}
}
@@ -212,5 +202,5 @@
font.encoding(), font, desc));
}
}
-
}
+
1.113 +3 -2 xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- PDFRenderer.java 30 Jul 2002 13:04:05 -0000 1.112
+++ PDFRenderer.java 31 Jul 2002 08:20:40 -0000 1.113
@@ -14,6 +14,7 @@
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.*;
@@ -158,7 +159,7 @@
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);
}
1.1 xml-fop/src/org/apache/fop/render/pdf/FontTriplet.java
Index: FontTriplet.java
===================================================================
/*
* $Id: FontTriplet.java,v 1.1 2002/07/31 08:20:40 keiron Exp $
* 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;
}
}
1.1 xml-fop/src/org/apache/fop/render/pdf/EmbedFontInfo.java
Index: EmbedFontInfo.java
===================================================================
/*
* $Id: EmbedFontInfo.java,v 1.1 2002/07/31 08:20:40 keiron Exp $
* 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;
}
}
1.12 +6 -3
xml-fop/src/org/apache/fop/configuration/ConfigurationParser.java
Index: ConfigurationParser.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/configuration/ConfigurationParser.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ConfigurationParser.java 22 Nov 2001 07:11:38 -0000 1.11
+++ ConfigurationParser.java 31 Jul 2002 08:20:40 -0000 1.12
@@ -8,6 +8,9 @@
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;
@@ -74,7 +77,7 @@
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;
@@ -195,7 +198,7 @@
} 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;
1.3 +2 -2 xml-fop/src/org/apache/fop/mif/MIFHandler.java
Index: MIFHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/mif/MIFHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MIFHandler.java 18 Jul 2002 09:43:20 -0000 1.2
+++ MIFHandler.java 31 Jul 2002 08:20:40 -0000 1.3
@@ -42,7 +42,7 @@
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() {
1.48 +6 -6 xml-fop/src/org/apache/fop/pdf/PDFDocument.java
Index: PDFDocument.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFDocument.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- PDFDocument.java 19 Jul 2002 07:16:20 -0000 1.47
+++ PDFDocument.java 31 Jul 2002 08:20:40 -0000 1.48
@@ -154,7 +154,7 @@
* time to work out, and is so obvious now. Sigh.
* [EMAIL PROTECTED] Maybe I should do a PDF course.
*/
- public PDFDocument() {
+ public PDFDocument(String prod) {
/* create the /Root, /Info and /Resources objects */
this.pages = makePages();
@@ -166,7 +166,7 @@
this.resources = makeResources();
// Make the /Info record
- this.info = makeInfo();
+ this.info = makeInfo(prod);
}
/**
@@ -225,7 +225,7 @@
* @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
@@ -233,7 +233,7 @@
*/
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;
}
@@ -904,7 +904,7 @@
* 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);
1.17 +2 -2 xml-fop/src/org/apache/fop/render/PrintRenderer.java
Index: PrintRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/PrintRenderer.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- PrintRenderer.java 26 Feb 2002 12:43:09 -0000 1.16
+++ PrintRenderer.java 31 Jul 2002 08:20:40 -0000 1.17
@@ -35,7 +35,7 @@
*/
public void setupFontInfo(FontInfo fontInfo) {
this.fontInfo = fontInfo;
- FontSetup.setup(fontInfo);
+ FontSetup.setup(fontInfo,
org.apache.fop.configuration.Configuration.getFonts());
}
/**
1.24 +2 -2 xml-fop/src/org/apache/fop/render/ps/PSRenderer.java
Index: PSRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/ps/PSRenderer.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- PSRenderer.java 9 Jul 2002 09:43:14 -0000 1.23
+++ PSRenderer.java 31 Jul 2002 08:20:40 -0000 1.24
@@ -229,7 +229,7 @@
*/
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;
}
1.39 +2 -2 xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java
Index: XMLRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- XMLRenderer.java 26 May 2002 15:02:44 -0000 1.38
+++ XMLRenderer.java 31 Jul 2002 08:20:41 -0000 1.39
@@ -148,7 +148,7 @@
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() {
1.21 +4 -5 xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
Index: PDFDocumentGraphics2D.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- PDFDocumentGraphics2D.java 23 Jul 2002 10:57:57 -0000 1.20
+++ PDFDocumentGraphics2D.java 31 Jul 2002 08:20:41 -0000 1.21
@@ -59,14 +59,13 @@
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();
1.39 +3 -3 xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java
Index: PDFGraphics2D.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- PDFGraphics2D.java 23 Jul 2002 10:57:57 -0000 1.38
+++ PDFGraphics2D.java 31 Jul 2002 08:20:41 -0000 1.39
@@ -791,7 +791,7 @@
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);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]