You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2009/10/23 19:27:17 UTC
svn commit: r829138 [1/2] - in /xmlgraphics/fop/branches/Temp_Accessibility:
./ lib/ src/documentation/content/xdocs/trunk/ src/java/META-INF/services/
src/java/org/apache/fop/afp/ src/java/org/apache/fop/afp/goca/
src/java/org/apache/fop/afp/ioca/ src...
Author: vhennebert
Date: Fri Oct 23 17:27:14 2009
New Revision: 829138
URL: http://svn.apache.org/viewvc?rev=829138&view=rev
Log:
Merged changes from Trunk up to revision 829121
Added:
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java
- copied unchanged from r829121, xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/AttributeQualifierTriplet.java
- copied unchanged from r829121, xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/AttributeQualifierTriplet.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java
- copied unchanged from r829121, xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/Triplet.java
- copied unchanged from r829121, xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/triplets/Triplet.java
xmlgraphics/fop/branches/Temp_Accessibility/test/layoutengine/standard-testcases/flow_changing-ipd_no-restartable.xml
- copied unchanged from r829121, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/flow_changing-ipd_no-restartable.xml
xmlgraphics/fop/branches/Temp_Accessibility/test/layoutengine/standard-testcases/flow_changing-ipd_table-after-break.xml
- copied unchanged from r829121, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/flow_changing-ipd_table-after-break.xml
Modified:
xmlgraphics/fop/branches/Temp_Accessibility/ (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/build.xml
xmlgraphics/fop/branches/Temp_Accessibility/lib/xmlgraphics-commons-1.4svn.jar
xmlgraphics/fop/branches/Temp_Accessibility/src/documentation/content/xdocs/trunk/anttask.xml
xmlgraphics/fop/branches/Temp_Accessibility/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPDataObjectFactory.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPPaintingState.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageContent.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageSegment.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageObject.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/TagLogicalElement.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/InputHandler.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FObj.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/CIDSubset.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/Font.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/KnuthBox.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/KnuthElement.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/KnuthGlue.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/PageProvider.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/pdf/PDFFontNonBase14.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPCustomizable.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPImageHandlerRawStream.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPRenderer.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFContentHandler.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFPainter.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/IFRenderer.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/tools/anttasks/Fop.java
xmlgraphics/fop/branches/Temp_Accessibility/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java (props changed)
xmlgraphics/fop/branches/Temp_Accessibility/status.xml
xmlgraphics/fop/branches/Temp_Accessibility/test/java/org/apache/fop/layoutengine/ElementListCheck.java
xmlgraphics/fop/branches/Temp_Accessibility/test/java/org/apache/fop/util/ElementListUtilsTestCase.java
Propchange: xmlgraphics/fop/branches/Temp_Accessibility/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 23 17:27:14 2009
@@ -1,4 +1,4 @@
/xmlgraphics/fop/branches/Temp_AFPGOCAResources:630874-721418
/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign:745924-746655
/xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
-/xmlgraphics/fop/trunk:603620-824832
+/xmlgraphics/fop/trunk:603620-829121
Modified: xmlgraphics/fop/branches/Temp_Accessibility/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/build.xml?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/build.xml (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/build.xml Fri Oct 23 17:27:14 2009
@@ -156,10 +156,14 @@
<property name="fo.examples.userconfig" value="conf/fop.xconf"/>
<property name="fo.examples.include" value="**/*.fo"/>
<property name="fo.examples.force" value="false"/>
+ <property name="xml.tests.include" value="**/*.xml"/>
+ <property name="xml.tests.force" value="false"/>
+ <property name="xml.tests.userconfig" value="conf/fop.xconf"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="user.hyph.dir" value="${basedir}/hyph"/>
<property name="unidata.dir" value="${basedir}/UNIDATA"/>
<property name="hyph.stacksize" value="512k"/>
+ <property name="test.dir" value="${basedir}/test"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.gensrc.dir" value="${build.dir}/gensrc"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
@@ -167,9 +171,11 @@
<property name="build.codegen-classes.dir" value="${build.dir}/codegen-classes"/>
<property name="build.javadocs.dir" value="${build.dir}/javadocs"/>
<property name="build.examples.dir" value="${build.dir}/examples"/>
+ <property name="build.tests.dir" value="${build.dir}/tests"/>
<property name="build.viewer.resources.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/resources"/>
<property name="build.viewer.images.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/images"/>
<property name="build.property.examples.mime.type" value="application/pdf"/>
+ <property name="build.property.tests.mime.type" value="application/pdf"/>
<!--property name="layoutengine.disabled" value="test/layoutengine/disabled-testcases.txt"/-->
<!--property name="fotree.disabled" value="test/fotree/disabled-testcases.txt"/-->
<property name="layoutengine.disabled" value="test/layoutengine/disabled-testcases.xml"/>
@@ -755,7 +761,7 @@
<mkdir dir="${build.dir}/test-gensrc"/>
<mkdir dir="${junit.reports.dir}"/>
<javac destdir="${build.dir}/test-classes" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}">
- <src path="${basedir}/test/java"/>
+ <src path="${test.dir}/java"/>
<patternset refid="test-sources"/>
<classpath>
<path refid="libs-build-tools-classpath"/>
@@ -765,19 +771,19 @@
</classpath>
</javac>
<copy todir="${build.dir}/test-classes">
- <fileset dir="${basedir}/test/java">
+ <fileset dir="${test.dir}/java">
<include name="**/*.xsl"/>
</fileset>
</copy>
</target>
<target name="junit-compile-copy-resources" if="junit.present">
<eventResourceGenerator modelfile="${build.dir}/test-gensrc/org/apache/fop/events/test-event-model.xml">
- <fileset dir="${basedir}/test/java">
+ <fileset dir="${test.dir}/java">
<include name="**/*.java"/>
</fileset>
</eventResourceGenerator>
<copy todir="${build.dir}/test-classes">
- <fileset dir="${basedir}/test/java">
+ <fileset dir="${test.dir}/java">
<include name="META-INF/**"/>
<include name="**/*.xml"/>
</fileset>
@@ -1336,9 +1342,9 @@
</jar>
</target>
<!-- =================================================================== -->
-<!-- Generate example PDFs -->
+<!-- Generate examples -->
<!-- =================================================================== -->
- <target name="examples" depends="package" description="Generates example PDF files">
+ <target name="examples" depends="package" description="Generates the example files">
<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="libs-run-classpath"/>
<mkdir dir="${build.examples.dir}"/>
<fop format="${build.property.examples.mime.type}" outdir="${build.examples.dir}" messagelevel="debug" basedir="${fo.examples.dir}" userconfig="${fo.examples.userconfig}" force="${fo.examples.force}">
@@ -1347,6 +1353,20 @@
</fileset>
</fop>
</target>
+
+<!-- =================================================================== -->
+<!-- Generate unit tests -->
+<!-- =================================================================== -->
+ <target name="tests" depends="package" description="Generates the test files">
+ <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="libs-run-classpath"/>
+ <mkdir dir="${build.tests.dir}"/>
+ <fop format="${build.property.tests.mime.type}" xsltfile="${test.dir}/layoutengine/testcase2fo.xsl" outdir="${build.tests.dir}" messagelevel="debug" basedir="${test.dir}" userconfig="${fo.examples.userconfig}" force="${xml.tests.force}">
+ <fileset dir="${test.dir}">
+ <include name="${xml.tests.include}"/>
+ </fileset>
+ </fop>
+ </target>
+
<!-- =================================================================== -->
<!-- Helper task to generate source files that have already been -->
<!-- checked into CVS. For these files, CVS version is the official one -->
Modified: xmlgraphics/fop/branches/Temp_Accessibility/lib/xmlgraphics-commons-1.4svn.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/lib/xmlgraphics-commons-1.4svn.jar?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
Binary files - no diff available.
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/documentation/content/xdocs/trunk/anttask.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/documentation/content/xdocs/trunk/anttask.xml?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/documentation/content/xdocs/trunk/anttask.xml (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/documentation/content/xdocs/trunk/anttask.xml Fri Oct 23 17:27:14 2009
@@ -69,6 +69,16 @@
<td>Yes, if no fileset nested element is used</td>
</tr>
<tr>
+ <td>xmlfile</td>
+ <td>XML input file</td>
+ <td>Yes, if no fofile is specified</td>
+ </tr>
+ <tr>
+ <td>xsltfile</td>
+ <td>XSLT input file</td>
+ <td>Yes, if no fofile is specified</td>
+ </tr>
+ <tr>
<td>outfile</td>
<td>Output filename</td>
<td>Yes, when fofile is used. (This attribute is not valid for filesets.)</td>
@@ -196,6 +206,31 @@
</fop>
</target>
]]></source>
+ <p>
+ The following example transforms and converts a single XML and XSLT file to an AFP document:
+ </p>
+ <source><![CDATA[
+<target name="generate-afp-from-transform" description="Generates a single AFP file from an XSLT stylesheet">
+ <fop format="application/x-afp"
+ xmlfile="c:\working\foDirectory\Document.xml"
+ xsltfile="c:\working\foDirectory\Document.xslt"
+ outfile="c:\working\afpDirectory\Document.afp" />
+</target>
+ ]]></source>
+ <p>
+ This example transforms and converts all XML files within an entire directory to PostScript:
+ </p>
+ <source><![CDATA[
+<target name="generate-multiple-ps-from-transform" description="Generates multiple PostScript files using an XSLT stylesheet">
+ <fop format="application/postscript"
+ xsltfile="c:\working\foDirectory\Document.xslt"
+ outdir="${build.dir}" messagelevel="debug">
+ <fileset dir="${test.dir}">
+ <include name="*.xml"/>
+ </fileset>
+ </fop>
+</target>
+ ]]></source>
</section>
</body>
</document>
Propchange: xmlgraphics/fop/branches/Temp_Accessibility/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 23 17:27:14 2009
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:699793-824832
+/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:699793-829121
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPDataObjectFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPDataObjectFactory.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPDataObjectFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPDataObjectFactory.java Fri Oct 23 17:27:14 2009
@@ -24,6 +24,7 @@
import org.apache.xmlgraphics.image.codec.tiff.TIFFImage;
import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
+import org.apache.fop.afp.ioca.IDEStructureParameter;
import org.apache.fop.afp.ioca.ImageContent;
import org.apache.fop.afp.modca.AbstractDataObject;
import org.apache.fop.afp.modca.AbstractNamedAFPObject;
@@ -113,12 +114,35 @@
}
}
- if (imageObjectInfo.isColor()) {
- imageObj.setIDESize((byte) 24);
- } else {
- imageObj.setIDESize((byte) imageObjectInfo.getBitsPerPixel());
+ ImageContent content = imageObj.getImageSegment().getImageContent();
+ int bitsPerPixel = imageObjectInfo.getBitsPerPixel();
+ imageObj.setIDESize((byte) bitsPerPixel);
+ IDEStructureParameter ideStruct;
+ switch (bitsPerPixel) {
+ case 1:
+ //Skip IDE Structure Parameter
+ break;
+ case 4:
+ case 8:
+ ideStruct = content.needIDEStructureParameter();
+ ideStruct.setBitsPerComponent(new int[] {bitsPerPixel});
+ break;
+ case 24:
+ ideStruct = content.needIDEStructureParameter();
+ ideStruct.setDefaultRGBColorModel();
+ break;
+ case 32:
+ ideStruct = content.needIDEStructureParameter();
+ ideStruct.setDefaultCMYKColorModel();
+ break;
+ default:
+ throw new IllegalArgumentException("Unsupported number of bits per pixel: "
+ + bitsPerPixel);
+ }
+ if (imageObjectInfo.isSubtractive()) {
+ ideStruct = content.needIDEStructureParameter();
+ ideStruct.setSubtractive(imageObjectInfo.isSubtractive());
}
- imageObj.setSubtractive(imageObjectInfo.isSubtractive());
imageObj.setData(imageObjectInfo.getData());
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPPaintingState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPPaintingState.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/AFPPaintingState.java Fri Oct 23 17:27:14 2009
@@ -46,8 +46,10 @@
/** color image support */
private boolean colorImages = false;
- /** images are supported in this AFP environment */
+ /** true if certain image formats may be embedded unchanged in their native format. */
private boolean nativeImagesSupported = false;
+ /** true if CMYK images (requires IOCA FS45 suppport on the target platform) may be generated */
+ private boolean cmykImagesSupported;
/** default value for image depth */
private int bitsPerPixel = 8;
@@ -64,6 +66,7 @@
/** a unit converter */
private final transient AFPUnitConverter unitConv = new AFPUnitConverter(this);
+
/**
* Sets the rotation to be used for portrait pages, valid values are 0
* (default), 90, 180, 270.
@@ -186,6 +189,24 @@
}
/**
+ * Controls whether CMYK images (IOCA FS45) are enabled. By default, support is disabled
+ * for wider compatibility. When disabled, any CMYK image is converted to the selected
+ * color format.
+ * @param value true to enabled CMYK images
+ */
+ public void setCMYKImagesSupported(boolean value) {
+ this.cmykImagesSupported = value;
+ }
+
+ /**
+ * Indicates whether CMYK images (IOCA FS45) are enabled.
+ * @return true if IOCA FS45 is enabled
+ */
+ public boolean isCMYKImagesSupported() {
+ return this.cmykImagesSupported;
+ }
+
+ /**
* Sets the output/device resolution
*
* @param resolution
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java Fri Oct 23 17:27:14 2009
@@ -45,7 +45,7 @@
*/
public GraphicsCharacterString(String str, int x, int y) {
super(x, y);
- this.str = truncate(str);
+ this.str = truncate(str, MAX_STR_LEN);
}
/**
@@ -57,7 +57,7 @@
*/
public GraphicsCharacterString(String str) {
super(null);
- this.str = truncate(str);
+ this.str = truncate(str, MAX_STR_LEN);
}
/** {@inheritDoc} */
@@ -83,20 +83,6 @@
}
/**
- * Truncates the string as necessary
- *
- * @param str a character string
- * @return a possibly truncated string
- */
- private String truncate(String str) {
- if (str.length() > MAX_STR_LEN) {
- str = str.substring(0, MAX_STR_LEN);
- log.warn("truncated character string, longer than " + MAX_STR_LEN + " chars");
- }
- return str;
- }
-
- /**
* Returns the text string as an encoded byte array
*
* @return the text string as an encoded byte array
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageContent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageContent.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageContent.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageContent.java Fri Oct 23 17:27:14 2009
@@ -56,21 +56,18 @@
/** the image size parameter */
private ImageSizeParameter imageSizeParameter = null;
+ /** the IDE Structure parameter */
+ private IDEStructureParameter ideStructureParameter = null;
+
/** the image encoding */
private byte encoding = (byte)0x03;
- /** the image ide size */
- private byte size = 1;
+ /** the image IDE (Image Data Element, Sample) size */
+ private byte ideSize = 1;
/** the image compression */
private byte compression = (byte)0xC0;
- /** the image color model */
- private byte colorModel = (byte)0x01;
-
- /** additive/subtractive setting for ASFLAG */
- private boolean subtractive = false;
-
/** the image data */
private byte[] data;
@@ -90,6 +87,34 @@
}
/**
+ * Sets the IDE Structure parameter.
+ * @param parameter the IDE Structure parameter
+ */
+ public void setIDEStructureParameter(IDEStructureParameter parameter) {
+ this.ideStructureParameter = parameter;
+ }
+
+ /**
+ * Returns the (optional) IDE Structure parameter
+ * @return the IDE Structure parameter or null if none is set
+ */
+ public IDEStructureParameter getIDEStructureParameter() {
+ return this.ideStructureParameter;
+ }
+
+ /**
+ * Returns the (optional) IDE Structure parameter. If none is set an instance is prepared
+ * with defaults for a bi-level image.
+ * @return the IDE Structure parameter
+ */
+ public IDEStructureParameter needIDEStructureParameter() {
+ if (this.ideStructureParameter == null) {
+ setIDEStructureParameter(new IDEStructureParameter());
+ }
+ return getIDEStructureParameter();
+ }
+
+ /**
* Sets the image encoding.
*
* @param enc The image encoding.
@@ -113,24 +138,26 @@
* @param s The IDE size.
*/
public void setImageIDESize(byte s) {
- this.size = s;
+ this.ideSize = s;
}
/**
* Sets the image IDE color model.
*
* @param color the IDE color model.
+ * @deprecated use {@link #setIDEStructureParameter(IDEStructureParameter)} instead
*/
public void setImageIDEColorModel(byte color) {
- this.colorModel = color;
+ needIDEStructureParameter().setColorModel(color);
}
/**
* Set either additive or subtractive mode (used for ASFLAG).
* @param subtractive true for subtractive mode, false for additive mode
+ * @deprecated use {@link #setIDEStructureParameter(IDEStructureParameter)} instead
*/
public void setSubtractive(boolean subtractive) {
- this.subtractive = subtractive;
+ needIDEStructureParameter().setSubtractive(subtractive);
}
/**
@@ -155,10 +182,12 @@
os.write(getImageIDESizeParameter());
- boolean useFS10 = (this.size == 1);
- if (!useFS10) {
- os.write(getIDEStructureParameter());
+ if (getIDEStructureParameter() != null) {
+ getIDEStructureParameter().writeToStream(os);
+ }
+ boolean useFS10 = (this.ideSize == 1);
+ if (!useFS10) {
os.write(getExternalAlgorithmParameter());
}
@@ -243,58 +272,15 @@
* @return byte[] The data stream.
*/
private byte[] getImageIDESizeParameter() {
- if (size != 1) {
+ if (ideSize != 1) {
final byte[] ideSizeData = new byte[] {
(byte)0x96, // ID
0x01, // Length
- size};
+ ideSize};
return ideSizeData;
} else {
return new byte[0];
}
}
- /**
- * Helper method to return the external algorithm parameter.
- *
- * @return byte[] The data stream.
- */
- private byte[] getIDEStructureParameter() {
- byte flags = 0x00;
- if (subtractive) {
- flags |= 1 << 7;
- }
- if (colorModel != 0 && size == 24) {
- final byte bits = (byte)(size / 3);
- final byte[] ideStructData = new byte[] {
- (byte)0x9B, // ID
- 0x00, // Length
- flags, // FLAGS
- colorModel, // COLOR MODEL
- 0x00, // Reserved
- 0x00, // Reserved
- 0x00, // Reserved
- bits,
- bits,
- bits,
- };
- ideStructData[1] = (byte)(ideStructData.length - 2);
- return ideStructData;
- } else if (size == 1) {
- final byte[] ideStructData = new byte[] {
- (byte)0x9B, // ID
- 0x00, // Length
- flags, // FLAGS
- colorModel, // COLOR MODEL
- 0x00, // Reserved
- 0x00, // Reserved
- 0x00, // Reserved
- 0x01
- };
- ideStructData[1] = (byte)(ideStructData.length - 2);
- return ideStructData;
- }
- return new byte[0];
- }
-
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageSegment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageSegment.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageSegment.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/ioca/ImageSegment.java Fri Oct 23 17:27:14 2009
@@ -56,7 +56,11 @@
this.factory = factory;
}
- private ImageContent getImageContent() {
+ /**
+ * Returns the image content object associated with this image segment.
+ * @return the image content
+ */
+ public ImageContent getImageContent() {
if (imageContent == null) {
this.imageContent = factory.createImageContent();
}
@@ -108,6 +112,7 @@
* Sets the image IDE color model.
*
* @param colorModel the IDE color model.
+ * @deprecated Use {@link IDEStructureParameter#setColorModel(byte)} instead.
*/
public void setIDEColorModel(byte colorModel) {
getImageContent().setImageIDEColorModel(colorModel);
@@ -116,6 +121,7 @@
/**
* Set either additive or subtractive mode (used for ASFLAG).
* @param subtractive true for subtractive mode, false for additive mode
+ * @deprecated Use {@link IDEStructureParameter#setSubtractive(boolean)} instead.
*/
public void setSubtractive(boolean subtractive) {
getImageContent().setSubtractive(subtractive);
@@ -124,7 +130,7 @@
/**
* Set the data image data.
*
- * @param data the image data
+ * @param imageData the image data
*/
public void setData(byte[] imageData) {
getImageContent().setImageData(imageData);
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java Fri Oct 23 17:27:14 2009
@@ -43,7 +43,7 @@
/** the structured field class id */
protected static final byte SF_CLASS = (byte)0xD3;
- private static final byte[] SF_HEADER = new byte[] {
+ protected static final byte[] SF_HEADER = new byte[] {
0x5A, // Structured field identifier
0x00, // Length byte 1
0x10, // Length byte 2
@@ -177,6 +177,21 @@
}
}
+ /**
+ * Truncates the string as necessary
+ *
+ * @param str a character string
+ * @param maxLength the maximum length allowed for the string
+ * @return a possibly truncated string
+ */
+ protected String truncate(String str, int maxLength) {
+ if (str.length() > maxLength) {
+ str = str.substring(0, maxLength);
+ log.warn("truncated character string '" + str + "', longer than " + maxLength + " chars");
+ }
+ return str;
+ }
+
/** structured field type codes */
public interface Type {
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java Fri Oct 23 17:27:14 2009
@@ -27,9 +27,12 @@
import org.apache.fop.afp.modca.Registry.ObjectType;
import org.apache.fop.afp.modca.triplets.AbstractTriplet;
+import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet;
+import org.apache.fop.afp.modca.triplets.AttributeValueTriplet;
import org.apache.fop.afp.modca.triplets.CommentTriplet;
import org.apache.fop.afp.modca.triplets.FullyQualifiedNameTriplet;
import org.apache.fop.afp.modca.triplets.ObjectClassificationTriplet;
+import org.apache.fop.afp.modca.triplets.Triplet;
/**
* A MODCA structured object base class providing support for Triplets
@@ -37,7 +40,7 @@
public class AbstractTripletStructuredObject extends AbstractStructuredObject {
/** list of object triplets */
- protected List/*<AbstractTriplet>*/ triplets = new java.util.ArrayList/*<AbstractTriplet>*/();
+ protected List/*<Triplet>*/ triplets = new java.util.ArrayList/*<Triplet>*/();
/**
* Returns the triplet data length
@@ -109,7 +112,7 @@
*
* @param triplet the triplet to add
*/
- protected void addTriplet(AbstractTriplet triplet) {
+ protected void addTriplet(Triplet triplet) {
triplets.add(triplet);
}
@@ -130,7 +133,7 @@
}
/**
- * Sets the fully qualified name of this resource
+ * Sets the fully qualified name of this structured field
*
* @param fqnType the fully qualified name type of this resource
* @param fqnFormat the fully qualified name format of this resource
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java Fri Oct 23 17:27:14 2009
@@ -79,6 +79,8 @@
data[18] = ysize[0];
data[19] = ysize[1];
data[20] = ysize[2];
+
+ os.write(data);
}
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java Fri Oct 23 17:27:14 2009
@@ -31,6 +31,7 @@
public static final byte FUNCTION_SET_FS10 = 0x0A;
public static final byte FUNCTION_SET_FS11 = 0x0B;
+ public static final byte FUNCTION_SET_FS45 = 45;
private byte functionSet = FUNCTION_SET_FS11; // FCNSET = IOCA FS 11
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageObject.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageObject.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/ImageObject.java Fri Oct 23 17:27:14 2009
@@ -24,9 +24,12 @@
import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.xmlgraphics.util.MimeConstants;
+
import org.apache.fop.afp.AFPDataObjectInfo;
import org.apache.fop.afp.AFPImageObjectInfo;
import org.apache.fop.afp.Factory;
+import org.apache.fop.afp.ioca.IDEStructureParameter;
import org.apache.fop.afp.ioca.ImageSegment;
/**
@@ -50,7 +53,11 @@
super(factory, name);
}
- private ImageSegment getImageSegment() {
+ /**
+ * Returns the image segment object associated with this image object.
+ * @return the image segment
+ */
+ public ImageSegment getImageSegment() {
if (imageSegment == null) {
this.imageSegment = factory.createImageSegment();
}
@@ -71,6 +78,8 @@
= factory.createImageDataDescriptor(dataWidth, dataHeight, dataWidthRes, dataHeightRes);
if (imageObjectInfo.getBitsPerPixel() == 1) {
imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS10);
+ } else if (MimeConstants.MIME_AFP_IOCA_FS45.equals(imageObjectInfo.getMimeType())) {
+ imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS45);
}
getObjectEnvironmentGroup().setDataDescriptor(imageDataDescriptor);
getObjectEnvironmentGroup().setMapImageObject(
@@ -110,6 +119,7 @@
* Sets the image IDE color model.
*
* @param colorModel the IDE color model.
+ * @deprecated Use {@link IDEStructureParameter#setColorModel(byte)} instead.
*/
public void setIDEColorModel(byte colorModel) {
getImageSegment().setIDEColorModel(colorModel);
@@ -118,6 +128,7 @@
/**
* Set either additive or subtractive mode (used for ASFLAG).
* @param subtractive true for subtractive mode, false for additive mode
+ * @deprecated Use {@link IDEStructureParameter#setSubtractive(boolean)} instead.
*/
public void setSubtractive(boolean subtractive) {
getImageSegment().setSubtractive(subtractive);
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/TagLogicalElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/TagLogicalElement.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/TagLogicalElement.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/TagLogicalElement.java Fri Oct 23 17:27:14 2009
@@ -21,9 +21,10 @@
import java.io.IOException;
import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import org.apache.fop.afp.AFPConstants;
+import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet;
+import org.apache.fop.afp.modca.triplets.AttributeValueTriplet;
+import org.apache.fop.afp.modca.triplets.FullyQualifiedNameTriplet;
import org.apache.fop.afp.util.BinaryUtils;
/**
@@ -45,7 +46,7 @@
* effect on the appearance of a document when it is presented.
* <p/>
*/
-public class TagLogicalElement extends AbstractAFPObject {
+public class TagLogicalElement extends AbstractTripletStructuredObject {
/**
* Name of the key, used within the TLE
@@ -75,77 +76,43 @@
this.tleID = tleID;
}
- /** {@inheritDoc} */
- public void writeToStream(OutputStream os) throws IOException {
+ /**
+ * Sets the attribute value of this structured field
+ *
+ * @param value the attribute value
+ */
+ public void setAttributeValue(String value) {
+ addTriplet(new AttributeValueTriplet(value));
+ }
- // convert name and value to ebcdic
- byte[] tleByteName = null;
- byte[] tleByteValue = null;
- try {
- tleByteName = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
- tleByteValue = value.getBytes(AFPConstants.EBCIDIC_ENCODING);
- } catch (UnsupportedEncodingException usee) {
- tleByteName = name.getBytes();
- tleByteValue = value.getBytes();
- log.warn(
- "Constructor:: UnsupportedEncodingException translating the name "
- + name);
- }
-
- byte[] data = new byte[27 + tleByteName.length + tleByteValue.length];
-
- data[0] = 0x5A;
- // Set the total record length
- byte[] rl1
- = BinaryUtils.convert(26 + tleByteName.length + tleByteValue.length, 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) Type.ATTRIBUTE;
- data[5] = (byte) Category.PROCESS_ELEMENT;
-
- data[6] = 0x00; // Reserved
- data[7] = 0x00; // Reserved
- data[8] = 0x00; // Reserved
-
- //Use 2 triplets, attribute name and value (the key for indexing)
-
- byte[] rl2 = BinaryUtils.convert(tleByteName.length + 4, 1);
- data[9] = rl2[0]; // length of the triplet, including this field
- data[10] = 0x02; //Identifies it as a FQN triplet
- data[11] = 0x0B; // GID format
- data[12] = 0x00;
-
- // write out TLE name
- int pos = 13;
- for (int i = 0; i < tleByteName.length; i++) {
- data[pos++] = tleByteName[i];
- }
-
- byte[] rl3 = BinaryUtils.convert(tleByteValue.length + 4, 1);
- data[pos++] = rl3[0]; // length of the triplet, including this field
- data[pos++] = 0x36; //Identifies the triplet, attribute value
- data[pos++] = 0x00; // Reserved
- data[pos++] = 0x00; // Reserved
-
- for (int i = 0; i < tleByteValue.length; i++) {
- data[pos++] = tleByteValue[i];
- }
- // attribute qualifier
- data[pos++] = 0x0A;
- data[pos++] = (byte)0x80;
- byte[] id = BinaryUtils.convert(tleID, 4);
- for (int i = 0; i < id.length; i++) {
- data[pos++] = id[i];
- }
- byte[] level = BinaryUtils.convert(1, 4);
- for (int i = 0; i < level.length; i++) {
- data[pos++] = level[i];
- }
+ /**
+ * Sets the attribute qualifier of this structured field
+ *
+ * @param seqNumber the attribute sequence number
+ * @param levNumber the attribute level number
+ */
+ public void setAttributeQualifier(int seqNumber, int levNumber) {
+ addTriplet(new AttributeQualifierTriplet(seqNumber, levNumber));
+ }
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ setFullyQualifiedName(
+ FullyQualifiedNameTriplet.TYPE_ATTRIBUTE_GID,
+ FullyQualifiedNameTriplet.FORMAT_CHARSTR,
+ name);
+ setAttributeQualifier(tleID, 1);
+ setAttributeValue(value);
+
+ byte[] data = new byte[SF_HEADER.length];
+ copySF(data, Type.ATTRIBUTE, Category.PROCESS_ELEMENT);
+
+ int tripletDataLength = getTripletDataLength();
+ byte[] l = BinaryUtils.convert(data.length + tripletDataLength - 1, 2);
+ data[1] = l[0];
+ data[2] = l[1];
os.write(data);
+
+ writeTriplets(os);
}
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java Fri Oct 23 17:27:14 2009
@@ -19,70 +19,12 @@
package org.apache.fop.afp.modca.triplets;
-import org.apache.fop.afp.Streamable;
-import org.apache.fop.afp.StructuredData;
+import org.apache.fop.afp.modca.AbstractAFPObject;
/**
* A simple implementation of a MOD:CA triplet
*/
-public abstract class AbstractTriplet implements Streamable, StructuredData {
- public static final byte CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER = 0x01;
-
- /** Triplet identifiers */
- public static final byte FULLY_QUALIFIED_NAME = 0x02;
- public static final byte MAPPING_OPTION = 0x04;
- public static final byte OBJECT_CLASSIFICATION = 0x10;
- public static final byte MODCA_INTERCHANGE_SET = 0x18;
- public static final byte FONT_DESCRIPTOR_SPECIFICATION = 0x1F;
- public static final byte OBJECT_FUNCTION_SET_SPECIFICATION = 0x21;
- public static final byte EXTENDED_RESOURCE_LOCAL_IDENTIFIER = 0x22;
- public static final byte RESOURCE_LOCAL_IDENTIFIER = 0x24;
- public static final byte RESOURCE_SECTION_NUMBER = 0x25;
- public static final byte CHARACTER_ROTATION = 0x26;
- public static final byte OBJECT_BYTE_OFFSET = 0x2D;
- public static final byte ATTRIBUTE_VALUE = 0x36;
- public static final byte DESCRIPTOR_POSITION = 0x43;
- public static final byte MEDIA_EJECT_CONTROL = 0x45;
- public static final byte PAGE_OVERLAY_CONDITIONAL_PROCESSING = 0x46;
- public static final byte RESOURCE_USAGE_ATTRIBUTE = 0x47;
- public static final byte MEASUREMENT_UNITS = 0x4B;
- public static final byte OBJECT_AREA_SIZE = 0x4C;
- public static final byte AREA_DEFINITION = 0x4D;
- public static final byte COLOR_SPECIFICATION = 0x4E;
- public static final byte ENCODING_SCHEME_ID = 0x50;
- public static final byte MEDIUM_MAP_PAGE_NUMBER = 0x56;
- public static final byte OBJECT_BYTE_EXTENT = 0x57;
- public static final byte OBJECT_STRUCTURED_FIELD_OFFSET = 0x58;
- public static final byte OBJECT_STRUCTURED_FIELD_EXTENT = 0x59;
- public static final byte OBJECT_OFFSET = 0x5A;
- public static final byte FONT_HORIZONTAL_SCALE_FACTOR = 0x5D;
- public static final byte OBJECT_COUNT = 0x5E;
- public static final byte OBJECT_DATE_AND_TIMESTAMP = 0x62;
- public static final byte COMMENT = 0x65;
- public static final byte MEDIUM_ORIENTATION = 0x68;
- public static final byte RESOURCE_OBJECT_INCLUDE = 0x6C;
- public static final byte PRESENTATION_SPACE_RESET_MIXING = 0x70;
- public static final byte PRESENTATION_SPACE_MIXING_RULE = 0x71;
- public static final byte UNIVERSAL_DATE_AND_TIMESTAMP = 0x72;
- public static final byte TONER_SAVER = 0x74;
- public static final byte COLOR_FIDELITY = 0x75;
- public static final byte FONT_FIDELITY = 0x78;
- public static final byte ATTRIBUTE_QUALIFIER = (byte)0x80;
- public static final byte PAGE_POSITION_INFORMATION = (byte)0x81;
- public static final byte PARAMETER_VALUE = (byte)0x82;
- public static final byte PRESENTATION_CONTROL = (byte)0x83;
- public static final byte FONT_RESOLUTION_AND_METRIC_TECHNOLOGY = (byte)0x84;
- public static final byte FINISHING_OPERATION = (byte)0x85;
- public static final byte TEXT_FIDELITY = (byte)0x86;
- public static final byte MEDIA_FIDELITY = (byte)0x87;
- public static final byte FINISHING_FIDELITY = (byte)0x88;
- public static final byte DATA_OBJECT_FONT_DESCRIPTOR = (byte)0x8B;
- public static final byte LOCALE_SELECTOR = (byte)0x8C;
- public static final byte UP3I_FINISHING_OPERATION = (byte)0x8E;
- public static final byte COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR = (byte)0x91;
- public static final byte RENDERING_INTENT = (byte)0x95;
- public static final byte CMR_TAG_FIDELITY = (byte)0x96;
- public static final byte DEVICE_APPEARANCE = (byte)0x97;
+public abstract class AbstractTriplet extends AbstractAFPObject implements Triplet {
/** the triplet identifier */
protected final byte id;
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/CommandLineOptions.java Fri Oct 23 17:27:14 2009
@@ -109,6 +109,8 @@
private boolean useStdIn = false;
/* true if System.out (stdout) should be used for the output file */
private boolean useStdOut = false;
+ /* true if a catalog resolver should be used for entity and uri resolution */
+ private boolean useCatalogResolver = false;
/* rendering options (for the user agent) */
private Map renderingOptions = new java.util.HashMap();
/* target resolution (for the user agent) */
@@ -354,6 +356,8 @@
} else {
throw new FOPException("invalid param usage: use -param <name> <value>");
}
+ } else if (args[i].equals("-catalog")) {
+ useCatalogResolver = true;
} else if (args[i].equals("-o")) {
i = i + parsePDFOwnerPassword(args, i);
} else if (args[i].equals("-u")) {
@@ -1024,7 +1028,7 @@
case IF_INPUT:
return new IFInputHandler(iffile);
case XSLT_INPUT:
- return new InputHandler(xmlfile, xsltfile, xsltParams);
+ return new InputHandler(xmlfile, xsltfile, xsltParams, useCatalogResolver);
case IMAGE_INPUT:
return new ImageInputHandler(imagefile, xsltfile, xsltParams);
default:
@@ -1166,6 +1170,7 @@
+ " -xsl stylesheet xslt stylesheet \n \n"
+ " -param name value <value> to use for parameter <name> in xslt stylesheet\n"
+ " (repeat '-param name value' for each parameter)\n \n"
+ + " -catalog use catalog resolver for input XML and XSLT files\n"
+ " [OUTPUT] \n"
+ " outfile input will be rendered as PDF into outfile\n"
+ " (use '-' for outfile to pipe output to stdout)\n"
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/InputHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/InputHandler.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/InputHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/cli/InputHandler.java Fri Oct 23 17:27:14 2009
@@ -19,7 +19,6 @@
package org.apache.fop.cli;
-// Imported java.io classes
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
@@ -34,11 +33,13 @@
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@@ -51,27 +52,27 @@
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.render.awt.viewer.Renderable;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
/**
* Class for handling files input from command line
* either with XML and XSLT files (and optionally xsl
- * parameters) or FO File input alone
+ * parameters) or FO File input alone.
*/
public class InputHandler implements ErrorListener, Renderable {
/** original source file */
- protected File sourcefile = null;
- private File stylesheet = null; // for XML/XSLT usage
- private Vector xsltParams = null; // for XML/XSLT usage
+ protected File sourcefile;
+ private File stylesheet; // for XML/XSLT usage
+ private Vector xsltParams; // for XML/XSLT usage
+ private EntityResolver entityResolver;
+ private URIResolver uriResolver;
/** the logger */
protected Log log = LogFactory.getLog(InputHandler.class);
/**
* Constructor for XML->XSLT->FO input
+ *
* @param xmlfile XML file
* @param xsltfile XSLT file
* @param params Vector of command-line parameters (name, value,
@@ -84,6 +85,23 @@
}
/**
+ * Constructor for XML->XSLT->FO input
+ *
+ * @param xmlfile XML file
+ * @param xsltfile XSLT file
+ * @param params Vector of command-line parameters (name, value,
+ * name, value, ...) for XSL stylesheet, null if none
+ * @param useCatalogResolver if true, use a catalog resolver
+ * for XML parsing and XSLT URI resolution
+ */
+ public InputHandler(File xmlfile, File xsltfile, Vector params, boolean useCatalogResolver) {
+ this(xmlfile, xsltfile, params);
+ if (useCatalogResolver) {
+ createCatalogResolver();
+ }
+ }
+
+ /**
* Constructor for FO input
* @param fofile the file to read the FO document.
*/
@@ -151,7 +169,7 @@
* @return the Source for the main input file
*/
protected Source createMainSource() {
- Source result;
+ Source source;
InputStream in;
String uri;
if (this.sourcefile != null) {
@@ -169,37 +187,91 @@
try {
InputSource is = new InputSource(in);
is.setSystemId(uri);
- SAXParserFactory spf = SAXParserFactory.newInstance();
- spf.setFeature("http://xml.org/sax/features/namespaces", true);
- spf.setFeature("http://apache.org/xml/features/xinclude", true);
- XMLReader xr = spf.newSAXParser().getXMLReader();
- result = new SAXSource(xr, is);
+ XMLReader xr = getXMLReader();
+ if (entityResolver != null) {
+ xr.setEntityResolver(entityResolver);
+ }
+ source = new SAXSource(xr, is);
} catch (SAXException e) {
if (this.sourcefile != null) {
- result = new StreamSource(this.sourcefile);
+ source = new StreamSource(this.sourcefile);
} else {
- result = new StreamSource(in, uri);
+ source = new StreamSource(in, uri);
}
} catch (ParserConfigurationException e) {
if (this.sourcefile != null) {
- result = new StreamSource(this.sourcefile);
+ source = new StreamSource(this.sourcefile);
} else {
- result = new StreamSource(in, uri);
+ source = new StreamSource(in, uri);
+ }
+ }
+ return source;
+ }
+
+ /**
+ * Creates a catalog resolver and uses it for XML parsing and XSLT URI resolution.
+ * Tries the Apache Commons Resolver, and if unsuccessful,
+ * tries the same built into Java 6.
+ */
+ private void createCatalogResolver() {
+ String[] classNames = new String[] {
+ "org.apache.xml.resolver.tools.CatalogResolver",
+ "com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver"};
+ Class resolverClass = null;
+ for (int i = 0; i < classNames.length && resolverClass == null; ++i) {
+ try {
+ resolverClass = Class.forName(classNames[i]);
+ } catch (ClassNotFoundException e) {
+ // No worries
}
}
- return result;
+ if (resolverClass == null) {
+ log.error("Could not find catalog resolver in class path");
+ return;
+ }
+ try {
+ entityResolver = (EntityResolver) resolverClass.newInstance();
+ uriResolver = (URIResolver) resolverClass.newInstance();
+ } catch (InstantiationException e) {
+ log.error("Error creating the catalog resolver: " + e.getMessage());
+ } catch (IllegalAccessException e) {
+ log.error("Error creating the catalog resolver: " + e.getMessage());
+ }
}
/**
* Creates a Source for the selected stylesheet.
+ *
* @return the Source for the selected stylesheet or null if there's no stylesheet
*/
protected Source createXSLTSource() {
+ Source xslt = null;
if (this.stylesheet != null) {
- return new StreamSource(this.stylesheet);
- } else {
- return null;
+ if (entityResolver != null) {
+ try {
+ InputSource is = new InputSource(this.stylesheet.getPath());
+ XMLReader xr = getXMLReader();
+ xr.setEntityResolver(entityResolver);
+ xslt = new SAXSource(xr, is);
+ } catch (SAXException e) {
+ // return StreamSource
+ } catch (ParserConfigurationException e) {
+ // return StreamSource
+ }
+ }
+ if (xslt == null) {
+ xslt = new StreamSource(this.stylesheet);
+ }
}
+ return xslt;
+ }
+
+ private XMLReader getXMLReader() throws ParserConfigurationException, SAXException {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature("http://xml.org/sax/features/namespaces", true);
+ spf.setFeature("http://apache.org/xml/features/xinclude", true);
+ XMLReader xr = spf.newSAXParser().getXMLReader();
+ return xr;
}
/**
@@ -226,6 +298,9 @@
(String) xsltParams.elementAt(i + 1));
}
}
+ if (uriResolver != null) {
+ transformer.setURIResolver(uriResolver);
+ }
}
transformer.setErrorListener(this);
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FObj.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FObj.java Fri Oct 23 17:27:14 2009
@@ -56,7 +56,7 @@
private List/*<ExtensionAttachment>*/ extensionAttachments = null;
/** The map of foreign attributes, null if none */
- private Map foreignAttributes = null;
+ private Map/*<QName,String>*/ foreignAttributes = null;
/** Used to indicate if this FO is either an Out Of Line FO (see rec)
* or a descendant of one. Used during FO validation.
@@ -591,7 +591,7 @@
throw new NullPointerException("Parameter attributeName must not be null");
}
if (foreignAttributes == null) {
- foreignAttributes = new java.util.HashMap();
+ foreignAttributes = new java.util.HashMap/*<QName,String>*/();
}
foreignAttributes.put(attributeName, value);
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/CIDSubset.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/CIDSubset.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/CIDSubset.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/CIDSubset.java Fri Oct 23 17:27:14 2009
@@ -161,12 +161,12 @@
}
/**
- * Returns a BitSet with bits set for each available glyph index.
+ * Returns a BitSet with bits set for each available glyph index in the subset.
* @return a BitSet indicating available glyph indices
*/
public BitSet getGlyphIndexBitSet() {
BitSet bitset = new BitSet();
- Iterator iter = usedGlyphs.keySet().iterator();
+ Iterator iter = usedGlyphsIndex.keySet().iterator();
while (iter.hasNext()) {
Integer cid = (Integer)iter.next();
bitset.set(cid.intValue());
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/Font.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/Font.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/Font.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fonts/Font.java Fri Oct 23 17:27:14 2009
@@ -170,6 +170,9 @@
/**
* Returns the amount of kerning between two characters.
+ *
+ * The value returned measures in pt. So it is already adjusted for font size.
+ *
* @param ch1 first character
* @param ch2 second character
* @return the distance to adjust for kerning, 0 if there's no kerning
@@ -179,7 +182,7 @@
if (kernPair != null) {
Integer width = (Integer)kernPair.get(new Integer(ch2));
if (width != null) {
- return width.intValue();
+ return width.intValue() * getFontSize() / 1000;
}
}
return 0;
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Fri Oct 23 17:27:14 2009
@@ -367,7 +367,7 @@
alg.setConstantLineWidth(flowBPD);
int optimalPageCount = alg.findBreakingPoints(effectiveList, 1, true,
BreakingAlgorithm.ALL_BREAKS);
- if (alg.ipdChanged()) {
+ if (alg.getIPDdifference() != 0) {
KnuthNode optimalBreak = alg.getBestNodeBeforeIPDChange();
int positionIndex = optimalBreak.position;
KnuthElement elementAtBreak = alg.getElement(positionIndex);
@@ -381,14 +381,19 @@
LayoutManager restartAtLM = null;
List firstElements = Collections.EMPTY_LIST;
if (containsNonRestartableLM(positionAtBreak)) {
+ if (alg.getIPDdifference() > 0) {
+ log.warn("Content that cannot handle IPD changes is flowing to a"
+ + " narrower page. Part of it may be clipped"
+ + " by the page border.");
+ }
firstElements = new LinkedList();
boolean boxFound = false;
- Iterator iter = effectiveList.listIterator(++positionIndex);
+ Iterator iter = effectiveList.listIterator(positionIndex + 1);
Position position = null;
while (iter.hasNext()
&& (position == null || containsNonRestartableLM(position))) {
- KnuthElement element = (KnuthElement) iter.next();
positionIndex++;
+ KnuthElement element = (KnuthElement) iter.next();
position = element.getPosition();
if (element.isBox()) {
boxFound = true;
@@ -400,9 +405,11 @@
if (position instanceof SpaceResolver.SpaceHandlingBreakPosition) {
/* Retrieve the original position wrapped into this space position */
positionAtBreak = position.getPosition();
+ } else {
+ positionAtBreak = null;
}
}
- if (positionAtBreak.getIndex() == -1) {
+ if (positionAtBreak != null && positionAtBreak.getIndex() == -1) {
/*
* This is an indication that we are between two blocks
* (possibly surrounded by another block), not inside a
@@ -588,7 +595,7 @@
.listIterator(startElementIndex);
while (effectiveListIterator.nextIndex() <= endElementIndex) {
KnuthElement tempEl = (KnuthElement)effectiveListIterator.next();
- if (tempEl.isBox() && tempEl.getW() > 0) {
+ if (tempEl.isBox() && tempEl.getWidth() > 0) {
boxCount++;
}
}
@@ -678,8 +685,23 @@
BlockSequence blockList;
List returnedList;
- if (positionAtIPDChange == null) {
+ if (firstElements == null) {
returnedList = getNextKnuthElements(childLC, alignment);
+ } else if (positionAtIPDChange == null) {
+ /*
+ * No restartable element found after changing IPD break. Simply add the
+ * non-restartable elements found after the break.
+ */
+ returnedList = firstElements;
+ /*
+ * Remove the last 3 penalty-filler-forced break elements that were added by
+ * the Knuth algorithm. They will be re-added later on.
+ */
+ ListIterator iter = returnedList.listIterator(returnedList.size());
+ for (int i = 0; i < 3; i++) {
+ iter.previous();
+ iter.remove();
+ }
} else {
returnedList = getNextKnuthElements(childLC, alignment, positionAtIPDChange,
restartAtLM);
@@ -861,9 +883,9 @@
case BlockLevelLayoutManager.LINE_NUMBER_ADJUSTMENT:
// potential line number adjustment
lineNumberMaxAdjustment.max += ((KnuthGlue) thisElement)
- .getY();
+ .getStretch();
lineNumberMaxAdjustment.min -= ((KnuthGlue) thisElement)
- .getZ();
+ .getShrink();
adjustableLinesList.add(thisElement);
break;
case BlockLevelLayoutManager.LINE_HEIGHT_ADJUSTMENT:
@@ -885,9 +907,9 @@
KnuthGlue blockSpace = (KnuthGlue) unconfirmedList
.removeFirst();
spaceMaxAdjustment.max += ((KnuthGlue) blockSpace)
- .getY();
+ .getStretch();
spaceMaxAdjustment.min -= ((KnuthGlue) blockSpace)
- .getZ();
+ .getShrink();
blockSpacesList.add(blockSpace);
}
}
@@ -898,11 +920,11 @@
log.debug("| space adj = "
+ spaceMaxAdjustment);
- if (thisElement.isPenalty() && thisElement.getW() > 0) {
+ if (thisElement.isPenalty() && thisElement.getWidth() > 0) {
log.debug(" mandatory variation to the number of lines!");
((BlockLevelLayoutManager) thisElement
.getLayoutManager()).negotiateBPDAdjustment(
- thisElement.getW(), thisElement);
+ thisElement.getWidth(), thisElement);
}
if (thisBreak.bpdAdjust != 0
@@ -967,7 +989,7 @@
int partial = 0;
while (spaceListIterator.hasNext()) {
KnuthGlue blockSpace = (KnuthGlue)spaceListIterator.next();
- partial += (difference > 0 ? blockSpace.getY() : blockSpace.getZ());
+ partial += (difference > 0 ? blockSpace.getStretch() : blockSpace.getShrink());
if (log.isDebugEnabled()) {
log.debug("available = " + partial + " / " + total);
log.debug("competenza = "
@@ -990,7 +1012,7 @@
int partial = 0;
while (lineListIterator.hasNext()) {
KnuthGlue line = (KnuthGlue)lineListIterator.next();
- partial += (difference > 0 ? line.getY() : line.getZ());
+ partial += (difference > 0 ? line.getStretch() : line.getShrink());
int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, line);
adjustedDiff += newAdjust;
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Fri Oct 23 17:27:14 2009
@@ -1133,7 +1133,7 @@
// by this BlockLM, and must be ignored
if (element.getLayoutManager() != this) {
splitList.add(element);
- splitLength += element.getW();
+ splitLength += element.getWidth();
lastLM = element.getLayoutManager();
}
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Fri Oct 23 17:27:14 2009
@@ -339,7 +339,7 @@
// by this BlockLM, and must be ignored
if (element.getLayoutManager() != this) {
splitList.add(element);
- splitLength += element.getW();
+ splitLength += element.getWidth();
lastLM = element.getLayoutManager();
}
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Fri Oct 23 17:27:14 2009
@@ -695,11 +695,11 @@
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> bpunit con penalty");
KnuthPenalty storedPenalty = (KnuthPenalty)
storedList.get(mappingPos.getLastIndex());
- if (storedPenalty.getW() > 0) {
+ if (storedPenalty.getWidth() > 0) {
// the original penalty has width > 0
/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> chiamata passata");
return ((BlockLevelLayoutManager)storedPenalty.getLayoutManager())
- .negotiateBPDAdjustment(storedPenalty.getW(),
+ .negotiateBPDAdjustment(storedPenalty.getWidth(),
storedPenalty);
} else {
// the original penalty has width = 0
@@ -1406,17 +1406,18 @@
while (oldListIterator.hasNext()) {
KnuthElement element = (KnuthElement) oldListIterator.next();
if (element.isBox()) {
- totalLength.add(new MinOptMax(element.getW()));
- //log.debug("box " + element.getW());
+ totalLength.add(new MinOptMax(element.getWidth()));
+ //log.debug("box " + element.getWidth());
} else if (element.isGlue()) {
- totalLength.min -= element.getZ();
- totalLength.max += element.getY();
+ totalLength.min -= element.getShrink();
+ totalLength.max += element.getStretch();
//leafValue = ((LeafPosition) element.getPosition()).getLeafPos();
- //log.debug("glue " + element.getW() + " + "
- // + ((KnuthGlue) element).getY() + " - " + ((KnuthGlue) element).getZ());
+ //log.debug("glue " + element.getWidth() + " + "
+ // + ((KnuthGlue) element).getStretch() + " - "
+ // + ((KnuthGlue) element).getShrink());
} else {
- //log.debug((((KnuthPenalty)element).getP() == KnuthElement.INFINITE
- // ? "PENALTY " : "penalty ") + element.getW());
+ //log.debug((((KnuthPenalty)element).getPenalty() == KnuthElement.INFINITE
+ // ? "PENALTY " : "penalty ") + element.getWidth());
}
}
// compute the total amount of "units"
@@ -1443,22 +1444,22 @@
KnuthElement element = (KnuthElement) oldListIterator.next();
lastIndex++;
if (element.isBox()) {
- lengthBeforeBreak.add(new MinOptMax(element.getW()));
- lengthAfterBreak.subtract(new MinOptMax(element.getW()));
+ lengthBeforeBreak.add(new MinOptMax(element.getWidth()));
+ lengthAfterBreak.subtract(new MinOptMax(element.getWidth()));
bPrevIsBox = true;
} else if (element.isGlue()) {
- lengthBeforeBreak.min -= element.getZ();
- lengthAfterBreak.min += element.getZ();
- lengthBeforeBreak.max += element.getY();
- lengthAfterBreak.max -= element.getY();
+ lengthBeforeBreak.min -= element.getShrink();
+ lengthAfterBreak.min += element.getShrink();
+ lengthBeforeBreak.max += element.getStretch();
+ lengthAfterBreak.max -= element.getStretch();
bPrevIsBox = false;
} else {
- lengthBeforeBreak.add(new MinOptMax(element.getW()));
+ lengthBeforeBreak.add(new MinOptMax(element.getWidth()));
bPrevIsBox = false;
}
// create the new elements
- if (element.isPenalty() && element.getP() < KnuthElement.INFINITE
+ if (element.isPenalty() && element.getPenalty() < KnuthElement.INFINITE
|| element.isGlue() && bPrevIsBox
|| !oldListIterator.hasNext()) {
// suppress elements after the breaking point
@@ -1468,8 +1469,8 @@
iStepsForward++;
if (el.isGlue()) {
// suppressed glue
- lengthAfterBreak.min += el.getZ();
- lengthAfterBreak.max -= el.getY();
+ lengthAfterBreak.min += el.getShrink();
+ lengthAfterBreak.max -= el.getStretch();
} else if (el.isPenalty()) {
// suppressed penalty, do nothing
} else {
@@ -1489,8 +1490,8 @@
for (int i = 0; i < iStepsForward; i++) {
KnuthElement el = (KnuthElement) oldListIterator.previous();
if (el.isGlue()) {
- lengthAfterBreak.min -= el.getZ();
- lengthAfterBreak.max += el.getY();
+ lengthAfterBreak.min -= el.getShrink();
+ lengthAfterBreak.max += el.getStretch();
}
}
@@ -1611,7 +1612,7 @@
}
if (element.isPenalty()) {
- lengthBeforeBreak.add(new MinOptMax(-element.getW()));
+ lengthBeforeBreak.add(new MinOptMax(-element.getWidth()));
}
}
@@ -1640,14 +1641,14 @@
- neededUnits(totalLength.opt - adjustedSpaceBefore))
* bpUnit;
// insert the correct elements
- newList.addFirst(new KnuthBox(wrongBox.getW() - decreasedLength,
+ newList.addFirst(new KnuthBox(wrongBox.getWidth() - decreasedLength,
wrongBox.getPosition(), false));
newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, SPACE_BEFORE_ADJUSTMENT,
wrongBox.getPosition(), false));
- //log.debug(" rimosso box " + neededUnits(wrongBox.getW()));
+ //log.debug(" rimosso box " + neededUnits(wrongBox.getWidth()));
//log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
//log.debug(" aggiunto box " + neededUnits(
- // wrongBox.getW() - decreasedLength));
+ // wrongBox.getWidth() - decreasedLength));
}
// if space-after.conditionality is "discard", correct newList
@@ -1663,7 +1664,7 @@
// (it cannot be parted and has some stretch or shrink)
// the wrong box is the first one, not the last one
LinkedList preserveList = new LinkedList();
- if (wrongBox.getW() == 0) {
+ if (wrongBox.getWidth() == 0) {
preserveList.add(wrongBox);
preserveList.addFirst((KnuthGlue) newList.removeLast());
preserveList.addFirst((KnuthPenalty) newList.removeLast());
@@ -1676,7 +1677,7 @@
- neededUnits(totalLength.opt - adjustedSpaceAfter))
* bpUnit;
// insert the correct box
- newList.addLast(new KnuthBox(wrongBox.getW() - decreasedLength,
+ newList.addLast(new KnuthBox(wrongBox.getWidth() - decreasedLength,
wrongBox.getPosition(), false));
// add preserved elements
if (!preserveList.isEmpty()) {
@@ -1685,9 +1686,9 @@
// insert the correct glue
newList.addLast(new KnuthGlue(decreasedLength, 0, 0, SPACE_AFTER_ADJUSTMENT,
wrongBox.getPosition(), false));
- //log.debug(" rimosso box " + neededUnits(wrongBox.getW()));
+ //log.debug(" rimosso box " + neededUnits(wrongBox.getWidth()));
//log.debug(" aggiunto box " + neededUnits(
- // wrongBox.getW() - decreasedLength));
+ // wrongBox.getWidth() - decreasedLength));
//log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
}
Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=829138&r1=829137&r2=829138&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Fri Oct 23 17:27:14 2009
@@ -491,7 +491,7 @@
elementIndex, previousIsBox, allowedBreaks).isBox();
if (activeNodeCount == 0) {
- if (ipdChanged()) {
+ if (getIPDdifference() != 0) {
return handleIpdChange();
}
if (!force) {
@@ -538,8 +538,8 @@
return line;
}
- protected boolean ipdChanged() {
- return false;
+ protected int getIPDdifference() {
+ return 0;
}
protected int handleIpdChange() {
@@ -676,7 +676,7 @@
protected void handleBox(KnuthBox box) {
// a KnuthBox object is not a legal line break,
// just add the width to the total
- totalWidth += box.getW();
+ totalWidth += box.getWidth();
}
/**
@@ -697,9 +697,9 @@
&& !(allowedBreaks == ONLY_FORCED_BREAKS)) {
considerLegalBreak(glue, position);
}
- totalWidth += glue.getW();
- totalStretch += glue.getY();
- totalShrink += glue.getZ();
+ totalWidth += glue.getWidth();
+ totalStretch += glue.getStretch();
+ totalShrink += glue.getShrink();
}
/**
@@ -716,8 +716,8 @@
// only if its penalty is not infinite;
// consider all penalties, non-flagged penalties or non-forcing penalties
// according to the value of allowedBreaks
- if (((penalty.getP() < KnuthElement.INFINITE)
- && (!(allowedBreaks == NO_FLAGGED_PENALTIES) || !penalty.isFlagged())
+ if (((penalty.getPenalty() < KnuthElement.INFINITE)
+ && (!(allowedBreaks == NO_FLAGGED_PENALTIES) || !penalty.isPenaltyFlagged())
&& (!(allowedBreaks == ONLY_FORCED_BREAKS)
|| penalty.isForcedBreak()))) {
considerLegalBreak(penalty, position);
@@ -880,7 +880,7 @@
*/
protected boolean elementCanEndLine(KnuthElement element, int line, int difference) {
return (!element.isPenalty()
- || element.getP() < KnuthElement.INFINITE);
+ || element.getPenalty() < KnuthElement.INFINITE);
}
/**
@@ -921,9 +921,9 @@
if (tempElement.isBox()) {
break;
} else if (tempElement.isGlue()) {
- newWidth += tempElement.getW();
- newStretch += tempElement.getY();
- newShrink += tempElement.getZ();
+ newWidth += tempElement.getWidth();
+ newStretch += tempElement.getStretch();
+ newShrink += tempElement.getShrink();
} else if (tempElement.isForcedBreak() && i != elementIdx) {
break;
}
@@ -1034,9 +1034,9 @@
if (tempElement.isBox()) {
break;
} else if (tempElement.isGlue()) {
- newWidth += tempElement.getW();
- newStretch += tempElement.getY();
- newShrink += tempElement.getZ();
+ newWidth += tempElement.getWidth();
+ newStretch += tempElement.getStretch();
+ newShrink += tempElement.getShrink();
} else if (tempElement.isForcedBreak() && i != elementIdx) {
break;
}
@@ -1075,7 +1075,7 @@
// compute the adjustment ratio
int actualWidth = totalWidth - activeNode.totalWidth;
if (element.isPenalty()) {
- actualWidth += element.getW();
+ actualWidth += element.getWidth();
}
return getLineWidth() - actualWidth;
}
@@ -1133,7 +1133,7 @@
double f = Math.abs(r);
f = 1 + 100 * f * f * f;
if (element.isPenalty()) {
- double penalty = element.getP();
+ double penalty = element.getPenalty();
if (penalty >= 0) {
f += penalty;
demerits = f * f;
@@ -1146,9 +1146,9 @@
demerits = f * f;
}
- if (element.isPenalty() && ((KnuthPenalty) element).isFlagged()
+ if (element.isPenalty() && ((KnuthPenalty) element).isPenaltyFlagged()
&& getElement(activeNode.position).isPenalty()
- && ((KnuthPenalty) getElement(activeNode.position)).isFlagged()) {
+ && ((KnuthPenalty) getElement(activeNode.position)).isPenaltyFlagged()) {
// add demerit for consecutive breaks at flagged penalties
demerits += repeatedFlaggedDemerit;
// there are at least two consecutive lines ending with a flagged penalty;
@@ -1160,7 +1160,7 @@
prevNode = prevNode.previous) {
KnuthElement prevElement = getElement(prevNode.position);
if (prevElement.isPenalty()
- && ((KnuthPenalty) prevElement).isFlagged()) {
+ && ((KnuthPenalty) prevElement).isPenaltyFlagged()) {
// the previous line ends with a flagged penalty too
flaggedPenaltiesCount++;
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org