From: Mehdi Houshmand Date: Mon, 2 Jul 2012 13:23:46 +0000 (+0000) Subject: Merged in trunk@1356161 X-Git-Tag: fop-2_0~346^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab426a49d46ec69b80e6accccd537522477df5b3;p=xmlgraphics-fop.git Merged in trunk@1356161 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_URI_Unification@1356212 13f79535-47bb-0310-9956-ffa450edef68 --- ab426a49d46ec69b80e6accccd537522477df5b3 diff --cc src/java/org/apache/fop/render/afp/AFPPainter.java index 86858c3c8,592b47eaa..7d659a8b4 --- a/src/java/org/apache/fop/render/afp/AFPPainter.java +++ b/src/java/org/apache/fop/render/afp/AFPPainter.java @@@ -45,9 -51,9 +51,8 @@@ import org.apache.fop.afp.modca.Abstrac import org.apache.fop.afp.modca.PresentationTextObject; import org.apache.fop.afp.ptoca.PtocaBuilder; import org.apache.fop.afp.ptoca.PtocaProducer; -import org.apache.fop.afp.util.DefaultFOPResourceAccessor; -import org.apache.fop.afp.util.ResourceAccessor; +import org.apache.fop.afp.util.AFPResourceAccessor; import org.apache.fop.fonts.Font; - import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; import org.apache.fop.fonts.Typeface; import org.apache.fop.render.RenderingContext; @@@ -202,11 -204,11 +203,11 @@@ public class AFPPainter extends Abstrac //Do we need to embed an external page segment? if (pageSegment.getURI() != null) { - ResourceAccessor accessor = new DefaultFOPResourceAccessor ( - getUserAgent(), null, null); + AFPResourceAccessor accessor = new AFPResourceAccessor( - documentHandler.getUserAgent().getResourceResolver()); ++ getDocumentHandler().getUserAgent().getResourceResolver()); try { URI resourceUri = new URI(pageSegment.getURI()); - documentHandler.getResourceManager().createIncludedResourceFromExternal( + getDocumentHandler().getResourceManager().createIncludedResourceFromExternal( pageSegment.getName(), resourceUri, accessor); } catch (URISyntaxException urie) { diff --cc src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java index e86cc435f,327eca14e..147b6d54b --- a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java +++ b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java @@@ -45,7 -45,10 +45,9 @@@ import org.apache.xmlgraphics.image.loa import org.apache.fop.ResourceEventProducer; import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.FopFactory; import org.apache.fop.fo.Constants; + import org.apache.fop.fonts.FontInfo; + import org.apache.fop.fonts.FontTriplet; import org.apache.fop.render.ImageHandler; import org.apache.fop.render.ImageHandlerRegistry; import org.apache.fop.render.ImageHandlerUtil; diff --cc src/java/org/apache/fop/render/pcl/PCLPainter.java index 2f22424f5,f0d87d542..614ebf1d2 --- a/src/java/org/apache/fop/render/pcl/PCLPainter.java +++ b/src/java/org/apache/fop/render/pcl/PCLPainter.java @@@ -438,16 -428,11 +428,15 @@@ public class PCLPainter extends Abstrac final int letterSpacing, final int wordSpacing, final int[][] dp, final String text, FontTriplet triplet) throws IFException { //Use Java2D to paint different fonts via bitmap - final Font font = parent.getFontInfo().getFontInstance(triplet, state.getFontSize()); + final Font font = getFontInfo().getFontInstance(triplet, state.getFontSize()); //for cursive fonts, so the text isn't clipped - final FontMetricsMapper mapper = (FontMetricsMapper) getFontInfo().getMetricsFor( - font.getFontName()); + FontMetricsMapper mapper; + try { - mapper = (FontMetricsMapper)parent.getFontInfo().getMetricsFor( - font.getFontName()); ++ mapper = (FontMetricsMapper) getFontInfo().getMetricsFor(font.getFontName()); + } catch (Exception t) { + throw new RuntimeException(t); + } final int maxAscent = mapper.getMaxAscent(font.getFontSize()) / 1000; final int ascent = mapper.getAscender(font.getFontSize()) / 1000; final int descent = mapper.getDescender(font.getFontSize()) / 1000; diff --cc src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java index 1ad8034e0,c56bce218..dd9320571 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java @@@ -74,25 -72,22 +73,22 @@@ public class PDFDocumentHandler extend * Utility class which enables all sorts of features that are not directly connected to the * normal rendering process. */ - protected final PDFRenderingUtil pdfUtil; - private PDFRenderingUtil pdfUtil; ++ private final PDFRenderingUtil pdfUtil; /** the /Resources object of the PDF document being created */ - protected PDFResources pdfResources; + private PDFResources pdfResources; /** The current content generator */ - protected PDFContentGenerator generator; - - /** the current annotation list to add annotations to */ - protected PDFResourceContext currentContext; + private PDFContentGenerator generator; /** the current page to add annotations to */ - protected PDFPage currentPage; + private PDFPage currentPage; /** the current page's PDF reference */ - protected PageReference currentPageRef; + private PageReference currentPageRef; /** Used for bookmarks/outlines. */ - protected Map pageReferences = new HashMap(); + private Map pageReferences = new HashMap(); private final PDFDocumentNavigationHandler documentNavigationHandler = new PDFDocumentNavigationHandler(this); diff --cc src/java/org/apache/fop/render/ps/PSDocumentHandler.java index 488abd559,bf2d95c1d..d73beb759 --- a/src/java/org/apache/fop/render/ps/PSDocumentHandler.java +++ b/src/java/org/apache/fop/render/ps/PSDocumentHandler.java @@@ -52,10 -50,11 +52,11 @@@ import org.apache.xmlgraphics.ps.dsc.Re import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox; -import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.apps.io.TempResourceURIGenerator; import org.apache.fop.render.intermediate.AbstractBinaryWritingIFDocumentHandler; import org.apache.fop.render.intermediate.IFContext; + import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFPainter; @@@ -80,15 -77,13 +81,15 @@@ public class PSDocumentHandler extends * Utility class which enables all sorts of features that are not directly connected to the * normal rendering process. */ - protected PSRenderingUtil psUtil; + private PSRenderingUtil psUtil; /** The PostScript generator used to output the PostScript */ - protected PSGenerator gen; + PSGenerator gen; /** the temporary file in case of two-pass processing */ - private File tempFile; + private URI tempURI; + private static final TempResourceURIGenerator TEMP_URI_GENERATOR + = new TempResourceURIGenerator("ps-optimize"); private int currentPageNumber = 0; private PageDefinition currentPageDefinition; @@@ -134,9 -127,21 +135,13 @@@ return MimeConstants.MIME_POSTSCRIPT; } + PSGenerator getGenerator() { + return gen; + } + - /** {@inheritDoc} */ - public void setContext(IFContext context) { - super.setContext(context); - FOUserAgent userAgent = context.getUserAgent(); - this.psUtil = new PSRenderingUtil(userAgent); - eventProducer = PSEventProducer.Provider.get(userAgent.getEventBroadcaster()); - } - /** {@inheritDoc} */ public IFDocumentHandlerConfigurator getConfigurator() { - return new PSRendererConfigurator(getUserAgent()); + return new PSRendererConfigurator(getUserAgent(), new PSRendererConfigParser()); } PSRenderingUtil getPSUtil() {