Browse Source

Updated from Jakarta Commons IO 1.0 to 1.1. CopyUtils.copy() becomes IOUtils.copy() again. CopyUtils in 1.0 was not ideal design decision.

Fixed most of the unappropriate System.err/System.out/Exception.printStackTrace(). Those that aren't fixed and are not legitimate calls (in main() methods etc.) are marked with a TODO item.
Some Javadocs and style updates.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@344111 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_90-alpha1
Jeremias Maerki 18 years ago
parent
commit
18536029a6
54 changed files with 473 additions and 359 deletions
  1. 1
    1
      fop.bat
  2. 1
    1
      lib/README.txt
  3. BIN
      lib/commons-io-1.0.jar
  4. BIN
      lib/commons-io-1.1.jar
  5. 203
    56
      lib/commons-io.LICENSE.txt
  6. 3
    0
      lib/commons-io.NOTICE.txt
  7. 4
    4
      src/java/org/apache/fop/area/CachedRenderPagesModel.java
  8. 2
    2
      src/java/org/apache/fop/area/RenderPagesModel.java
  9. 9
    2
      src/java/org/apache/fop/area/Trait.java
  10. 4
    4
      src/java/org/apache/fop/fo/FOText.java
  11. 1
    1
      src/java/org/apache/fop/fo/FOTreeBuilder.java
  12. 1
    1
      src/java/org/apache/fop/fo/XMLObj.java
  13. 44
    31
      src/java/org/apache/fop/fo/properties/PropertyMaker.java
  14. 2
    2
      src/java/org/apache/fop/fo/properties/StringProperty.java
  15. 6
    6
      src/java/org/apache/fop/fonts/FontReader.java
  16. 3
    1
      src/java/org/apache/fop/fonts/FontSetup.java
  17. 8
    10
      src/java/org/apache/fop/fonts/LazyFont.java
  18. 0
    1
      src/java/org/apache/fop/fonts/MultiByteFont.java
  19. 0
    2
      src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
  20. 1
    2
      src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
  21. 6
    5
      src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
  22. 7
    12
      src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
  23. 6
    8
      src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
  24. 53
    71
      src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
  25. 0
    1
      src/java/org/apache/fop/layoutmgr/PositionIterator.java
  26. 2
    2
      src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
  27. 18
    19
      src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
  28. 2
    1
      src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java
  29. 2
    2
      src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
  30. 0
    4
      src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
  31. 0
    2
      src/java/org/apache/fop/pdf/PDFDocument.java
  32. 4
    4
      src/java/org/apache/fop/pdf/PDFEncryptionManager.java
  33. 0
    1
      src/java/org/apache/fop/pdf/PDFState.java
  34. 3
    2
      src/java/org/apache/fop/pdf/PDFStream.java
  35. 7
    5
      src/java/org/apache/fop/pdf/TempFileStreamCache.java
  36. 2
    2
      src/java/org/apache/fop/render/bitmap/TIFFRenderer.java
  37. 1
    1
      src/java/org/apache/fop/render/java2d/Java2DRenderer.java
  38. 2
    2
      src/java/org/apache/fop/render/pdf/PDFRenderer.java
  39. 1
    1
      src/java/org/apache/fop/render/print/PrintRenderer.java
  40. 3
    3
      src/java/org/apache/fop/render/ps/PSFontUtils.java
  41. 1
    0
      src/java/org/apache/fop/render/ps/PSGraphics2D.java
  42. 0
    10
      src/java/org/apache/fop/render/ps/PSTextPainter.java
  43. 6
    1
      src/java/org/apache/fop/render/xml/XMLXMLHandler.java
  44. 1
    0
      src/java/org/apache/fop/svg/PDFANode.java
  45. 7
    13
      src/java/org/apache/fop/svg/PDFGraphics2D.java
  46. 1
    4
      src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java
  47. 41
    32
      src/java/org/apache/fop/svg/PDFImageElementBridge.java
  48. 0
    8
      src/java/org/apache/fop/svg/PDFTextPainter.java
  49. 0
    3
      src/java/org/apache/fop/util/ASCII85InputStream.java
  50. 0
    1
      src/java/org/apache/fop/util/ASCII85OutputStream.java
  51. 0
    1
      src/java/org/apache/fop/util/CloseBlockerOutputStream.java
  52. 1
    1
      src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java
  53. 0
    2
      src/sandbox/org/apache/fop/render/pcl/PCLStream.java
  54. 3
    8
      test/java/org/apache/fop/util/ASCII85InputStreamTestCase.java

+ 1
- 1
fop.bat View File

@@ -47,7 +47,7 @@ set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\serializer-2.7.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik-all-1.6.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.2.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-logging-1.0.3.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar

+ 1
- 1
lib/README.txt View File

@@ -17,7 +17,7 @@ Normal Dependencies
http://jakarta.apache.org/commons/io/
(I/O routines)
Apache License v1.1
Apache License v2.0
- Apache Jakarta Commons Logging


BIN
lib/commons-io-1.0.jar View File


BIN
lib/commons-io-1.1.jar View File


+ 203
- 56
lib/commons-io.LICENSE.txt View File

@@ -1,56 +1,203 @@
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


+ 3
- 0
lib/commons-io.NOTICE.txt View File

@@ -0,0 +1,3 @@
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).


+ 4
- 4
src/java/org/apache/fop/area/CachedRenderPagesModel.java View File

@@ -65,7 +65,7 @@ public class CachedRenderPagesModel extends RenderPagesModel {
// load page from cache
String name = (String)pageMap.get(p);
File temp = new File(name);
System.out.println("page serialized to: " + temp.length());
log.debug("page serialized to: " + temp.length());
ObjectInputStream in = new ObjectInputStream(
new BufferedInputStream(
new FileInputStream(temp)));
@@ -74,7 +74,7 @@ public class CachedRenderPagesModel extends RenderPagesModel {
temp.delete();
pageMap.remove(p);
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
}

@@ -90,7 +90,7 @@ public class CachedRenderPagesModel extends RenderPagesModel {
}
} catch (Exception e) {
// use error handler to handle this FOP or IO Exception
e.printStackTrace();
log.error(e);
}
p.clear();
iter.remove();
@@ -123,7 +123,7 @@ public class CachedRenderPagesModel extends RenderPagesModel {
tempstream.close();
pageMap.put(page, fname);
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
}
}

+ 2
- 2
src/java/org/apache/fop/area/RenderPagesModel.java View File

@@ -115,7 +115,7 @@ public class RenderPagesModel extends AreaTreeModel {
renderer.renderPage(page);
} catch (Exception e) {
// use error handler to handle this FOP or IO Exception
e.printStackTrace();
log.error(e);
}
page.clear();
} else {
@@ -159,7 +159,7 @@ public class RenderPagesModel extends AreaTreeModel {
}
} catch (Exception e) {
// use error handler to handle this FOP or IO Exception
e.printStackTrace();
log.error(e);
}
p.clear();
iter.remove();

+ 9
- 2
src/java/org/apache/fop/area/Trait.java View File

@@ -18,6 +18,9 @@

