Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=1136002&r1=1136001&r2=1136002&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFGraphics2D.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFGraphics2D.java Wed Jun 15 11:44:43 2011 @@ -243,6 +243,7 @@ public class PDFGraphics2D extends Abstr * @return a new graphics context that is a copy of * this graphics context. */ + @Override public Graphics create() { return new PDFGraphics2D(this); } @@ -486,6 +487,7 @@ public class PDFGraphics2D extends Abstr * @see java.awt.image.ImageObserver * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int) */ + @Override public boolean drawImage(Image img, int x, int y, ImageObserver observer) { preparePainting(); @@ -506,6 +508,7 @@ public class PDFGraphics2D extends Abstr } /** {@inheritDoc} */ + @Override public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { preparePainting(); @@ -576,6 +579,7 @@ public class PDFGraphics2D extends Abstr * @see java.awt.Component#getGraphics * @see java.awt.Graphics#create */ + @Override public void dispose() { pdfDoc = null; fontInfo = null; @@ -599,6 +603,7 @@ public class PDFGraphics2D extends Abstr * @see #setClip * @see #setComposite */ + @Override public void draw(Shape s) { preparePainting(); @@ -619,8 +624,7 @@ public class PDFGraphics2D extends Abstr && !trans.isIdentity(); if (newClip || newTransform) { - currentStream.write("q\n"); - paintingState.save(); + saveGraphicsState(); if (newTransform) { concatMatrix(tranvals); } @@ -645,8 +649,7 @@ public class PDFGraphics2D extends Abstr applyUnknownPaint(paint, ss); if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } return; } @@ -657,8 +660,7 @@ public class PDFGraphics2D extends Abstr processPathIterator(iter); doDrawing(false, true, false); if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } } @@ -748,9 +750,17 @@ public class PDFGraphics2D extends Abstr } } - StringBuffer sb = new StringBuffer(); - colorHandler.establishColor(sb, col, fill); - currentStream.write(sb.toString()); + boolean doWrite = false; + if (fill && paintingState.setBackColor(col)) { + doWrite = true; + } else if (paintingState.setColor(col)) { + doWrite = true; + } + if (doWrite) { + StringBuffer sb = new StringBuffer(); + colorHandler.establishColor(sb, col, fill); + currentStream.write(sb.toString()); + } } /** @@ -805,7 +815,7 @@ public class PDFGraphics2D extends Abstr transform.concatenate(getTransform()); transform.concatenate(gp.getTransform()); - List theMatrix = new java.util.ArrayList(); + List<Double> theMatrix = new java.util.ArrayList<Double>(); double [] mat = new double[6]; transform.getMatrix(mat); for (int idx = 0; idx < mat.length; idx++) { @@ -814,29 +824,29 @@ public class PDFGraphics2D extends Abstr Point2D p1 = gp.getStartPoint(); Point2D p2 = gp.getEndPoint(); - List theCoords = new java.util.ArrayList(); + List<Double> theCoords = new java.util.ArrayList<Double>(); theCoords.add(new Double(p1.getX())); theCoords.add(new Double(p1.getY())); theCoords.add(new Double(p2.getX())); theCoords.add(new Double(p2.getY())); - List theExtend = new java.util.ArrayList(); - theExtend.add(new Boolean(true)); - theExtend.add(new Boolean(true)); + List<Boolean> theExtend = new java.util.ArrayList<Boolean>(); + theExtend.add(Boolean.TRUE); + theExtend.add(Boolean.TRUE); - List theDomain = new java.util.ArrayList(); + List<Double> theDomain = new java.util.ArrayList<Double>(); theDomain.add(new Double(0)); theDomain.add(new Double(1)); - List theEncode = new java.util.ArrayList(); + List<Double> theEncode = new java.util.ArrayList<Double>(); theEncode.add(new Double(0)); theEncode.add(new Double(1)); theEncode.add(new Double(0)); theEncode.add(new Double(1)); - List theBounds = new java.util.ArrayList(); + List<Double> theBounds = new java.util.ArrayList<Double>(); - List someColors = new java.util.ArrayList(); + List<Color> someColors = new java.util.ArrayList<Color>(); for (int count = 0; count < cols.length; count++) { Color c1 = cols[count]; @@ -882,7 +892,7 @@ public class PDFGraphics2D extends Abstr transform.concatenate(getTransform()); transform.concatenate(rgp.getTransform()); - List theMatrix = new java.util.ArrayList(); + List<Double> theMatrix = new java.util.ArrayList<Double>(); double [] mat = new double[6]; transform.getMatrix(mat); for (int idx = 0; idx < mat.length; idx++) { @@ -893,7 +903,7 @@ public class PDFGraphics2D extends Abstr Point2D ac = rgp.getCenterPoint(); Point2D af = rgp.getFocusPoint(); - List theCoords = new java.util.ArrayList(); + List<Double> theCoords = new java.util.ArrayList<Double>(); double dx = af.getX() - ac.getX(); double dy = af.getY() - ac.getY(); double d = Math.sqrt(dx * dx + dy * dy); @@ -913,7 +923,7 @@ public class PDFGraphics2D extends Abstr theCoords.add(new Double(ar)); Color[] cols = rgp.getColors(); - List someColors = new java.util.ArrayList(); + List<Color> someColors = new java.util.ArrayList<Color>(); for (int count = 0; count < cols.length; count++) { Color cc = cols[count]; if (cc.getAlpha() != 255) { @@ -924,7 +934,7 @@ public class PDFGraphics2D extends Abstr } float[] fractions = rgp.getFractions(); - List theBounds = new java.util.ArrayList(); + List<Double> theBounds = new java.util.ArrayList<Double>(); for (int count = 1; count < fractions.length - 1; count++) { float offset = fractions[count]; theBounds.add(new Double(offset)); @@ -964,7 +974,7 @@ public class PDFGraphics2D extends Abstr pattGraphic.setOutputStream(outputStream); GraphicsNode gn = pp.getGraphicsNode(); - Rectangle2D gnBBox = gn.getBounds(); + //Rectangle2D gnBBox = gn.getBounds(); Rectangle2D rect = pp.getPatternRect(); // if (!pp.getOverflow()) { @@ -1000,7 +1010,7 @@ public class PDFGraphics2D extends Abstr // } // } - List bbox = new java.util.ArrayList(); + List<Double> bbox = new java.util.ArrayList<Double>(); bbox.add(new Double(rect.getX())); bbox.add(new Double(rect.getHeight() + rect.getY())); bbox.add(new Double(rect.getWidth() + rect.getX())); @@ -1011,7 +1021,7 @@ public class PDFGraphics2D extends Abstr transform.concatenate(getTransform()); transform.concatenate(pp.getPatternTransform()); - List theMatrix = new java.util.ArrayList(); + List<Double> theMatrix = new java.util.ArrayList<Double>(); double [] mat = new double[6]; transform.getMatrix(mat); for (int idx = 0; idx < mat.length; idx++) { @@ -1219,6 +1229,7 @@ public class PDFGraphics2D extends Abstr } /** {@inheritDoc} */ + @Override public void drawRenderedImage(RenderedImage img, AffineTransform xform) { String key = "TempImage:" + img.toString(); drawInnerRenderedImage(key, img, xform); @@ -1268,6 +1279,7 @@ public class PDFGraphics2D extends Abstr } /** {@inheritDoc} */ + @Override public void drawRenderableImage(RenderableImage img, AffineTransform xform) { //TODO Check if this is good enough @@ -1298,6 +1310,7 @@ public class PDFGraphics2D extends Abstr * @see #setComposite * @see #setClip */ + @Override public void drawString(String s, float x, float y) { preparePainting(); @@ -1321,7 +1334,7 @@ public class PDFGraphics2D extends Abstr applyPaint(getPaint(), true); applyAlpha(c.getAlpha(), OPAQUE); - Map kerning = fontState.getKerning(); + Map<Integer, Map<Integer, Integer>> kerning = fontState.getKerning(); boolean kerningAvailable = (kerning != null && !kerning.isEmpty()); boolean useMultiByte = isMultiByteFont(currentFontName); @@ -1379,8 +1392,8 @@ public class PDFGraphics2D extends Abstr } if (kerningAvailable && (i + 1) < l) { - addKerning(currentStream, (new Integer(ch)), - (new Integer(fontState.mapChar(s.charAt(i + 1)))), + addKerning(currentStream, (Integer.valueOf(ch)), + (Integer.valueOf(fontState.mapChar(s.charAt(i + 1)))), kerning, startText, endText); } @@ -1400,7 +1413,7 @@ public class PDFGraphics2D extends Abstr protected void applyAlpha(int fillAlpha, int strokeAlpha) { if (fillAlpha != OPAQUE || strokeAlpha != OPAQUE) { checkTransparencyAllowed(); - Map vals = new java.util.HashMap(); + Map<String, Float> vals = new java.util.HashMap<String, Float>(); if (fillAlpha != OPAQUE) { vals.put(PDFGState.GSTATE_ALPHA_NONSTROKE, new Float(fillAlpha / 255f)); } @@ -1437,6 +1450,7 @@ public class PDFGraphics2D extends Abstr * @return the internal Font * @deprecated use FontInfo.getFontInstanceForAWTFont(java.awt.Font awtFont) instead */ + @Deprecated protected Font getInternalFontForAWTFont(java.awt.Font awtFont) { return fontInfo.getFontInstanceForAWTFont(awtFont); } @@ -1449,18 +1463,18 @@ public class PDFGraphics2D extends Abstr protected boolean isMultiByteFont(String name) { // This assumes that *all* CIDFonts use a /ToUnicode mapping org.apache.fop.fonts.Typeface f - = (org.apache.fop.fonts.Typeface)fontInfo.getFonts().get(name); + = fontInfo.getFonts().get(name); return f.isMultiByte(); } private void addKerning(StringWriter buf, Integer ch1, Integer ch2, - Map kerning, String startText, + Map<Integer, Map<Integer, Integer>> kerning, String startText, String endText) { preparePainting(); - Map kernPair = (Map)kerning.get(ch1); + Map<Integer, Integer> kernPair = kerning.get(ch1); if (kernPair != null) { - Integer width = (Integer)kernPair.get(ch2); + Integer width = kernPair.get(ch2); if (width != null) { currentStream.write(endText + (-width.intValue()) + " " + startText); } @@ -1572,6 +1586,7 @@ public class PDFGraphics2D extends Abstr * @see #clip * @see #setClip */ + @Override public void fill(Shape s) { preparePainting(); @@ -1595,8 +1610,7 @@ public class PDFGraphics2D extends Abstr && !trans.isIdentity(); if (newClip || newTransform) { - currentStream.write("q\n"); - paintingState.save(); + saveGraphicsState(); if (newTransform) { concatMatrix(tranvals); } @@ -1619,24 +1633,40 @@ public class PDFGraphics2D extends Abstr applyUnknownPaint(paint, s); if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } return; } } - //PathIterator iter = s.getPathIterator(getTransform()); - PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM); - processPathIterator(iter); - doDrawing(true, false, - iter.getWindingRule() == PathIterator.WIND_EVEN_ODD); + if (s instanceof Rectangle2D) { + Rectangle2D rect = (Rectangle2D)s; + currentStream.write(PDFNumber.doubleOut(rect.getMinX(), DEC) + " " + + PDFNumber.doubleOut(rect.getMinY(), DEC) + " "); + currentStream.write(PDFNumber.doubleOut(rect.getWidth(), DEC) + " " + + PDFNumber.doubleOut(rect.getHeight(), DEC) + " re "); + doDrawing(true, false, false); + } else { + PathIterator iter = s.getPathIterator(IDENTITY_TRANSFORM); + processPathIterator(iter); + doDrawing(true, false, + iter.getWindingRule() == PathIterator.WIND_EVEN_ODD); + } if (newClip || newTransform) { - currentStream.write("Q\n"); - paintingState.restore(); + restoreGraphicsState(); } } + void saveGraphicsState() { + currentStream.write("q\n"); + paintingState.save(); + } + + void restoreGraphicsState() { + currentStream.write("Q\n"); + paintingState.restore(); + } + /** Checks whether the use of transparency is allowed. */ protected void checkTransparencyAllowed() { pdfDoc.getProfile().verifyTransparencyAllowed("Java2D graphics"); @@ -1720,6 +1750,7 @@ public class PDFGraphics2D extends Abstr * * @return the PDF graphics configuration */ + @Override public GraphicsConfiguration getDeviceConfiguration() { return new PDFGraphicsConfiguration(); } @@ -1744,6 +1775,7 @@ public class PDFGraphics2D extends Abstr * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ + @Override public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { return fmg.getFontMetrics(f); } @@ -1763,6 +1795,7 @@ public class PDFGraphics2D extends Abstr * drawn twice, then all pixels are restored to their original values. * @param c1 the XOR alternation color */ + @Override public void setXORMode(Color c1) { //NYI } @@ -1787,6 +1820,7 @@ public class PDFGraphics2D extends Abstr * @param dx the horizontal distance to copy the pixels. * @param dy the vertical distance to copy the pixels. */ + @Override public void copyArea(int x, int y, int width, int height, int dx, int dy) { //NYI
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFTextPainter.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFTextPainter.java?rev=1136002&r1=1136001&r2=1136002&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFTextPainter.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/svg/PDFTextPainter.java Wed Jun 15 11:44:43 2011 @@ -62,11 +62,13 @@ class PDFTextPainter extends NativeTextP } /** {@inheritDoc} */ + @Override protected boolean isSupported(Graphics2D g2d) { return g2d instanceof PDFGraphics2D; } /** {@inheritDoc} */ + @Override protected void paintTextRun(TextRun textRun, Graphics2D g2d) { AttributedCharacterIterator runaci = textRun.getACI(); runaci.first(); @@ -86,7 +88,9 @@ class PDFTextPainter extends NativeTextP runaci.first(); //Reset ACI final PDFGraphics2D pdf = (PDFGraphics2D)g2d; + PDFTextUtil textUtil = new PDFTextUtil(pdf.fontInfo) { + @Override protected void write(String code) { pdf.currentStream.write(code); } @@ -109,7 +113,7 @@ class PDFTextPainter extends NativeTextP return; } - textUtil.saveGraphicsState(); + pdf.saveGraphicsState(); textUtil.concatMatrix(g2d.getTransform()); Shape imclip = g2d.getClip(); pdf.writeClip(imclip); @@ -197,7 +201,7 @@ class PDFTextPainter extends NativeTextP } textUtil.writeTJ(); textUtil.endTextObject(); - textUtil.restoreGraphicsState(); + pdf.restoreGraphicsState(); if (DEBUG) { g2d.setStroke(new BasicStroke(0)); g2d.setColor(Color.LIGHT_GRAY); Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/ColorExt.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jun 15 11:44:43 2011 @@ -3,4 +3,4 @@ /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/ColorExt.java:603620-746655 /xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorExt.java:956535-1069429 /xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/util/ColorExt.java:684572,688085,688696 -/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:981451-1094916 +/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:981451-1135999 Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml?rev=1136002&r1=1136001&r2=1136002&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml Wed Jun 15 11:44:43 2011 @@ -59,6 +59,49 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Renderers" dev="VH" type="fix"> + Bugfix: alternative text not working in tagged PDF for TIFF images. + </action> + <action context="Renderers" dev="PH" type="fix" fixes-bug="50909"> + Fixed io exception in MODCAParser caused by the improper use of mark() and reset() on the + MODCA data input stream. Added unit test. </action> + <action context="Fonts" dev="JM" type="fix" fixes-bug="51144" due-to="Mehdi Houshmand"> + Removed invalid entries in ToUnicode table of CID subset fonts. + </action> + <action context="Renderers" dev="JM" type="fix" fixes-bug="50899" due-to="Glenn Adams"> + Fixed mapping of font weights between CSS values and TextAttribute.WEIGHT_*. + </action> + <action context="Renderers" dev="JM" type="fix"> + AFP GOCA: fonts were not embedded from within AFPGraphics2D. + </action> + <action context="Renderers" dev="JM" type="fix"> + AFP GOCA: Changed the way FOP fonts are selected based on Batik's GVT fonts to match + the behaviour of PDF/PS output. + </action> + <action context="Renderers" dev="JM" type="add"> + Added option to place AFP NOPs right before the end of a named page group (page-sequence), + rather than after the start. + </action> + <action context="Renderers" dev="JM" type="add"> + Added option for PostScript output to optimize for file size rather than quality. + </action> + <action context="Renderers" dev="JM" type="add"> + AFP GOCA: Added option to disable GOCA and to control text painting inside GOCA graphics. + </action> + <action context="Renderers" dev="JM" type="fix"> + AFP GOCA: Work-around for InfoPrint's AFP implementation which seems to lose + the character set state over Graphics Data (GAD) boundaries. + </action> + <action context="Renderers" dev="JM" type="fix"> + Bugfix for AFP GOCA segments: they were not properly marked as appended which could + lead to graphics state changes in some implementations. + </action> + <action context="Renderers" dev="CB" type="fix" fixes-bug="51010" due-to="Max Aster"> + Bugzilla 51010: Bookmarks create useless lines in RTF + </action> + <action context="Renderers" dev="CB" type="fix" fixes-bug="51008" due-to="Max Aster"> + Bugzilla 51008: page-number-citation-last does not work in RTF + </action> <action context="Renderers" dev="VH" type="add"> Added id element to intermediate format to track the origin of content. </action> Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/StandardTestSuite.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/StandardTestSuite.java?rev=1136002&r1=1136001&r2=1136002&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/StandardTestSuite.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/StandardTestSuite.java Wed Jun 15 11:44:43 2011 @@ -23,6 +23,7 @@ import junit.framework.Test; import junit.framework.TestSuite; import org.apache.fop.area.ViewportTestSuite; +import org.apache.fop.afp.parser.MODCAParserTestCase; import org.apache.fop.fonts.DejaVuLGCSerifTest; import org.apache.fop.image.loader.batik.ImageLoaderTestCase; import org.apache.fop.image.loader.batik.ImagePreloaderTestCase; @@ -57,6 +58,7 @@ public class StandardTestSuite { suite.addTest(new TestSuite(PDFCMapTestCase.class)); suite.addTest(new TestSuite(PDFsRGBSettingsTestCase.class)); suite.addTest(new TestSuite(DejaVuLGCSerifTest.class)); + suite.addTest(new TestSuite(MODCAParserTestCase.class)); suite.addTest(AFPTestSuite.suite()); suite.addTest(PSTestSuite.suite()); suite.addTest(RichTextFormatTestSuite.suite()); Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/intermediate/AbstractIFTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/intermediate/AbstractIFTestCase.java?rev=1136002&r1=1136001&r2=1136002&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/intermediate/AbstractIFTestCase.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/intermediate/AbstractIFTestCase.java Wed Jun 15 11:44:43 2011 @@ -34,6 +34,7 @@ import javax.xml.validation.SchemaFactor import javax.xml.validation.Validator; import org.w3c.dom.Document; + import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; @@ -55,8 +56,23 @@ abstract class AbstractIFTestCase extend Schema ifSchema = null; try { SchemaFactory sFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + sFactory.setErrorHandler(new ErrorHandler() { + + public void error(SAXParseException exception) throws SAXException { + throw exception; + } + + public void fatalError(SAXParseException exception) throws SAXException { + throw exception; + } + + public void warning(SAXParseException exception) throws SAXException { + throw exception; + } + + }); File ifSchemaFile = new File( - "src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd"); + "src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd"); ifSchema = sFactory.newSchema(ifSchemaFile); } catch (IllegalArgumentException iae) { System.err.println("No suitable SchemaFactory for XML Schema validation found!"); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
