cvs commit: xml-fop/src/org/apache/fop/pdf ASCII85Filter.java ASCIIHexFilter.java FlateFilter.java PDFAction.java PDFAnnotList.java PDFArray.java PDFCIDFont.java PDFDocument.java PDFXObject.java
keiron 2002/09/17 02:20:58 Modified:src/org/apache/fop/pdf ASCII85Filter.java ASCIIHexFilter.java FlateFilter.java PDFAction.java PDFAnnotList.java PDFArray.java PDFCIDFont.java PDFDocument.java PDFXObject.java Log: fixed some style errors Revision ChangesPath 1.6 +46 -19xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java Index: ASCII85Filter.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ASCII85Filter.java2 Aug 2002 06:50:08 - 1.5 +++ ASCII85Filter.java17 Sep 2002 09:20:57 - 1.6 @@ -1,34 +1,57 @@ /* * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ package org.apache.fop.pdf; -import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.InputStream; import java.io.IOException; -import java.io.*; +/** + * PDF Filter for ASCII85. + * This applies a filter to a pdf stream that converts + * the data to ASCII. + */ public class ASCII85Filter extends PDFFilter { private static final char ASCII85_ZERO = 'z'; private static final char ASCII85_START = '!'; private static final String ASCII85_EOD = "~>"; -private static final long base85_4 = 85; +private static final long BASE85_4 = 85; //private static final long base85_3 = base85_4 * base85_4; //private static final long base85_2 = base85_3 * base85_4; //private static final long base85_1 = base85_2 * base85_4; +/** + * Get the PDF name of this filter. + * + * @return the name of the filter to be inserted into the PDF + */ public String getName() { return "/ASCII85Decode"; } +/** + * Get the decode parameters. + * + * @return always null + */ public String getDecodeParms() { return null; } +/** + * Encode a pdf stream using this filter. + * + * @param in the input stream to read the data from + * @param out the output stream to write the data + * @param length the length of the data to filter + * @throws IOException if there is an error reading or writing to the streams + */ public void encode(InputStream in, OutputStream out, int length) throws IOException { int i; @@ -94,7 +117,11 @@ * int out = (result.length-ASCII85_EOD.getBytes().length) % 5; * if ((in+1 != out) && !(in == 0 && out == 0)) { * System.out.println("ASCII85 assertion failed:"); - * System.out.println("inlength = "+data.length+" inlength % 4 = "+(data.length % 4)+" outlength = "+(result.length-ASCII85_EOD.getBytes().length)+" outlength % 5 = "+((result.length-ASCII85_EOD.getBytes().length) % 5)); + * System.out.println("inlength = "+data.length+" inlength % 4 = " + * + (data.length % 4)+" outlength = " + * + (result.length-ASCII85_EOD.getBytes().length) + * + " outlength % 5 = " + * + ((result.length-ASCII85_EOD.getBytes().length) % 5)); * } */ @@ -128,11 +155,11 @@ byte c3 = (byte)(((word - (c1 * base85_1) - (c2 * base85_2)) / base85_3) & 0xFF); -byte c4 = -(byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3)) / base85_4) +byte c4 = (byte)(((word - (c1 * base85_1) + - (c2 * base85_2) - (c3 * base85_3)) / base85_4) & 0xFF); -byte c5 = -(byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3) - (c4 * base85_4))) +byte c5 = (byte)(((word - (c1 * base85_1) + - (c2 * base85_2) - (c3 * base85_3) - (c4 * base85_4))) & 0xFF); byte[] ret = { @@ -142,15 +169,15 @@ }; */ -byte c5 = (byte)((word % base85_4) + ASCII85_START); -word = word / base85_4; -byte c4 = (byte)((word % base85_4) + ASCII85_START); -word = word / base85_4; -byte c3 = (byte)((word % base85_4) + ASCII85_START); -word = word / base85_4; -byte c2 = (byte)((word % base85_4) + ASCII85_START); -word = word / base85_4; -byte c1 = (byte)((word % base85_
cvs commit: xml-fop/src/org/apache/fop/pdf ASCII85Filter.java
keiron 2002/08/01 23:50:08 Modified:src/org/apache/fop/pdf ASCII85Filter.java Log: Simplified ASCII85Filter computation, thereby hopefully working around JVM bugs from Branch Revision ChangesPath 1.5 +21 -6 xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java Index: ASCII85Filter.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ASCII85Filter.java27 May 2002 10:59:07 - 1.4 +++ ASCII85Filter.java2 Aug 2002 06:50:08 - 1.5 @@ -17,11 +17,9 @@ private static final String ASCII85_EOD = "~>"; private static final long base85_4 = 85; -private static final long base85_3 = base85_4 * base85_4; -private static final long base85_2 = base85_3 * base85_4; -private static final long base85_1 = base85_2 * base85_4; - - +//private static final long base85_3 = base85_4 * base85_4; +//private static final long base85_2 = base85_3 * base85_4; +//private static final long base85_1 = base85_2 * base85_4; public String getName() { return "/ASCII85Decode"; @@ -124,6 +122,7 @@ }; return result; } else { +/* byte c1 = (byte)((word / base85_1) & 0xFF); byte c2 = (byte)(((word - (c1 * base85_1)) / base85_2) & 0xFF); byte c3 = @@ -141,6 +140,22 @@ (byte)(c3 + ASCII85_START), (byte)(c4 + ASCII85_START), (byte)(c5 + ASCII85_START) }; +*/ + +byte c5 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c4 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c3 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c2 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c1 = (byte)((word % base85_4) + ASCII85_START); + +byte[] ret = { + c1 , c2, c3, c4, c5 +}; + for (int i = 0; i < ret.length; i++) { if (ret[i] < 33 || ret[i] > 117) { System.out.println("illegal char value " - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/pdf ASCII85Filter.java
pietsch 2002/08/01 07:52:49 Modified:src/org/apache/fop/pdf Tag: fop-0_20_2-maintain ASCII85Filter.java Log: Simplified ASCII85Filter computation, thereby hopefully working around JVM bugs Revision ChangesPath No revision No revision 1.3.2.2 +30 -18xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java Index: ASCII85Filter.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -r1.3.2.1 -r1.3.2.2 --- ASCII85Filter.java31 May 2002 00:17:16 - 1.3.2.1 +++ ASCII85Filter.java1 Aug 2002 14:52:49 - 1.3.2.2 @@ -17,9 +17,9 @@ private static final String ASCII85_EOD = "~>"; private static final long base85_4 = 85; -private static final long base85_3 = base85_4 * base85_4; -private static final long base85_2 = base85_3 * base85_4; -private static final long base85_1 = base85_2 * base85_4; +// private static final long base85_3 = base85_4 * base85_4; +// private static final long base85_2 = base85_3 * base85_4; +// private static final long base85_1 = base85_2 * base85_4; @@ -131,22 +131,34 @@ }; return result; } else { -byte c1 = (byte)((word / base85_1) & 0xFF); -byte c2 = (byte)(((word - (c1 * base85_1)) / base85_2) & 0xFF); -byte c3 = -(byte)(((word - (c1 * base85_1) - (c2 * base85_2)) / base85_3) - & 0xFF); -byte c4 = -(byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3)) / base85_4) - & 0xFF); -byte c5 = -(byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3) - (c4 * base85_4))) - & 0xFF); +// byte c1 = (byte)((word / base85_1) & 0xFF); +// byte c2 = (byte)(((word - (c1 * base85_1)) / base85_2) & 0xFF); +// byte c3 = +// (byte)(((word - (c1 * base85_1) - (c2 * base85_2)) / base85_3) +// & 0xFF); +// byte c4 = +// (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3)) / base85_4) +// & 0xFF); +// byte c5 = +// (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3) - (c4 * base85_4))) +// & 0xFF); + +// byte[] ret = { +// (byte)(c1 + ASCII85_START), (byte)(c2 + ASCII85_START), +// (byte)(c3 + ASCII85_START), (byte)(c4 + ASCII85_START), +// (byte)(c5 + ASCII85_START) +byte c5 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c4 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c3 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c2 = (byte)((word % base85_4) + ASCII85_START); +word = word / base85_4; +byte c1 = (byte)((word % base85_4) + ASCII85_START); byte[] ret = { -(byte)(c1 + ASCII85_START), (byte)(c2 + ASCII85_START), -(byte)(c3 + ASCII85_START), (byte)(c4 + ASCII85_START), -(byte)(c5 + ASCII85_START) + c1 , c2, c3, c4, c5 }; for (int i = 0; i < ret.length; i++) { if (ret[i] < 33 || ret[i] > 117) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/pdf ASCII85Filter.java ASCIIHexFilter.java PDFAnnotList.java PDFArray.java PDFCIDFont.java PDFCIDSystemInfo.java PDFDocument.java PDFEncoding.java PDFFileSpec.java PDFFont.java PDFFontDescriptor.java PDFFunction.java PDFGoTo.java PDFGoToRemote.java PDFICCStream.java PDFInfo.java PDFLink.java PDFOutline.java PDFPage.java PDFPages.java PDFPattern.java PDFRectangle.java PDFResources.java PDFRoot.java PDFShading.java PDFStream.java PDFT1Stream.java PDFTTFStream.java PDFWArray.java PDFXObject.java
chrisg 02/05/30 17:17:17 Modified:.Tag: fop-0_20_2-maintain CHANGES src/org/apache/fop/pdf Tag: fop-0_20_2-maintain ASCII85Filter.java ASCIIHexFilter.java PDFAnnotList.java PDFArray.java PDFCIDFont.java PDFCIDSystemInfo.java PDFDocument.java PDFEncoding.java PDFFileSpec.java PDFFont.java PDFFontDescriptor.java PDFFunction.java PDFGoTo.java PDFGoToRemote.java PDFICCStream.java PDFInfo.java PDFLink.java PDFOutline.java PDFPage.java PDFPages.java PDFPattern.java PDFRectangle.java PDFResources.java PDFRoot.java PDFShading.java PDFStream.java PDFT1Stream.java PDFTTFStream.java PDFWArray.java PDFXObject.java Log: Fixed PDF-Renderer to work on EBCDIC systems (Actually on systems where file.encoding != ASCII/ISO-8859) Submitted by: Jason West <[EMAIL PROTECTED]> Revision ChangesPath No revision No revision 1.10.2.16 +4 -0 xml-fop/CHANGES Index: CHANGES === RCS file: /home/cvs/xml-fop/CHANGES,v retrieving revision 1.10.2.15 retrieving revision 1.10.2.16 diff -u -r1.10.2.15 -r1.10.2.16 --- CHANGES 8 May 2002 15:18:48 - 1.10.2.15 +++ CHANGES 31 May 2002 00:17:16 - 1.10.2.16 @@ -18,6 +18,10 @@ Submitted by: Michal Buchtik <[EMAIL PROTECTED]> - Added support for background-image Submitted by: Michael Gratton <[EMAIL PROTECTED]> +- Fixed PDF-Renderer to work on EBCDIC systems + (Actually on systems where file.encoding != ASCII/ISO-8859) + Submitted by: Jason West <[EMAIL PROTECTED]> + == Done since 0.20.2 release *** General No revision No revision 1.3.2.1 +9 -6 xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java Index: ASCII85Filter.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- ASCII85Filter.java30 Jul 2001 20:29:29 - 1.3 +++ ASCII85Filter.java31 May 2002 00:17:16 - 1.3.2.1 @@ -1,5 +1,5 @@ /* - * $Id: ASCII85Filter.java,v 1.3 2001/07/30 20:29:29 tore Exp $ + * $Id: ASCII85Filter.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -9,6 +9,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.UnsupportedEncodingException; public class ASCII85Filter extends PDFFilter { private static final char ASCII85_ZERO = 'z'; @@ -87,12 +88,14 @@ } // finally write the two character end of data marker -buffer.write(ASCII85_EOD.getBytes(), 0, - ASCII85_EOD.getBytes().length); - - +byte[] eod; +try { +eod = ASCII85_EOD.getBytes(PDFDocument.ENCODING); +} catch (UnsupportedEncodingException ue) { +eod = ASCII85_EOD.getBytes(); +} +buffer.write(eod, 0, eod.length); byte[] result = buffer.toByteArray(); - // assert that we have the correct outgoing length /* 1.2.2.1 +7 -3 xml-fop/src/org/apache/fop/pdf/ASCIIHexFilter.java Index: ASCIIHexFilter.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCIIHexFilter.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ASCIIHexFilter.java 30 Jul 2001 20:29:29 - 1.2 +++ ASCIIHexFilter.java 31 May 2002 00:17:16 - 1.2.2.1 @@ -1,5 +1,5 @@ /* - * $Id: ASCIIHexFilter.java,v 1.2 2001/07/30 20:29:29 tore Exp $ + * $Id: ASCIIHexFilter.java,v 1.2.2.1 2002/05/31 00:17:16 chrisg Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -8,6 +8,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.UnsupportedEncodingException; public class ASCIIHexFilter extends PDFFilter { private static final String ASCIIHEX_EOD = ">"; @@ -32,8 +33,11 @@ } buffer.append(ASCIIHEX_EOD); -return b