package org.apache.fop.area;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.Constants;
import org.apache.fop.image.FopImage;
@@ -34,6 +37,10 @@ import java.util.Iterator;
* This class represents an area trait that specifies a value for rendering.
*/
public class Trait implements Serializable {

/** Logger instance */
private static Log log = LogFactory.getLog(Trait.class);
/**
* Id reference line, not resolved.
* not sure if this is needed.
@@ -402,11 +409,11 @@ public class Trait implements Serializable {
Object o = tclass.newInstance();
//return o.fromString(sTraitValue);
} catch (IllegalAccessException e1) {
System.err.println("Can't create instance of "
log.error("Can't create instance of "
+ tclass.getName());
return null;
} catch (InstantiationException e2) {
System.err.println("Can't create instance of "
log.error("Can't create instance of "
+ tclass.getName());
return null;
}

+ 4
- 4
src/java/org/apache/fop/fo/FOText.java View File

@@ -500,7 +500,7 @@ public class FOText extends FONode {
public boolean hasNext() {
if (curIndex == 0) {
// System.out.println("->" + new String(ca) + "<-");
// log.debug("->" + new String(ca) + "<-");
}
return (curIndex < endIndex);
}
@@ -519,16 +519,16 @@ public class FOText extends FONode {
if (curIndex < endIndex && nextCharCalled < 2) {
startIndex++;
nextCharCalled = 0;
// System.out.println("removeA: " + new String(ca, startIndex, endIndex - startIndex));
// log.debug("removeA: " + new String(ca, startIndex, endIndex - startIndex));
} else if (curIndex < endIndex) {
// copy from curIndex to end to curIndex-1
System.arraycopy(ca, curIndex, ca, curIndex - 1,
endIndex - curIndex);
endIndex--;
curIndex--;
// System.out.println("removeB: " + new String(ca, startIndex, endIndex - startIndex));
// log.debug("removeB: " + new String(ca, startIndex, endIndex - startIndex));
} else if (curIndex == endIndex) {
// System.out.println("removeC: " + new String(ca, startIndex, endIndex - startIndex));
// log.debug("removeC: " + new String(ca, startIndex, endIndex - startIndex));
endIndex--;
curIndex--;
}

+ 1
- 1
src/java/org/apache/fop/fo/FOTreeBuilder.java View File

@@ -265,7 +265,7 @@ public class FOTreeBuilder extends DefaultHandler {
}
ElementMapping.Maker fobjMaker = findFOMaker(namespaceURI, localName);
// System.out.println("found a " + fobjMaker.toString());
// log.debug("found a " + fobjMaker.toString());

try {
foNode = fobjMaker.make(currentFObj);

+ 1
- 1
src/java/org/apache/fop/fo/XMLObj.java View File

@@ -173,7 +173,7 @@ public abstract class XMLObj extends FONode {
element = doc.getDocumentElement();
buildTopLevel(doc, element);
} catch (Exception e) {
e.printStackTrace();
log.error("Error while trying to instantiate a DOM Document", e);
}
return doc;
}

+ 44
- 31
src/java/org/apache/fop/fo/properties/PropertyMaker.java View File

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 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.
@@ -38,15 +38,22 @@ import org.apache.fop.fo.expr.PropertyParser;

/**
* Base class for all property makers
* @author unascribed
*/
public class PropertyMaker implements Cloneable {

/** Logger instance */
private static Log log = LogFactory.getLog(PropertyMaker.class);

/** the property ID */
protected int propId;
private boolean inherited = true;
private Map enums = null;
private Map keywords = null;
/** the default value for the maker */
protected String defaultValue = null;
/** Indicates whether the property is context-dependant and therefore can't be cached. */
protected boolean contextDep = false;
/** Indicates whether the property is set through a shorthand. */
protected boolean setByShorthand = false;
private int percentBase = -1;
private PropertyMaker[] shorthands = null;
@@ -55,8 +62,6 @@ public class PropertyMaker implements Cloneable {
protected Property defaultProperty;
protected CorrespondingPropertyMaker corresponding;

private static Log log = LogFactory.getLog(PropertyMaker.class);

/**
* @return the name of the property for this Maker
*/
@@ -95,7 +100,7 @@ public class PropertyMaker implements Cloneable {

/**
* Set the inherited flag.
* @param inherited
* @param inherited true if this is an inherited property
*/
public void setInherited(boolean inherited) {
this.inherited = inherited;
@@ -103,8 +108,8 @@ public class PropertyMaker implements Cloneable {

/**
* Add a keyword-equiv to the maker.
* @param keyword
* @param value
* @param keyword the keyword
* @param value the value to be used when the keyword is specified
*/
public void addKeyword(String keyword, String value) {
if (keywords == null) {
@@ -115,8 +120,8 @@ public class PropertyMaker implements Cloneable {

/**
* Add a enum constant.
* @param constant
* @param value
* @param constant the enum constant
* @param value the Property value to use when the constant is specified
*/
public void addEnum(String constant, Property value) {
if (enums == null) {
@@ -127,7 +132,7 @@ public class PropertyMaker implements Cloneable {

/**
* Add a subproperty to this maker.
* @param subproperty
* @param subproperty the PropertyMaker for the subproperty
*/
public void addSubpropMaker(PropertyMaker subproperty) {
throw new RuntimeException("Unable to add subproperties " + getClass());
@@ -179,7 +184,7 @@ public class PropertyMaker implements Cloneable {

/**
* Set the default value for this maker.
* @param defaultValue
* @param defaultValue the default value
* @param contextDep true when the value context dependent and
* must not be cached.
*/
@@ -190,7 +195,7 @@ public class PropertyMaker implements Cloneable {

/**
* Set the percent base identifier for this maker.
* @param percentBase
* @param percentBase the percent base (ex. LengthBase.FONTSIZE)
*/
public void setPercentBase(int percentBase) {
this.percentBase = percentBase;
@@ -201,7 +206,7 @@ public class PropertyMaker implements Cloneable {
* makers. It should be true for the subproperties which must be
* assigned a value when the base property is assigned a attribute
* value directly.
* @param setByShorthand
* @param setByShorthand true if this subproperty must be set when the base property is set
*/
public void setByShorthand(boolean setByShorthand) {
this.setByShorthand = setByShorthand;
@@ -225,18 +230,21 @@ public class PropertyMaker implements Cloneable {
return null;
}

/*
/**
* If the property is a relative property with a corresponding absolute
* value specified, the absolute value is used. This is also true of
* the inheritance priority (I think...)
* If the property is an "absolute" property and it isn't specified, then
* we try to compute it from the corresponding relative property: this
* happens in computeProperty.
* @param propertyList the applicable property list
* @param tryInherit true if inherited properties should be examined.
* @return the property value
* @throws PropertyException if there is a problem evaluating the property
*/
public Property findProperty(PropertyList propertyList,
boolean tryInherit)
throws PropertyException
{
throws PropertyException {
Property p = null;
if (log.isTraceEnabled()) {
@@ -275,12 +283,13 @@ public class PropertyMaker implements Cloneable {
* Is 0 when retriving a base property.
* @param propertyList The PropertyList object being built for this FO.
* @param tryInherit true if inherited properties should be examined.
* @param tryDefault true if the default value should be returned.
* @param tryDefault true if the default value should be returned.
* @return the property value
* @throws PropertyException if there is a problem evaluating the property
*/
public Property get(int subpropertyId, PropertyList propertyList,
boolean tryInherit, boolean tryDefault)
throws PropertyException
{
throws PropertyException {
Property p = findProperty(propertyList, tryInherit);

if (p == null && tryDefault) { // default value for this FO!
@@ -307,11 +316,14 @@ public class PropertyMaker implements Cloneable {
* @param pl the PropertyList containing the property. (TODO: explain
* what this is used for, or remove it from the signature.)
* @return an object implementing the PercentBase interface.
* @throws PropertyException if there is a problem while evaluating the base property
*/
public PercentBase getPercentBase(FObj fo, PropertyList pl) throws PropertyException {
if (percentBase == -1)
if (percentBase == -1) {
return null;
return new LengthBase(fo, pl, percentBase);
} else {
return new LengthBase(fo, pl, percentBase);
}
}

/**
@@ -414,7 +426,8 @@ public class PropertyMaker implements Cloneable {
newProp = convertProperty(newProp, propertyList, fo);
}
if (newProp == null) {
throw new org.apache.fop.fo.expr.PropertyException("No conversion defined " + pvalue);
throw new org.apache.fop.fo.expr.PropertyException(
"No conversion defined " + pvalue);
}
return newProp;
} catch (PropertyException propEx) {
@@ -448,23 +461,21 @@ public class PropertyMaker implements Cloneable {

public Property convertShorthandProperty(PropertyList propertyList,
Property prop, FObj fo)
throws PropertyException
{
throws PropertyException {
Property pret = convertProperty(prop, propertyList, fo);
if (pret == null) {
// If value is a name token, may be keyword or Enum
String sval = prop.getNCname();
if (sval != null) {
// System.err.println("Convert shorthand ncname " + sval);
//log.debug("Convert shorthand ncname " + sval);
pret = checkEnumValues(sval);
if (pret == null) {
/* Check for keyword shorthand values to be substituted. */
String pvalue = checkValueKeywords(sval);
if (!pvalue.equals(sval)) {
// System.err.println("Convert shorthand keyword" + pvalue);
// log.debug("Convert shorthand keyword" + pvalue);
// Substituted a value: must parse it
Property p =
PropertyParser.parse(pvalue,
Property p = PropertyParser.parse(pvalue,
new PropertyInfo(this,
propertyList,
fo));
@@ -475,7 +486,7 @@ public class PropertyMaker implements Cloneable {
}
if (pret != null) {
/*
* System.err.println("Return shorthand value " + pret.getString() +
* log.debug("Return shorthand value " + pret.getString() +
* " for " + getPropName());
*/
}
@@ -584,10 +595,10 @@ public class PropertyMaker implements Cloneable {
* return an appropriate border-right-width Property object.
* @param propertyList the collection of properties to be considered
* @return the Property, if found, the correspons, otherwise, null
* @throws PropertyException if there is a problem while evaluating the shorthand
*/
public Property getShorthand(PropertyList propertyList)
throws PropertyException
{
throws PropertyException {
if (shorthands == null) {
return null;
}
@@ -608,6 +619,7 @@ public class PropertyMaker implements Cloneable {
return null;
}
/** @return the name of the property this maker is used for. */
public String getName() {
return FOPropertyMapping.getPropertyName(propId);
}
@@ -615,6 +627,7 @@ public class PropertyMaker implements Cloneable {
/**
* Return a clone of the makers. Used by useGeneric() to clone the
* subproperty makers of the generic compound makers.
* @see java.lang.Object#clone()
*/
public Object clone() {
try {

+ 2
- 2
src/java/org/apache/fop/fo/properties/StringProperty.java View File

@@ -61,7 +61,7 @@ public class StringProperty extends Property {
if (value.charAt(vlen) == q1) {
return new StringProperty(value.substring(1, vlen));
}
System.err.println("Warning String-valued property starts with quote"
log.warn("String-valued property starts with quote"
+ " but doesn't end with quote: "
+ value);
// fall through and use the entire value, including first quote
@@ -83,7 +83,7 @@ public class StringProperty extends Property {
*/
public StringProperty(String str) {
this.str = str;
// System.err.println("Set StringProperty: " + str);
// log.debug("Set StringProperty: " + str);
}

/**

+ 6
- 6
src/java/org/apache/fop/fonts/FontReader.java View File

@@ -147,7 +147,7 @@ public class FontReader extends DefaultHandler {
* @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
*/
public void startElement(String uri, String localName, String qName,
Attributes attributes) {
Attributes attributes) throws SAXException {
if (localName.equals("font-metrics")) {
if ("TYPE0".equals(attributes.getValue("type"))) {
multiFont = new MultiByteFont();
@@ -190,8 +190,8 @@ public class FontReader extends DefaultHandler {
singleFont.setWidth(Integer.parseInt(attributes.getValue("idx")),
Integer.parseInt(attributes.getValue("wdt")));
} catch (NumberFormatException ne) {
System.out.println("Malformed width in metric file: "
+ ne.getMessage());
throw new SAXException("Malformed width in metric file: "
+ ne.getMessage(), ne);
}
} else if ("pair".equals(localName)) {
currentKerning.put(new Integer(attributes.getValue("kpx2")),
@@ -199,12 +199,12 @@ public class FontReader extends DefaultHandler {
}
}

private int getInt(String str) {
private int getInt(String str) throws SAXException {
int ret = 0;
try {
ret = Integer.parseInt(str);
} catch (Exception e) {
/**@todo log this exception */
throw new SAXException("Error while parsing integer value: " + str, e);
}
return ret;
}
@@ -212,7 +212,7 @@ public class FontReader extends DefaultHandler {
/**
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
public void endElement(String uri, String localName, String qName) {
public void endElement(String uri, String localName, String qName) throws SAXException {
String content = text.toString().trim();
if ("font-name".equals(localName)) {
returnFont.setFontName(content);

+ 3
- 1
src/java/org/apache/fop/fonts/FontSetup.java View File

@@ -200,7 +200,9 @@ public class FontSetup {
FontTriplet triplet = (FontTriplet) triplets.get(c);

int weight = FontUtil.parseCSS2FontWeight(triplet.getWeight());
//System.out.println("Registering: "+triplet+" weight="+weight);
if (log.isDebugEnabled()) {
log.debug("Registering: " + triplet + " weight=" + weight);
}
fontInfo.addFontProperties(internalName,
triplet.getName(),
triplet.getStyle(),

+ 8
- 10
src/java/org/apache/fop/fonts/LazyFont.java View File

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 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,17 +18,18 @@

package org.apache.fop.fonts;

//Java
import java.util.Map;

//FOP
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* This class is used to defer the loading of a font until it is really used.
*/
public class LazyFont extends Typeface implements FontDescriptor {

private static Log log = LogFactory.getLog(LazyFont.class);
private String metricsFileName = null;
private String fontEmbedPath = null;
private boolean useKerning = false;
@@ -62,13 +63,10 @@ public class LazyFont extends Typeface implements FontDescriptor {
if (realFont instanceof FontDescriptor) {
realFontDescriptor = (FontDescriptor) realFont;
}
// System.out.println("Metrics " + metricsFileName + " loaded.");
// log.debug("Metrics " + metricsFileName + " loaded.");
} catch (Exception ex) {
ex.printStackTrace();
/**@todo Log this exception */
//log.error("Failed to read font metrics file "
// + metricsFileName
// + " : " + ex.getMessage());
log.error("Failed to read font metrics file "
+ metricsFileName, ex);
}
}
}

+ 0
- 1
src/java/org/apache/fop/fonts/MultiByteFont.java View File

@@ -223,7 +223,6 @@ public class MultiByteFont extends CIDFont {
usedGlyphsIndex.put(new Integer(usedGlyphsCount),
new Integer(retIdx));
retIdx = usedGlyphsCount;
// System.out.println(c+"("+(int)c+") = "+retIdx);
usedGlyphsCount++;
} else {
retIdx = newIdx.intValue();

+ 0
- 2
src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java View File

@@ -46,9 +46,7 @@ class TTFDirTabEntry {
offset = in.readTTFULong();
length = in.readTTFULong();
String tagStr = new String(tag, "ISO-8859-1");
// System.err.println("tag='" + tagStr + "'");

//System.out.println(this.toString());
return tagStr;
}


+ 1
- 2
src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java View File

@@ -81,8 +81,7 @@ public abstract class AbstractBaseLayoutManager
case LengthBase.CONTAINING_REFAREA_WIDTH:
return getReferenceAreaIPD();
default:
log.error("Unknown base type for LengthBase:" + lengthBase);
new Exception().printStackTrace();
log.error(new Exception("Unknown base type for LengthBase:" + lengthBase));
return 0;
}
} else {

+ 6
- 5
src/java/org/apache/fop/layoutmgr/AbstractBreaker.java View File

@@ -174,12 +174,14 @@ public abstract class AbstractBreaker {
ElementListObserver.observe(elementList, "breaker", null);
}
/**
* Starts the page breaking process.
* @param flowBPD the constant available block-progression-dimension (used for every part)
*/
public void doLayout(int flowBPD) {
LayoutContext childLC = createLayoutContext();
childLC.setStackLimit(new MinOptMax(flowBPD));

//System.err.println("Vertical alignment: " +
// currentSimplePageMaster.getRegion(FO_REGION_BODY).getDisplayAlign());
if (getCurrentDisplayAlign() == Constants.EN_X_FILL) {
//EN_FILL is non-standard (by LF)
alignment = Constants.EN_JUSTIFY;
@@ -492,7 +494,6 @@ public abstract class AbstractBreaker {
private int optimizeLineLength(KnuthSequence effectiveList, int startElementIndex, int endElementIndex) {
ListIterator effectiveListIterator;
// optimize line length
//System.out.println(" ");
int boxCount = 0;
int accumulatedLineLength = 0;
int greatestMinimumLength = 0;
@@ -520,10 +521,10 @@ public abstract class AbstractBreaker {
int averageLineLength = 0;
if (accumulatedLineLength > 0 && boxCount > 0) {
averageLineLength = (int) (accumulatedLineLength / boxCount);
//System.out.println("PSLM> lunghezza media = " + averageLineLength);
log.debug("Average line length = " + averageLineLength);
if (averageLineLength < greatestMinimumLength) {
averageLineLength = greatestMinimumLength;
//System.out.println(" correzione, ora e' = " + averageLineLength);
log.debug(" Correction to: " + averageLineLength);
}
}
return averageLineLength;

+ 7
- 12
src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java View File

@@ -690,7 +690,6 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
Position lastPos = null;
while (parentIter.hasNext()) {
pos = (Position) parentIter.next();
//System.out.println("pos = " + pos.getClass().getName());
if (pos.getIndex() >= 0) {
if (firstPos == null) {
firstPos = pos;
@@ -728,13 +727,10 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
// pos was created by this BlockLM and was inside a penalty
// allowing or forbidding a page break
// nothing to do
/* LF *///System.out.println(" penalty");
} else {
// innerPosition was created by another LM
positionList.add(innerPosition);
lastLM = innerPosition.getLM();
/* LF *///System.out.println(" " +
// innerPosition.getClass().getName());
}
}

@@ -756,7 +752,6 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
// // the last item inside positionList is a LeafPosition
// // (a LineBreakPosition, more precisely); this means that
// // the whole paragraph is on the same page
// System.out.println("paragrafo intero");
// childPosIter = new KnuthPossPosIter(storedList, 0,
// storedList.size());
//} else {
@@ -781,11 +776,11 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
lastLM = element.getLayoutManager();
}
}
//System.out.println("addAreas riferito a storedList da " +
// iFirst + " a " + iLast);
//System.out.println("splitLength= " + splitLength
// + " (" + neededUnits(splitLength) + " unita') "
// + (neededUnits(splitLength) * bpUnit - splitLength) + " spazi");
//log.debug("Adding areas from " + iFirst + " to " + iLast);
//log.debug("splitLength= " + splitLength
// + " (" + neededUnits(splitLength) + " units') "
// + (neededUnits(splitLength) * bpUnit - splitLength)
// + " spacing");
// add space before and / or after the paragraph
// to reach a multiple of bpUnit
if (bSpaceBefore && bSpaceAfter) {
@@ -810,8 +805,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
+ foBlockSpaceAfter.min)
* bpUnit - splitLength;
}
//System.out.println("spazio prima = " + adjustedSpaceBefore
// + " spazio dopo = " + adjustedSpaceAfter + " totale = " +
//log.debug("space before = " + adjustedSpaceBefore
// + " space after = " + adjustedSpaceAfter + " total = " +
// (adjustedSpaceBefore + adjustedSpaceAfter + splitLength));
childPosIter = new KnuthPossPosIter(splitList, 0, splitList
.size());

+ 6
- 8
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java View File

@@ -232,7 +232,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
*/
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
//System.out.println(" BLM.addAreas>");
getParentArea(null);

// if this will create the first block area in a page
@@ -316,7 +315,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
// // the last item inside positionList is a LeafPosition
// // (a LineBreakPosition, more precisely); this means that
// // the whole paragraph is on the same page
// System.out.println("paragrafo intero");
// childPosIter = new KnuthPossPosIter(storedList, 0,
// storedList.size());
//} else {
@@ -341,11 +339,11 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
lastLM = element.getLayoutManager();
}
}
//System.out.println("addAreas riferito a storedList da " +
// iFirst + " a " + iLast);
//System.out.println("splitLength= " + splitLength
// + " (" + neededUnits(splitLength) + " unita') "
// + (neededUnits(splitLength) * bpUnit - splitLength) + " spazi");
//log.debug("Adding areas from " + iFirst + " to " + iLast);
//log.debug("splitLength= " + splitLength
// + " (" + neededUnits(splitLength) + " units') "
// + (neededUnits(splitLength) * bpUnit - splitLength)
// + " spacing");
// add space before and / or after the paragraph
// to reach a multiple of bpUnit
if (bSpaceBefore && bSpaceAfter) {
@@ -370,7 +368,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
+ foSpaceAfter.min)
* bpUnit - splitLength;
}
//System.out.println("spazio prima = " + adjustedSpaceBefore
//log.debug("spazio prima = " + adjustedSpaceBefore
// + " spazio dopo = " + adjustedSpaceAfter + " totale = " +
// (adjustedSpaceBefore + adjustedSpaceAfter + splitLength));
childPosIter = new KnuthPossPosIter(splitList, 0, splitList

+ 53
- 71
src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java View File

@@ -178,11 +178,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @see LayoutManager#getNextKnuthElements(LayoutContext, int)
*/
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
/* LF *///System.err.println("BLM.getNextKnuthElements> keep-together = "
//log.debug("BLM.getNextKnuthElements> keep-together = "
// + layoutProps.keepTogether.getType());
/* LF *///System.err.println(" keep-with-previous = " +
//log.debug(" keep-with-previous = " +
// layoutProps.keepWithPrevious.getType());
/* LF *///System.err.println(" keep-with-next = " +
//log.debug(" keep-with-next = " +
// layoutProps.keepWithNext.getType());
BlockLevelLayoutManager curLM; // currently active LM
BlockLevelLayoutManager prevLM = null; // previously active LM
@@ -388,11 +388,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#negotiateBPDAdjustment(int, org.apache.fop.layoutmgr.KnuthElement)
*/
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> " + adj);
/*LF*/ //System.out.println(" lastElement e' " + (lastElement.isPenalty()
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> " + adj);
/*LF*/ //log.debug(" lastElement e' " + (lastElement.isPenalty()
// ? "penalty" : (lastElement.isGlue() ? "glue" : "box" )));
/*LF*/ //System.out.println(" position e' " + lastElement.getPosition().getClass().getName());
/*LF*/ //System.out.println(" " + (bpUnit > 0 ? "unit" : ""));
/*LF*/ //log.debug(" position e' " + lastElement.getPosition().getClass().getName());
/*LF*/ //log.debug(" " + (bpUnit > 0 ? "unit" : ""));
Position innerPosition = ((NonLeafPosition) lastElement.getPosition()).getPosition();

if (innerPosition == null && lastElement.isGlue()) {
@@ -400,11 +400,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
if (((KnuthGlue) lastElement).getAdjustmentClass() == SPACE_BEFORE_ADJUSTMENT) {
// this adjustment applies to space-before
adjustedSpaceBefore += adj;
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> spazio prima: " + adj);
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> spazio prima: " + adj);
} else {
// this adjustment applies to space-after
adjustedSpaceAfter += adj;
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> spazio dopo: " + adj);
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> spazio dopo: " + adj);
}
return adj;
} else if (innerPosition instanceof MappingPosition) {
@@ -414,7 +414,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
MappingPosition mappingPos = (MappingPosition)innerPosition;
if (lastElement.isGlue()) {
// lastElement is a glue
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> bpunit con glue");
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> bpunit con glue");
ListIterator storedListIterator = storedList.listIterator(
mappingPos.getFirstIndex());
int newAdjustment = 0;
@@ -424,7 +424,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
newAdjustment += ((BlockLevelLayoutManager)storedElement
.getLayoutManager()).negotiateBPDAdjustment(
adj - newAdjustment, storedElement);
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> (progressivo) righe: "
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> (progressivo) righe: "
// + newAdjustment);
}
}
@@ -435,19 +435,19 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
// lastElement is a penalty: this means that the paragraph
// has been split between consecutive pages:
// this may involve a change in the number of lines
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> bpunit con penalty");
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> bpunit con penalty");
KnuthPenalty storedPenalty = (KnuthPenalty)
storedList.get(mappingPos.getLastIndex());
if (storedPenalty.getW() > 0) {
// the original penalty has width > 0
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> chiamata passata");
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> chiamata passata");
return ((BlockLevelLayoutManager)storedPenalty.getLayoutManager())
.negotiateBPDAdjustment(storedPenalty.getW(),
(KnuthElement)storedPenalty);
} else {
// the original penalty has width = 0
// the adjustment involves only the spaces before and after
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> chiamata gestita");
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> chiamata gestita");
return adj;
}
}
@@ -458,7 +458,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
int returnValue = ((BlockLevelLayoutManager)lastElement.getLayoutManager())
.negotiateBPDAdjustment(adj, lastElement);
lastElement.setPosition(savedPos);
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> righe: " + returnValue);
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> righe: " + returnValue);
return returnValue;
} else {
// this should never happen
@@ -471,7 +471,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @see BlockLevelLayoutManager#discardSpace(KnuthGlue)
*/
public void discardSpace(KnuthGlue spaceGlue) {
//System.out.println(" BLM.discardSpace> " + spaceGlue.getPosition().getClass().getName());
//log.debug(" BLM.discardSpace> " + spaceGlue.getPosition().getClass().getName());
Position innerPosition = ((NonLeafPosition) spaceGlue.getPosition()).getPosition();

if (innerPosition == null || innerPosition.getLM() == this) {
@@ -501,8 +501,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @see LayoutManager#getChangedKnuthElements(List, int)
*/
public LinkedList getChangedKnuthElements(List oldList, int alignment) {
/*LF*/ //System.out.println("");
/*LF*/ //System.out.println(" BLM.getChangedKnuthElements> inizio: oldList.size() = "
/*LF*/ //log.debug("");
/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = "
// + oldList.size());
ListIterator oldListIterator = oldList.listIterator();
KnuthElement returnedElement;
@@ -517,10 +517,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
while (oldListIterator.hasNext()) {
oldElement = (KnuthElement)oldListIterator.next();
Position innerPosition = ((NonLeafPosition) oldElement.getPosition()).getPosition();
//System.out.println(" BLM> unwrapping: "
//log.debug(" BLM> unwrapping: "
// + (oldElement.isBox() ? "box " : (oldElement.isGlue() ? "glue " : "penalty"))
// + " creato da " + oldElement.getLayoutManager().getClass().getName());
//System.out.println(" BLM> unwrapping: "
//log.debug(" BLM> unwrapping: "
// + oldElement.getPosition().getClass().getName());
if (innerPosition != null) {
// oldElement was created by a descendant of this BlockLM
@@ -557,19 +557,18 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}
int iLast = ((MappingPosition) el.getPosition()).getLastIndex();

//System.out.println(" si usa storedList da " + iFirst + " a " + iLast
//log-debug(" si usa storedList da " + iFirst + " a " + iLast
// + " compresi su " + storedList.size() + " elementi totali");
workList = storedList.subList(iFirst, iLast + 1);
}
ListIterator workListIterator = workList.listIterator();

//System.out.println("");
//System.out.println(" BLM.getChangedKnuthElements> workList.size() = "
//log.debug(" BLM.getChangedKnuthElements> workList.size() = "
// + workList.size() + " da 0 a " + (workList.size() - 1));

while (workListIterator.hasNext()) {
currElement = (KnuthElement) workListIterator.next();
//System.out.println("elemento n. " + workListIterator.previousIndex()
//log.debug("elemento n. " + workListIterator.previousIndex()
// + " nella workList");
if (prevElement != null
&& prevElement.getLayoutManager() != currElement.getLayoutManager()) {
@@ -580,7 +579,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
currElement.getLayoutManager();
boolean bSomethingAdded = false;
if (prevLM != this) {
//System.out.println(" BLM.getChangedKnuthElements> chiamata da "
//log.debug(" BLM.getChangedKnuthElements> chiamata da "
// + fromIndex + " a " + workListIterator.previousIndex() + " su "
// + prevLM.getClass().getName());
returnedList.addAll(prevLM.getChangedKnuthElements(workList.subList(
@@ -589,7 +588,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
} else {
// prevLM == this
// do nothing
//System.out.println(" BLM.getChangedKnuthElements> elementi propri, "
//log.debug(" BLM.getChangedKnuthElements> elementi propri, "
// + "ignorati, da " + fromIndex + " a " + workListIterator.previousIndex()
// + " su " + prevLM.getClass().getName());
}
@@ -614,7 +613,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
BlockLevelLayoutManager currLM = (BlockLevelLayoutManager)
currElement.getLayoutManager();
if (currLM != this) {
//System.out.println(" BLM.getChangedKnuthElements> chiamata da " + fromIndex
//log.debug(" BLM.getChangedKnuthElements> chiamata da " + fromIndex
// + " a " + oldList.size() + " su " + currLM.getClass().getName());
returnedList.addAll(currLM.getChangedKnuthElements(
workList.subList(fromIndex, workList.size()), alignment));
@@ -625,7 +624,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
if (returnedList.size() > 0) {
returnedList.removeLast();
}
//System.out.println(" BLM.getChangedKnuthElements> elementi propri, ignorati, da "
//log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da "
// + fromIndex + " a " + workList.size());
}
}
@@ -654,7 +653,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}
}

//System.out.println(" BLM.getChangedKnuthElements> intermedio: returnedList.size() = "
//log.debug(" BLM.getChangedKnuthElements> intermedio: returnedList.size() = "
// + returnedList.size());

/* estensione: conversione complessiva */
@@ -702,7 +701,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}
}

//System.out.println(" BLM.getChangedKnuthElements> finished: returnList.size() = "
//log.debug(" BLM.getChangedKnuthElements> finished: returnList.size() = "
// + returnList.size());
return returnList;
}
@@ -875,13 +874,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
CommonBorderPaddingBackground.BEFORE),
RelSide.BEFORE, isFirst, false, this));
}
//TODO Handle conditionality
/*
int bpBefore = borderAndPadding.getBorderBeforeWidth(false)
+ borderAndPadding.getPaddingBefore(false, this);
if (bpBefore > 0) {
returnList.add(new KnuthBox(bpBefore, getAuxiliaryPosition(), true));
}*/
}
}

@@ -907,13 +899,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
.getWidth(),
RelSide.AFTER, false, isLast, this));
}
//TODO Handle conditionality
/*
int bpAfter = borderAndPadding.getBorderAfterWidth(false)
+ borderAndPadding.getPaddingAfter(false, this);
if (bpAfter > 0) {
returnList.add(new KnuthBox(bpAfter, getAuxiliaryPosition(), true));
}*/
}
}

@@ -1077,8 +1062,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}

protected LinkedList createUnitElements(LinkedList oldList) {
//System.out.println(" ");
//System.out.println("Start conversion: " + oldList.size()
//log.debug("Start conversion: " + oldList.size()
// + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min
// + " space-after.min=" + layoutProps.spaceAfter.getSpace().min);
// add elements at the beginning and at the end of oldList
@@ -1101,23 +1085,22 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
MinOptMax totalUnits = new MinOptMax(0);
LinkedList newList = new LinkedList();

//System.out.println(" ");
//System.out.println(" Prima scansione");
//log.debug(" Prima scansione");
// scan the list once to compute total min, opt and max length
ListIterator oldListIterator = oldList.listIterator();
while (oldListIterator.hasNext()) {
KnuthElement element = (KnuthElement) oldListIterator.next();
if (element.isBox()) {
totalLength.add(new MinOptMax(element.getW()));
//System.out.println("box " + element.getW());
//log.debug("box " + element.getW());
} else if (element.isGlue()) {
totalLength.min -= ((KnuthGlue) element).getZ();
totalLength.max += ((KnuthGlue) element).getY();
//leafValue = ((LeafPosition) element.getPosition()).getLeafPos();
//System.out.println("glue " + element.getW() + " + "
//log.debug("glue " + element.getW() + " + "
// + ((KnuthGlue) element).getY() + " - " + ((KnuthGlue) element).getZ());
} else {
//System.out.println((((KnuthPenalty)element).getP() == KnuthElement.INFINITE
//log.debug((((KnuthPenalty)element).getP() == KnuthElement.INFINITE
// ? "PENALTY " : "penalty ") + element.getW());
}
}
@@ -1125,11 +1108,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
totalUnits = new MinOptMax(neededUnits(totalLength.min),
neededUnits(totalLength.opt),
neededUnits(totalLength.max));
//System.out.println(" totalLength= " + totalLength);
//System.out.println(" unita'= " + totalUnits);
//log.debug(" totalLength= " + totalLength);
//log.debug(" unita'= " + totalUnits);

//System.out.println(" ");
//System.out.println(" Seconda scansione");
//log.debug(" Seconda scansione");
// scan the list once more, stopping at every breaking point
// in order to compute partial min, opt and max length
// and create the new elements
@@ -1212,7 +1194,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
int uNewShrink = (unitsBeforeBreak.opt - unitsBeforeBreak.min)
- (unsuppressibleUnits.opt - unsuppressibleUnits.min);

//System.out.println("("
//log.debug("("
// + unsuppressibleUnits.min + "-" + unsuppressibleUnits.opt + "-"
// + unsuppressibleUnits.max + ") "
// + " -> " + unitsBeforeBreak.min + "-" + unitsBeforeBreak.opt + "-"
@@ -1245,7 +1227,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
mappingPos,
false));
unsuppressibleUnits.add(new MinOptMax(uNewNormal - uLengthChange));
//System.out.println(" box " + (uNewNormal - uLengthChange));
//log.debug(" box " + (uNewNormal - uLengthChange));

// new infinite penalty, glue and box, if necessary
if (uNewStretch - uStretchChange > 0
@@ -1263,15 +1245,15 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
LINE_NUMBER_ADJUSTMENT,
mappingPos,
false));
//System.out.println(" PENALTY");
//System.out.println(" glue 0 " + iStretchUnits + " " + iShrinkUnits);
//log.debug(" PENALTY");
//log.debug(" glue 0 " + iStretchUnits + " " + iShrinkUnits);
unsuppressibleUnits.max += iStretchUnits;
unsuppressibleUnits.min -= iShrinkUnits;
if (!oldListIterator.hasNext()) {
newList.add(new KnuthBox(0,
mappingPos,
false));
//System.out.println(" box 0");
//log.debug(" box 0");
}
}

@@ -1296,10 +1278,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
LINE_NUMBER_ADJUSTMENT,
mappingPos,
false));
//System.out.println(" PENALTY");
//System.out.println(" glue 0 " + uStretchChange + " " + uShrinkChange);
//System.out.println(" penalty " + uLengthChange + " * unit");
//System.out.println(" glue 0 " + (- uStretchChange) + " "
//log.debug(" PENALTY");
//log.debug(" glue 0 " + uStretchChange + " " + uShrinkChange);
//log.debug(" penalty " + uLengthChange + " * unit");
//log.debug(" glue 0 " + (- uStretchChange) + " "
// + (- uShrinkChange));
} else if (oldListIterator.hasNext()) {
// new penalty
@@ -1307,7 +1289,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
0, false,
mappingPos,
false));
//System.out.println(" penalty " + uLengthChange + " * unit");
//log.debug(" penalty " + uLengthChange + " * unit");
}
// update firstIndex
firstIndex = lastIndex + 1;
@@ -1347,9 +1329,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
wrongBox.getPosition(), false));
newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, SPACE_BEFORE_ADJUSTMENT,
wrongBox.getPosition(), false));
//System.out.println(" rimosso box " + neededUnits(wrongBox.getW()));
//System.out.println(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
//System.out.println(" aggiunto box " + neededUnits(
//log.debug(" rimosso box " + neededUnits(wrongBox.getW()));
//log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
//log.debug(" aggiunto box " + neededUnits(
// wrongBox.getW() - decreasedLength));
}

@@ -1388,10 +1370,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
// insert the correct glue
newList.addLast(new KnuthGlue(decreasedLength, 0, 0, SPACE_AFTER_ADJUSTMENT,
wrongBox.getPosition(), false));
//System.out.println(" rimosso box " + neededUnits(wrongBox.getW()));
//System.out.println(" aggiunto box " + neededUnits(
//log.debug(" rimosso box " + neededUnits(wrongBox.getW()));
//log.debug(" aggiunto box " + neededUnits(
// wrongBox.getW() - decreasedLength));
//System.out.println(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
//log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
}

return newList;

+ 0
- 1
src/java/org/apache/fop/layoutmgr/PositionIterator.java View File

@@ -84,7 +84,6 @@ public abstract class PositionIterator implements Iterator {
if (bHasNext) {
Object retObj = getPos(nextObj);
lookAhead();
//System.out.println(retObj);
return retObj;
} else {
throw new NoSuchElementException("PosIter");

+ 2
- 2
src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java View File

@@ -108,7 +108,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {

// get elements from curLM
returnedList = curLM.getNextKnuthElements(childLC, alignment);
//System.out.println("FLM.getNextKnuthElements> returnedList.size() = "
//log.debug("FLM.getNextKnuthElements> returnedList.size() = "
// + returnedList.size());

// "wrap" the Position inside each element
@@ -148,7 +148,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
&& ((KnuthPenalty)returnedList.getLast()).getP()
== -KnuthElement.INFINITE) {
// a descendant of this flow has break-after
/*LF*/ //System.out.println("FLM - break after!!");
/*LF*/ //log.debug("FLM - break after!!");
return returnList;
}
/*LF*/ }

+ 18
- 19
src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java View File

@@ -432,10 +432,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager
if (addedPositions == lineLayouts.getLineCount(activePossibility)) {
activePossibility++;
addedPositions = 0;
//System.out.println(" ");
}

//System.out.println("LLM> (" + (lineLayouts.getLineNumber(activePossibility) - addedPositions) + ") difference = " + difference + " ratio = " + ratio);
//log.debug("LLM> (" + (lineLayouts.getLineNumber(activePossibility) - addedPositions) + ") difference = " + difference + " ratio = " + ratio);
lineLayouts.addBreakPosition(makeLineBreakPosition(par,
(bestActiveNode.line > 1 ? bestActiveNode.previous.position + 1: 0),
bestActiveNode.position,
@@ -543,26 +542,26 @@ public class LineLayoutManager extends InlineStackingLayoutManager

if (pageAlignment == EN_JUSTIFY) {
// leave all active nodes and find the optimum line number
//System.out.println("LBA.filterActiveNodes> " + activeNodeCount + " layouts");
//log.debug("LBA.filterActiveNodes> " + activeNodeCount + " layouts");
for (int i = startLine; i < endLine; i++) {
for (KnuthNode node = getNode(i); node != null; node = node.next) {
//System.out.println(" + lines = " + node.line + " demerits = " + node.totalDemerits);
//log.debug(" + lines = " + node.line + " demerits = " + node.totalDemerits);
bestActiveNode = compareNodes(bestActiveNode, node);
}
}

// scan the node set once again and remove some nodes
//System.out.println("LBA.filterActiveList> layout selection");
//log.debug("LBA.filterActiveList> layout selection");
for (int i = startLine; i < endLine; i++) {
for (KnuthNode node = getNode(i); node != null; node = node.next) {
//if (Math.abs(node.line - bestActiveNode.line) > maxDiff) {
//if (false) {
if (node.line != bestActiveNode.line
&& node.totalDemerits > MAX_DEMERITS) {
//System.out.println(" XXX lines = " + node.line + " demerits = " + node.totalDemerits);
//log.debug(" XXX lines = " + node.line + " demerits = " + node.totalDemerits);
removeNode(i, node);
} else {
//System.out.println(" ok lines = " + node.line + " demerits = " + node.totalDemerits);
//log.debug(" ok lines = " + node.line + " demerits = " + node.totalDemerits);
}
}
}
@@ -1105,8 +1104,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager
shorter or longer lines */
//TODO This code snippet is disabled. Reenable?
if (false && alignment == EN_JUSTIFY && textAlignment == EN_JUSTIFY) {
//System.out.println("LLM.getNextKnuthElements> layouts with more lines? " + lineLayouts.canUseMoreLines());
//System.out.println(" layouts with fewer lines? " + lineLayouts.canUseLessLines());
//log.debug("LLM.getNextKnuthElements> layouts with more lines? " + lineLayouts.canUseMoreLines());
//log.debug(" layouts with fewer lines? " + lineLayouts.canUseLessLines());
if (!lineLayouts.canUseMoreLines()) {
alg.resetAlgorithm();
lineLayouts.savePossibilities(true);
@@ -1132,8 +1131,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager
lineLayouts.restorePossibilities();
iLineWidth = savedLineWidth;
}
//System.out.println("LLM.getNextKnuthElements> now, layouts with more lines? " + lineLayouts.canUseMoreLines());
//System.out.println(" now, layouts with fewer lines? " + lineLayouts.canUseLessLines());
//log.debug("LLM.getNextKnuthElements> now, layouts with more lines? " + lineLayouts.canUseMoreLines());
//log.debug(" now, layouts with fewer lines? " + lineLayouts.canUseLessLines());
}
}
return lineLayouts;
@@ -1299,7 +1298,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false));
}

//System.out.println("first=" + nFirstLines + " inner=" + nInnerLines
//log.debug("first=" + nFirstLines + " inner=" + nInnerLines
// + " optional=" + nOptionalLines + " eliminable=" + nEliminableLines
// + " last=" + nLastLines
// + " (condOpt=" + nConditionalOptionalLines + " condEl=" + nConditionalEliminableLines + ")");
@@ -1386,7 +1385,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
//}
//int lineNumberDifference = (int)((double) totalAdj / constantLineHeight);
int lineNumberDifference = (int) Math.round((double) totalAdj / constantLineHeight + (adj > 0 ? - 0.4 : 0.4));
//System.out.println(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight) + " variazione applicata = " + lineNumberDifference);
//log.debug(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight) + " variazione applicata = " + lineNumberDifference);
lineLayouts = (LineLayoutPossibilities)lineLayoutsList.get(pos.getLeafPos());
lineNumberDifference = lineLayouts.applyLineCountAdjustment(lineNumberDifference);
return lineNumberDifference * constantLineHeight;
@@ -1405,7 +1404,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
LinkedList returnList = new LinkedList();
for (int p = 0; p < knuthParagraphs.size(); p++) {
lineLayouts = (LineLayoutPossibilities)lineLayoutsList.get(p);
//System.out.println("demerits of the chosen layout: " + lineLayouts.getChosenDemerits());
//log.debug("demerits of the chosen layout: " + lineLayouts.getChosenDemerits());
for (int i = 0; i < lineLayouts.getChosenLineCount(); i++) {
if (!((BlockLevelLayoutManager) parentLM).mustKeepTogether()
&& i >= fobj.getOrphans()
@@ -1414,10 +1413,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager
returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
LineBreakPosition lbp = (LineBreakPosition) lineLayouts.getChosenPosition(i);
//System.out.println("LLM.getChangedKnuthElements> lineWidth= " + lbp.lineWidth + " difference= " + lbp.difference);
//System.out.println(" shrink= " + lbp.availableShrink + " stretch= " + lbp.availableStretch);
//log.debug("LLM.getChangedKnuthElements> lineWidth= " + lbp.lineWidth + " difference= " + lbp.difference);
//log.debug(" shrink= " + lbp.availableShrink + " stretch= " + lbp.availableStretch);

//System.out.println("linewidth= " + lbp.lineWidth + " difference= " + lbp.difference + " indent= " + lbp.startIndent);
//log.debug("linewidth= " + lbp.lineWidth + " difference= " + lbp.difference + " indent= " + lbp.startIndent);
MinOptMax contentIPD;
if (alignment == EN_JUSTIFY) {
contentIPD = new MinOptMax(
@@ -1750,8 +1749,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager
updatedRatio = (float) updatedDifference / lbp.availableShrink;
}
lc.setIPDAdjust(updatedRatio);
//System.out.println("LLM.addAreas> old difference = " + lbp.difference + " new difference = " + updatedDifference);
//System.out.println(" old ratio = " + lbp.ipdAdjust + " new ratio = " + updatedRatio);
//log.debug("LLM.addAreas> old difference = " + lbp.difference + " new difference = " + updatedDifference);
//log.debug(" old ratio = " + lbp.ipdAdjust + " new ratio = " + updatedRatio);
} else if (false && textAlignment == EN_CENTER) {
// re-compute indent
int updatedIndent = lbp.startIndent

+ 2
- 1
src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java View File

@@ -157,7 +157,8 @@ public class LineLayoutPossibilities {
chosenIndex = optimumIndex;
}
}
/*LF*/ //System.out.println(">> minLineCount = " + getMinLineCount() + " optLineCount = " + getOptLineCount() + " maxLineCount() = " + getMaxLineCount());
//log.debug(">> minLineCount = " + getMinLineCount()
// + " optLineCount = " + getOptLineCount() + " maxLineCount() = " + getMaxLineCount());
}

public void addBreakPosition(Position pos, int i) {

+ 2
- 2
src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java View File

@@ -385,10 +385,10 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
while (oldListIterator.hasNext()) {
oldElement = (KnuthElement)oldListIterator.next();
Position innerPosition = ((NonLeafPosition) oldElement.getPosition()).getPosition();
//System.out.println(" BLM> unwrapping: " + (oldElement.isBox()
//log.debug(" BLM> unwrapping: " + (oldElement.isBox()
// ? "box " : (oldElement.isGlue() ? "glue " : "penalty"))
// + " creato da " + oldElement.getLayoutManager().getClass().getName());
//System.out.println(" BLM> unwrapping: "
//log.debug(" BLM> unwrapping: "
// + oldElement.getPosition().getClass().getName());
if (innerPosition != null) {
// oldElement was created by a descendant of this BlockLM

+ 0
- 4
src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java View File

@@ -692,24 +692,20 @@ public class TableContentLayoutManager implements PercentBaseContext {
TableBody body = null;
while (iterator.hasNext()) {
Position pos = (Position)iterator.next();
//System.out.println(pos);
if (pos instanceof TableContentPosition) {
TableContentPosition tcpos = (TableContentPosition)pos;
lst.add(tcpos);
//System.out.println(tcpos.row);
GridUnitPart part = (GridUnitPart)tcpos.gridUnitParts.get(0);
if (body == null) {
body = part.pgu.getBody();
}
if (tcpos.getFlag(TableContentPosition.FIRST_IN_ROWGROUP)
&& tcpos.row.getFlag(EffRow.FIRST_IN_BODY)) {
//System.out.println("pgu is first in body");
firstPos = true;

}
if (tcpos.getFlag(TableContentPosition.LAST_IN_ROWGROUP)
&& tcpos.row.getFlag(EffRow.LAST_IN_BODY)) {
//System.out.println("pgu is last in body");
lastPos = true;
getTableLM().getCurrentPV().addMarkers(body.getMarkers(),
true, firstPos, lastPos);

+ 0
- 2
src/java/org/apache/fop/pdf/PDFDocument.java View File

@@ -394,8 +394,6 @@ public class PDFDocument {
//Add object to list
this.objects.add(obj);

//System.out.println("Registering: "+obj);

//Add object to special lists where necessary
if (obj instanceof PDFFunction) {
this.functions.add(obj);

+ 4
- 4
src/java/org/apache/fop/pdf/PDFEncryptionManager.java View File

@@ -118,19 +118,19 @@ public class PDFEncryptionManager {
return (PDFEncryption)obj;
} catch (ClassNotFoundException e) {
if (checkAvailableAlgorithms()) {
System.out.println("JCE and algorithms available, but the "
log.warn("JCE and algorithms available, but the "
+ "implementation class unavailable. Please do a full "
+ "rebuild.");
}
return null;
} catch (NoSuchMethodException e) {
e.printStackTrace();
log.error(e);
return null;
} catch (IllegalAccessException e) {
e.printStackTrace();
log.error(e);
return null;
} catch (InvocationTargetException e) {
e.printStackTrace();
log.error(e);
return null;
}
}

+ 0
- 1
src/java/org/apache/fop/pdf/PDFState.java View File

@@ -163,7 +163,6 @@ public class PDFState {
*/
public boolean setColor(Color col) {
if (!col.equals(getData().color)) {
//System.out.println("old: " + getData().color + ", new: " + col);
getData().color = col;
return true;
} else {

+ 3
- 2
src/java/org/apache/fop/pdf/PDFStream.java View File

@@ -44,7 +44,7 @@ public class PDFStream extends AbstractPDFStream {
try {
data = StreamCacheFactory.getInstance().createStreamCache();
} catch (IOException ex) {
/**@todo Log with Logger */
//TODO throw the exception and catch it elsewhere
ex.printStackTrace();
}
}
@@ -58,7 +58,7 @@ public class PDFStream extends AbstractPDFStream {
try {
data.getOutputStream().write(s.getBytes());
} catch (IOException ex) {
/**@todo Log with Logger */
//TODO throw the exception and catch it elsewhere
ex.printStackTrace();
}

@@ -82,6 +82,7 @@ public class PDFStream extends AbstractPDFStream {
try {
return data.getSize();
} catch (Exception e) {
//TODO throw the exception and catch it elsewhere
e.printStackTrace();
return 0;
}

+ 7
- 5
src/java/org/apache/fop/pdf/TempFileStreamCache.java View File

@@ -25,7 +25,7 @@ import java.io.IOException;
import java.io.File;

//Commons
import org.apache.commons.io.CopyUtils;
import org.apache.commons.io.IOUtils;

/**
* StreamCache implementation that uses temporary files rather than heap.
@@ -90,11 +90,13 @@ public class TempFileStreamCache implements StreamCache {
output.close();
output = null;

// don't need a buffer because streamCopy is buffered
// don't need a buffer because copy() is buffered
InputStream input = new java.io.FileInputStream(tempFile);
final long bytesCopied = CopyUtils.copy(input, out);
input.close();
return (int)bytesCopied;
try {
return IOUtils.copy(input, out);
} finally {
IOUtils.closeQuietly(input);
}
}

/**

+ 2
- 2
src/java/org/apache/fop/render/bitmap/TIFFRenderer.java View File

@@ -202,8 +202,8 @@ public class TIFFRenderer extends Java2DRenderer {
try {
pageImage = getPageImage(current++);
} catch (FOPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e);
return null;
}

switch (renderParams.getCompression()) {

+ 1
- 1
src/java/org/apache/fop/render/java2d/Java2DRenderer.java View File

@@ -1084,7 +1084,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab
renderPageAreas(viewport.getPage());
return PAGE_EXISTS;
} catch (FOPException e) {
e.printStackTrace();
log.error(e);
return NO_SUCH_PAGE;
} finally {
oldState = state;

+ 2
- 2
src/java/org/apache/fop/render/pdf/PDFRenderer.java View File

@@ -1027,7 +1027,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
int rx = currentIPPosition + ch.getBorderAndPaddingWidthStart();
int bl = currentBPPosition + ch.getOffset() + ch.getBaselineOffset();

/* System.out.println("Text = " + ch.getTextArea() +
/* log.debug("Text = " + ch.getTextArea() +
"; text width: " + ch.getWidth() +
"; BlockIP Position: " + currentBlockIPPosition +
"; currentBPPosition: " + currentBPPosition +
@@ -1096,7 +1096,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
int rx = currentIPPosition + text.getBorderAndPaddingWidthStart();
int bl = currentBPPosition + text.getOffset() + text.getBaselineOffset();

/* System.out.println("Text = " + text.getTextArea() +
/* log.debug("Text = " + text.getTextArea() +
"; text width: " + text.getWidth() +
"; BlockIP Position: " + currentBlockIPPosition +
"; currentBPPosition: " + currentBPPosition +

+ 1
- 1
src/java/org/apache/fop/render/print/PrintRenderer.java View File

@@ -141,7 +141,7 @@ public class PrintRenderer extends Java2DRenderer implements Pageable {
try {
printerJob.print();
} catch (PrinterException e) {
e.printStackTrace();
log.error(e);
throw new IOException("Unable to print: " + e.getClass().getName()
+ ": " + e.getMessage());
}

+ 3
- 3
src/java/org/apache/fop/render/ps/PSFontUtils.java View File

@@ -29,8 +29,8 @@ import java.util.Map;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

import org.apache.commons.io.CopyUtils;
import org.apache.commons.io.EndianUtils;
import org.apache.commons.io.IOUtils;
import org.apache.fop.fonts.CustomFont;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontType;
@@ -116,7 +116,7 @@ public class PSFontUtils {
gen.writeln("end");
gen.writeln("/" + fm.getFontName() + " exch definefont pop");
} else {
System.out.println("Only WinAnsiEncoding is supported. Font '"
gen.commentln("%WARNING: Only WinAnsiEncoding is supported. Font '"
+ fm.getFontName() + "' asks for: " + fm.getEncoding());
}
}
@@ -163,7 +163,7 @@ public class PSFontUtils {

SubInputStream sin = new SubInputStream(in, dataSegLen);
ASCIIHexOutputStream hexOut = new ASCIIHexOutputStream(gen.getOutputStream());
CopyUtils.copy(sin, hexOut);
IOUtils.copy(sin, hexOut);
gen.newLine();
break;
case 3: //EOF

+ 1
- 0
src/java/org/apache/fop/render/ps/PSGraphics2D.java View File

@@ -190,6 +190,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
* @param ioe IOException to handle
*/
protected void handleIOException(IOException ioe) {
//TODO Surely, there's a better way to do this.
ioe.printStackTrace();
}


+ 0
- 10
src/java/org/apache/fop/render/ps/PSTextPainter.java View File

@@ -61,7 +61,6 @@ import org.apache.fop.fonts.FontInfo;
* (todo) use drawString(AttributedCharacterIterator iterator...) for some
*
* @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
* @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
* @version $Id: PSTextPainter.java,v 1.15 2003/01/08 14:03:55 jeremias Exp $
*/
public class PSTextPainter implements TextPainter {
@@ -93,7 +92,6 @@ public class PSTextPainter implements TextPainter {
* @param g2d the Graphics2D to use
*/
public void paint(TextNode node, Graphics2D g2d) {
// System.out.println("PSText paint");
String txt = node.getText();
Point2D loc = node.getLocation();
@@ -251,7 +249,6 @@ public class PSTextPainter implements TextPainter {
* @return new current location
*/
protected Point2D paintACI(AttributedCharacterIterator aci, Graphics2D g2d, Point2D loc) {
//System.out.println("==============================================");
//ACIUtils.dumpAttrs(aci);
aci.first();
@@ -498,7 +495,6 @@ public class PSTextPainter implements TextPainter {
* @return null
*/
public Mark getMark(TextNode node, int pos, boolean all) {
System.out.println("PSText getMark");
return null;
}

@@ -511,7 +507,6 @@ public class PSTextPainter implements TextPainter {
* @return null
*/
public Mark selectAt(double x, double y, TextNode node) {
System.out.println("PSText selectAt");
return null;
}

@@ -524,7 +519,6 @@ public class PSTextPainter implements TextPainter {
* @return null
*/
public Mark selectTo(double x, double y, Mark beginMark) {
System.out.println("PSText selectTo");
return null;
}

@@ -535,7 +529,6 @@ public class PSTextPainter implements TextPainter {
* @return null
*/
public Mark selectFirst(TextNode node) {
System.out.println("PSText selectFirst");
return null;
}

@@ -546,7 +539,6 @@ public class PSTextPainter implements TextPainter {
* @return null
*/
public Mark selectLast(TextNode node) {
System.out.println("PSText selectLast");
return null;
}

@@ -558,7 +550,6 @@ public class PSTextPainter implements TextPainter {
* @return null
*/
public int[] getSelected(Mark start, Mark finish) {
System.out.println("PSText getSelected");
return null;
}

@@ -570,7 +561,6 @@ public class PSTextPainter implements TextPainter {
* @return null
*/
public Shape getHighlightShape(Mark beginMark, Mark endMark) {
System.out.println("PSText getHighlightShape");
return null;
}


+ 6
- 1
src/java/org/apache/fop/render/xml/XMLXMLHandler.java View File

@@ -18,6 +18,8 @@
package org.apache.fop.render.xml;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fop.render.XMLHandler;
import org.apache.fop.render.RendererContext;

@@ -38,6 +40,9 @@ public class XMLXMLHandler implements XMLHandler {
/** Key for getting the TransformerHandler from the RendererContext */
public static final String HANDLER = "handler";

/** Logging instance */
private static Log log = LogFactory.getLog(XMLXMLHandler.class);
private AttributesImpl atts = new AttributesImpl();
/** @see org.apache.fop.render.XMLHandler */
@@ -105,7 +110,7 @@ public class XMLXMLHandler implements XMLHandler {
handler.endCDATA();
break;
case Node.ENTITY_REFERENCE_NODE:
System.out.println("Ignoring ENTITY_REFERENCE_NODE. NYI");
log.warn("Ignoring ENTITY_REFERENCE_NODE. NYI");
/*
writer.write("&");
writer.write();

+ 1
- 0
src/java/org/apache/fop/svg/PDFANode.java View File

@@ -101,6 +101,7 @@ public class PDFANode extends CompositeGraphicsNode {
}
}
} catch (Exception e) {
//TODO Move this to setDestination() and throw an IllegalArgumentException
e.printStackTrace();
}
Rectangle2D destRect = new Rectangle2D.Float(x, y, width, height);

+ 7
- 13
src/java/org/apache/fop/svg/PDFGraphics2D.java View File

@@ -240,6 +240,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @param ioe IOException to handle
*/
protected void handleIOException(IOException ioe) {
//TODO Surely, there's a better way to do this.
ioe.printStackTrace();
}

@@ -439,7 +440,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
public boolean drawImage(Image img, int x, int y,
ImageObserver observer) {
preparePainting();
// System.err.println("drawImage:x, y");

int width = img.getWidth(observer);
int height = img.getHeight(observer);
@@ -493,8 +493,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
public boolean drawImage(Image img, int x, int y, int width, int height,
ImageObserver observer) {
preparePainting();
//System.out.println("drawImage x=" + x + " y=" + y
//+ " width=" + width + " height=" + height + " image=" + img.toString());
// first we look to see if we've already added this image to
// the pdf document. If so, we just reuse the reference;
// otherwise we have to build a FopImage and add it to the pdf
@@ -637,7 +635,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see java.awt.Graphics#create
*/
public void dispose() {
// System.out.println("dispose");
pdfDoc = null;
fontInfo = null;
currentStream = null;
@@ -662,7 +659,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
public void draw(Shape s) {
preparePainting();
// System.out.println("draw(Shape)");

//Transparency shortcut
Color c;
@@ -833,7 +829,8 @@ public class PDFGraphics2D extends AbstractGraphics2D {
//PDFColor currentColour = new PDFColor(blackMagenta[0], blackMagenta[1]);
//currentStream.write(currentColour.getColorSpaceOut(fill));
} else {
System.err.println("Color Space not supported by PDFGraphics2D");
throw new UnsupportedOperationException(
"Color Space not supported by PDFGraphics2D");
}
}

@@ -1319,7 +1316,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #setClip
*/
public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
//System.out.println("drawRenderedImage");
//NYI
}

/**
@@ -1354,7 +1351,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
public void drawRenderableImage(RenderableImage img,
AffineTransform xform) {
//System.out.println("drawRenderableImage");
//NYI
}

/**
@@ -1383,7 +1380,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
public void drawString(String s, float x, float y) {
preparePainting();
// System.out.println("drawString(String)");

Font fontState;
if (ovFontState == null) {
@@ -1550,7 +1546,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
public void drawString(AttributedCharacterIterator iterator, float x,
float y) {
preparePainting();
System.err.println("drawString(AttributedCharacterIterator)");

Font fontState = null;

@@ -1630,7 +1625,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
public void fill(Shape s) {
preparePainting();
// System.err.println("fill");

//Transparency shortcut
Color c;
@@ -1828,7 +1822,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @param c1 the XOR alternation color
*/
public void setXORMode(Color c1) {
//System.out.println("setXORMode");
//NYI
}


@@ -1853,7 +1847,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
public void copyArea(int x, int y, int width, int height, int dx,
int dy) {
//System.out.println("copyArea");
//NYI
}

}

+ 1
- 4
src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java View File

@@ -70,7 +70,7 @@ class PDFGraphicsConfiguration extends GraphicsConfiguration {
}

/**
* FIXX ME: This should return the page bounds in Pts,
* TODO: This should return the page bounds in Pts,
* I couldn't figure out how to get this for the current
* page from the PDFDocument (this still works for now,
* but it should be fixed...).
@@ -78,7 +78,6 @@ class PDFGraphicsConfiguration extends GraphicsConfiguration {
* @return the bounds of the PDF document page
*/
public Rectangle getBounds() {
System.out.println("getting getBounds");
return null;
}

@@ -110,7 +109,6 @@ class PDFGraphicsConfiguration extends GraphicsConfiguration {
* @return the default transform for the configuration
*/
public AffineTransform getDefaultTransform() {
System.out.println("getting getDefaultTransform");
return new AffineTransform();
}

@@ -122,7 +120,6 @@ class PDFGraphicsConfiguration extends GraphicsConfiguration {
* @return the normalizing transform for the configuration
*/
public AffineTransform getNormalizingTransform() {
System.out.println("getting getNormalizingTransform");
return new AffineTransform(2, 0, 0, 2, 0, 0);
}


+ 41
- 32
src/java/org/apache/fop/svg/PDFImageElementBridge.java View File

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 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,6 @@ package org.apache.fop.svg;

import org.apache.batik.bridge.SVGImageElementBridge;

import org.apache.fop.image.JpegImage;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.analyser.ImageReaderFactory;

import java.awt.Shape;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
@@ -32,12 +28,15 @@ import java.io.InputStream;

import org.w3c.dom.Element;

import org.apache.commons.logging.impl.SimpleLog;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.gvt.AbstractGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.util.ParsedURL;

import org.apache.fop.image.JpegImage;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.analyser.ImageReaderFactory;

/**
* Bridge class for the &lt;image> element when jpeg images.
*
@@ -55,12 +54,12 @@ public class PDFImageElementBridge extends SVGImageElementBridge {
* THis checks if it is a jpeg file and creates a jpeg node
* so the jpeg can be inserted directly into the pdf document.
* @param ctx the bridge context
* @param e the svg element for the image
* @param imageElement the svg element for the image
* @param purl the parsed url for the image resource
* @return a new graphics node
*/
protected GraphicsNode createImageGraphicsNode
(BridgeContext ctx, Element e, ParsedURL purl) {
(BridgeContext ctx, Element imageElement, ParsedURL purl) {
try {
InputStream is = purl.openStream();
if (!is.markSupported()) {
@@ -71,38 +70,41 @@ public class PDFImageElementBridge extends SVGImageElementBridge {
byte [] data = new byte[3];
is.read(data);
is.reset();
if ((data[0] == (byte)0xFF) && (data[1] == (byte)0xD8) &&
(data[2] == (byte)0xFF)) {
FopImage.ImageInfo ii = ImageReaderFactory.make
(purl.toString(), is, null);
if ((data[0] == (byte)0xFF)
&& (data[1] == (byte)0xD8)
&& (data[2] == (byte)0xFF)) {
FopImage.ImageInfo ii = ImageReaderFactory.make
(purl.toString(), is, null);
JpegImage jpeg = new JpegImage(ii);
SimpleLog logger = new SimpleLog("FOP/SVG");
logger.setLevel(SimpleLog.LOG_LEVEL_INFO);
jpeg.load(FopImage.ORIGINAL_DATA);
PDFJpegNode node = new PDFJpegNode(jpeg, ctx, e, purl);
Rectangle2D imgBounds = getImageBounds(ctx, e);
Rectangle2D bounds = node.getPrimitiveBounds();
float [] vb = new float[4];
vb[0] = 0; // x
vb[1] = 0; // y
vb[2] = (float) bounds.getWidth(); // width
vb[3] = (float) bounds.getHeight(); // height
Rectangle2D bounds = node.getPrimitiveBounds();
float [] vb = new float[4];
vb[0] = 0; // x
vb[1] = 0; // y
vb[2] = (float) bounds.getWidth(); // width
vb[3] = (float) bounds.getHeight(); // height
// handles the 'preserveAspectRatio', 'overflow' and 'clip'
// and sets the appropriate AffineTransform to the image node
initializeViewport(ctx, e, node, vb, imgBounds);
return node;
return node;
}
} catch (Exception ex) {
//TODO Handle this exception
}

return superCreateGraphicsNode(ctx, e, purl);
}

/**
* @see org.apache.batik.bridge.SVGImageElementBridge
*/
protected GraphicsNode superCreateGraphicsNode
(BridgeContext ctx, Element e, ParsedURL purl) {
return super.createImageGraphicsNode(ctx, e, purl);
(BridgeContext ctx, Element imageElement, ParsedURL purl) {
return super.createImageGraphicsNode(ctx, imageElement, purl);
}


@@ -112,21 +114,26 @@ public class PDFImageElementBridge extends SVGImageElementBridge {
* the PDFGraphics2D.
*/
public class PDFJpegNode extends AbstractGraphicsNode {
private JpegImage jpeg;
private BridgeContext ctx;
private Element e;
private Element imageElement;
private ParsedURL purl;
private GraphicsNode origGraphicsNode=null;
private GraphicsNode origGraphicsNode = null;
/**
* Create a new pdf jpeg node for drawing jpeg images
* into pdf graphics.
* @param j the jpeg image
* @param ctx the bridge context
* @param imageElement the SVG image element
* @param purl the URL to the image
*/
public PDFJpegNode(JpegImage j, BridgeContext ctx,
Element e, ParsedURL purl) {
Element imageElement, ParsedURL purl) {
this.jpeg = j;
this.ctx = ctx;
this.e = e;
this.imageElement = imageElement;
this.purl = purl;
}

@@ -154,6 +161,7 @@ public class PDFImageElementBridge extends SVGImageElementBridge {
float height = jpeg.getHeight();
pdfg.addJpegImage(jpeg, x, y, width, height);
} catch (Exception e) {
//TODO Handle this exception properly
e.printStackTrace();
}
} else {
@@ -162,9 +170,9 @@ public class PDFImageElementBridge extends SVGImageElementBridge {
if (origGraphicsNode == null) {
// Haven't constructed baseclass Graphics Node,
// so do so now.
origGraphicsNode =
PDFImageElementBridge.this.superCreateGraphicsNode
(ctx, e, purl);
origGraphicsNode
= PDFImageElementBridge.this.superCreateGraphicsNode
(ctx, imageElement, purl);
}
origGraphicsNode.primitivePaint(g2d);
}
@@ -187,6 +195,7 @@ public class PDFImageElementBridge extends SVGImageElementBridge {
return new Rectangle2D.Double(0, 0, jpeg.getWidth(),
jpeg.getHeight());
} catch (Exception e) {
//TODO Handle this exception properly
e.printStackTrace();
}
return null;

+ 0
- 8
src/java/org/apache/fop/svg/PDFTextPainter.java View File

@@ -84,7 +84,6 @@ public class PDFTextPainter implements TextPainter {
* @param g2d the Graphics2D to use
*/
public void paint(TextNode node, Graphics2D g2d) {
// System.out.println("PDFText paint");
String txt = node.getText();
Point2D loc = node.getLocation();
@@ -328,7 +327,6 @@ public class PDFTextPainter implements TextPainter {
* @return null
*/
public Mark getMark(TextNode node, int pos, boolean all) {
System.out.println("PDFText getMark");
return null;
}

@@ -341,7 +339,6 @@ public class PDFTextPainter implements TextPainter {
* @return null
*/
public Mark selectAt(double x, double y, TextNode node) {
System.out.println("PDFText selectAt");
return null;
}

@@ -354,7 +351,6 @@ public class PDFTextPainter implements TextPainter {
* @return null
*/
public Mark selectTo(double x, double y, Mark beginMark) {
System.out.println("PDFText selectTo");
return null;
}

@@ -365,7 +361,6 @@ public class PDFTextPainter implements TextPainter {
* @return null
*/
public Mark selectFirst(TextNode node) {
System.out.println("PDFText selectFirst");
return null;
}

@@ -376,7 +371,6 @@ public class PDFTextPainter implements TextPainter {
* @return null
*/
public Mark selectLast(TextNode node) {
System.out.println("PDFText selectLast");
return null;
}

@@ -388,7 +382,6 @@ public class PDFTextPainter implements TextPainter {
* @return null
*/
public int[] getSelected(Mark start, Mark finish) {
System.out.println("PDFText getSelected");
return null;
}

@@ -400,7 +393,6 @@ public class PDFTextPainter implements TextPainter {
* @return null
*/
public Shape getHighlightShape(Mark beginMark, Mark endMark) {
System.out.println("PDFText getHighlightShape");
return null;
}


+ 0
- 3
src/java/org/apache/fop/util/ASCII85InputStream.java View File

@@ -31,7 +31,6 @@ import java.io.IOException;
* The filter is described in chapter 3.13.3 of the PostScript Language
* Reference (third edition).
*
* @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
* @version $Id$
*/
public class ASCII85InputStream extends InputStream
@@ -119,7 +118,6 @@ public class ASCII85InputStream extends InputStream
} else {
int cIndex = 0;
tuple = (buf - START) * POW85[cIndex];
//System.out.println(cIndex + ": " + Long.toHexString(tuple));
cIndex++;
while (cIndex < 5) {
buf = filteredRead();
@@ -131,7 +129,6 @@ public class ASCII85InputStream extends InputStream
throw new IOException("Illegal 'z' within tuple");
} else {
tuple += (buf - START) * POW85[cIndex];
//System.out.println(cIndex + ": " + Long.toHexString(tuple));
cIndex++;
}
}

+ 0
- 1
src/java/org/apache/fop/util/ASCII85OutputStream.java View File

@@ -25,7 +25,6 @@ import java.io.IOException;
/**
* This class applies a ASCII85 encoding to the stream.
*
* @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
* @version $Id$
*/
public class ASCII85OutputStream extends FilterOutputStream

+ 0
- 1
src/java/org/apache/fop/util/CloseBlockerOutputStream.java View File

@@ -38,7 +38,6 @@ public class CloseBlockerOutputStream extends FilterOutputStream {
* @see java.io.OutputStream#close()
*/
public void close() throws IOException {
//System.out.println("Not sending close() to " + out);
try {
flush();
} catch (IOException ioe) {

+ 1
- 1
src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java View File

@@ -69,7 +69,7 @@ public class PCLRenderer extends PrintRenderer {
try {
fontcode = Integer.parseInt(name.substring(1));
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
}
switch (fontcode) {

+ 0
- 2
src/sandbox/org/apache/fop/render/pcl/PCLStream.java View File

@@ -44,8 +44,6 @@ public class PCLStream {
try {
out.write(buff);
} catch (IOException e) {
// e.printStackTrace();
// e.printStackTrace(System.out);
throw new RuntimeException(e.toString());
}
}

+ 3
- 8
test/java/org/apache/fop/util/ASCII85InputStreamTestCase.java View File

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 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.
@@ -22,7 +22,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.CopyUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.fop.pdf.PDFText;

@@ -34,8 +34,6 @@ import junit.framework.TestCase;
* ATTENTION: Some of the tests here depend on the correct behaviour of
* ASCII85OutputStream. If something fails here make sure
* ASCII85OutputStreamTestCase runs!
*
* @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
*/
public class ASCII85InputStreamTestCase extends TestCase {

@@ -52,10 +50,7 @@ public class ASCII85InputStreamTestCase extends TestCase {
byte[] ascii85 = text.getBytes("US-ASCII");
InputStream in = new ByteArrayInputStream(ascii85);
InputStream decoder = new ASCII85InputStream(in);
ByteArrayOutputStream baout = new ByteArrayOutputStream();
CopyUtils.copy(decoder, baout);
baout.close();
return baout.toByteArray();
return IOUtils.toByteArray(decoder);
}

private byte[] getChunk(int count) {

Loading…
Cancel
Save