diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-05-12 08:58:21 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-05-12 08:58:21 +0000 |
commit | df8430fb6c4d776b404455baeb5c56617b54f0db (patch) | |
tree | bd76246c5b3753f40e7510c1200a4c98520751b3 /src/java/org/apache/fop/svg | |
parent | d972250786d5575d56a55aede884e9df46450c60 (diff) | |
download | xmlgraphics-fop-df8430fb6c4d776b404455baeb5c56617b54f0db.tar.gz xmlgraphics-fop-df8430fb6c4d776b404455baeb5c56617b54f0db.zip |
Merged revisions 654783,654849,654869,654946,654982,655085,655093,655275,655281,655285,655309,655349,655370 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r654783 | vhennebert | 2008-05-09 13:30:40 +0100 (Fri, 09 May 2008) | 3 lines
Checkstyle and minor typo fixes
Set svn:keywords and svn:eol-style properties on new files
........
r654849 | acumiskey | 2008-05-09 16:14:37 +0100 (Fri, 09 May 2008) | 1 line
Unwanted list self concatenation :).
........
r654869 | acumiskey | 2008-05-09 17:13:47 +0100 (Fri, 09 May 2008) | 1 line
Moved the instantiation of the FontManager to the constructor along with all the other aggregated objects.
........
r654946 | adelmelle | 2008-05-09 22:40:14 +0100 (Fri, 09 May 2008) | 6 lines
Bugzilla 44794:
Added support for page-number-citation and page-number-citation-last of fo:inline.
Corrected behavior for page-number-citation-last of fo:block - forward references properly resolved.
(+ support for page-number-citation-last on list-related FOs)
........
r654982 | acumiskey | 2008-05-10 00:47:28 +0100 (Sat, 10 May 2008) | 1 line
Checkstyle cleanup and javadoc
........
r655085 | adelmelle | 2008-05-10 14:44:09 +0100 (Sat, 10 May 2008) | 5 lines
Tweaks:
-> remove split in CommonFont: font-size is resolved early, so no need anymore for CachedCommonFont
-> allow disabling the PropertyCache via a system property (just in case...)
........
r655093 | adelmelle | 2008-05-10 15:23:56 +0100 (Sat, 10 May 2008) | 1 line
Correction: set default to true...
........
r655275 | maxberger | 2008-05-11 08:30:55 +0100 (Sun, 11 May 2008) | 1 line
made sure warning for missing glyphs is emitted in all cases
........
r655281 | maxberger | 2008-05-11 10:01:31 +0100 (Sun, 11 May 2008) | 1 line
Support character-by-character font-selection strategy on fo:character element
........
r655285 | maxberger | 2008-05-11 10:17:07 +0100 (Sun, 11 May 2008) | 1 line
Forgot to update testcases
........
r655309 | adelmelle | 2008-05-11 13:22:22 +0100 (Sun, 11 May 2008) | 3 lines
Make the LM clean up on end-of-layout, if possible.
Added clearChildNodes() method to FObj to release the reference to the FO's children.
........
r655349 | spepping | 2008-05-11 19:05:51 +0100 (Sun, 11 May 2008) | 2 lines
The spec requires rounding, not truncating
........
r655370 | adelmelle | 2008-05-11 22:03:41 +0100 (Sun, 11 May 2008) | 1 line
Avoid creation of unnecessary dummy areas.
........
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@655445 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/svg')
3 files changed, 49 insertions, 49 deletions
diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java index 513ba4587..5bdfe8c8d 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -56,7 +56,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { private int width; private int height; - + //for SVG scaling private float svgWidth; private float svgHeight; @@ -65,7 +65,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public static final int NORMAL_PDF_RESOLUTION = 72; /** Default device resolution (300dpi is a resonable quality for most purposes) */ public static final int DEFAULT_NATIVE_DPI = 300; - + /** * The device resolution may be different from the normal target resolution. See * http://issues.apache.org/bugzilla/show_bug.cgi?id=37305 @@ -96,7 +96,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public PDFDocumentGraphics2D(boolean textAsShapes) { super(textAsShapes); - this.pdfDoc = new PDFDocument("Apache FOP Version " + Version.getVersion() + this.pdfDoc = new PDFDocument("Apache FOP Version " + Version.getVersion() + ": PDFDocumentGraphics2D"); this.pdfContext = new PDFContext(); } @@ -150,7 +150,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { } /** - * Setup a default FontInfo instance if none has been setup before. + * Setup a default FontInfo instance if none has been setup before. */ public void setupDefaultFontInfo() { if (fontInfo == null) { @@ -160,7 +160,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { setFontInfo(fontInfo); } } - + /** * Set the device resolution for rendering. Will take effect at the * start of the next page. @@ -184,7 +184,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public void setFontInfo(FontInfo fontInfo) { this.fontInfo = fontInfo; } - + /** * Get the font info for this pdf document. * @return the font information @@ -208,7 +208,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public PDFContext getPDFContext() { return this.pdfContext; } - + /** * Set the dimensions of the svg document that will be drawn. * This is useful if the dimensions of the svg document are different @@ -248,9 +248,9 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public void nextPage() { closePage(); } - + /** - * Closes the current page and adds it to the PDF file. + * Closes the current page and adds it to the PDF file. */ protected void closePage() { if (!pdfContext.isPagePending()) { @@ -270,7 +270,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { this.pdfDoc.addObject(pdfContext.getCurrentPage()); pdfContext.clearCurrentPage(); } - + /** {@inheritDoc} */ protected void preparePainting() { if (pdfContext.isPagePending()) { @@ -300,7 +300,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { if (this.initialTransform == null) { //Save initial transformation matrix this.initialTransform = getTransform(); - this.initialClip = getClip(); + this.initialClip = getClip(); } else { //Reset transformation matrix setTransform(this.initialTransform); @@ -313,7 +313,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { if (currentStream == null) { currentStream = new StringWriter(); } - + PDFResources pdfResources = this.pdfDoc.getResources(); PDFPage page = this.pdfDoc.getFactory().makePage(pdfResources, width, height); @@ -321,7 +321,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { pdfContext.setCurrentPage(page); pageRef = page.referencePDF(); - AffineTransform at = new AffineTransform(1.0, 0.0, 0.0, -1.0, + AffineTransform at = new AffineTransform(1.0, 0.0, 0.0, -1.0, 0.0, (double)height); currentStream.write("1 0 0 -1 0 " + height + " cm\n"); if (svgWidth != 0) { @@ -336,7 +336,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { at.scale(s, s); currentStream.write("" + PDFNumber.doubleOut(s) + " 0 0 " + PDFNumber.doubleOut(s) + " 0 0 cm\n"); - + scale(1 / s, 1 / s); } // Remember the transform we installed. @@ -344,8 +344,8 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { pdfContext.increasePageCount(); } - - + + /** * The rendering process has finished. * This should be called after the rendering has completed as there is diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java b/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java index 789a7c247..cda1478bb 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java +++ b/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java @@ -44,23 +44,23 @@ public class PDFDocumentGraphics2DConfigurator { * @param cfg the configuration * @throws ConfigurationException if an error occurs while configuring the object */ - public void configure(PDFDocumentGraphics2D graphics, Configuration cfg) + public void configure(PDFDocumentGraphics2D graphics, Configuration cfg) throws ConfigurationException { PDFDocument pdfDoc = graphics.getPDFDocument(); - + //Filter map pdfDoc.setFilterMap( PDFRendererConfigurator.buildFilterMapFromConfiguration(cfg)); - + //Fonts try { FontResolver fontResolver = FontManager.createMinimalFontResolver(); //TODO The following could be optimized by retaining the FontManager somewhere FontManager fontManager = new FontManager(); - + //TODO Make use of fontBaseURL, font substitution and referencing configuration //Requires a change to the expected configuration layout - + List/*<EmbedFontInfo>*/ embedFontInfoList = PrintRendererConfigurator.buildFontListFromConfiguration( cfg, fontResolver, false, fontManager); @@ -74,5 +74,5 @@ public class PDFDocumentGraphics2DConfigurator { throw new ConfigurationException("Error while setting up fonts", e); } } - + } diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 5a147f3be..4d1ee6a6d 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -106,13 +106,13 @@ import org.apache.fop.util.ColorExt; public class PDFGraphics2D extends AbstractGraphics2D { private static final AffineTransform IDENTITY_TRANSFORM = new AffineTransform(); - - /** The number of decimal places. */ + + /** The number of decimal places. */ private static final int DEC = 8; /** Convenience constant for full opacity */ static final int OPAQUE = 255; - + /** * the PDF Document being created */ @@ -308,7 +308,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { public String getPageReference() { return this.pageRef; } - + /** * Set the Graphics context. * @param c the graphics context to use @@ -319,10 +319,10 @@ public class PDFGraphics2D extends AbstractGraphics2D { } private void setPrivateHints() { - setRenderingHint(RenderingHintsKeyExt.KEY_AVOID_TILE_PAINTING, + setRenderingHint(RenderingHintsKeyExt.KEY_AVOID_TILE_PAINTING, RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_ON); } - + /** * Set the override font state for drawing text. * This is used by the PDF text painter so that it can temporarily @@ -362,7 +362,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { concatMatrix(matrix); } } - + /** * This is mainly used for shading patterns which use the document-global coordinate system * instead of the local one. @@ -372,7 +372,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { AffineTransform at = new AffineTransform(graphicsState.getTransform()); return at; } - + /** * This is a pdf specific method used to add a link to the * pdf document. @@ -417,7 +417,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { * @param width the width to draw the image * @param height the height to draw the image */ - void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y, + void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y, float width, float height) { preparePainting(); String key = image.getInfo().getOriginalURI(); @@ -425,10 +425,10 @@ public class PDFGraphics2D extends AbstractGraphics2D { // Need to include hash code as when invoked from FO you // may have several 'independent' PDFGraphics2D so the // count is not enough. - key = "__AddNative_" + hashCode() + "_" + nativeCount; + key = "__AddNative_" + hashCode() + "_" + nativeCount; nativeCount++; } - + PDFImage pdfImage; if (image instanceof ImageRawJPEG) { pdfImage = new ImageRawJPEGAdapter((ImageRawJPEG)image, key); @@ -438,7 +438,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { throw new IllegalArgumentException( "Unsupported Image subclass: " + image.getClass().getName()); } - + PDFXObject xObject = this.pdfDoc.addImage(resourceContext, pdfImage); if (outputStream != null) { try { @@ -649,7 +649,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { graphicsState.pop(); } } - + /* // in theory we could set the clip using these methods // it doesn't seem to improve the file sizes much @@ -784,8 +784,8 @@ public class PDFGraphics2D extends AbstractGraphics2D { (float) gpaint.getPoint1().getX(), (float) gpaint.getPoint1().getY(), (float) gpaint.getPoint2().getX(), - (float) gpaint.getPoint2().getY(), - new float[] {0, 1}, + (float) gpaint.getPoint2().getY(), + new float[] {0, 1}, new Color[] {gpaint.getColor1(), gpaint.getColor2()}, gpaint.isCyclic() ? LinearGradientPaint.REPEAT : LinearGradientPaint.NO_CYCLE); } @@ -927,7 +927,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { return false; // PDF can't do alpha } - someColors.add(new PDFColor(cc.getRed(), cc.getGreen(), + someColors.add(new PDFColor(cc.getRed(), cc.getGreen(), cc.getBlue())); } @@ -947,7 +947,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { currentStream.write(myPat.getColorSpaceOut(fill)); return true; - } + } if (paint instanceof PatternPaint) { PatternPaint pp = (PatternPaint)paint; return createPattern(pp, fill); @@ -990,14 +990,14 @@ public class PDFGraphics2D extends AbstractGraphics2D { // double patMaxX = rect.getX() + rect.getWidth(); // double patMaxY = rect.getY() + rect.getHeight(); // double stepX = rect.getWidth(); - // double stepY = rect.getHeight(); - // + // double stepY = rect.getHeight(); + // // int startX = (int)((rect.getX() - gnMaxX)/stepX); // int startY = (int)((rect.getY() - gnMaxY)/stepY); - // + // // int endX = (int)((patMaxX - gnMinX)/stepX); // int endY = (int)((patMaxY - gnMinY)/stepY); - // + // // pattGraphic.translate(startX*stepX, startY*stepY); // for (int yIdx=startY; yIdx<=endY; yIdx++) { // for (int xIdx=startX; xIdx<=endX; xIdx++) { @@ -1027,14 +1027,14 @@ public class PDFGraphics2D extends AbstractGraphics2D { } /** @todo see if pdfDoc and res can be linked here, - (currently res <> PDFDocument's resources) so addFonts() + (currently res <> PDFDocument's resources) so addFonts() can be moved to PDFDocument class */ res.addFonts(pdfDoc, specialFontInfo); PDFPattern myPat = pdfDoc.getFactory().makePattern( resourceContext, 1, res, 1, 1, bbox, rect.getWidth(), rect.getHeight(), - theMatrix, null, + theMatrix, null, pattGraphic.getBuffer()); currentStream.write(myPat.getColorSpaceOut(fill)); @@ -1094,7 +1094,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { (rgbCS, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, false, DataBuffer.TYPE_BYTE); - PaintContext pctx = paint.createContext(rgbCM, devBounds, usrBounds, + PaintContext pctx = paint.createContext(rgbCM, devBounds, usrBounds, at, getRenderingHints()); PDFXObject imageInfo = pdfDoc.getXObject ("TempImage:" + pctx.toString()); @@ -1112,7 +1112,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { final int[] line = new int[devW]; final byte[] mask; int x, y, val, rgbIdx = 0; - + if (pcm.hasAlpha()) { mask = new byte[devW * devH]; int maskIdx = 0; @@ -1611,7 +1611,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { return; } } - + AffineTransform trans = getTransform(); double[] tranvals = new double[6]; trans.getMatrix(tranvals); @@ -1709,7 +1709,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { iter.next(); } } - + /** * Do the PDF drawing command. * This does the PDF drawing command according to fill |