diff options
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/fop/apps/FOUserAgent.java | 92 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/CustomFont.java | 28 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/FontReader.java | 22 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/FontSetup.java | 14 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/LazyFont.java | 49 | ||||
-rw-r--r-- | src/java/org/apache/fop/image/ImageFactory.java | 14 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFFactory.java | 50 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/PrintRenderer.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSFontUtils.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSTranscoder.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/rtf/RTFHandler.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java | 6 | ||||
-rw-r--r-- | src/java/org/apache/fop/svg/PDFGraphics2D.java | 4 |
15 files changed, 209 insertions, 95 deletions
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index 48e4d0566..203f7f951 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,8 +85,12 @@ public class FOUserAgent { /** Registry for XML handlers */ private XMLHandlerRegistry xmlHandlers = new XMLHandlerRegistry(); + /** The base URL for all URL resolutions, especially for external-graphics */ private String baseURL; + /** The base URL for all font URL resolutions */ + private String fontBaseURL; + /** A user settable URI Resolver */ private URIResolver uriResolver = null; /** Our default resolver if none is set */ @@ -389,29 +393,8 @@ public class FOUserAgent { */ public void initUserConfig() throws ConfigurationException { log.debug("Initializing User Agent Configuration"); - if (userConfig.getChild("base", false) != null) { - try { - String cfgBaseDir = userConfig.getChild("base").getValue(null); - if (cfgBaseDir != null) { - File dir = new File(cfgBaseDir); - if (dir.isDirectory()) { - cfgBaseDir = "file://" + dir.getCanonicalPath() - + System.getProperty("file.separator"); - cfgBaseDir = cfgBaseDir.replace( - System.getProperty("file.separator").charAt(0), '/'); - } else { - //The next statement is for validation only - new URL(cfgBaseDir); - } - } - setBaseURL(cfgBaseDir); - } catch (MalformedURLException mue) { - log.error("Base URL in user config is malformed!"); - } catch (IOException ioe) { - log.error("Error converting relative base directory to absolute URL."); - } - log.info("Base URL set to: " + baseURL); - } + setBaseURL(getBaseURLfromConfig("base")); + setFontBaseURL(getBaseURLfromConfig("font-base")); if (userConfig.getChild("source-resolution", false) != null) { this.sourceResolution = userConfig.getChild("source-resolution").getValueAsFloat( @@ -444,6 +427,33 @@ public class FOUserAgent { } } + private String getBaseURLfromConfig(String name) { + if (userConfig.getChild(name, false) != null) { + try { + String cfgBaseDir = userConfig.getChild(name).getValue(null); + if (cfgBaseDir != null) { + File dir = new File(cfgBaseDir); + if (dir.isDirectory()) { + cfgBaseDir = "file://" + dir.getCanonicalPath() + + System.getProperty("file.separator"); + cfgBaseDir = cfgBaseDir.replace( + System.getProperty("file.separator").charAt(0), '/'); + } else { + //The next statement is for validation only + new URL(cfgBaseDir); + } + } + log.info(name + " set to: " + cfgBaseDir); + return cfgBaseDir; + } catch (MalformedURLException mue) { + log.error("Base URL in user config is malformed!"); + } catch (IOException ioe) { + log.error("Error converting relative base directory to absolute URL."); + } + } + return null; + } + /** * Returns the configuration subtree for a specific renderer. * @param mimeType MIME type of the renderer @@ -492,6 +502,22 @@ public class FOUserAgent { } /** + * Sets the font base URL. + * @param fontBaseURL font base URL + */ + public void setFontBaseURL(String fontBaseURL) { + this.fontBaseURL = fontBaseURL; + } + + /** + * Returns the font base URL. + * @return the font base URL + */ + public String getFontBaseURL() { + return this.fontBaseURL != null ? this.fontBaseURL : this.baseURL ; + } + + /** * Sets the URI Resolver. * @param uriResolver the new URI resolver */ @@ -535,10 +561,24 @@ public class FOUserAgent { * @see org.apache.fop.apps.FOURIResolver */ public Source resolveURI(String uri) { + return resolveURI(uri, getBaseURL()); + } + + /** + * Attempts to resolve the given URI. + * Will use the configured resolver and if not successful fall back + * to the default resolver. + * @param uri URI to access + * @param baseURL the base url to resolve against + * @return A {@link javax.xml.transform.Source} object, or null if the URI + * cannot be resolved. + * @see org.apache.fop.apps.FOURIResolver + */ + public Source resolveURI(String uri, String baseURL) { Source source = null; if (uriResolver != null) { try { - source = uriResolver.resolve(uri, getBaseURL()); + source = uriResolver.resolve(uri, baseURL); } catch (TransformerException te) { log.error("Attempt to resolve URI '" + uri + "' failed: ", te); } @@ -546,7 +586,7 @@ public class FOUserAgent { if (source == null) { // URI Resolver not configured or returned null, use default resolver try { - source = foURIResolver.resolve(uri, getBaseURL()); + source = foURIResolver.resolve(uri, baseURL); } catch (TransformerException te) { log.error("Attempt to resolve URI '" + uri + "' failed: ", te); } diff --git a/src/java/org/apache/fop/fonts/CustomFont.java b/src/java/org/apache/fop/fonts/CustomFont.java index cc29b77d6..f39bb108d 100644 --- a/src/java/org/apache/fop/fonts/CustomFont.java +++ b/src/java/org/apache/fop/fonts/CustomFont.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2004, 2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,9 @@ package org.apache.fop.fonts; import java.util.Map; +import javax.xml.transform.Source; + +import org.apache.fop.apps.FOUserAgent; /** @@ -30,7 +33,8 @@ public abstract class CustomFont extends Typeface private String fontName = null; private String embedFileName = null; private String embedResourceName = null; - + private FOUserAgent userAgent = null; + private int capHeight = 0; private int xHeight = 0; private int ascender = 0; @@ -46,7 +50,6 @@ public abstract class CustomFont extends Typeface private Map kerning = new java.util.HashMap(); - private boolean useKerning = true; @@ -67,6 +70,17 @@ public abstract class CustomFont extends Typeface } /** + * Returns a Source representing an embeddable font file. + * @return Source for an embeddable font file or null if not available. + */ + public Source getEmbedFileSource() { + if (userAgent != null && embedFileName != null) { + return userAgent.resolveURI(embedFileName, userAgent.getFontBaseURL()); + } + return null; + } + + /** * Returns the lookup name to an embeddable font file available as a * resource. * (todo) Remove this method, this should be done using a resource: URI. @@ -329,6 +343,14 @@ public abstract class CustomFont extends Typeface } /** + * Sets the user agent environment. Needed for URI resolution + * @param userAgent the user agent + */ + public void setUserAgent(FOUserAgent userAgent) { + this.userAgent = userAgent; + } + + /** * @see org.apache.fop.fonts.MutableFont#putKerningEntry(Integer, Map) */ public void putKerningEntry(Integer key, Map value) { diff --git a/src/java/org/apache/fop/fonts/FontReader.java b/src/java/org/apache/fop/fonts/FontReader.java index 5953c91fb..74ed06579 100644 --- a/src/java/org/apache/fop/fonts/FontReader.java +++ b/src/java/org/apache/fop/fonts/FontReader.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004,2006 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,8 @@ import org.xml.sax.helpers.DefaultHandler; //FOP import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.xml.sax.InputSource; /** * Class for reading a metric.xml file and creating a font object. @@ -61,7 +63,7 @@ public class FontReader extends DefaultHandler { private List bfranges = null; - private void createFont(String path) throws FOPException { + private void createFont(InputSource source) throws FOPException { XMLReader parser = null; try { @@ -86,7 +88,7 @@ public class FontReader extends DefaultHandler { parser.setContentHandler(this); try { - parser.parse(path); + parser.parse(source); } catch (SAXException e) { throw new FOPException(e); } catch (IOException e) { @@ -111,6 +113,14 @@ public class FontReader extends DefaultHandler { returnFont.setKerningEnabled(enabled); } + /** + * Sets the user agent environment. Needed for URI resolution + * @param userAgent the user agent + */ + public void setUserAgent(FOUserAgent userAgent) { + returnFont.setUserAgent(userAgent); + } + /** * Get the generated font object @@ -123,11 +133,11 @@ public class FontReader extends DefaultHandler { /** * Construct a FontReader object from a path to a metric.xml file * and read metric data - * @param path URI to the font metric file + * @param source Source of the font metric file * @throws FOPException if loading the font fails */ - public FontReader(String path) throws FOPException { - createFont(path); + public FontReader(InputSource source) throws FOPException { + createFont(source); } /** diff --git a/src/java/org/apache/fop/fonts/FontSetup.java b/src/java/org/apache/fop/fonts/FontSetup.java index 1fb153919..8ac36bbd5 100644 --- a/src/java/org/apache/fop/fonts/FontSetup.java +++ b/src/java/org/apache/fop/fonts/FontSetup.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ package org.apache.fop.fonts; +import org.apache.fop.apps.FOUserAgent; + // FOP (base 14 fonts) import org.apache.fop.fonts.base14.Helvetica; import org.apache.fop.fonts.base14.HelveticaBold; @@ -68,7 +70,7 @@ public class FontSetup { * @param fontInfo the font info object to set up * @param embedList ??? */ - public static void setup(FontInfo fontInfo, List embedList) { + public static void setup(FontInfo fontInfo, List embedList, FOUserAgent ua) { fontInfo.addMetrics("F1", new Helvetica()); fontInfo.addMetrics("F2", new HelveticaOblique()); @@ -160,7 +162,7 @@ public class FontSetup { "normal", Font.NORMAL); /* Add configured fonts */ - addConfiguredFonts(fontInfo, embedList, 15); + addConfiguredFonts(fontInfo, embedList, 15, ua); } /** @@ -169,7 +171,8 @@ public class FontSetup { * @param fontInfoList * @param num starting index for internal font numbering */ - public static void addConfiguredFonts(FontInfo fontInfo, List fontInfoList, int num) { + public static void addConfiguredFonts(FontInfo fontInfo, List fontInfoList + , int num, FOUserAgent userAgent) { if (fontInfoList == null) { return; //No fonts to process } @@ -192,7 +195,8 @@ public class FontSetup { */ LazyFont font = new LazyFont(configFontInfo.getEmbedFile(), metricsFile, - configFontInfo.getKerning()); + configFontInfo.getKerning(), + userAgent); fontInfo.addMetrics(internalName, font); List triplets = configFontInfo.getFontTriplets(); diff --git a/src/java/org/apache/fop/fonts/LazyFont.java b/src/java/org/apache/fop/fonts/LazyFont.java index cffe19aa7..1ba35a590 100644 --- a/src/java/org/apache/fop/fonts/LazyFont.java +++ b/src/java/org/apache/fop/fonts/LazyFont.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,18 @@ /* $Id$ */ package org.apache.fop.fonts; - +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Map; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.fop.apps.FOUserAgent; +import org.xml.sax.InputSource; /** * This class is used to defer the loading of a font until it is really used. @@ -38,16 +45,21 @@ public class LazyFont extends Typeface implements FontDescriptor { private Typeface realFont = null; private FontDescriptor realFontDescriptor = null; + private FOUserAgent userAgent = null; + /** * Main constructor * @param fontEmbedPath path to embeddable file (may be null) * @param metricsFileName path to the metrics XML file * @param useKerning True, if kerning should be enabled + * @param userAgent the environment for uri resoltuion */ - public LazyFont(String fontEmbedPath, String metricsFileName, boolean useKerning) { + public LazyFont(String fontEmbedPath, String metricsFileName + , boolean useKerning, FOUserAgent userAgent) { this.metricsFileName = metricsFileName; this.fontEmbedPath = fontEmbedPath; this.useKerning = useKerning; + this.userAgent = userAgent; } private void load() { @@ -55,18 +67,41 @@ public class LazyFont extends Typeface implements FontDescriptor { isMetricsLoaded = true; try { /**@todo Possible thread problem here */ - - FontReader reader = new FontReader(metricsFileName); + FontReader reader = null; + if (userAgent != null) { + Source source = userAgent.resolveURI(metricsFileName + , userAgent.getFontBaseURL()); + if (source == null) { + log.error("Failed to create Source from metrics file " + metricsFileName); + return; + } + InputStream in = null; + if (source instanceof StreamSource) { + in = ((StreamSource) source).getInputStream(); + } + if (in == null && source.getSystemId() != null) { + in = new java.net.URL(source.getSystemId()).openStream(); + } + if (in == null) { + log.error("Failed to create InputStream from Source for metrics file " + + metricsFileName); + return; + } + reader = new FontReader(new InputSource(in)); + } else { + reader + = new FontReader(new InputSource(new URL(metricsFileName).openStream())); + } reader.setKerningEnabled(useKerning); reader.setFontEmbedPath(fontEmbedPath); + reader.setUserAgent(userAgent); realFont = reader.getFont(); if (realFont instanceof FontDescriptor) { realFontDescriptor = (FontDescriptor) realFont; } // log.debug("Metrics " + metricsFileName + " loaded."); } catch (Exception ex) { - log.error("Failed to read font metrics file " - + metricsFileName, ex); + log.error("Failed to read font metrics file " + metricsFileName, ex); } } } diff --git a/src/java/org/apache/fop/image/ImageFactory.java b/src/java/org/apache/fop/image/ImageFactory.java index d7b73c372..e41ceb858 100644 --- a/src/java/org/apache/fop/image/ImageFactory.java +++ b/src/java/org/apache/fop/image/ImageFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,6 +66,8 @@ public final class ImageFactory { "ImageIOImage", "org.apache.fop.image.ImageIOImage"); ImageProvider gifImage = new ImageProvider("GIFImage", "org.apache.fop.image.GifImage"); ImageProvider jpegImage = new ImageProvider("JPEGImage", "org.apache.fop.image.JpegImage"); + ImageProvider jpegImageIOImage = new ImageProvider( + "JPEGImage", "org.apache.fop.image.JpegImageIOImage"); ImageProvider bmpImage = new ImageProvider("BMPImage", "org.apache.fop.image.BmpImage"); ImageProvider epsImage = new ImageProvider("EPSImage", "org.apache.fop.image.EPSImage"); ImageProvider pngImage = new ImageProvider("PNGImage", "org.apache.fop.image.PNGImage"); @@ -82,6 +84,7 @@ public final class ImageFactory { imt = new ImageMimeType("image/jpeg"); imageMimeTypes.put(imt.getMimeType(), imt); + imt.addProvider(jpegImageIOImage); imt.addProvider(jpegImage); imt = new ImageMimeType("image/bmp"); @@ -244,16 +247,14 @@ public final class ImageFactory { } catch (Exception e) { log.debug("Error closing the InputStream for the image", e); } - log.error("No ImageReader for this type of image (" - + href + ")"); + log.error("No ImageReader for this type of image (" + href + ")"); return null; } // Associate mime-type to FopImage class String imgMimeType = imgInfo.mimeType; Class imageClass = getImageClass(imgMimeType); if (imageClass == null) { - log.error("Unsupported image type (" - + href + "): " + imgMimeType); + log.error("Unsupported image type (" + href + "): " + imgMimeType); return null; } else { if (log.isDebugEnabled()) { @@ -294,8 +295,7 @@ public final class ImageFactory { return null; } if (!(imageInstance instanceof org.apache.fop.image.FopImage)) { - log.error("Error creating FopImage object (" - + href + "): " + "class " + log.error("Error creating FopImage object (" + href + "): " + "class " + imageClass.getName() + " doesn't implement org.apache.fop.image.FopImage interface"); return null; diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index 5ef2a72a1..39b172417 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +20,14 @@ package org.apache.fop.pdf; // Java import java.awt.geom.Rectangle2D; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.MalformedURLException; import java.util.List; import java.util.Map; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; // Apache libs import org.apache.commons.io.IOUtils; @@ -1120,31 +1124,33 @@ public class PDFFactory { InputStream in = null; try { - // Get file first - if (font.getEmbedFileName() != null) { - try { - in = getDocument().resolveURI(font.getEmbedFileName()); - } catch (Exception e) { - log.error("Failed to embed fontfile: " - + font.getEmbedFileName() - + "(" + e.getMessage() + ")"); - } + Source source = font.getEmbedFileSource(); + if (source == null && font.getEmbedResourceName() != null) { + source = new StreamSource(this.getClass() + .getResourceAsStream(font.getEmbedResourceName())); } - - // Get resource - if (in == null && font.getEmbedResourceName() != null) { + if (source == null) { + return null; + } + if (source instanceof StreamSource) { + in = ((StreamSource) source).getInputStream(); + } + if (in == null && source.getSystemId() != null) { try { - in = new java.io.BufferedInputStream( - this.getClass().getResourceAsStream( - font.getEmbedResourceName())); - } catch (Exception e) { - log.error( - "Failed to embed fontresource: " - + font.getEmbedResourceName() - + "(" + e.getMessage() + ")"); + in = new java.net.URL(source.getSystemId()).openStream(); + } catch (MalformedURLException e) { + new FileNotFoundException( + "File not found. URL could not be resolved: " + + e.getMessage()); } } - + if (in == null) { + return null; + } + //Make sure the InputStream is decorated with a BufferedInputStream + if (!(in instanceof java.io.BufferedInputStream)) { + in = new java.io.BufferedInputStream(in); + } if (in == null) { return null; } else { diff --git a/src/java/org/apache/fop/render/PrintRenderer.java b/src/java/org/apache/fop/render/PrintRenderer.java index 7b6b646f7..f1e943c56 100644 --- a/src/java/org/apache/fop/render/PrintRenderer.java +++ b/src/java/org/apache/fop/render/PrintRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public abstract class PrintRenderer extends AbstractRenderer { */ public void setupFontInfo(FontInfo inFontInfo) { this.fontInfo = inFontInfo; - FontSetup.setup(fontInfo, fontList); + FontSetup.setup(fontInfo, fontList, userAgent); } /** diff --git a/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java index 2c684d5b9..33c366a4d 100644 --- a/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ public abstract class AbstractPSDocumentGraphics2D extends PSGraphics2D { if (!textAsShapes) { fontInfo = new FontInfo(); - FontSetup.setup(fontInfo, null); + FontSetup.setup(fontInfo, null, null); } } diff --git a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java index 08bbc3050..90cf60ce1 100644 --- a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ public class PSDocumentGraphics2D extends AbstractPSDocumentGraphics2D { if (!textAsShapes) { fontInfo = new FontInfo(); - FontSetup.setup(fontInfo, null); + FontSetup.setup(fontInfo, null, null); } } diff --git a/src/java/org/apache/fop/render/ps/PSFontUtils.java b/src/java/org/apache/fop/render/ps/PSFontUtils.java index e04f3e2fc..f209eaab0 100644 --- a/src/java/org/apache/fop/render/ps/PSFontUtils.java +++ b/src/java/org/apache/fop/render/ps/PSFontUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005 The Apache Software Foundation. + * Copyright 2001-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -177,10 +177,7 @@ public class PSFontUtils { private static InputStream getInputStreamOnFont(PSGenerator gen, CustomFont font) throws IOException { if (font.isEmbeddable()) { - Source source = null; - if (font.getEmbedFileName() != null) { - source = gen.resolveURI(font.getEmbedFileName()); - } + Source source = font.getEmbedFileSource(); if (source == null && font.getEmbedResourceName() != null) { source = new StreamSource(PSFontUtils.class .getResourceAsStream(font.getEmbedResourceName())); diff --git a/src/java/org/apache/fop/render/ps/PSTranscoder.java b/src/java/org/apache/fop/render/ps/PSTranscoder.java index 598700367..62104ca26 100644 --- a/src/java/org/apache/fop/render/ps/PSTranscoder.java +++ b/src/java/org/apache/fop/render/ps/PSTranscoder.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index d317ffe50..3714ac2ab 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,7 +130,7 @@ public class RTFHandler extends FOEventHandler { this.os = os; bDefer = true; - FontSetup.setup(fontInfo, null); + FontSetup.setup(fontInfo, null, userAgent); } /** diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java index ffe99b8f2..e4891020a 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D this.pdfContext = new PDFContext(); if (!textAsShapes) { fontInfo = new FontInfo(); - FontSetup.setup(fontInfo, null); + FontSetup.setup(fontInfo, null, null); //FontState fontState = new FontState("Helvetica", "normal", // FontInfo.NORMAL, 12, 0); } @@ -166,7 +166,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D public void initialize() throws Exception { if (this.fontInfo == null) { fontInfo = new FontInfo(); - FontSetup.setup(fontInfo, this.pdfContext.getFontList()); + FontSetup.setup(fontInfo, this.pdfContext.getFontList(), null); //FontState fontState = new FontState("Helvetica", "normal", // FontInfo.NORMAL, 12, 0); } diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index edb538df4..732cd95bd 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1023,7 +1023,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { preparePainting(); FontInfo fontInfo = new FontInfo(); - FontSetup.setup(fontInfo, null); + FontSetup.setup(fontInfo, null, null); PDFResources res = pdfDoc.getFactory().makeResources(); PDFResourceContext context = new PDFResourceContext(res); |