diff options
author | Keiron Liddle <keiron@apache.org> | 2002-07-31 08:20:41 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-07-31 08:20:41 +0000 |
commit | 8e5e7ec55175127751235408d9e69edb4f4a579e (patch) | |
tree | 9dac922bf5b0ae655dfb18dbe361e35cf37e8720 /src/org/apache | |
parent | 4ba06a463c7723ab28ffb7a5c21afe1b2cdd56a9 (diff) | |
download | xmlgraphics-fop-8e5e7ec55175127751235408d9e69edb4f4a579e.tar.gz xmlgraphics-fop-8e5e7ec55175127751235408d9e69edb4f4a579e.zip |
moved embed font info into the render.pdf package
reduced dependancy on Configuration
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195039 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r-- | src/org/apache/fop/configuration/ConfigurationParser.java | 7 | ||||
-rw-r--r-- | src/org/apache/fop/mif/MIFHandler.java | 2 | ||||
-rw-r--r-- | src/org/apache/fop/pdf/PDFDocument.java | 10 | ||||
-rw-r--r-- | src/org/apache/fop/render/PrintRenderer.java | 2 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/EmbedFontInfo.java (renamed from src/org/apache/fop/configuration/FontInfo.java) | 8 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/FontSetup.java | 26 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/FontTriplet.java (renamed from src/org/apache/fop/configuration/FontTriplet.java) | 9 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/PDFRenderer.java | 3 | ||||
-rw-r--r-- | src/org/apache/fop/render/ps/PSRenderer.java | 2 | ||||
-rw-r--r-- | src/org/apache/fop/render/xml/XMLRenderer.java | 2 | ||||
-rw-r--r-- | src/org/apache/fop/svg/PDFDocumentGraphics2D.java | 5 | ||||
-rw-r--r-- | src/org/apache/fop/svg/PDFGraphics2D.java | 2 |
12 files changed, 31 insertions, 47 deletions
diff --git a/src/org/apache/fop/configuration/ConfigurationParser.java b/src/org/apache/fop/configuration/ConfigurationParser.java index 39039dd89..9d60352ac 100644 --- a/src/org/apache/fop/configuration/ConfigurationParser.java +++ b/src/org/apache/fop/configuration/ConfigurationParser.java @@ -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 @@ public class ConfigurationParser extends DefaultHandler { 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 @@ public class ConfigurationParser extends DefaultHandler { } 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; diff --git a/src/org/apache/fop/mif/MIFHandler.java b/src/org/apache/fop/mif/MIFHandler.java index 2cf6bff19..a71fa304e 100644 --- a/src/org/apache/fop/mif/MIFHandler.java +++ b/src/org/apache/fop/mif/MIFHandler.java @@ -42,7 +42,7 @@ public class MIFHandler extends StructureHandler { 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() { diff --git a/src/org/apache/fop/pdf/PDFDocument.java b/src/org/apache/fop/pdf/PDFDocument.java index 715e95742..1fcfdf696 100644 --- a/src/org/apache/fop/pdf/PDFDocument.java +++ b/src/org/apache/fop/pdf/PDFDocument.java @@ -154,7 +154,7 @@ public class PDFDocument { * 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(); @@ -166,7 +166,7 @@ public class PDFDocument { this.resources = makeResources(); // Make the /Info record - this.info = makeInfo(); + this.info = makeInfo(prod); } /** @@ -225,7 +225,7 @@ public class PDFDocument { * @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 @@ public class PDFDocument { */ 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 @@ public class PDFDocument { * 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); diff --git a/src/org/apache/fop/render/PrintRenderer.java b/src/org/apache/fop/render/PrintRenderer.java index 95aa56d39..ca0c6238c 100644 --- a/src/org/apache/fop/render/PrintRenderer.java +++ b/src/org/apache/fop/render/PrintRenderer.java @@ -35,7 +35,7 @@ public abstract class PrintRenderer extends AbstractRenderer { */ public void setupFontInfo(FontInfo fontInfo) { this.fontInfo = fontInfo; - FontSetup.setup(fontInfo); + FontSetup.setup(fontInfo, org.apache.fop.configuration.Configuration.getFonts()); } /** diff --git a/src/org/apache/fop/configuration/FontInfo.java b/src/org/apache/fop/render/pdf/EmbedFontInfo.java index db0c96c38..270418054 100644 --- a/src/org/apache/fop/configuration/FontInfo.java +++ b/src/org/apache/fop/render/pdf/EmbedFontInfo.java @@ -5,21 +5,19 @@ * LICENSE file included with these sources. */ - -package org.apache.fop.configuration; +package org.apache.fop.render.pdf; import java.util.ArrayList; /** * FontInfo contains meta information on fonts (where is the metrics file etc.) */ - -public class FontInfo { +public class EmbedFontInfo { private String metricsFile, embedFile, name; private boolean kerning; private ArrayList fontTriplets; - public FontInfo(String name, String metricsFile, boolean kerning, + public EmbedFontInfo(String name, String metricsFile, boolean kerning, ArrayList fontTriplets, String embedFile) { this.name = name; this.metricsFile = metricsFile; diff --git a/src/org/apache/fop/render/pdf/FontSetup.java b/src/org/apache/fop/render/pdf/FontSetup.java index 221020bbe..21ae5eced 100644 --- a/src/org/apache/fop/render/pdf/FontSetup.java +++ b/src/org/apache/fop/render/pdf/FontSetup.java @@ -13,8 +13,6 @@ import org.apache.fop.layout.FontInfo; 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 @@ public class FontSetup { * * @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 @@ public class FontSetup { "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 @@ public class FontSetup { weight); } } - } catch (Exception ex) { - //log.error("Failed to read font metrics file " - // + configFontInfo.getMetricsFile() - // + " : " + ex.getMessage()); - } } } @@ -212,5 +202,5 @@ public class FontSetup { font.encoding(), font, desc)); } } - } + diff --git a/src/org/apache/fop/configuration/FontTriplet.java b/src/org/apache/fop/render/pdf/FontTriplet.java index b39ab3edf..fda5ff011 100644 --- a/src/org/apache/fop/configuration/FontTriplet.java +++ b/src/org/apache/fop/render/pdf/FontTriplet.java @@ -5,14 +5,11 @@ * LICENSE file included with these sources. */ - -package org.apache.fop.configuration; +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) { @@ -32,9 +29,5 @@ public class FontTriplet { public String getStyle() { return style; } - } - - - diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index db2841125..a288911c4 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -14,6 +14,7 @@ import org.apache.fop.render.RendererContext; 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 class PDFRenderer extends PrintRenderer { 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); } diff --git a/src/org/apache/fop/render/ps/PSRenderer.java b/src/org/apache/fop/render/ps/PSRenderer.java index 67cdf8c4e..c40af92b9 100644 --- a/src/org/apache/fop/render/ps/PSRenderer.java +++ b/src/org/apache/fop/render/ps/PSRenderer.java @@ -229,7 +229,7 @@ public class PSRenderer extends AbstractRenderer { */ 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; } diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java index 8250ae4df..8dfa8ee5f 100644 --- a/src/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/org/apache/fop/render/xml/XMLRenderer.java @@ -148,7 +148,7 @@ public class XMLRenderer extends AbstractRenderer { 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() { diff --git a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java index 2b67d0f83..86f6ff20a 100644 --- a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -59,14 +59,13 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { 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(); diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java index ec5bcb327..3093deded 100644 --- a/src/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/org/apache/fop/svg/PDFGraphics2D.java @@ -791,7 +791,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { 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); |