aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2007-08-08 17:37:33 +0000
committerVincent Hennebert <vhennebert@apache.org>2007-08-08 17:37:33 +0000
commit723d5c2d87d440c65f7d87bd02948ea774b5828a (patch)
tree56d6a5066b36138cf56110ef9cd8b7fe87004922
parentb389c2867b23d5dc4c820526ecb36361b9596b18 (diff)
downloadxmlgraphics-fop-723d5c2d87d440c65f7d87bd02948ea774b5828a.tar.gz
xmlgraphics-fop-723d5c2d87d440c65f7d87bd02948ea774b5828a.zip
Merged revisions 556566-556990,556992-556996,556998-557336,557338-557540,557542-557629,557631-557648,557651-558044,558046-559086,559088-562052,562054-562139,562141-562171,562173-562382,562384-563902,563904-563927 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r557035 | adelmelle | 2007-07-17 21:29:40 +0200 (mar, 17 jui 2007) | 1 line Undo changes of r556112 ........ r557219 | manuel | 2007-07-18 12:40:12 +0200 (mer, 18 jui 2007) | 1 line Fixed incomplete support for Unicode word joiners ........ r557272 | adelmelle | 2007-07-18 16:21:49 +0200 (mer, 18 jui 2007) | 1 line Correction of premature javadoc commit in r557035 ........ r557347 | manuel | 2007-07-18 20:06:09 +0200 (mer, 18 jui 2007) | 1 line Added support for keep-togther.within-line="always" ........ r557612 | adelmelle | 2007-07-19 15:24:54 +0200 (jeu, 19 jui 2007) | 1 line Fix: add implementation of hashCode() and equals() to NumberProperty, to make the caching work as expected. ........ r557814 | adelmelle | 2007-07-20 01:31:55 +0200 (ven, 20 jui 2007) | 1 line Cache CharacterProperty ........ r557934 | jeremias | 2007-07-20 11:17:21 +0200 (ven, 20 jui 2007) | 1 line Fix bug in equals() that made caching effect-less. ........ r558041 | adelmelle | 2007-07-20 18:20:23 +0200 (ven, 20 jui 2007) | 1 line Fix possible memory leak in PropertyCache ........ r558042 | adelmelle | 2007-07-20 18:25:23 +0200 (ven, 20 jui 2007) | 1 line Remove method added only for quick debug. ........ r558047 | adelmelle | 2007-07-20 18:51:51 +0200 (ven, 20 jui 2007) | 1 line Tweak: use generic boolean Maker. ........ r558279 | vhennebert | 2007-07-21 11:37:08 +0200 (sam, 21 jui 2007) | 2 lines Fix javadoc error ........ r558455 | manuel | 2007-07-22 04:55:46 +0200 (dim, 22 jui 2007) | 1 line Corrected issue with zero width spaces being given a non zero width ........ r558456 | manuel | 2007-07-22 05:08:14 +0200 (dim, 22 jui 2007) | 1 line Changed my mind on handling of width calculation for zero width spaces and moved it into the Font class where other similar cases are already dealt with ........ r559818 | jeremias | 2007-07-26 15:59:12 +0200 (jeu, 26 jui 2007) | 1 line rubico.com doesn't exist anymore. ........ r560936 | cbowditch | 2007-07-30 14:20:15 +0200 (lun, 30 jui 2007) | 5 lines Bugzilla #42971 and #42956 AFP Renderer Improvements Submitted by Adrian Cumiskey <dev.at.cumiskey.com> ........ r561251 | jeremias | 2007-07-31 09:19:11 +0200 (mar, 31 jui 2007) | 4 lines Bugzilla #42956: AFP Renderer - No Operation Extension. Added missing file (including the bugfix for the right encoding). Submitted by: Adrian Cumiskey <dev.at.cumiskey.com> ........ r561256 | cbowditch | 2007-07-31 09:54:02 +0200 (mar, 31 jui 2007) | 4 lines Bugzilla #42956: AFP Renderer - No Operation Extension. yet another missing file! The documentation! Submitted by: Adrian Cumiskey <dev.at.cumiskey.com> ........ r561280 | jeremias | 2007-07-31 11:28:47 +0200 (mar, 31 jui 2007) | 2 lines AFP Renderer: Bugfix for 1 bit images where the width is not a multiple of 8. Essentially, I rewrote convertToGrayScaleImage() to properly padding at the end of each scanline if necessary. ........ r561757 | cbowditch | 2007-08-01 12:39:58 +0200 (mer, 01 aoû 2007) | 3 lines Bugzilla #42956 Second attempt at AFP NOP Extension Submitted by Adrian Cumiskey <dev.at.cumiskey.com> ........ r561861 | vhennebert | 2007-08-01 18:30:44 +0200 (mer, 01 aoû 2007) | 2 lines Set visibility of fields to private ........ r562908 | vhennebert | 2007-08-05 19:08:04 +0200 (dim, 05 aoû 2007) | 6 lines Add in status.xml the noticeable changes I made in the last couple of months: - support for conditional spaces in tables - fix several keeps and breaks issues in tables Plus add importance="high" to the font auto-detection addition ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_94@563951 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/documentation/content/xdocs/compliance.ihtml9
-rw-r--r--src/documentation/content/xdocs/resources.xml1
-rw-r--r--src/documentation/content/xdocs/trunk/output.xml21
-rw-r--r--src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory3
-rw-r--r--src/java/org/apache/fop/fo/FONode.java14
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java9
-rw-r--r--src/java/org/apache/fop/fo/FOText.java10
-rw-r--r--src/java/org/apache/fop/fo/properties/CharacterProperty.java38
-rw-r--r--src/java/org/apache/fop/fo/properties/FixedLength.java2
-rw-r--r--src/java/org/apache/fop/fo/properties/NumberProperty.java16
-rw-r--r--src/java/org/apache/fop/fo/properties/PropertyCache.java15
-rw-r--r--src/java/org/apache/fop/fonts/Font.java4
-rw-r--r--src/java/org/apache/fop/fonts/truetype/TTFFile.java14
-rw-r--r--src/java/org/apache/fop/layoutmgr/LayoutContext.java10
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java10
-rw-r--r--src/java/org/apache/fop/render/afp/AFPRenderer.java196
-rwxr-xr-xsrc/java/org/apache/fop/render/afp/extensions/AFPElement.java12
-rwxr-xr-xsrc/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java11
-rw-r--r--src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java115
-rw-r--r--src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java41
-rw-r--r--src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java55
-rw-r--r--src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java30
-rw-r--r--src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java11
-rw-r--r--src/java/org/apache/fop/render/afp/fonts/CharacterSet.java3
-rw-r--r--src/java/org/apache/fop/render/afp/modca/AFPDataStream.java9
-rw-r--r--src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java14
-rw-r--r--src/java/org/apache/fop/render/afp/modca/NoOperation.java99
-rw-r--r--src/java/org/apache/fop/util/CMYKColorSpace.java8
-rw-r--r--src/java/org/apache/fop/util/CharUtilities.java7
-rw-r--r--src/java/org/apache/fop/util/CloseBlockerOutputStream.java2
-rw-r--r--src/java/org/apache/fop/util/CommandLineLogger.java36
-rw-r--r--src/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java14
-rw-r--r--src/java/org/apache/fop/util/DataURIResolver.java2
-rw-r--r--src/java/org/apache/fop/util/DefaultErrorListener.java6
-rw-r--r--src/java/org/apache/fop/util/DelegatingContentHandler.java48
-rw-r--r--src/java/org/apache/fop/util/IntMap.java248
-rw-r--r--src/java/org/apache/fop/util/QName.java6
-rw-r--r--src/java/org/apache/fop/util/WriterOutputStream.java10
-rw-r--r--status.xml31
-rw-r--r--test/layoutengine/disabled-testcases.xml5
-rwxr-xr-xtest/layoutengine/standard-testcases/block_uax14_linebreaking.xml10
-rw-r--r--test/layoutengine/standard-testcases/inline_keep-together.xml22
-rw-r--r--test/layoutengine/standard-testcases/page-breaking_5.xml8
43 files changed, 732 insertions, 503 deletions
diff --git a/src/documentation/content/xdocs/compliance.ihtml b/src/documentation/content/xdocs/compliance.ihtml
index 61bea9979..47f1a6d76 100644
--- a/src/documentation/content/xdocs/compliance.ihtml
+++ b/src/documentation/content/xdocs/compliance.ihtml
@@ -3692,8 +3692,13 @@
<li>
[0.93] works on all implemented block-level FOs, but not on inline-level FOs. </li>
<li>
- [0.93] &lt;integer&gt; values are not supported. </li>
- </ul> </td>
+ [0.93] &lt;integer&gt; values are not supported.
+ </li>
+ <li>
+ [Dev] &lt;integer&gt; values are not supported.
+ </li>
+ </ul>
+ </td>
</tr>
<tr>
<td>
diff --git a/src/documentation/content/xdocs/resources.xml b/src/documentation/content/xdocs/resources.xml
index 72b26719e..f4bfc45f7 100644
--- a/src/documentation/content/xdocs/resources.xml
+++ b/src/documentation/content/xdocs/resources.xml
@@ -219,7 +219,6 @@
<li>[software] <jump href="http://www.scruffyware.com/products/foeditor/">FOEditor</jump> by Scruffy Software (Shareware)</li>
<li>[software] <jump href="http://www.scriptura-xsl.com">Scriptura</jump> by Inventive Designers (commercial)</li>
<li>[software] <jump href="http://www.xslfast.com">XSLfast</jump> by jCatalog Software AG (commercial)</li>
- <li>[software] <jump href="http://www.rubico.com/styler">XML Report Styler</jump> by Rubico (commercial)</li>
<li>[software] <jump href="http://www.metafocus.no/en/xultation_designer.php">Xultation Designer</jump> by Metafocus (commercial)</li>
<li>[software] <jump href="http://web.assentis.com/products/products.php?navi=Products&amp;product_id=7">Assentis:DocDesign</jump> by Assentis Technologies (commercial)</li>
</ul>
diff --git a/src/documentation/content/xdocs/trunk/output.xml b/src/documentation/content/xdocs/trunk/output.xml
index 998a5e1ce..21743519f 100644
--- a/src/documentation/content/xdocs/trunk/output.xml
+++ b/src/documentation/content/xdocs/trunk/output.xml
@@ -590,8 +590,7 @@ out = proc.getOutputStream();]]></source>
</section>
<section id="afp-tag-logical-element">
<title>Tag Logical Element Extension</title>
- <p>The tag-logical-element extension element allows to injects TLEs into the AFP output stream. Example:
- Example:</p>
+ <p>The tag-logical-element extension element allows to injects TLEs into the AFP output stream. Example:</p>
<source><![CDATA[
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">
@@ -607,6 +606,24 @@ out = proc.getOutputStream();]]></source>
The name and value attributes are mandatory.
</p>
</section>
+ <section id="afp-no-operation">
+ <title>No Operation Extension</title>
+ <p>The no-operation extension provides the ability to carry up to 32K of comments or any other type
+ of unarchitected data into the AFP output stream. Example:</p>
+ <source><![CDATA[
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="simple">
+ <afp:no-operation name="My NOP">insert up to 32k of character data here!</afp:no-operation>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+]]></source>
+ <p>The no-operation extension element can only occur within a simple-page-master.
+ Multiple no-operation extension elements within a simple-page-master are allowed.
+ The name attribute is mandatory.
+ </p>
+ </section>
</section>
</section>
<section id="rtf">
diff --git a/src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory b/src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory
index f7a90079b..53fe41b13 100644
--- a/src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory
+++ b/src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory
@@ -1,2 +1,3 @@
+org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory
org.apache.fop.render.ps.extensions.PSExtensionHandlerFactory
-org.apache.fop.fo.extensions.xmp.XMPContentHandlerFactory \ No newline at end of file
+org.apache.fop.fo.extensions.xmp.XMPContentHandlerFactory
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index a90d564ec..f9338c428 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -103,6 +103,20 @@ public abstract class FONode implements Cloneable {
}
/**
+ * Bind the given <code>PropertyList</code> to this node
+ * Does nothing by default. Subclasses should override this method
+ * in case they want to use the properties available on the
+ * <code>PropertyList</code>.
+ *
+ * @param propertyList the <code>PropertyList</code>
+ * @throws FOPException if there was an error when
+ * processing the <code>PropertyList</code>
+ */
+ public void bind(PropertyList propertyList) throws FOPException {
+ //nop
+ }
+
+ /**
* Set the location information for this element
* @param locator the org.xml.sax.Locator object
*/
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index 7eea2dd93..50cf8c4a9 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -1076,9 +1076,8 @@ public final class FOPropertyMapping implements Constants {
// hyphenate
m = new EnumProperty.Maker(PR_HYPHENATE);
+ m.useGeneric(genericBoolean);
m.setInherited(true);
- m.addEnum("true", getEnumProperty(EN_TRUE, "TRUE"));
- m.addEnum("false", getEnumProperty(EN_FALSE, "FALSE"));
m.setDefault("false");
addPropertyMaker("hyphenate", m);
@@ -1695,9 +1694,8 @@ public final class FOPropertyMapping implements Constants {
// treat-as-word-space
m = new EnumProperty.Maker(PR_TREAT_AS_WORD_SPACE);
+ m.useGeneric(genericBoolean);
m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
- m.addEnum("true", getEnumProperty(EN_TRUE, "TRUE"));
- m.addEnum("false", getEnumProperty(EN_FALSE, "FALSE"));
m.setInherited(false);
m.setDefault("auto");
addPropertyMaker("treat-as-word-space", m);
@@ -2238,9 +2236,8 @@ public final class FOPropertyMapping implements Constants {
// precedence
m = new EnumProperty.Maker(PR_PRECEDENCE);
+ m.useGeneric(genericBoolean);
m.setInherited(false);
- m.addEnum("true", getEnumProperty(EN_TRUE, "TRUE"));
- m.addEnum("false", getEnumProperty(EN_FALSE, "FALSE"));
m.setDefault("false");
addPropertyMaker("precedence", m);
diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java
index 2205c0170..b636adad4 100644
--- a/src/java/org/apache/fop/fo/FOText.java
+++ b/src/java/org/apache/fop/fo/FOText.java
@@ -30,6 +30,7 @@ import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonHyphenation;
import org.apache.fop.fo.properties.CommonTextDecoration;
+import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.SpaceProperty;
@@ -80,6 +81,7 @@ public class FOText extends FONode {
private CommonFont commonFont;
private CommonHyphenation commonHyphenation;
private Color color;
+ private KeepProperty keepTogether;
private Property letterSpacing;
private SpaceProperty lineHeight;
private int whiteSpaceTreatment;
@@ -165,6 +167,7 @@ public class FOText extends FONode {
commonFont = pList.getFontProps();
commonHyphenation = pList.getHyphenationProps();
color = pList.get(Constants.PR_COLOR).getColor(getUserAgent());
+ keepTogether = pList.get(Constants.PR_KEEP_TOGETHER).getKeep();
lineHeight = pList.get(Constants.PR_LINE_HEIGHT).getSpace();
letterSpacing = pList.get(Constants.PR_LETTER_SPACING);
whiteSpaceCollapse = pList.get(Constants.PR_WHITE_SPACE_COLLAPSE).getEnum();
@@ -555,6 +558,13 @@ public class FOText extends FONode {
return color;
}
+ /**
+ * @return the "keep-together" property.
+ */
+ public KeepProperty getKeepTogether() {
+ return keepTogether;
+ }
+
/**
* @return the "letter-spacing" property.
*/
diff --git a/src/java/org/apache/fop/fo/properties/CharacterProperty.java b/src/java/org/apache/fop/fo/properties/CharacterProperty.java
index 79b0ebc07..1496f5f86 100644
--- a/src/java/org/apache/fop/fo/properties/CharacterProperty.java
+++ b/src/java/org/apache/fop/fo/properties/CharacterProperty.java
@@ -25,8 +25,8 @@ import org.apache.fop.fo.PropertyList;
/**
* Superclass for properties that wrap a character value
*/
-public class CharacterProperty extends Property {
-
+public final class CharacterProperty extends Property {
+
/**
* Inner class for creating instances of CharacterProperty
*/
@@ -42,19 +42,27 @@ public class CharacterProperty extends Property {
public Property make(PropertyList propertyList, String value,
FObj fo) {
char c = value.charAt(0);
- return new CharacterProperty(c);
+ return CharacterProperty.getInstance(c);
}
- } // end Character.Maker
+ }
+
+ /** cache containing all canonical CharacterProperty instances */
+ private static final PropertyCache cache = new PropertyCache();
- private char character;
+ private final char character;
/**
* @param character character value to be wrapped in this property
*/
- public CharacterProperty(char character) {
+ private CharacterProperty(char character) {
this.character = character;
}
+
+ public static CharacterProperty getInstance(char character) {
+ return (CharacterProperty) cache.fetch(
+ new CharacterProperty(character));
+ }
/**
* @return this.character cast as an Object
@@ -77,4 +85,22 @@ public class CharacterProperty extends Property {
return new Character(character).toString();
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof CharacterProperty) {
+ return (((CharacterProperty)obj).character == this.character);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode() {
+ return (int) character;
+ }
+
}
diff --git a/src/java/org/apache/fop/fo/properties/FixedLength.java b/src/java/org/apache/fop/fo/properties/FixedLength.java
index 80016ba2e..76d99cba2 100644
--- a/src/java/org/apache/fop/fo/properties/FixedLength.java
+++ b/src/java/org/apache/fop/fo/properties/FixedLength.java
@@ -151,7 +151,7 @@ public class FixedLength extends LengthProperty {
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object obj) {
- if (obj instanceof EnumProperty) {
+ if (obj instanceof FixedLength) {
return (((FixedLength)obj).millipoints == this.millipoints);
} else {
return false;
diff --git a/src/java/org/apache/fop/fo/properties/NumberProperty.java b/src/java/org/apache/fop/fo/properties/NumberProperty.java
index 55206cff7..46aed83ac 100644
--- a/src/java/org/apache/fop/fo/properties/NumberProperty.java
+++ b/src/java/org/apache/fop/fo/properties/NumberProperty.java
@@ -223,4 +223,20 @@ public class NumberProperty extends Property implements Numeric {
return Color.black;
}
+ /** {@inheritDoc} */
+ public int hashCode() {
+ return number.hashCode();
+ }
+
+ /** {@inheritDoc} */
+ public boolean equals(Object o) {
+ if (o != null && o instanceof NumberProperty) {
+ NumberProperty np = (NumberProperty) o;
+ return (np.number == this.number
+ || (this.number != null
+ && this.number.equals(np.number)));
+ } else {
+ return false;
+ }
+ }
}
diff --git a/src/java/org/apache/fop/fo/properties/PropertyCache.java b/src/java/org/apache/fop/fo/properties/PropertyCache.java
index 176cdd4aa..a76c8b2f4 100644
--- a/src/java/org/apache/fop/fo/properties/PropertyCache.java
+++ b/src/java/org/apache/fop/fo/properties/PropertyCache.java
@@ -19,6 +19,7 @@
package org.apache.fop.fo.properties;
+import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
@@ -44,12 +45,14 @@ public class PropertyCache {
*/
public Property fetch(Property prop) {
- Property cacheEntry = (Property) propCache.get(prop);
- if (cacheEntry != null) {
- return cacheEntry;
- } else {
- propCache.put(prop, prop);
- return prop;
+ WeakReference ref = (WeakReference) propCache.get(prop);
+ if (ref != null) {
+ Property cacheEntry = (Property)ref.get();
+ if (cacheEntry != null) {
+ return cacheEntry;
+ }
}
+ propCache.put(prop, new WeakReference(prop));
+ return prop;
}
}
diff --git a/src/java/org/apache/fop/fonts/Font.java b/src/java/org/apache/fop/fonts/Font.java
index 7f4a6d6e8..82a43f4dc 100644
--- a/src/java/org/apache/fop/fonts/Font.java
+++ b/src/java/org/apache/fop/fonts/Font.java
@@ -284,8 +284,12 @@ public class Font {
width = 0;
} else if (c == '\u202F') {
width = getCharWidth(' ') / 2;
+ } else if (c == '\u2060') {
+ width = 0;
} else if (c == '\u3000') {
width = getCharWidth(' ') * 2;
+ } else if (c == '\ufeff') {
+ width = 0;
} else {
//Will be internally replaced by "#" if not found
width = getWidth(mapChar(c));
diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/java/org/apache/fop/fonts/truetype/TTFFile.java
index f60aa91f1..4142b0444 100644
--- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java
+++ b/src/java/org/apache/fop/fonts/truetype/TTFFile.java
@@ -20,7 +20,6 @@
package org.apache.fop.fonts.truetype;
import java.io.IOException;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.List;
@@ -28,7 +27,6 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fop.fonts.Glyphs;
-import org.apache.fop.util.IntMap;
/**
* Reads a TrueType file or a TrueType Collection.
@@ -111,8 +109,8 @@ public class TTFFile {
// internal mapping of glyph indexes to unicode indexes
// used for quick mappings in this class
- private IntMap glyphToUnicodeMap = new IntMap();
- private IntMap unicodeToGlyphMap = new IntMap();
+ private Map glyphToUnicodeMap = new java.util.HashMap();
+ private Map unicodeToGlyphMap = new java.util.HashMap();
private TTFDirTabEntry currentDirTab;
@@ -134,8 +132,8 @@ public class TTFFile {
UnicodeMapping(int glyphIndex, int unicodeIndex) {
this.unicodeIndex = unicodeIndex;
this.glyphIndex = glyphIndex;
- glyphToUnicodeMap.put(glyphIndex, unicodeIndex);
- unicodeToGlyphMap.put(unicodeIndex, glyphIndex);
+ glyphToUnicodeMap.put(new Integer(glyphIndex), new Integer(unicodeIndex));
+ unicodeToGlyphMap.put(new Integer(unicodeIndex), new Integer(glyphIndex));
}
/**
@@ -1505,7 +1503,7 @@ public class TTFFile {
* @throws IOException if glyphIndex not found
*/
private Integer glyphToUnicode(int glyphIndex) throws IOException {
- return new Integer(glyphToUnicodeMap.get(glyphIndex));
+ return (Integer) glyphToUnicodeMap.get(new Integer(glyphIndex));
}
/**
@@ -1517,7 +1515,7 @@ public class TTFFile {
*/
private Integer unicodeToGlyph(int unicodeIndex) throws IOException {
final Integer result =
- new Integer(unicodeToGlyphMap.get(unicodeIndex));
+ (Integer) unicodeToGlyphMap.get(new Integer(unicodeIndex));
if (result == null) {
throw new IOException(
"Glyph index not found for unicode value " + unicodeIndex);
diff --git a/src/java/org/apache/fop/layoutmgr/LayoutContext.java b/src/java/org/apache/fop/layoutmgr/LayoutContext.java
index 5bac30f0b..18a3b2bd8 100644
--- a/src/java/org/apache/fop/layoutmgr/LayoutContext.java
+++ b/src/java/org/apache/fop/layoutmgr/LayoutContext.java
@@ -71,7 +71,7 @@ public class LayoutContext {
public static final int KEEP_WITH_PREVIOUS_PENDING = 0x400;
- public int flags; // Contains some set of flags defined above
+ private int flags; // Contains some set of flags defined above
/**
* Total available stacking dimension for a "galley-level" layout
* manager (Line or Flow). It is passed by the parent LM. For LineLM,
@@ -79,22 +79,22 @@ public class LayoutContext {
* These LM <b>may</b> wish to pass this information down to lower
* level LM to allow them to optimize returned break possibilities.
*/
- MinOptMax stackLimit;
+ private MinOptMax stackLimit;
/** True if current element list is spanning in multi-column layout. */
private int nextSpan = Constants.NOT_SET;
/** inline-progression-dimension of nearest ancestor reference area */
- int refIPD;
+ private int refIPD;
/** the writing mode established by the nearest ancestor reference area */
private int writingMode = Constants.EN_LR_TB;
/** Current pending space-after or space-end from preceding area */
- SpaceSpecifier trailingSpace;
+ private SpaceSpecifier trailingSpace;
/** Current pending space-before or space-start from ancestor areas */
- SpaceSpecifier leadingSpace;
+ private SpaceSpecifier leadingSpace;
/**
* A list of pending marks (border and padding) on the after edge when a page break occurs.
diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
index 8539bcbe3..1aebd1abf 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
@@ -164,6 +164,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
private int lineStartBAP = 0;
private int lineEndBAP = 0;
+
+ private boolean keepTogether;
/**
* Create a Text layout manager.
@@ -213,6 +215,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
// in the SpaceVal.makeWordSpacing() method
letterSpaceIPD = ls.getSpace();
wordSpaceIPD = MinOptMax.add(new MinOptMax(spaceCharIPD), ws.getSpace());
+
+ keepTogether = foText.getKeepTogether().getWithinLine().getEnum() == Constants.EN_ALWAYS;
}
@@ -538,7 +542,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
*/
private static boolean isSpace(final char ch) {
return ch == CharUtilities.SPACE
- || ch == CharUtilities.NBSPACE
+ || CharUtilities.isNonBreakableSpace(ch)
|| CharUtilities.isFixedWidthSpace(ch);
}
@@ -562,7 +566,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
while (iNextStart < textArray.length) {
ch = textArray[iNextStart];
boolean breakOpportunity = false;
- byte breakAction = lbs.nextChar(ch);
+ byte breakAction = keepTogether? LineBreakStatus.PROHIBITED_BREAK : lbs.nextChar(ch);
switch (breakAction) {
case LineBreakStatus.COMBINING_PROHIBITED_BREAK:
case LineBreakStatus.PROHIBITED_BREAK:
@@ -689,7 +693,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
(short) 1, (short) 0,
wordSpaceIPD, false, true, breakOpportunity);
iThisStart = (short) (iNextStart + 1);
- } else if (CharUtilities.isFixedWidthSpace(ch)) {
+ } else if (CharUtilities.isFixedWidthSpace(ch) || CharUtilities.isZeroWidthSpace(ch)) {
// create the AreaInfo object
MinOptMax ipd = new MinOptMax(font.getCharWidth(ch));
ai = new AreaInfo(iNextStart, (short) (iNextStart + 1),
diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java
index ea1087893..9777a1967 100644
--- a/src/java/org/apache/fop/render/afp/AFPRenderer.java
+++ b/src/java/org/apache/fop/render/afp/AFPRenderer.java
@@ -45,8 +45,8 @@ import org.apache.fop.area.PageViewport;
import org.apache.fop.area.RegionReference;
import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.Trait;
-import org.apache.fop.area.inline.Leader;
import org.apache.fop.area.inline.Image;
+import org.apache.fop.area.inline.Leader;
import org.apache.fop.area.inline.SpaceArea;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.area.inline.WordArea;
@@ -67,8 +67,8 @@ import org.apache.fop.render.Graphics2DAdapter;
import org.apache.fop.render.RendererContext;
import org.apache.fop.render.afp.extensions.AFPElementMapping;
import org.apache.fop.render.afp.extensions.AFPPageSetup;
-import org.apache.fop.render.afp.fonts.AFPFontInfo;
import org.apache.fop.render.afp.fonts.AFPFont;
+import org.apache.fop.render.afp.fonts.AFPFontInfo;
import org.apache.fop.render.afp.fonts.CharacterSet;
import org.apache.fop.render.afp.fonts.FopCharacterSet;
import org.apache.fop.render.afp.fonts.OutlineFont;
@@ -256,10 +256,10 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
this.fontInfo = inFontInfo;
int num = 1;
if (this.fontList != null && this.fontList.size() > 0) {
- for (Iterator it = this.fontList.iterator(); it.hasNext(); ) {
+ for (Iterator it = this.fontList.iterator(); it.hasNext();) {
AFPFontInfo afi = (AFPFontInfo)it.next();
AFPFont bf = (AFPFont)afi.getAFPFont();
- for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext(); ) {
+ for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext();) {
FontTriplet ft = (FontTriplet)it2.next();
this.fontInfo.addFontProperties("F" + num, ft.getName()
, ft.getStyle(), ft.getWeight());
@@ -271,21 +271,24 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
log.warn("No AFP fonts configured - using default setup");
}
if (this.fontInfo.fontLookup("sans-serif", "normal", 400) == null) {
- CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500", "CZH200 ", 1, new Helvetica());
+ CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500", "CZH200 ",
+ 1, new Helvetica());
AFPFont bf = new OutlineFont("Helvetica", cs);
this.fontInfo.addFontProperties("F" + num, "sans-serif", "normal", 400);
this.fontInfo.addMetrics("F" + num, bf);
num++;
}
if (this.fontInfo.fontLookup("serif", "normal", 400) == null) {
- CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500", "CZN200 ", 1, new TimesRoman());
+ CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500", "CZN200 ",
+ 1, new TimesRoman());
AFPFont bf = new OutlineFont("Helvetica", cs);
this.fontInfo.addFontProperties("F" + num, "serif", "normal", 400);
this.fontInfo.addMetrics("F" + num, bf);
num++;
}
if (this.fontInfo.fontLookup("monospace", "normal", 400) == null) {
- CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500", "CZ4200 ", 1, new Courier());
+ CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500", "CZ4200 ",
+ 1, new Courier());
AFPFont bf = new OutlineFont("Helvetica", cs);
this.fontInfo.addFontProperties("F" + num, "monospace", "normal", 400);
this.fontInfo.addMetrics("F" + num, bf);
@@ -293,7 +296,8 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
if (this.fontInfo.fontLookup("any", "normal", 400) == null) {
FontTriplet ft = this.fontInfo.fontLookup("sans-serif", "normal", 400);
- this.fontInfo.addFontProperties(this.fontInfo.getInternalFontKey(ft), "any", "normal", 400);
+ this.fontInfo.addFontProperties(
+ this.fontInfo.getInternalFontKey(ft), "any", "normal", 400);
}
}
@@ -340,7 +344,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
*
* @see org.apache.fop.render.Renderer#preparePage(PageViewport)
*/
- public void preparePage(PageViewport page) {
+ public void preparePage(PageViewport pageViewport) {
// initializeRootExtensions(page);
_currentFontFamily = "";
@@ -349,7 +353,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
_currentPageFonts.clear();
_lineCache = new HashSet();
- Rectangle2D bounds = page.getViewArea();
+ Rectangle2D bounds = pageViewport.getViewArea();
_pageWidth = mpts2units(bounds.getWidth());
_pageHeight = mpts2units(bounds.getHeight());
@@ -358,12 +362,12 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
_afpDataStream.startPage(_pageWidth, _pageHeight, 0);
- renderPageObjectExtensions(page);
+ renderPageObjectExtensions(pageViewport);
if (_pages == null) {
_pages = new HashMap();
}
- _pages.put(page, _afpDataStream.savePage());
+ _pages.put(pageViewport, _afpDataStream.savePage());
}
@@ -380,7 +384,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
/**
- * @see org.apache.fop.render.AbstractRenderer#startVParea(CTM, Rectangle2D)
+ * {@inheritDoc}
*/
public void startVParea(CTM ctm, Rectangle2D clippingRect) {
// dummy not used
@@ -436,7 +440,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
/**
- * @see org.apache.fop.render.AbstractRenderer#renderBlockViewport(BlockViewport, List)
+ * {@inheritDoc}
*/
protected void renderBlockViewport(BlockViewport bv, List children) {
// clip and position viewport if necessary
@@ -548,7 +552,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
/**
* @see org.apache.fop.render.Renderer#renderPage(PageViewport)
*/
- public void renderPage(PageViewport page) {
+ public void renderPage(PageViewport pageViewport) {
// initializeRootExtensions(page);
@@ -558,27 +562,27 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
_currentPageFonts.clear();
_lineCache = new HashSet();
- Rectangle2D bounds = page.getViewArea();
+ Rectangle2D bounds = pageViewport.getViewArea();
_pageWidth = mpts2units(bounds.getWidth());
_pageHeight = mpts2units(bounds.getHeight());
- if (_pages != null && _pages.containsKey(page)) {
+ if (_pages != null && _pages.containsKey(pageViewport)) {
- _afpDataStream.restorePage((PageObject)_pages.remove(page));
+ _afpDataStream.restorePage((PageObject)_pages.remove(pageViewport));
} else {
// renderPageGroupExtensions(page);
_afpDataStream.startPage(_pageWidth, _pageHeight, 0);
- renderPageObjectExtensions(page);
+ renderPageObjectExtensions(pageViewport);
}
pushViewPortPos(new ViewPortPos());
- renderPageAreas(page.getPage());
+ renderPageAreas(pageViewport.getPage());
Iterator i = _currentPageFonts.values().iterator();
while (i.hasNext()) {
@@ -610,25 +614,21 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
/**
- * Clip using a rectangular area.
- * @see org.apache.fop.render.AbstractPathOrientedRenderer#clipRect(float, float, float, float)
+ * {@inheritDoc}
*/
public void clipRect(float x, float y, float width, float height) {
// TODO
}
/**
- * Moves the current point to (x, y), omitting any connecting line segment.
- * @see org.apache.fop.render.AbstractPathOrientedRenderer#moveTo(float, float)
+ * {@inheritDoc}
*/
public void moveTo(float x, float y) {
// TODO
}
/**
- * Appends a straight line segment from the current point to (x, y). The
- * new current point is (x, y).
- * @see org.apache.fop.render.AbstractPathOrientedRenderer#lineTo(float, float)
+ * {@inheritDoc}
*/
public void lineTo(float x, float y) {
// TODO
@@ -644,8 +644,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
/**
- * Fill a rectangular area.
- * @see org.apache.fop.render.AbstractPathOrientedRenderer#fillRect(float, float, float, float)
+ * {@inheritDoc}
*/
public void fillRect(float x, float y, float width, float height) {
/*
@@ -868,14 +867,13 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
protected RendererContext createRendererContext(int x, int y, int width, int height, Map foreignAttributes) {
RendererContext context;
context = super.createRendererContext(x, y, width, height, foreignAttributes);
- context.setProperty(AFPRendererContextConstants.AFP_GRAYSCALE,
+ context.setProperty(AFPRendererContextConstants.AFP_GRAYSCALE,
new Boolean(!this.colorImages));
return context;
}
/**
- * Draw an image at the indicated location.
- * @see org.apache.fop.render.AbstractPathOrientedRenderer#drawImage(String, Rectangle2D, Map)
+ * {@inheritDoc}
*/
public void drawImage(String url, Rectangle2D pos, Map foreignAttributes) {
String name = null;
@@ -962,13 +960,15 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
if (!fopimage.load(FopImage.BITMAP)) {
return;
}
- convertToGrayScaleImage(io, fopimage.getBitmaps());
+ convertToGrayScaleImage(io, fopimage.getBitmaps(),
+ fopimage.getWidth(), fopimage.getHeight());
}
} else {
if (!fopimage.load(FopImage.BITMAP)) {
return;
}
- convertToGrayScaleImage(io, fopimage.getBitmaps());
+ convertToGrayScaleImage(io, fopimage.getBitmaps(),
+ fopimage.getWidth(), fopimage.getHeight());
}
} else {
if (!fopimage.load(FopImage.BITMAP)) {
@@ -991,7 +991,8 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
io.setImageIDESize((byte)24);
io.setImageData(fopimage.getBitmaps());
} else {
- convertToGrayScaleImage(io, fopimage.getBitmaps());
+ convertToGrayScaleImage(io, fopimage.getBitmaps(),
+ fopimage.getWidth(), fopimage.getHeight());
}
}
}
@@ -1019,7 +1020,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
}
}
-
+
/**
* Draws a BufferedImage to AFP.
* @param bi the BufferedImage
@@ -1039,7 +1040,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
//Serialize image
writeImage(bi, baout);
byte[] buf = baout.toByteArray();
-
+
//Generate image
ImageObject io = _afpDataStream.getImageObject(afpx, afpy, afpw, afph);
io.setImageParameters(
@@ -1053,16 +1054,16 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
} else {
//TODO Teach it how to handle grayscale BufferedImages directly
//because this is pretty inefficient
- convertToGrayScaleImage(io, buf);
+ convertToGrayScaleImage(io, buf, bi.getWidth(), bi.getHeight());
}
} catch (IOException ioe) {
log.error("Error while serializing bitmap: " + ioe.getMessage(), ioe);
}
}
-
+
/**
* Establishes a new foreground or fill color.
- * @see org.apache.fop.render.AbstractPathOrientedRenderer#updateColor(Color, boolean)
+ * {@inheritDoc}
*/
public void updateColor(Color col, boolean fill) {
if (fill) {
@@ -1107,7 +1108,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
/**
- * @see org.apache.fop.render.AbstractRenderer#renderImage(Image, Rectangle2D)
+ * {@inheritDoc}
*/
public void renderImage(Image image, Rectangle2D pos) {
String url = image.getURL();
@@ -1365,40 +1366,50 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
* Method to render the page extension.
* <p>
*
- * @param page
+ * @param pageViewport
* the page object
*/
- private void renderPageObjectExtensions(PageViewport page) {
+ private void renderPageObjectExtensions(PageViewport pageViewport) {
_pageSegmentsMap = null;
- if (page.getExtensionAttachments() != null
- && page.getExtensionAttachments().size() > 0) {
+ if (pageViewport.getExtensionAttachments() != null
+ && pageViewport.getExtensionAttachments().size() > 0) {
//Extract all AFPPageSetup instances from the attachment list on the s-p-m
- Iterator i = page.getExtensionAttachments().iterator();
+ Iterator i = pageViewport.getExtensionAttachments().iterator();
while (i.hasNext()) {
ExtensionAttachment attachment = (ExtensionAttachment)i.next();
if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
- AFPPageSetup aps = (AFPPageSetup)attachment;
- String element = aps.getElementName();
- if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) {
- String overlay = aps.getName();
- if (overlay != null) {
- _afpDataStream.createIncludePageOverlay(overlay);
- }
- } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) {
- String name = aps.getName();
- String source = aps.getValue();
- if (_pageSegmentsMap == null) {
- _pageSegmentsMap = new HashMap();
+ if (attachment instanceof AFPPageSetup) {
+ AFPPageSetup aps = (AFPPageSetup)attachment;
+ if (log.isDebugEnabled()) {
+ log.debug(aps);
}
- _pageSegmentsMap.put(source, name);
- } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
- String name = aps.getName();
- String value = aps.getValue();
- if (_pageSegmentsMap == null) {
- _pageSegmentsMap = new HashMap();
+ String element = aps.getElementName();
+ if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) {
+ String overlay = aps.getName();
+ if (overlay != null) {
+ _afpDataStream.createIncludePageOverlay(overlay);
+ }
+ } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) {
+ String name = aps.getName();
+ String source = aps.getValue();
+ if (_pageSegmentsMap == null) {
+ _pageSegmentsMap = new HashMap();
+ }
+ _pageSegmentsMap.put(source, name);
+ } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
+ String name = aps.getName();
+ String value = aps.getValue();
+ if (_pageSegmentsMap == null) {
+ _pageSegmentsMap = new HashMap();
+ }
+ _afpDataStream.createTagLogicalElement(name, value);
+ } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
+ String content = aps.getContent();
+ if (content != null) {
+ _afpDataStream.createNoOperation(content);
+ }
}
- _afpDataStream.createTagLogicalElement(name, value);
}
}
}
@@ -1430,32 +1441,53 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
return (int)Math.round(mpt / DPI_CONVERSION_FACTOR_240);
}
- private void convertToGrayScaleImage(ImageObject io, byte raw[]) {
+ /**
+ * Converts a byte array containing 24 bit RGB image data to a grayscale image.
+ * @param io the target image object
+ * @param raw the buffer containing the RGB image data
+ * @param width the width of the image in pixels
+ * @param height the height of the image in pixels
+ */
+ private void convertToGrayScaleImage(ImageObject io, byte[] raw, int width, int height) {
int pixelsPerByte = 8 / bitsPerPixel;
- byte bw[] = new byte[raw.length / (3 * pixelsPerByte)];
- int k = 0;
- for (int i = 0, j = 0; i < raw.length; i += 3, j++) {
- if (j == pixelsPerByte) {
- j = 0;
- k++;
- }
- // see http://www.jguru.com/faq/view.jsp?EID=221919
- double greyVal = 0.212671d * ((int) raw[i] & 0xff)
- + 0.715160d * ((int) raw[i + 1] & 0xff)
- + 0.072169d * ((int) raw[i + 2] & 0xff);
- switch (bitsPerPixel) {
+ int bytewidth = (width / pixelsPerByte);
+ if ((width % pixelsPerByte) != 0) {
+ bytewidth++;
+ }
+ byte[] bw = new byte[height * bytewidth];
+ byte ib;
+ for (int y = 0; y < height; y++) {
+ ib = 0;
+ int i = 3 * y * width;
+ for (int x = 0; x < width; x++, i += 3) {
+
+ // see http://www.jguru.com/faq/view.jsp?EID=221919
+ double greyVal = 0.212671d * ((int) raw[i] & 0xff)
+ + 0.715160d * ((int) raw[i + 1] & 0xff)
+ + 0.072169d * ((int) raw[i + 2] & 0xff);
+
+ switch (bitsPerPixel) {
case 1:
- if (greyVal > 128) {
- bw[k] |= (byte)(1 << j);
+ if (greyVal < 128) {
+ ib |= (byte)(1 << (7 - (x % 8)));
}
break;
case 4:
greyVal /= 16;
- bw[k] |= (byte)((byte)greyVal << (j * 4));
+ ib |= (byte)((byte)greyVal << ((1 - (x % 2)) * 4));
break;
case 8:
- bw[k] = (byte)greyVal;
+ ib = (byte)greyVal;
break;
+ default:
+ throw new UnsupportedOperationException(
+ "Unsupported bits per pixel: " + bitsPerPixel);
+ }
+
+ if ((x % pixelsPerByte) == (pixelsPerByte - 1) || ((x + 1) == width)) {
+ bw[(y * bytewidth) + (x / pixelsPerByte)] = ib;
+ ib = 0;
+ }
}
}
io.setImageIDESize((byte)bitsPerPixel);
diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPElement.java b/src/java/org/apache/fop/render/afp/extensions/AFPElement.java
index 8ee8cca42..304f1a5d6 100755
--- a/src/java/org/apache/fop/render/afp/extensions/AFPElement.java
+++ b/src/java/org/apache/fop/render/afp/extensions/AFPElement.java
@@ -18,11 +18,11 @@
/* $Id$ */
package org.apache.fop.render.afp.extensions;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.XMLObj;
/**
* This class extends the org.apache.fop.extensions.ExtensionObj class. The
@@ -43,16 +43,6 @@ public class AFPElement extends AbstractAFPExtensionObject {
}
/** @see org.apache.fop.fo.FONode#getNamespaceURI() */
- public String getNamespaceURI() {
- return AFPElementMapping.NAMESPACE;
- }
-
- /** @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() */
- public String getNormalNamespacePrefix() {
- return "afp";
- }
-
- /** @see org.apache.fop.fo.FONode#startOfNode() */
protected void startOfNode() throws FOPException {
super.startOfNode();
//if (!AFPElementMapping.NAMESPACE.equals(parent.getNamespaceURI())
diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java b/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java
index eb7a5158f..b58bff290 100755
--- a/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java
+++ b/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java
@@ -45,6 +45,9 @@ public class AFPElementMapping extends ElementMapping {
public static final String INCLUDE_PAGE_SEGMENT = "include-page-segment";
+ /** NOP */
+ public static final String NO_OPERATION = "no-operation";
+
/**
* The namespace used for AFP extensions
*/
@@ -79,6 +82,9 @@ public class AFPElementMapping extends ElementMapping {
foObjs.put(
INCLUDE_PAGE_OVERLAY,
new AFPIncludePageOverlayMaker());
+ foObjs.put(
+ NO_OPERATION,
+ new AFPNoOperationMaker());
}
}
@@ -107,4 +113,9 @@ public class AFPElementMapping extends ElementMapping {
}
}
+ static class AFPNoOperationMaker extends ElementMapping.Maker {
+ public FONode make(FONode parent) {
+ return new AFPElement(parent, NO_OPERATION);
+ }
+ }
}
diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java b/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java
new file mode 100644
index 000000000..8d0e50fbc
--- /dev/null
+++ b/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.extensions;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.util.ContentHandlerFactory;
+import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * ContentHandler (parser) for restoring AFPExtension objects from XML.
+ */
+public class AFPExtensionHandler extends DefaultHandler
+ implements ContentHandlerFactory.ObjectSource {
+
+ /** Logger instance */
+ protected static Log log = LogFactory.getLog(AFPExtensionHandler.class);
+
+ private StringBuffer content = new StringBuffer();
+ private Attributes lastAttributes;
+
+ private AFPPageSetup returnedObject;
+ private ObjectBuiltListener listener;
+
+ /** {@inheritDoc} */
+ public void startElement(String uri, String localName, String qName, Attributes attributes)
+ throws SAXException {
+ boolean handled = false;
+ if (AFPPageSetup.CATEGORY.equals(uri)) {
+ lastAttributes = attributes;
+ handled = true;
+ if (localName.equals(AFPElementMapping.NO_OPERATION)
+ || localName.equals(AFPElementMapping.TAG_LOGICAL_ELEMENT)
+ || localName.equals(AFPElementMapping.INCLUDE_PAGE_OVERLAY)
+ || localName.equals(AFPElementMapping.INCLUDE_PAGE_SEGMENT)
+ || localName.equals(AFPElementMapping.PAGE)
+ || localName.equals(AFPElementMapping.PAGE_GROUP)) {
+ //handled in endElement
+ } else {
+ handled = false;
+ }
+ }
+ if (!handled) {
+ if (AFPPageSetup.CATEGORY.equals(uri)) {
+ throw new SAXException("Unhandled element " + localName
+ + " in namespace: " + uri);
+ } else {
+ log.warn("Unhandled element " + localName
+ + " in namespace: " + uri);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ if (AFPPageSetup.CATEGORY.equals(uri)) {
+ String name = lastAttributes.getValue("name");
+ this.returnedObject = new AFPPageSetup(localName);
+ returnedObject.setName(name);
+ if (content.length() > 0) {
+ returnedObject.setContent(content.toString());
+ content.setLength(0); //Reset text buffer (see characters())
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ content.append(ch, start, length);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void endDocument() throws SAXException {
+ if (listener != null) {
+ listener.notifyObjectBuilt(getObject());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getObject() {
+ return returnedObject;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setObjectBuiltListener(ObjectBuiltListener listener) {
+ this.listener = listener;
+ }
+
+}
diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java b/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java
new file mode 100644
index 000000000..4fe5eaab2
--- /dev/null
+++ b/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.extensions;
+
+import org.apache.fop.util.ContentHandlerFactory;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Factory for the ContentHandler that handles serialized AFPPageSetup instances.
+ */
+public class AFPExtensionHandlerFactory implements ContentHandlerFactory {
+
+ private static final String[] NAMESPACES = new String[] {AFPPageSetup.CATEGORY};
+
+ /** {@inheritDoc} */
+ public String[] getSupportedNamespaces() {
+ return NAMESPACES;
+ }
+
+ /** {@inheritDoc} */
+ public ContentHandler createContentHandler() {
+ return new AFPExtensionHandler();
+ }
+}
diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java b/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java
index 415d1656b..28d06a69e 100644
--- a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java
+++ b/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java
@@ -22,11 +22,17 @@ package org.apache.fop.render.afp.extensions;
import java.io.Serializable;
import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.apache.fop.util.XMLizable;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
/**
* This is the pass-through value object for the PostScript extension.
*/
-public class AFPPageSetup implements ExtensionAttachment, Serializable {
+public class AFPPageSetup implements ExtensionAttachment, Serializable, XMLizable {
+
+ private static final long serialVersionUID = 7190606822558332901L;
/** The category URI for this extension attachment. */
public static final String CATEGORY = "apache:fop:extensions:afp";
@@ -37,12 +43,15 @@ public class AFPPageSetup implements ExtensionAttachment, Serializable {
private String value;
+ private String content;
+
/**
* Default constructor.
- * @param name the name of the setup code object, may be null
+ *
+ * @param elementName the name of the setup code object, may be null
*/
- public AFPPageSetup(String name) {
- this.elementName = name;
+ public AFPPageSetup(String elementName) {
+ this.elementName = elementName;
}
/** @return the name */
@@ -77,15 +86,49 @@ public class AFPPageSetup implements ExtensionAttachment, Serializable {
public void setValue(String source) {
this.value = source;
}
-
+
/** @see org.apache.fop.fo.extensions.ExtensionAttachment#getCategory() */
public String getCategory() {
return CATEGORY;
}
- /** @see java.lang.Object#toString() */
+ /**
+ * @return the data
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * Sets the data
+ * @param content The byte data to set.
+ */
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ /** {@inheritDoc} */
public String toString() {
return "AFPPageSetup(element-name=" + getElementName() + " name=" + getName() + ")";
}
+ private static final String ATT_NAME = "name";
+ private static final String ATT_VALUE = "value";
+
+ /** {@inheritDoc} */
+ public void toSAX(ContentHandler handler) throws SAXException {
+ AttributesImpl atts = new AttributesImpl();
+ if (name != null && name.length() > 0) {
+ atts.addAttribute(null, ATT_NAME, ATT_NAME, "CDATA", name);
+ }
+ if (value != null && value.length() > 0) {
+ atts.addAttribute(null, ATT_VALUE, ATT_VALUE, "CDATA", value);
+ }
+ handler.startElement(CATEGORY, elementName, elementName, atts);
+ if (content != null && content.length() > 0) {
+ char[] chars = content.toCharArray();
+ handler.characters(chars, 0, chars.length);
+ }
+ handler.endElement(CATEGORY, elementName, elementName);
+ }
}
diff --git a/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java b/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java
index 54bdc9fb0..01bd49a33 100644
--- a/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java
+++ b/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java
@@ -33,10 +33,13 @@ import org.xml.sax.Locator;
*/
public abstract class AbstractAFPExtensionObject extends FONode {
- private AFPPageSetup setupCode = null;
-
- private String _name = null;
+ /**
+ * AFP setup code
+ */
+ private AFPPageSetup setupCode;
+ private String name;
+
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
* @param parent the parent formatting object
@@ -44,14 +47,11 @@ public abstract class AbstractAFPExtensionObject extends FONode {
*/
public AbstractAFPExtensionObject(FONode parent, String name) {
super(parent);
- _name = name;
- setupCode = new AFPPageSetup(name);
+ this.name = name;
+ this.setupCode = new AFPPageSetup(name);
}
- /**
- * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
- * here, blocks XSL FO's from having non-FO parents.
- */
+ /** {@inheritDoc} */
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
if (FO_URI.equals(nsURI)) {
@@ -60,8 +60,9 @@ public abstract class AbstractAFPExtensionObject extends FONode {
}
/** @see org.apache.fop.fo.FONode */
- protected void addCharacters(char[] data, int start, int length,
+ protected void addCharacters(char[] data, int start, int end,
PropertyList pList, Locator locator) {
+ setupCode.setContent(new String(data, start, end - start));
}
/** @see org.apache.fop.fo.FONode#getNamespaceURI() */
@@ -69,7 +70,7 @@ public abstract class AbstractAFPExtensionObject extends FONode {
return AFPElementMapping.NAMESPACE;
}
- /**@see org.apache.fop.fo.FONode#getNormalNamespacePrefix() */
+ /** {@inheritDoc} */
public String getNormalNamespacePrefix() {
return AFPElementMapping.NAMESPACE_PREFIX;
}
@@ -91,8 +92,7 @@ public abstract class AbstractAFPExtensionObject extends FONode {
} else {
throw new FOPException(elementName + " must have a src attribute.");
}
- }
- if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(elementName)) {
+ } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(elementName)) {
name = attlist.getValue("value");
if (name != null && name.length() > 0) {
setupCode.setValue(name);
@@ -114,8 +114,6 @@ public abstract class AbstractAFPExtensionObject extends FONode {
/** @see org.apache.fop.fo.FONode#getLocalName() */
public String getLocalName() {
- return _name;
+ return name;
}
-
}
-
diff --git a/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java b/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
index ad3a04d06..103828d1a 100644
--- a/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
+++ b/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
@@ -111,7 +111,7 @@ public final class AFPFontReader {
/**
* The collection of code pages
*/
- private static HashMap _codePages = new HashMap();
+ private HashMap _codePages = new HashMap();
/**
* Load the font details and metrics into the CharacterSetMetric object,
@@ -120,7 +120,7 @@ public final class AFPFontReader {
*
* @param characterSet the CharacterSetMetric object to populate
*/
- public static void loadCharacterSetMetric(CharacterSet characterSet) {
+ public void loadCharacterSetMetric(CharacterSet characterSet) {
InputStream inputStream = null;
@@ -275,6 +275,11 @@ public final class AFPFontReader {
}
File directory = new File(url.getPath());
+ if (!directory.canRead()) {
+ String msg = "Failed to read directory " + url.getPath();
+ log.error(msg);
+ throw new FileNotFoundException(msg);
+ }
final String filterpattern = codePage.trim();
FilenameFilter filter = new FilenameFilter() {
@@ -606,4 +611,4 @@ public final class AFPFontReader {
}
}
-} \ No newline at end of file
+}
diff --git a/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java b/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
index 75e56ea5e..2727ba15a 100644
--- a/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
+++ b/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
@@ -250,7 +250,8 @@ public class CharacterSet {
if (!_isMetricsLoaded) {
- AFPFontReader.loadCharacterSetMetric(this);
+ AFPFontReader afpFontReader = new AFPFontReader();
+ afpFontReader.loadCharacterSetMetric(this);
_isMetricsLoaded = true;
}
diff --git a/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java b/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
index ebf74b1c1..a6fff9bc0 100644
--- a/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
+++ b/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
@@ -571,6 +571,15 @@ public class AFPDataStream {
}
/**
+ * Creates a NoOperation item
+ *
+ * @param content byte data
+ */
+ public void createNoOperation(String content) {
+ _currentPage.createNoOperation(content);
+ }
+
+ /**
* Start a new page group. When processing has finished on the current page
* group the {@link #endPageGroup()}method must be invoked to mark the page
* group ending.
diff --git a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
index 90c92e4f0..90d83cb55 100644
--- a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
+++ b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
@@ -357,6 +357,18 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject {
}
/**
+ * Creates a NoOperation on the page.
+ *
+ * @param content the byte data
+ */
+ public void createNoOperation(String content) {
+
+ NoOperation noOp = new NoOperation(content);
+ _objects.add(noOp);
+
+ }
+
+ /**
* Creates an IncludePageSegment on the current page.
*
* @param name
@@ -410,4 +422,4 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject {
return _rotation;
}
-} \ No newline at end of file
+}
diff --git a/src/java/org/apache/fop/render/afp/modca/NoOperation.java b/src/java/org/apache/fop/render/afp/modca/NoOperation.java
new file mode 100644
index 000000000..0ba354195
--- /dev/null
+++ b/src/java/org/apache/fop/render/afp/modca/NoOperation.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.afp.modca;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * The No Operation structured field may be used to carry comments
+ * or any other type of unarchitected data. Although not recommended,
+ * it may also be used to carry semantic data in private or exchange data
+ * streams. However, because receivers of interchange data streams should
+ * ignore the content of No Operation structured fields and because
+ * receiver-generator products are not required to propagate
+ * No Operation structured fields, no semantics should be attached to
+ * the data carried by the No Operation structured field in interchange
+ */
+public class NoOperation extends AbstractAFPObject {
+
+ /** Up to 32759 bytes of data with no architectural definition */
+ private static final int MAX_DATA_LEN = 32759;
+
+ /**
+ * Byte representation of the comment
+ */
+ private String content;
+
+ /**
+ * Construct a tag logical element with the name and value specified.
+ *
+ * @param content the content to record
+ */
+ public NoOperation(String content) {
+ this.content = content;
+ }
+
+ /**
+ * Accessor method to obtain the byte array AFP datastream for the
+ * NoOperation.
+ *
+ * @param os The outputsteam stream
+ * @throws java.io.IOException if an I/O exception occurs during processing
+ */
+ public void writeDataStream(OutputStream os) throws IOException {
+ byte[] contentData = content.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ int contentLen = contentData.length;
+
+ // packet maximum of 32759 bytes
+ if (contentLen > MAX_DATA_LEN) {
+ contentLen = MAX_DATA_LEN;
+ }
+
+ byte[] data = new byte[9 + contentLen];
+
+ data[0] = 0x5A;
+
+ // Set the total record length
+ byte[] rl1 = BinaryUtils.convert(8 + contentLen, 2);
+
+ //Ignore first byte
+ data[1] = rl1[0];
+ data[2] = rl1[1];
+
+ // Structured field ID for a TLE
+ data[3] = (byte) 0xD3;
+ data[4] = (byte) 0xEE;
+ data[5] = (byte) 0xEE;
+
+ data[6] = 0x00; // Reserved
+ data[7] = 0x00; // Reserved
+ data[8] = 0x00; // Reserved
+
+ int pos = 9;
+ for (int i = 0; i < contentLen; i++) {
+ data[pos++] = contentData[i];
+ }
+ os.write(data);
+ }
+
+} \ No newline at end of file
diff --git a/src/java/org/apache/fop/util/CMYKColorSpace.java b/src/java/org/apache/fop/util/CMYKColorSpace.java
index 655c0b3d9..26de8aa97 100644
--- a/src/java/org/apache/fop/util/CMYKColorSpace.java
+++ b/src/java/org/apache/fop/util/CMYKColorSpace.java
@@ -48,7 +48,7 @@ public class CMYKColorSpace extends ColorSpace {
}
/**
- * @see java.awt.color.ColorSpace#toRGB(float[])
+ * {@inheritDoc}
*/
public float[] toRGB(float[] colorvalue) {
return new float [] {
@@ -58,21 +58,21 @@ public class CMYKColorSpace extends ColorSpace {
}
/**
- * @see java.awt.color.ColorSpace#fromRGB(float[])
+ * {@inheritDoc}
*/
public float[] fromRGB(float[] rgbvalue) {
throw new UnsupportedOperationException("NYI");
}
/**
- * @see java.awt.color.ColorSpace#toCIEXYZ(float[])
+ * {@inheritDoc}
*/
public float[] toCIEXYZ(float[] colorvalue) {
throw new UnsupportedOperationException("NYI");
}
/**
- * @see java.awt.color.ColorSpace#fromCIEXYZ(float[])
+ * {@inheritDoc}
*/
public float[] fromCIEXYZ(float[] colorvalue) {
throw new UnsupportedOperationException("NYI");
diff --git a/src/java/org/apache/fop/util/CharUtilities.java b/src/java/org/apache/fop/util/CharUtilities.java
index 1aad75ad7..5663dbb1e 100644
--- a/src/java/org/apache/fop/util/CharUtilities.java
+++ b/src/java/org/apache/fop/util/CharUtilities.java
@@ -60,6 +60,8 @@ public class CharUtilities {
public static final char NBSPACE = '\u00A0';
/** zero-width space */
public static final char ZERO_WIDTH_SPACE = '\u200B';
+ /** word joiner */
+ public static final char WORD_JOINER = '\u2060';
/** zero-width no-break space (= byte order mark) */
public static final char ZERO_WIDTH_NOBREAK_SPACE = '\uFEFF';
/** soft hyphen */
@@ -106,6 +108,7 @@ public class CharUtilities {
*/
public static boolean isZeroWidthSpace(char c) {
return c == ZERO_WIDTH_SPACE // 200Bh
+ || c == WORD_JOINER // 2060h
|| c == ZERO_WIDTH_NOBREAK_SPACE; // FEFFh (also used as BOM)
}
@@ -115,7 +118,8 @@ public class CharUtilities {
* @return true if the character has a fixed-width
*/
public static boolean isFixedWidthSpace(char c) {
- return (c >= '\u2000' && c <= '\u200B') || c == '\u3000';
+ return (c >= '\u2000' && c <= '\u200B')
+ || c == '\u3000';
// c == '\u2000' // en quad
// c == '\u2001' // em quad
// c == '\u2002' // en space
@@ -142,6 +146,7 @@ public class CharUtilities {
(c == NBSPACE // no-break space
|| c == '\u202F' // narrow no-break space
|| c == '\u3000' // ideographic space
+ || c == WORD_JOINER // word joiner
|| c == ZERO_WIDTH_NOBREAK_SPACE); // zero width no-break space
}
diff --git a/src/java/org/apache/fop/util/CloseBlockerOutputStream.java b/src/java/org/apache/fop/util/CloseBlockerOutputStream.java
index 5bf057c26..7192e76d2 100644
--- a/src/java/org/apache/fop/util/CloseBlockerOutputStream.java
+++ b/src/java/org/apache/fop/util/CloseBlockerOutputStream.java
@@ -36,7 +36,7 @@ public class CloseBlockerOutputStream extends FilterOutputStream {
}
/**
- * @see java.io.OutputStream#close()
+ * {@inheritDoc}
*/
public void close() throws IOException {
try {
diff --git a/src/java/org/apache/fop/util/CommandLineLogger.java b/src/java/org/apache/fop/util/CommandLineLogger.java
index d42eadf57..beb82ab03 100644
--- a/src/java/org/apache/fop/util/CommandLineLogger.java
+++ b/src/java/org/apache/fop/util/CommandLineLogger.java
@@ -74,49 +74,49 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#isTraceEnabled()
+ * {@inheritDoc}
*/
public final boolean isTraceEnabled() {
return logLevel <= LOG_LEVEL_TRACE;
}
/**
- * @see org.apache.commons.logging.Log#isDebugEnabled()
+ * {@inheritDoc}
*/
public final boolean isDebugEnabled() {
return logLevel <= LOG_LEVEL_DEBUG;
}
/**
- * @see org.apache.commons.logging.Log#isInfoEnabled()
+ * {@inheritDoc}
*/
public final boolean isInfoEnabled() {
return logLevel <= LOG_LEVEL_INFO;
}
/**
- * @see org.apache.commons.logging.Log#isWarnEnabled()
+ * {@inheritDoc}
*/
public final boolean isWarnEnabled() {
return logLevel <= LOG_LEVEL_WARN;
}
/**
- * @see org.apache.commons.logging.Log#isErrorEnabled()
+ * {@inheritDoc}
*/
public final boolean isErrorEnabled() {
return logLevel <= LOG_LEVEL_ERROR;
}
/**
- * @see org.apache.commons.logging.Log#isFatalEnabled()
+ * {@inheritDoc}
*/
public final boolean isFatalEnabled() {
return logLevel <= LOG_LEVEL_FATAL;
}
/**
- * @see org.apache.commons.logging.Log#trace(java.lang.Object)
+ * {@inheritDoc}
*/
public final void trace(Object message) {
if (isTraceEnabled()) {
@@ -125,7 +125,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#trace(java.lang.Object, java.lang.Throwable)
+ * {@inheritDoc}
*/
public final void trace(Object message, Throwable t) {
if (isTraceEnabled()) {
@@ -134,7 +134,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#debug(java.lang.Object)
+ * {@inheritDoc}
*/
public final void debug(Object message) {
if (isDebugEnabled()) {
@@ -143,7 +143,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#debug(java.lang.Object, java.lang.Throwable)
+ * {@inheritDoc}
*/
public final void debug(Object message, Throwable t) {
if (isDebugEnabled()) {
@@ -152,7 +152,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#info(java.lang.Object)
+ * {@inheritDoc}
*/
public final void info(Object message) {
if (isInfoEnabled()) {
@@ -161,7 +161,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#info(java.lang.Object, java.lang.Throwable)
+ * {@inheritDoc}
*/
public final void info(Object message, Throwable t) {
if (isInfoEnabled()) {
@@ -170,7 +170,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#warn(java.lang.Object)
+ * {@inheritDoc}
*/
public final void warn(Object message) {
if (isWarnEnabled()) {
@@ -179,7 +179,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#warn(java.lang.Object, java.lang.Throwable)
+ * {@inheritDoc}
*/
public final void warn(Object message, Throwable t) {
if (isWarnEnabled()) {
@@ -188,7 +188,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#error(java.lang.Object)
+ * {@inheritDoc}
*/
public final void error(Object message) {
if (isErrorEnabled()) {
@@ -197,7 +197,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#error(java.lang.Object, java.lang.Throwable)
+ * {@inheritDoc}
*/
public final void error(Object message, Throwable t) {
if (isErrorEnabled()) {
@@ -206,7 +206,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#fatal(java.lang.Object)
+ * {@inheritDoc}
*/
public final void fatal(Object message) {
if (isFatalEnabled()) {
@@ -215,7 +215,7 @@ public class CommandLineLogger implements Log {
}
/**
- * @see org.apache.commons.logging.Log#fatal(java.lang.Object, java.lang.Throwable)
+ * {@inheritDoc}
*/
public final void fatal(Object message, Throwable t) {
if (isFatalEnabled()) {
diff --git a/src/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java b/src/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java
index 11ac96da8..5ad127021 100644
--- a/src/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java
+++ b/src/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java
@@ -52,12 +52,12 @@ public class DOMBuilderContentHandlerFactory implements ContentHandlerFactory {
this.domImplementation = domImplementation;
}
- /** @see org.apache.fop.util.ContentHandlerFactory#getSupportedNamespaces() */
+ /** {@inheritDoc} */
public String[] getSupportedNamespaces() {
return new String[] {namespaceURI};
}
- /** @see org.apache.fop.util.ContentHandlerFactory#createContentHandler() */
+ /** {@inheritDoc} */
public ContentHandler createContentHandler() throws SAXException {
return new Handler();
}
@@ -77,21 +77,21 @@ public class DOMBuilderContentHandlerFactory implements ContentHandlerFactory {
}
/**
- * @see org.apache.fop.util.ContentHandlerFactory.ObjectSource#getObject()
+ * {@inheritDoc}
*/
public Object getObject() {
return getDocument();
}
/**
- * @see org.apache.fop.util.ContentHandlerFactory.ObjectSource
+ * {@inheritDoc}
*/
public void setObjectBuiltListener(ObjectBuiltListener listener) {
this.obListener = listener;
}
/**
- * @see org.apache.fop.util.DelegatingContentHandler#startDocument()
+ * {@inheritDoc}
*/
public void startDocument() throws SAXException {
//Suppress startDocument() call if doc has not been set, yet. It will be done later.
@@ -101,7 +101,7 @@ public class DOMBuilderContentHandlerFactory implements ContentHandlerFactory {
}
/**
- * @see org.apache.fop.util.DelegatingContentHandler
+ * {@inheritDoc}
*/
public void startElement(String uri, String localName, String qName, Attributes atts)
throws SAXException {
@@ -125,7 +125,7 @@ public class DOMBuilderContentHandlerFactory implements ContentHandlerFactory {
}
/**
- * @see org.apache.fop.util.DelegatingContentHandler#endDocument()
+ * {@inheritDoc}
*/
public void endDocument() throws SAXException {
super.endDocument();
diff --git a/src/java/org/apache/fop/util/DataURIResolver.java b/src/java/org/apache/fop/util/DataURIResolver.java
index 4ae4be156..699659f7e 100644
--- a/src/java/org/apache/fop/util/DataURIResolver.java
+++ b/src/java/org/apache/fop/util/DataURIResolver.java
@@ -38,7 +38,7 @@ import org.apache.xmlgraphics.util.io.Base64DecodeStream;
public class DataURIResolver implements URIResolver {
/**
- * @see javax.xml.transform.URIResolver#resolve(java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public Source resolve(String href, String base) throws TransformerException {
if (href.startsWith("data:")) {
diff --git a/src/java/org/apache/fop/util/DefaultErrorListener.java b/src/java/org/apache/fop/util/DefaultErrorListener.java
index cc9d24c6e..3717d3192 100644
--- a/src/java/org/apache/fop/util/DefaultErrorListener.java
+++ b/src/java/org/apache/fop/util/DefaultErrorListener.java
@@ -41,21 +41,21 @@ public class DefaultErrorListener implements ErrorListener {
}
/**
- * @see javax.xml.transform.ErrorListener#warning(javax.xml.transform.TransformerException)
+ * {@inheritDoc}
*/
public void warning(TransformerException exc) {
log.warn(exc.toString());
}
/**
- * @see javax.xml.transform.ErrorListener#error(javax.xml.transform.TransformerException)
+ * {@inheritDoc}
*/
public void error(TransformerException exc) throws TransformerException {
throw exc;
}
/**
- * @see javax.xml.transform.ErrorListener#fatalError(javax.xml.transform.TransformerException)
+ * {@inheritDoc}
*/
public void fatalError(TransformerException exc)
throws TransformerException {
diff --git a/src/java/org/apache/fop/util/DelegatingContentHandler.java b/src/java/org/apache/fop/util/DelegatingContentHandler.java
index 75e82124e..d6c772735 100644
--- a/src/java/org/apache/fop/util/DelegatingContentHandler.java
+++ b/src/java/org/apache/fop/util/DelegatingContentHandler.java
@@ -106,7 +106,7 @@ public class DelegatingContentHandler
// ==== EntityResolver
/**
- * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
if (entityResolver != null) {
@@ -119,7 +119,7 @@ public class DelegatingContentHandler
// ==== DTDHandler
/**
- * @see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public void notationDecl(String name, String publicId, String systemId) throws SAXException {
if (dtdHandler != null) {
@@ -128,7 +128,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public void unparsedEntityDecl(String name, String publicId, String systemId,
String notationName) throws SAXException {
@@ -140,42 +140,42 @@ public class DelegatingContentHandler
// ==== ContentHandler
/**
- * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
+ * {@inheritDoc}
*/
public void setDocumentLocator(Locator locator) {
delegate.setDocumentLocator(locator);
}
/**
- * @see org.xml.sax.ContentHandler#startDocument()
+ * {@inheritDoc}
*/
public void startDocument() throws SAXException {
delegate.startDocument();
}
/**
- * @see org.xml.sax.ContentHandler#endDocument()
+ * {@inheritDoc}
*/
public void endDocument() throws SAXException {
delegate.endDocument();
}
/**
- * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public void startPrefixMapping(String prefix, String uri) throws SAXException {
delegate.startPrefixMapping(prefix, uri);
}
/**
- * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
+ * {@inheritDoc}
*/
public void endPrefixMapping(String prefix) throws SAXException {
delegate.endPrefixMapping(prefix);
}
/**
- * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ * {@inheritDoc}
*/
public void startElement(String uri, String localName, String qName,
Attributes atts) throws SAXException {
@@ -183,35 +183,35 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public void endElement(String uri, String localName, String qName) throws SAXException {
delegate.endElement(uri, localName, qName);
}
/**
- * @see org.xml.sax.ContentHandler#characters(char[], int, int)
+ * {@inheritDoc}
*/
public void characters(char[] ch, int start, int length) throws SAXException {
delegate.characters(ch, start, length);
}
/**
- * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
+ * {@inheritDoc}
*/
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
delegate.ignorableWhitespace(ch, start, length);
}
/**
- * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public void processingInstruction(String target, String data) throws SAXException {
delegate.processingInstruction(target, data);
}
/**
- * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String)
+ * {@inheritDoc}
*/
public void skippedEntity(String name) throws SAXException {
delegate.skippedEntity(name);
@@ -220,7 +220,7 @@ public class DelegatingContentHandler
// ==== LexicalHandler
/**
- * @see org.xml.sax.ext.LexicalHandler#startDTD(java.lang.String, java.lang.String, java.lang.String)
+ * {@inheritDoc}
*/
public void startDTD(String name, String publicId, String systemId) throws SAXException {
if (lexicalHandler != null) {
@@ -230,7 +230,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ext.LexicalHandler#endDTD()
+ * {@inheritDoc}
*/
public void endDTD() throws SAXException {
if (lexicalHandler != null) {
@@ -239,7 +239,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ext.LexicalHandler#startEntity(java.lang.String)
+ * {@inheritDoc}
*/
public void startEntity(String name) throws SAXException {
if (lexicalHandler != null) {
@@ -248,7 +248,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ext.LexicalHandler#endEntity(java.lang.String)
+ * {@inheritDoc}
*/
public void endEntity(String name) throws SAXException {
if (lexicalHandler != null) {
@@ -257,7 +257,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ext.LexicalHandler#startCDATA()
+ * {@inheritDoc}
*/
public void startCDATA() throws SAXException {
if (lexicalHandler != null) {
@@ -266,7 +266,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ext.LexicalHandler#endCDATA()
+ * {@inheritDoc}
*/
public void endCDATA() throws SAXException {
if (lexicalHandler != null) {
@@ -275,7 +275,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int)
+ * {@inheritDoc} int, int)
*/
public void comment(char[] ch, int start, int length) throws SAXException {
if (lexicalHandler != null) {
@@ -286,7 +286,7 @@ public class DelegatingContentHandler
// ==== ErrorHandler
/**
- * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
+ * {@inheritDoc}
*/
public void warning(SAXParseException exception) throws SAXException {
if (errorHandler != null) {
@@ -295,7 +295,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
+ * {@inheritDoc}
*/
public void error(SAXParseException exception) throws SAXException {
if (errorHandler != null) {
@@ -304,7 +304,7 @@ public class DelegatingContentHandler
}
/**
- * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
+ * {@inheritDoc}
*/
public void fatalError(SAXParseException exception) throws SAXException {
if (errorHandler != null) {
diff --git a/src/java/org/apache/fop/util/IntMap.java b/src/java/org/apache/fop/util/IntMap.java
deleted file mode 100644
index 9a931502f..000000000
--- a/src/java/org/apache/fop/util/IntMap.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-/* $Id$ */
-
-package org.apache.fop.util;
-
-/**
- * Dedicated map for storing int-to-int mappings,
- * where the key is always a positive <code>int</code>.
- *
- */
-public class IntMap {
-
- private static final int DEFAULT_CAPACITY = 256;
-
- private int[] cachedKeys;
- private int[] cachedValues;
- private Entry[] entries;
-
- private int initialCapacity = DEFAULT_CAPACITY;
- private int currentSize;
-
- /**
- * Creates an IntMap instance with an <code>initialCapacity</code>
- * of 256 mappings
- *
- */
- public IntMap() {
- this(DEFAULT_CAPACITY);
- }
-
- /**
- * Creates an IntMap instance with the supplied
- * <code>initialCapacity</code>
- *
- * @param initialCapacity the map's initial capacity
- */
- public IntMap(int initialCapacity) {
- this.initialCapacity = initialCapacity;
- initMap();
- }
-
- private void initMap() {
- this.entries = new Entry[initialCapacity];
- this.currentSize = 0;
- }
-
- /**
- * Clears the map, and re-initializes it
- */
- public void clear() {
- initMap();
- }
-
- /**
- * Checks whether a mapping for the specified key exists.
- * @param key the key to look up
- * @return true if the map contains a mapping for the specified key
- */
- public boolean containsKey(int key) {
- return (key >= 0)
- && (currentSize > 0)
- && (searchKeyIndex(key) == key);
- }
-
- /**
- *
- * @param key the key
- * @return the corresponding value; a value of 0 can
- * either mean that the key is mapped to 0
- * or that the key is not mapped at all; use
- * <code>containsKey(int)</code> to find
- * out if a mapping exists
- */
- public int get(int key) {
-
- if (key >= 0 && currentSize > 0) {
- int idx = searchKeyIndex(key);
- if (entries[idx] != null) {
- return entries[idx].mapping[1];
- } else {
- return 0;
- }
- } else {
- return 0;
- }
- }
-
- /**
- * Adds a mapping corresponding to the key-value pair
- * @param key the key for which to create the mapping
- * @param value the mapped value
- * @return the value that was previously associated with the
- * specified key; a value of 0 can mean either that
- * the key was unmapped or mapped to the value 0
- */
- public int put(int key, int value) {
- if (key >= 0) {
- ensureCapacity(key + 1);
- int keyIndex = searchKeyIndex(key);
- int retVal = 0;;
- if (entries[keyIndex] == null) {
- entries[currentSize++] = new Entry(key, value);
- cachedKeys = null;;
- } else {
- retVal = entries[keyIndex].mapping[1];
- entries[keyIndex].mapping[1] = value;
- }
- cachedValues = null;
- return retVal;
- } else {
- throw new IllegalArgumentException(
- "This map allows only positive integers as keys.");
- }
- }
-
- /**
- * Removes the mapping corresponding to the key
- * @param key the key of the mapping to be removed
- * @return the value that was associated with the given key;
- * a value of 0 can mean that the key was either
- * unmapped or mapped to the value 0
- */
- public int remove(int key) {
- if (key >= 0
- && currentSize > 0) {
- int keyIndex = searchKeyIndex(key);
- int retVal = 0;
- if (entries[keyIndex] != null
- && entries[keyIndex].mapping[0] == key) {
- retVal = entries[key].mapping[0];
- entries[key] = null;
- cachedKeys = null;
- cachedValues = null;
- currentSize--;
- }
- return retVal;
- } else {
- return 0;
- }
- }
-
- /**
- * Get an array containing the mapped keys
- * @return the keys as an array of <code>int</code>
- */
- public int[] keys() {
-
- if (currentSize > 0
- && cachedKeys == null) {
- cachedKeys = new int[currentSize];
- int keyIndex = currentSize;
- for (int i = entries.length; --i >= 0;) {
- if (entries[i] != null) {
- cachedKeys[--keyIndex] = entries[i].mapping[0];
- }
- }
- }
- return cachedKeys;
- }
-
- /**
- * Get an array containing the mapped values
- * @return the values as an array of <code>int</code>
- */
- public int[] values() {
-
- if (currentSize > 0
- && cachedValues == null) {
- cachedValues = new int[currentSize];
- int valIndex = currentSize;
- for (int i = entries.length; --i >= 0;) {
- if (entries[i] != null) {
- cachedValues[--valIndex] = entries[i].mapping[0];
- }
- }
- }
- return cachedValues;
- }
-
- /**
- * Get the size of the map (= the number of keys that are mapped)
- * @return the size of the map
- */
- public int size() {
- return currentSize;
- }
-
- private void ensureCapacity(int minCapacity) {
- if (entries.length == 0) {
- entries = new Entry[minCapacity];
- } else if (entries.length < minCapacity) {
- int newCap = entries.length + 1;
- while (newCap < minCapacity) {
- newCap += (newCap / 2);
- }
- Entry[] oldEntries = entries;
- entries = new Entry[newCap];
- System.arraycopy(oldEntries, 0, entries, 0, oldEntries.length);
- }
- }
-
- private final int searchKeyIndex(int key) {
- if (currentSize > 0) {
- int start = 0;
- int end = currentSize;
- int mid;
- while (end >= start) {
- mid = (start + end) / 2;
- if (entries[mid] == null || entries[mid].mapping[0] > key) {
- end = mid - 1;
- } else if (entries[mid].mapping[0] == key) {
- return mid;
- } else {
- start = mid + 1;
- }
- }
- return start;
- } else {
- return 0;
- }
- }
-
- private static final class Entry {
-
- protected int[] mapping;
-
- private Entry(int key, int value) {
- this.mapping = new int[]{key, value};
- }
-
- }
-}
diff --git a/src/java/org/apache/fop/util/QName.java b/src/java/org/apache/fop/util/QName.java
index 9a0a947b9..0794d3088 100644
--- a/src/java/org/apache/fop/util/QName.java
+++ b/src/java/org/apache/fop/util/QName.java
@@ -99,12 +99,12 @@ public class QName implements Serializable {
return getPrefix() != null ? getPrefix() + ':' + getLocalName() : getLocalName();
}
- /** @see java.lang.Object#hashCode() */
+ /** {@inheritDoc} */
public int hashCode() {
return this.hashCode;
}
- /** @see java.lang.Object#equals(java.lang.Object) */
+ /** {@inheritDoc} */
public boolean equals(Object obj) {
if (obj == null) {
return false;
@@ -122,7 +122,7 @@ public class QName implements Serializable {
return false;
}
- /** @see java.lang.Object#toString() */
+ /** {@inheritDoc} */
public String toString() {
return prefix != null
? (prefix + ":" + localName)
diff --git a/src/java/org/apache/fop/util/WriterOutputStream.java b/src/java/org/apache/fop/util/WriterOutputStream.java
index d1908996a..d399b60dc 100644
--- a/src/java/org/apache/fop/util/WriterOutputStream.java
+++ b/src/java/org/apache/fop/util/WriterOutputStream.java
@@ -50,21 +50,21 @@ public class WriterOutputStream extends OutputStream {
}
/**
- * @see java.io.OutputStream#close()
+ * {@inheritDoc}
*/
public void close() throws IOException {
writer.close();
}
/**
- * @see java.io.OutputStream#flush()
+ * {@inheritDoc}
*/
public void flush() throws IOException {
writer.flush();
}
/**
- * @see java.io.OutputStream#write(byte[], int, int)
+ * {@inheritDoc}
*/
public void write(byte[] buf, int offset, int length) throws IOException {
if (encoding != null) {
@@ -75,14 +75,14 @@ public class WriterOutputStream extends OutputStream {
}
/**
- * @see java.io.OutputStream#write(byte[])
+ * {@inheritDoc}
*/
public void write(byte[] buf) throws IOException {
write(buf, 0, buf.length);
}
/**
- * @see java.io.OutputStream#write(int)
+ * {@inheritDoc}
*/
public void write(int b) throws IOException {
write(new byte[] {(byte)b});
diff --git a/status.xml b/status.xml
index d155da934..7de903d8e 100644
--- a/status.xml
+++ b/status.xml
@@ -28,17 +28,29 @@
<changes>
<release version="FOP Trunk">
- <action context="code" dev="AD" type="add" fixes-bug="42785" due-to="Max Berger">
+ <action context="Code" dev="JM" type="fix">
+ AFP Renderer: Bugfix for 1 bit images where the width is not a multiple of 8.
+ </action>
+ <action context="Code" dev="MM" type="add">
+ Support for keep-together.within-line="always".
+ </action>
+ <action context="Code" dev="MM" type="fix">
+ Fixed incomplete support for Unicode Word Joiner characters (U+2060 and U+FEFF).
+ </action>
+ <action context="Code" dev="VH" type="add">
+ Add support for conditional spaces in table-cells.
+ </action>
+ <action context="Code" dev="AD" type="add" fixes-bug="42785" due-to="Max Berger">
Support alignment-adjust for images.
</action>
- <action context="code" dev="AD" type="add" fixes-bug="41044" due-to="Richard Wheeldon">
+ <action context="Code" dev="AD" type="add" fixes-bug="41044" due-to="Richard Wheeldon">
Partial application of the patch in Bugzilla 41044:
* addition of a generic PropertyCache to be used by all Property
types that can be safely canonicalized
* modified EnumProperty, StringProperty, NumberProperty, EnumNumber
and FixedLength to make use of the cache infrastructure
</action>
- <action context="code" dev="AD" type="update" fixes-bug="41656">
+ <action context="Code" dev="AD" type="update" fixes-bug="41656">
Refactoring in the fo package:
-> removal of the childNodes instance member in fop.fo.FObj
-> addition of a firstChild instance member in fop.fo.FObj
@@ -46,7 +58,7 @@
-> addition of a FONodeIterator interface in FONode + corresponding implementation in FObj
-> changed implementations of FObj.addChildNode(), .removeChild() and .getChildNodes()
</action>
- <action context="code" dev="AD" type="update" fixes-bug="42089" due-to="Adrian Cumiskey">
+ <action context="Code" dev="AD" type="update" fixes-bug="42089" due-to="Adrian Cumiskey">
Code cleanup and restructuring:
Refactoring of PageSequenceLayoutManager and provide common FObj id property use
</action>
@@ -57,7 +69,7 @@
<action context="Code" dev="JM" type="update">
Updated PDF/A-1b support according to ISO-19005-1:2005/Cor.1:2007.
</action>
- <action context="Code" dev="JM" type="add" fixes-bug="41831" due-to="Adrian Cumiskey">
+ <action context="Code" dev="JM" type="add" importance="high" fixes-bug="41831" due-to="Adrian Cumiskey">
Add support for font auto-detection (easier font configuration).
</action>
<action context="Code" dev="JM" type="update" fixes-bug="42406" due-to="Hussein Shafie">
@@ -77,6 +89,15 @@
<action context="Code" dev="JM" type="fix" fixes-bug="41434" due-to="Martin Kögler">
Fix PDF Genaration for non-ASCII compatible locales.
</action>
+ <action context="Code" dev="VH" type="fix">
+ Fix several exceptions when break-before/after is set on the first/last row of a table.
+ </action>
+ <action context="Code" dev="VH" type="fix">
+ Fix extra page break when break-before is set on both a table and its first row.
+ </action>
+ <action context="Code" dev="VH" type="fix">
+ Make keep-with-next and keep-with-previous work on fo:table.
+ </action>
<action context="Code" dev="VH, JM" type="add" importance="high" fixes-bug="36934">
Add support for the collapsing-border model in tables.
</action>
diff --git a/test/layoutengine/disabled-testcases.xml b/test/layoutengine/disabled-testcases.xml
index d81c0dc27..a7cf1a707 100644
--- a/test/layoutengine/disabled-testcases.xml
+++ b/test/layoutengine/disabled-testcases.xml
@@ -123,11 +123,6 @@
<reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=37579</reference>
</testcase>
<testcase>
- <name>keeps on inlines NYI</name>
- <file>inline_keep-together.xml</file>
- <description>Keeps are not implemented in inline-level elements, yet.</description>
- </testcase>
- <testcase>
<name>NPE for table inside an inline</name>
<file>inline_block_nested_3.xml</file>
<description>Placing a table as a child of an fo:inline produces a
diff --git a/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml b/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml
index 101e5197d..715a9364a 100755
--- a/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml
+++ b/test/layoutengine/standard-testcases/block_uax14_linebreaking.xml
@@ -112,6 +112,12 @@
<fo:block background-color="yellow" margin="0pt 0pt 3pt 0pt">
No-break-point-in-normal-dates-12/12/2006-or-fractions-12345678/67890112
</fo:block>
+ <fo:block background-color="silver" font-size="8pt" margin="3pt 0pt 0pt 0pt">
+ WJ -- Word Joiner (XB/XA)
+ </fo:block>
+ <fo:block background-color="yellow" margin="0pt 0pt 3pt 0pt">
+ Here we/&#x2060;prevent/&#x2060;any/&#x2060;breaks/&#x2060;after the/&#x2060;solidus
+ </fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
@@ -184,5 +190,9 @@
<eval expected="114460" xpath="//flow/block[27]/lineArea[1]/text/@ipd"/>
<eval expected="93380" xpath="//flow/block[27]/lineArea[2]/text/@ipd"/>
<eval expected="132860" xpath="//flow/block[27]/lineArea[3]/text/@ipd"/>
+
+ <eval expected="2" xpath="count(//flow/block[29]/lineArea)"/>
+ <eval expected="147840" xpath="//flow/block[29]/lineArea[1]/text/@ipd"/>
+ <eval expected="47800" xpath="//flow/block[29]/lineArea[2]/text/@ipd"/>
</checks>
</testcase>
diff --git a/test/layoutengine/standard-testcases/inline_keep-together.xml b/test/layoutengine/standard-testcases/inline_keep-together.xml
index 1bd82c0b8..af9317815 100644
--- a/test/layoutengine/standard-testcases/inline_keep-together.xml
+++ b/test/layoutengine/standard-testcases/inline_keep-together.xml
@@ -33,12 +33,11 @@
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
- <fo:flow flow-name="xsl-region-body" hyphenate="true">
+ <fo:flow flow-name="xsl-region-body">
<fo:block-container width="100pt" background-color="yellow">
- <fo:block>This is <fo:inline keep-together.within-line="always">BLah-blah-blah-blah!</fo:inline></fo:block>
- <fo:block>This is <fo:inline keep-together.within-line="always">Blah-blah-blah-blah!</fo:inline></fo:block>
- <fo:block>This is <fo:inline>Blah blah blah blah!</fo:inline></fo:block>
+ <fo:block keep-together.within-line="always">This is Blah blah blah blah!</fo:block>
<fo:block>This is <fo:inline keep-together.within-line="always">Blah blah blah blah!</fo:inline></fo:block>
+ <fo:block>This is <fo:wrapper keep-together.within-line="always">Blah blah blah blah!</fo:wrapper></fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
@@ -46,18 +45,15 @@
</fo>
<checks>
<!-- The layout engine should warn the user about the overflow in this case. -->
- <eval expected="This is " xpath="//flow/block[1]/block[1]/block[1]/lineArea[1]"/>
- <eval expected="BLah-blah-blah-blah!" xpath="//flow/block[1]/block[1]/block[1]/lineArea[2]"/>
+ <eval expected="This is Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[1]/lineArea[1]"/>
<!-- The layout engine should warn the user about the overflow in this case. -->
- <eval expected="This is " xpath="//flow/block[1]/block[1]/block[2]/lineArea[1]"/>
- <eval expected="Blah-blah-blah-blah!" xpath="//flow/block[1]/block[1]/block[2]/lineArea[2]"/>
-
- <eval expected="This is Blah blah " xpath="//flow/block[1]/block[1]/block[3]/lineArea[1]"/>
- <eval expected="blah blah!" xpath="//flow/block[1]/block[1]/block[3]/lineArea[2]"/>
+ <eval expected="This is" xpath="//flow/block[1]/block[1]/block[2]/lineArea[1]"/>
+ <eval expected="Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[2]/lineArea[2]"/>
<!-- The layout engine should warn the user about the overflow in this case. -->
- <eval expected="This is " xpath="//flow/block[1]/block[1]/block[4]/lineArea[1]"/>
- <eval expected="Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[4]/lineArea[2]"/>
+ <eval expected="This is" xpath="//flow/block[1]/block[1]/block[3]/lineArea[1]"/>
+ <eval expected="Blah blah blah blah!" xpath="//flow/block[1]/block[1]/block[3]/lineArea[2]"/>
+
</checks>
</testcase>
diff --git a/test/layoutengine/standard-testcases/page-breaking_5.xml b/test/layoutengine/standard-testcases/page-breaking_5.xml
index ffd337c92..f0067d004 100644
--- a/test/layoutengine/standard-testcases/page-breaking_5.xml
+++ b/test/layoutengine/standard-testcases/page-breaking_5.xml
@@ -41,10 +41,10 @@
</fo:layout-master-set>
<fo:page-sequence master-reference="master">
<fo:flow flow-name="xsl-region-body">
- <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
- <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
- <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
- <fo:block background-color="orange" keep-together="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
+ <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
+ <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
+ <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
+ <fo:block background-color="orange" keep-together.within-page="always">Apache FOP is a great tool to create PDF documents with.</fo:block>
<fo:block background-color="yellow">last line in new block</fo:block>
</fo:flow>
</fo:page-sequence>