diff options
578 files changed, 10713 insertions, 12843 deletions
@@ -1,5 +1,5 @@ Apache FOP -Copyright 1999-2009 The Apache Software Foundation +Copyright 1999-2010 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). @@ -47,7 +47,10 @@ License version 2.0: Info: src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm.LICENSE.txt - K3 3 of 9 barcode font (TrueType) File: examples/fo/advanced/K3.TTF - Info: example/fo/advanced/K3.README + Info: examples/fo/advanced/K3.README +- DejaVu LGC Serif font (TrueType) + File: test/resources/fonts/DejaVuLGCSerif.ttf + Info: test/resources/fonts/DejaVuLGCSerif.LICENSE Where to get help? @@ -90,6 +93,54 @@ http://xmlgraphics.apache.org/fop/stable/running.html RELEASE NOTES ============================================================================== +Version 1.0 +=========== + +This is a production grade release of Apache FOP. +It contains many bug fixes and new features. See below for details. + +Compliance +---------- + +This release implements the XSL 1.0 and 1.1 recommendations to a high +degree of compliance. See the compliance page +http://xmlgraphics.apache.org/fop/compliance.html for a detailed +overview. + +Known issues +------------ + +The known issues of this release are listed at +http://xmlgraphics.apache.org/fop/1.0/knownissues_overview.html. + +Major Changes in Version 1.0 +---------------------------- + +* Added support for addressing all glyphs available in a Type 1 font +* Added support for auto-configuring TrueType Collections. XML font + metrics files for *.ttc fonts are not required anymore. +* Added support for rendering pages using Java Printing System. +* Support character-by-character font-selection strategy on + fo:character element. +* Implemented word-by-ford font-selection strategy on text. +* AFP Output: Various enhancements +* FOP now creates ToUnicode CMaps for single-byte fonts that don't use + built-in encodings +* Introduced a new, additional intermediate format optimized for + performance. See the intermediate format documentation for details. +* Added an initial set of extensions for prepress support. +* Added limited support for different page widths within a page-sequence. +* Added support for TrueType fonts with symbol character maps (like + "Wingdings" and "Symbol"). +* Added an event handling framework which allows to get better feedback + from within FOP with the ability to customize problem management. + +The long list of changes in this release is available at +http://xmlgraphics.apache.org/fop/1.0/changes_1.0.html. + +The long list of changes in this and earlier releases is available at +http://xmlgraphics.apache.org/fop/changes.html. + Version 0.95 ============ @@ -57,7 +57,6 @@ list of possible build targets. <property file="${basedir}/build-local.properties"/> <property file="${basedir}/build.properties"/> <property environment="env"/> - <property name="build.lib.dir" value="${basedir}/lib/build"/> <fileset dir="${basedir}" id="dist.bin"> <include name="conf/**"/> <include name="examples/**"/> @@ -85,12 +84,22 @@ list of possible build targets. <include name="lib/xml-apis*"/> </patternset> </fileset> + <patternset id="dist.src.lib.tools"> + <include name="lib/build/asm*"/> + <include name="lib/build/backport-util-concurrent*"/> + <include name="lib/build/jaxen*"/> + <include name="lib/build/pmd*"/> + <include name="lib/build/qdox*"/> + <include name="lib/build/retroweaver*"/> + <include name="lib/build/xmlunit*"/> + </patternset> <fileset dir="${basedir}" id="dist.src"> <include name="src/**"/> <include name="conf/**"/> <include name="hyph/hyphenation.dtd"/> <include name="hyph/readme"/> <patternset refid="dist.lib"/> + <patternset refid="dist.src.lib.tools"/> <include name="lib/servlet*"/> <include name="test/**"/> <include name="examples/**"/> @@ -103,6 +112,8 @@ list of possible build targets. <include name="build.*"/> <include name="forrest.properties"/> <include name="fop.bat"/> + <include name="fop.cmd"/> + <include name="fop.js"/> <include name="fop"/> </fileset> <path id="libs-build-classpath"> @@ -110,10 +121,10 @@ list of possible build targets. <include name="*.jar"/> </fileset> </path> - <property name="lib-build-tools" value="${basedir}/lib/build"/> - <path id="libs-build-tools-classpath"> + <property name="lib-tools" value="${basedir}/lib/build"/> + <path id="libs-tools-build-classpath"> <path refid="libs-build-classpath"/> - <fileset dir="${lib-build-tools}"> + <fileset dir="${lib-tools}"> <include name="*.jar"/> </fileset> </path> @@ -134,7 +145,7 @@ list of possible build targets. <property name="name" value="fop"/> <property name="NAME" value="FOP"/> <property name="version" value="svn-trunk"/> - <property name="year" value="1999-2009"/> + <property name="year" value="1999-2010"/> <property name="javac.debug" value="on"/> <property name="javac.optimize" value="off"/> <property name="javac.deprecation" value="on"/> @@ -226,7 +237,7 @@ list of possible build targets. <echo message="${jce.message}"/> <available property="jdk14.present" classname="java.lang.CharSequence"/> <fail message="${Name} requires at least Java 1.4!" unless="jdk14.present"/> - <available property="junit.present" classname="junit.framework.TestCase" classpathref="libs-build-tools-classpath"/> + <available property="junit.present" classname="junit.framework.TestCase" classpathref="libs-tools-build-classpath"/> <condition property="junit.message" value="JUnit Support PRESENT"> <equals arg1="${junit.present}" arg2="true"/> </condition> @@ -238,7 +249,7 @@ list of possible build targets. <echo message="${junit.message}"/> <condition property="xmlunit.present"> <and> - <available classname="org.custommonkey.xmlunit.XMLTestCase" classpathref="libs-build-tools-classpath"/> + <available classname="org.custommonkey.xmlunit.XMLTestCase" classpathref="libs-tools-build-classpath"/> <isset property="junit.present"/> </and> </condition> @@ -319,7 +330,7 @@ list of possible build targets. <target name="compile-java" depends="init, codegen"> <!-- create directories --> <mkdir dir="${build.classes.dir}"/> - <javac destdir="${build.classes.dir}" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}"> + <javac destdir="${build.classes.dir}" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}" includeAntRuntime="true"> <src path="${build.gensrc.dir}"/> <src path="${src.java.dir}"/> <patternset includes="**/*.java"/> @@ -328,7 +339,7 @@ list of possible build targets. <classpath refid="libs-build-classpath"/> </javac> <mkdir dir="${build.sandbox-classes.dir}"/> - <javac destdir="${build.sandbox-classes.dir}" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}"> + <javac destdir="${build.sandbox-classes.dir}" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}" includeAntRuntime="true"> <src path="${src.sandbox.dir}"/> <patternset includes="**/*.java"/> <patternset refid="exclude-jai"/> @@ -340,11 +351,11 @@ list of possible build targets. </target> <target name="resourcegen" depends="compile-java"> <mkdir dir="${build.codegen-classes.dir}"/> - <javac destdir="${build.codegen-classes.dir}" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}"> + <javac destdir="${build.codegen-classes.dir}" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}" includeAntRuntime="true"> <src path="${src.codegen.dir}/java"/> <patternset includes="**/*.java"/> <classpath> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> <pathelement location="${build.classes.dir}"/> </classpath> </javac> @@ -355,7 +366,7 @@ list of possible build targets. </copy> <taskdef name="eventResourceGenerator" classname="org.apache.fop.tools.EventProducerCollectorTask"> <classpath> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> <pathelement location="${build.classes.dir}"/> <pathelement location="${build.codegen-classes.dir}"/> </classpath> @@ -472,7 +483,7 @@ list of possible build targets. <target name="retro-avail" depends="compile" if="java14.rt.lib"> <taskdef name="retroweaver" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask"> <classpath> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> </classpath> </taskdef> <path id="verify-classpath"> @@ -483,7 +494,7 @@ list of possible build targets. </path> <!-- If we decide to use retroweaver for the actual weaving, the mkdir and destdir= will have to be removed. Also, the weaving task would additionally - need to be defined even if no jdk 14 is available. --> + need to be defined even if no jdk 14 is available. --> <mkdir dir="${build.dir}/temp"/> <retroweaver srcdir="${build.classes.dir}" destdir="${build.dir}/temp" classpath="${toString:verify-classpath}" lazy="false" @@ -509,7 +520,6 @@ list of possible build targets. <jar jarfile="${build.dir}/fop.jar" basedir="${build.classes.dir}"> <manifest> <attribute name="Main-Class" value="org.apache.fop.cli.Main"/> - <attribute name="Class-Path" value="${manifest.classpath}"/> <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/> <section name="org/apache/fop/"> <attribute name="Specification-Title" value="XSL-FO - Extensible Stylesheet Language"/> @@ -714,11 +724,11 @@ list of possible build targets. <mkdir dir="${build.dir}/test-classes"/> <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}"> + <javac destdir="${build.dir}/test-classes" fork="${javac.fork}" debug="${javac.debug}" deprecation="${javac.deprecation}" optimize="${javac.optimize}" source="${javac.source}" target="${javac.target}" includeAntRuntime="true"> <src path="${test.dir}/java"/> <patternset refid="test-sources"/> <classpath> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> <fileset dir="${build.dir}"> <include name="fop.jar"/> </fileset> @@ -796,6 +806,7 @@ list of possible build targets. <target name="junit-userconfig" depends="junit-compile" if="junit.present" description="Runs FOP's user config JUnit tests"> <echo message="Running user config tests"/> <junit dir="${basedir}" haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure"> + <jvmarg value="-Xmx1024m"/> <sysproperty key="basedir" value="${basedir}"/> <sysproperty key="jawa.awt.headless" value="true"/> <sysproperty key="fop.layoutengine.disabled" value="${layoutengine.disabled}"/> @@ -917,7 +928,7 @@ list of possible build targets. <formatter type="xml" usefile="true"/> <classpath> <pathelement location="${build.dir}/test-classes"/> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> <pathelement location="${build.dir}/fop.jar"/> </classpath> <test name="@{testsuite}" todir="${junit.reports.dir}" outfile="@{outfile}"/> @@ -1034,7 +1045,7 @@ NOTE: <pathelement path="${src.sandbox.dir}"/> <pathelement path="${build.gensrc.dir}"/> </sourcepath> - <tag name="todo" scope="all" description="To do:"/> + <tag name="asf.todo" scope="all" description="To do:"/> <tag name="event.severity" scope="all" description="Event severity level:"/> <group title="Control and Startup"> <package name="org.apache.fop"/> @@ -1116,7 +1127,7 @@ NOTE: <and> <available classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"> <classpath> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> </classpath> </available> <available file="${checkstyle.noframes.xslt}"/> @@ -1124,13 +1135,20 @@ NOTE: </condition> <target name="checkstyle-avail" unless="checkstyle.avail"> <echo message="Checkstyle support NOT present. Please download it from http://checkstyle.sf.net/ and"/> - <echo message="..copy or link checkstyle-all-5.0.jar to ${lib-build-tools}"/> + <echo message="..copy or link checkstyle-all-5.1.jar to ${lib-tools}"/> <echo message="..copy or link checkstyle-noframes.xsl to ${checkstyle.noframes.xslt}"/> </target> - <target name="checkstyle" depends="init, checkstyle-avail" if="checkstyle.avail" description="Runs Checkstyle for a code quality report"> - <taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="libs-build-tools-classpath"/> - <checkstyle config="checkstyle-5.0.xml" failonviolation="false"> - <fileset dir="${src.java.dir}" includes="**/*.java"/> + <target name="checkstyle" depends="package, checkstyle-avail" if="checkstyle.avail" description="Runs Checkstyle for a code quality report"> + <taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="libs-tools-build-classpath"/> + <mkdir dir="${build.dir}"/> + <checkstyle config="checkstyle-5.1.xml" failonviolation="false"> + <classpath> + <path refid="libs-build-classpath"/> + <pathelement location="${build.classes.dir}"/> + <pathelement location="${build.sandbox-classes.dir}"/> + <pathelement location="${build.codegen-classes.dir}"/> + </classpath> + <fileset dir="${src.dir}" includes="**/*.java"/> <formatter type="xml" toFile="${build.dir}/report_checkstyle.xml"/> </checkstyle> <xslt in="${build.dir}/report_checkstyle.xml" out="${build.dir}/report_checkstyle.html" style="${checkstyle.noframes.xslt}"/> @@ -1142,7 +1160,7 @@ NOTE: <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"> <classpath> <path refid="libs-build-classpath"/> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> </classpath> </taskdef> <pmd shortFilenames="true" targetjdk="${javac.target}"> @@ -1160,7 +1178,7 @@ NOTE: <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask"> <classpath> <path refid="libs-build-classpath"/> - <path refid="libs-build-tools-classpath"/> + <path refid="libs-tools-build-classpath"/> </classpath> </taskdef> <cpd minimumTokenCount="100" outputFile="${build.dir}/report_cpd.txt"> @@ -1172,22 +1190,62 @@ NOTE: <!-- =================================================================== --> <!-- Findbugs --> <!-- =================================================================== --> - <property name="findbugs.lib" value="${findbugs.home.dir}/lib"/> - <path id="libs-findbugs"> - <fileset dir="${findbugs.lib}"> - <include name="*.jar"/> - </fileset> - </path> - <target name="findbugs-avail" unless="findbugs.home.dir"> - <echo message="Findbugs Support NOT Present. Please download it from http://findbugs.sf.net/ and set findbugs.home.dir in build-local.properties"/> + <target name="findbugs-maybe-describe-install" unless="findbugs.present"> + <echo message="Please download FINDBUGS from http://findbugs.sf.net/ and set property findbugs.home.dir"/> + <echo message="in build-local.properties to the top-level directory of the binary distribution."/> + </target> + <target name="findbugs-avail"> + <condition property="findbugs.present"> + <and> + <isset property="findbugs.home.dir"/> + <available file="${findbugs.home.dir}" type="dir"/> + </and> + </condition> + <condition property="findbugs.message" value="FINDBUGS Support PRESENT"> + <equals arg1="${findbugs.present}" arg2="true"/> + </condition> + <condition property="findbugs.message" value="FINDBUGS Support NOT Present"> + <not> + <equals arg1="${findbugs.present}" arg2="true"/> + </not> + </condition> + <echo message="${findbugs.message}"/> + <antcall target="findbugs-maybe-describe-install"/> </target> - <target name="findbugs" depends="init, findbugs-avail, compile-java" if="findbugs.home.dir"> - <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="libs-findbugs"/> - <findbugs home="${findbugs.home.dir}" output="html" reportLevel="low" effort="max" outputFile="${build.dir}/report_findbugs.html" jvmargs="-Xmx1024m"> + <target name="findbugs-exec" depends="compile-java" if="findbugs.present"> + <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"> + <classpath> + <fileset dir="${findbugs.home.dir}/lib"> + <include name="*.jar"/> + </fileset> + </classpath> + </taskdef> + <findbugs home="${findbugs.home.dir}" output="${findbugs.output.format}" reportLevel="low" effort="max" + outputFile="${build.dir}/report_findbugs.${findbugs.output.extension}" excludeFilter="findbugs-exclude.xml" jvmargs="-Xmx1024m"> <sourcePath path="${src.java.dir}"/> <class location="${build.classes.dir}"/> + <auxClasspath> + <path refid="libs-build-classpath"/> + <path> + <fileset dir="${ant.library.dir}"> + <include name="ant.jar"/> + <include name="ant-launcher.jar"/> + </fileset> + </path> + </auxClasspath> </findbugs> </target> + <target name="findbugs-xml" depends="findbugs-avail" if="findbugs.present" description="Runs findbugs for a code quality report in XML"> + <property name="findbugs.output.format" value="xml"/> + <property name="findbugs.output.extension" value="xml"/> + <antcall target="findbugs-exec"/> + </target> + <target name="findbugs-html" depends="findbugs-avail" if="findbugs.present" description="Runs findbugs for a code quality report in HTML"> + <property name="findbugs.output.format" value="html"/> + <property name="findbugs.output.extension" value="html"/> + <antcall target="findbugs-exec"/> + </target> + <target name="findbugs" depends="findbugs-html" description="Runs findbugs for a code quality report in HTML"/> <!-- =================================================================== --> <!-- Creates the reports --> <!-- =================================================================== --> @@ -1197,21 +1255,18 @@ NOTE: <!-- =================================================================== --> <target name="docs" description="Generates documentation"> <echo message="Building documentation with Forrest..."/> -<!-- - <echo message="Make sure that you have installed Apache Forrest and"/> - <echo message="the FORREST_HOME environment variable is set (see http://forrest.apache.org/)"/> - <echo message="FORREST_HOME = ${forrest.home}"/> - --> + <echo message="FORREST_HOME = ${env.FORREST_HOME}"/> <echo message="Make sure you have a proper Forrest installation (see http://forrest.apache.org/)"/> <condition property="forrest.call" value="forrest.bat" else="forrest"> <os family="windows"/> </condition> - <exec executable="${forrest.call}"/> + <exec executable="${env.FORREST_HOME}/bin/${forrest.call}"/> </target> <!-- =================================================================== --> <!-- Creates the distribution --> <!-- =================================================================== --> - <target name="dist" depends="dist-prereq,dist-src,dist-bin" description="Generates the distribution package"/> +<!-- It would be better to make dist depend on distclean. But as long as the forrest projectInfo plugin depends on a higher Java version (1.5) than we use for the compilation (1.4), leaving it out enables a workaround --> + <target name="dist" depends="dist-prereq,dist-src,dist-bin,maven-artifacts" description="Generates the distribution package"/> <target name="dist-prereq" depends="init,dist-get-jai"> <fail message="A complete binary build requires JAI" unless="jai.present"/> <fail message="A complete binary build requires JCE" unless="jce.present"/> @@ -1259,7 +1314,7 @@ NOTE: <gzip zipfile="${name}-${version}-bin.tar.gz" src="${name}-${version}-bin.tar"/> <delete file="${name}-${version}-bin.tar"/> </target> - <target name="dist-src" depends="all"> + <target name="dist-src"> <echo message="Building the source distribution files (zip,tar)"/> <mkdir dir="${dist.src.result.dir}"/> <copy todir="${dist.src.result.dir}"> @@ -1298,6 +1353,7 @@ NOTE: <fileset dir="${build.dir}/maven"/> <metainf dir="${basedir}" includes="LICENSE,NOTICE"/> </jar> + <move file="${build.dir}/${name}-${version}-bundle.jar" todir="${basedir}"/> </target> <!-- =================================================================== --> <!-- Generate examples --> @@ -1368,6 +1424,7 @@ NOTE: <delete> <fileset dir="${basedir}" includes="${name}-*.tar.gz"/> <fileset dir="${basedir}" includes="${name}-*.zip"/> + <fileset dir="${basedir}" includes="${name}-bundle.jar"/> </delete> </target> <target name="validate-xdocs" description="Validate the xdocs. Point schemas.dir to Forrest's 'schemas' directory."> diff --git a/checkstyle-5.0.xml b/checkstyle-5.1.xml index 182385286..dab1e5ebb 100644 --- a/checkstyle-5.0.xml +++ b/checkstyle-5.1.xml @@ -175,6 +175,7 @@ <property name="severity" value="warning"/> <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> </module> + <module name="FileContentsHolder"/> </module> <module name="RegexpHeader"> <property name="headerFile" value="${samedir}/checkstyle.header"/> @@ -187,4 +188,17 @@ <module name="FileTabCharacter"> <property name="severity" value="error"/> </module> + <module name="SuppressionFilter"> + <property name="file" value="${samedir}/checkstyle-suppressions.xml"/> + </module> + <module name="SuppressionCommentFilter"> + <property name="offCommentFormat" value="CSOFF\: ([\w\|]+)"/> + <property name="onCommentFormat" value="CSON\: ([\w\|]+)"/> + <property name="checkFormat" value="$1"/> + </module> + <module name="SuppressWithNearbyCommentFilter"> + <property name="commentFormat" value="CSOK\: ([\w\|]+)"/> + <property name="checkFormat" value="$1"/> + <property name="influenceFormat" value="0"/> + </module> </module> diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml new file mode 100644 index 000000000..217299870 --- /dev/null +++ b/checkstyle-suppressions.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> +<suppressions> + <suppress files="org/apache/fop/fo/FOPropertyMapping.java" checks="FileLengthCheck"/> + <suppress files="org/apache/fop/fonts/truetype/TTFFile.java" checks="FileLengthCheck"/> + <suppress files="org/apache/fop/Version.java" lines="40-50" checks="LineLengthCheck"/> +</suppressions> diff --git a/examples/plan/src/org/apache/fop/plan/PlanHints.java b/examples/plan/src/org/apache/fop/plan/PlanHints.java index 2a2c1333a..a50d91139 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanHints.java +++ b/examples/plan/src/org/apache/fop/plan/PlanHints.java @@ -25,22 +25,22 @@ package org.apache.fop.plan; public interface PlanHints { /** Border attribute */ - public static final String PLAN_BORDER = "border"; + String PLAN_BORDER = "border"; /** Legend attribute */ - public static final String PLAN_LEGEND = "legend"; + String PLAN_LEGEND = "legend"; /** Font family attribute */ - public static final String FONT_FAMILY = "font-family"; + String FONT_FAMILY = "font-family"; /** Font size attribute */ - public static final String FONT_SIZE = "font-size"; + String FONT_SIZE = "font-size"; /** Legent type attribute */ - public static final String LEGEND_TYPE = "legendType"; + String LEGEND_TYPE = "legendType"; /** Locale attribute */ - public static final String LOCALE = "locale"; + String LOCALE = "locale"; /** Label type attribute */ - public static final String LABEL_TYPE = "labelType"; + String LABEL_TYPE = "labelType"; /** Label font size attribute */ - public static final String LABEL_FONT_SIZE = "labelFontSize"; + String LABEL_FONT_SIZE = "labelFontSize"; /** Label font attribute */ - public static final String LABEL_FONT = "labelFont"; + String LABEL_FONT = "labelFont"; } diff --git a/examples/plan/src/org/apache/fop/plan/PlanRenderer.java b/examples/plan/src/org/apache/fop/plan/PlanRenderer.java index 8b7978259..7d41962fb 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanRenderer.java +++ b/examples/plan/src/org/apache/fop/plan/PlanRenderer.java @@ -109,8 +109,8 @@ public class PlanRenderer { hints.put(PlanHints.FONT_FAMILY, fontFamily); hints.put(PlanHints.FONT_SIZE, new Float(fontSize)); hints.put(PlanHints.LOCALE, locale); - Document doc = - planDrawer.createDocument(data, width, height, hints); + Document doc + = planDrawer.createDocument(data, width, height, hints); return doc; } @@ -152,6 +152,7 @@ public class PlanRenderer { } else if (t.equals("grouping")) { data.setType(ActionInfo.GROUPING); } else { + throw new IllegalArgumentException("Unknown action type: " + t); } for (int i = 0; i < childs.getLength(); i++) { diff --git a/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java b/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java index 46b07601a..a8ba062ed 100644 --- a/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java +++ b/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java @@ -243,8 +243,8 @@ public class SimplePlanDrawer implements PlanDrawer { - lastWeek.getTime() + 43200000) / 86400000); int days = (int)((end.getTime() - start.getTime() + 43200000) / 86400000); - int daysFromEnd = - (int)((future.getTime() - end.getTime() + int daysFromEnd + = (int)((future.getTime() - end.getTime() + 43200000) / 86400000); Element taskGraphic; switch (type) { @@ -299,8 +299,8 @@ public class SimplePlanDrawer implements PlanDrawer { topEdge = lastTop; } } - int currentDays = - (int)((currentDate.getTime() - lastWeek.getTime() + int currentDays + = (int)((currentDate.getTime() - lastWeek.getTime() + 43200000) / 86400000); text = SVGUtilities.createText(doc, diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml new file mode 100644 index 000000000..e8a2357ac --- /dev/null +++ b/findbugs-exclude.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> +<FindBugsFilter> +</FindBugsFilter> @@ -13,6 +13,7 @@ REM distributed under the License is distributed on an "AS IS" BASIS, REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
+REM $Id$
rem %~dp0 is the expanded pathname of the current script under NT
set LOCAL_FOP_HOME=
@@ -61,7 +62,7 @@ set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.7.1.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\serializer-2.7.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik-all-1.7.jar
-set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xmlgraphics-commons-1.4svn.jar
+set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xmlgraphics-commons-1.4.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.2.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.3.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-logging-1.0.4.jar
@@ -80,5 +81,5 @@ goto runFop if "%JAVACMD%" == "" set JAVACMD=java
:runFop
-rem ECHO "%JAVACMD%"
+rem ECHO "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
diff --git a/lib/xmlgraphics-commons-1.4svn.jar b/lib/xmlgraphics-commons-1.5svn.jar Binary files differindex 444fa5f4d..0975fc22e 100644 --- a/lib/xmlgraphics-commons-1.4svn.jar +++ b/lib/xmlgraphics-commons-1.5svn.jar diff --git a/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java b/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java index c2262b7b7..6786e43f0 100644 --- a/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java +++ b/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java @@ -117,6 +117,7 @@ public class EventProducerCollectorTask extends Task { /** * Updates the translation file with new entries for newly found event producer methods. + * @param modelFile the model file to use * @throws IOException if an I/O error occurs */ protected void updateTranslationFile(File modelFile) throws IOException { diff --git a/src/codegen/unicode/data/LineBreakPairTable.txt b/src/codegen/unicode/data/LineBreakPairTable.txt index 948877d9f..8e2c0c6ce 100644 --- a/src/codegen/unicode/data/LineBreakPairTable.txt +++ b/src/codegen/unicode/data/LineBreakPairTable.txt @@ -1,28 +1,29 @@ - OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT -OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^ -CL _ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _ -QU ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % -GL % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % -NS _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -EX _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -SY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -IS _ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _ -PR % ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % % -PO % ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _ -NU % ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _ -AL % ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _ -ID _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ -IN _ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ -HY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -BA _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ -BB % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % -B2 _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _ -ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _ -CM _ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _ -WJ % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % -H2 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % % -H3 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ % -JL _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _ -JV _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % % -JT _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ % + OP CP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT +OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^ +CP _ ^ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _ +CL _ ^ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _ +QU ^ ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % +GL % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % +NS _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ +EX _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ +SY _ ^ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _ +IS _ ^ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _ +PR % ^ ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % % +PO % ^ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _ +NU % ^ ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _ +AL % ^ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _ +ID _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ +IN _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _ +HY _ ^ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _ +BA _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _ +BB % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % +B2 _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _ +ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _ +CM _ ^ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _ +WJ % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % % +H2 _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % % +H3 _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ % +JL _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _ +JV _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % % +JT _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ % diff --git a/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java b/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java index 4b3b9f734..263a1c694 100644 --- a/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java +++ b/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java @@ -51,7 +51,8 @@ import org.apache.fop.util.License; */ public final class UnicodeClasses { - public static String UNICODE_DIR = "http://www.unicode.org/Public/UNIDATA/"; + /** directory containing unicode properties files */ + public static final String UNICODE_DIR = "http://www.unicode.org/Public/UNIDATA/"; /** * Disallow constructor for this utility class @@ -77,7 +78,7 @@ public final class UnicodeClasses { * Generate classes.xml from Java's compiled-in Unicode Character Database * @param hexcode whether to prefix each class with the hexcode (only for debugging purposes) * @param outfilePath output file - * @throws IOException + * @throws IOException if an I/O exception occurs */ public static void fromJava(boolean hexcode, String outfilePath) throws IOException { File f = new File(outfilePath); @@ -159,8 +160,7 @@ public final class UnicodeClasses { * @param unidataPath path to the directory with UCD files * @param outfilePath output file * @throws IOException if the input files are not found - * @throws URISyntaxException - * @throws FOPException + * @throws URISyntaxException if {@code unidataPath} cannot be converted to a URI */ public static void fromUCD(boolean hexcode, String unidataPath, String outfilePath) throws IOException, URISyntaxException { @@ -286,7 +286,7 @@ public final class UnicodeClasses { * @param hexcode whether to prefix each class with the hexcode (only for debugging purposes) * @param lettersPath path to XeTeX's Unicode letters file unicode-letters-XeTeX.tex * @param outfilePath output file - * @throws IOException + * @throws IOException in case of an I/O exception */ public static void fromTeX(boolean hexcode, String lettersPath, String outfilePath) throws IOException { diff --git a/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java b/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java index f96b7484f..f4af3d915 100644 --- a/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java +++ b/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java @@ -33,6 +33,8 @@ import java.util.Map; import org.apache.fop.util.License; +// CSOFF: LineLengthCheck + /** * <p>Utility for generating a Java class representing line break properties * from the Unicode property files.</p> @@ -46,7 +48,10 @@ import org.apache.fop.util.License; * </ul> * */ -public class GenerateLineBreakUtils { +public final class GenerateLineBreakUtils { + + private GenerateLineBreakUtils() { + } private static final int MAX_LINE_LENGTH = 110; @@ -57,12 +62,14 @@ public class GenerateLineBreakUtils { private static final byte PROHIBITED_BREAK = 4; // ^ in table private static final byte EXPLICIT_BREAK = 5; // ! in rules private static final String BREAK_CLASS_TOKENS = "_%#@^!"; - private static final String notInPairTable[] = { "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" }; + private static final String[] NOT_IN_PAIR_TABLE = { + "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" + }; - private static final byte lineBreakProperties[] = new byte[0x10000]; - private static final Map lineBreakPropertyValues = new HashMap(); - private static final List lineBreakPropertyShortNames = new ArrayList(); - private static final List lineBreakPropertyLongNames = new ArrayList(); + private static byte[] lineBreakProperties = new byte[0x10000]; + private static Map lineBreakPropertyValues = new HashMap(); + private static List lineBreakPropertyShortNames = new ArrayList(); + private static List lineBreakPropertyLongNames = new ArrayList(); /** * Generate a class managing line break properties for Unicode characters and a sample @@ -76,7 +83,7 @@ public class GenerateLineBreakUtils { * @param outFileName Name of the output file. * @throws Exception in case anything goes wrong. */ - private static void convertLineBreakProperties( + private static void convertLineBreakProperties( // CSOK: MethodLength String lineBreakFileName, String propertyValueFileName, String breakPairFileName, @@ -86,21 +93,21 @@ public class GenerateLineBreakUtils { readLineBreakProperties(lineBreakFileName, propertyValueFileName); // read break pair table int lineBreakPropertyValueCount = lineBreakPropertyValues.size(); - int tableSize = lineBreakPropertyValueCount - notInPairTable.length; - Map notInPairTableMap = new HashMap(notInPairTable.length); - for (int i = 0; i < notInPairTable.length; i++) { - Object v = lineBreakPropertyValues.get(notInPairTable[i]); + int tableSize = lineBreakPropertyValueCount - NOT_IN_PAIR_TABLE.length; + Map notInPairTableMap = new HashMap(NOT_IN_PAIR_TABLE.length); + for (int i = 0; i < NOT_IN_PAIR_TABLE.length; i++) { + Object v = lineBreakPropertyValues.get(NOT_IN_PAIR_TABLE[i]); if (v == null) { - throw new Exception("'not in pair table' property not found: " + notInPairTable[i]); + throw new Exception("'not in pair table' property not found: " + NOT_IN_PAIR_TABLE[i]); } - notInPairTableMap.put(notInPairTable[i], v); + notInPairTableMap.put(NOT_IN_PAIR_TABLE[i], v); } - byte pairTable[][] = new byte[tableSize][]; - byte columnHeader[] = new byte[tableSize]; - byte rowHeader[] = new byte[tableSize]; - byte columnMap[] = new byte[lineBreakPropertyValueCount + 1]; + byte[][] pairTable = new byte[tableSize][]; + byte[] columnHeader = new byte[tableSize]; + byte[] rowHeader = new byte[tableSize]; + byte[] columnMap = new byte[lineBreakPropertyValueCount + 1]; Arrays.fill(columnMap, (byte)255); - byte rowMap[] = new byte[lineBreakPropertyValueCount + 1]; + byte[] rowMap = new byte[lineBreakPropertyValueCount + 1]; Arrays.fill(rowMap, (byte)255); BufferedReader b = new BufferedReader(new FileReader(breakPairFileName)); String line = b.readLine(); @@ -224,7 +231,7 @@ public class GenerateLineBreakUtils { // generate class int rowsize = 512; int blocksize = lineBreakProperties.length / rowsize; - byte row[][] = new byte[rowsize][]; + byte[][] row = new byte[rowsize][]; int idx = 0; StringBuffer doStaticLinkCode = new StringBuffer(); PrintWriter out = new PrintWriter(new FileWriter(outFileName)); @@ -242,8 +249,15 @@ public class GenerateLineBreakUtils { out.println(" * - commit BOTH changed files"); out.println(" */"); out.println(); + out.println("// CSOFF: WhitespaceAfterCheck"); + out.println("// CSOFF: LineLengthCheck"); + out.println(); + out.println("/** Line breaking utilities. */"); out.println("public final class LineBreakUtils {"); out.println(); + out.println(" private LineBreakUtils() {"); + out.println(" }"); + out.println(); out.println(" /** Break class constant */"); out.println(" public static final byte DIRECT_BREAK = " + DIRECT_BREAK + ';'); out.println(" /** Break class constant */"); @@ -257,7 +271,7 @@ public class GenerateLineBreakUtils { out.println(" /** Break class constant */"); out.println(" public static final byte EXPLICIT_BREAK = " + EXPLICIT_BREAK + ';'); out.println(); - out.println(" private static final byte PAIR_TABLE[][] = {"); + out.println(" private static final byte[][] PAIR_TABLE = {"); boolean printComma = false; for (int i = 1; i <= lineBreakPropertyValueCount; i++) { if (printComma) { @@ -283,9 +297,9 @@ public class GenerateLineBreakUtils { } out.println("};"); out.println(); - out.println(" private static byte lineBreakProperties[][] = new byte[" + rowsize + "][];"); + out.println(" private static byte[][] lineBreakProperties = new byte[" + rowsize + "][];"); out.println(); - out.println(" private static void init_0() {"); + out.println(" private static void init0() {"); int rowsPrinted = 0; int initSections = 0; for (int i = 0; i < rowsize; i++) { @@ -315,7 +329,7 @@ public class GenerateLineBreakUtils { out.println(" }"); out.println(); initSections++; - out.println(" private static void init_" + initSections + "() {"); + out.println(" private static void init" + initSections + "() {"); rowsPrinted = 0; } row[i] = new byte[blocksize]; @@ -339,7 +353,7 @@ public class GenerateLineBreakUtils { out.println(); out.println(" static {"); for (int i = 0; i <= initSections; i++) { - out.println(" init_" + i + "();"); + out.println(" init" + i + "();"); } out.print(doStaticLinkCode); out.println(" }"); @@ -354,7 +368,7 @@ public class GenerateLineBreakUtils { out.println(';'); } out.println(); - final String shortNamePrefix = " private static String lineBreakPropertyShortNames[] = {"; + final String shortNamePrefix = " private static String[] lineBreakPropertyShortNames = {"; out.print(shortNamePrefix); int lineLength = shortNamePrefix.length(); printComma = false; @@ -383,7 +397,7 @@ public class GenerateLineBreakUtils { } out.println("};"); out.println(); - final String longNamePrefix = " private static String lineBreakPropertyLongNames[] = {"; + final String longNamePrefix = " private static String[] lineBreakPropertyLongNames = {"; out.print(longNamePrefix); lineLength = longNamePrefix.length(); printComma = false; @@ -600,11 +614,11 @@ public class GenerateLineBreakUtils { for (int i = 0; i < 16; i++) { int rowsize = 1 << i; int blocksize = lineBreakProperties.length / (rowsize); - byte row[][] = new byte[rowsize][]; + byte[][] row = new byte[rowsize][]; int idx = 0; int nrOfDistinctBlocks = 0; for (int j = 0; j < rowsize; j++) { - byte block[] = new byte[blocksize]; + byte[] block = new byte[blocksize]; for (int k = 0; k < blocksize; k++) { block[k] = lineBreakProperties[idx]; idx++; @@ -638,6 +652,10 @@ public class GenerateLineBreakUtils { } } + /** + * Main entry point for running GenerateLineBreakUtils + * @param args array of command line arg + */ public static void main(String[] args) { String lineBreakFileName = "http://www.unicode.org/Public/UNIDATA/LineBreak.txt"; String propertyValueFileName = "http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt"; @@ -650,13 +668,13 @@ public class GenerateLineBreakUtils { } else { String opt = args[i]; if ("-l".equals(opt)) { - lineBreakFileName = args[i+1]; + lineBreakFileName = args[i + 1]; } else if ("-p".equals(opt)) { - propertyValueFileName = args[i+1]; + propertyValueFileName = args[i + 1]; } else if ("-b".equals(opt)) { - breakPairFileName = args[i+1]; - } else if("-o".equals(opt)) { - outFileName = args[i+1]; + breakPairFileName = args[i + 1]; + } else if ("-o".equals(opt)) { + outFileName = args[i + 1]; } else { ok = false; } diff --git a/src/codegen/unicode/java/org/apache/fop/util/License.java b/src/codegen/unicode/java/org/apache/fop/util/License.java index b6e3db8a4..ea28f6f09 100644 --- a/src/codegen/unicode/java/org/apache/fop/util/License.java +++ b/src/codegen/unicode/java/org/apache/fop/util/License.java @@ -29,10 +29,13 @@ import java.io.Writer; */ public final class License { + private License() { + } + /** * The Apache license text as a string array */ - public static final String[] license + public static final String[] LICENSE = {"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.", @@ -52,21 +55,21 @@ public final class License { /** * The subversion Id keyword line */ - public static final String id = "$Id$"; + public static final String ID = "$Id$"; /** * Calculate the maximum line length in the Apache license text * for use in formatting */ - private static int MAX_LENGTH; + private static int maxLength; static { int j = 0; - for (int i = 0; i < license.length; ++i) { - if (j < license[i].length()) { - j = license[i].length(); + for (int i = 0; i < LICENSE.length; ++i) { + if (j < LICENSE[i].length()) { + j = LICENSE[i].length(); } } - MAX_LENGTH = j; + maxLength = j; } /** @@ -76,16 +79,16 @@ public final class License { */ public static void writeJavaLicenseId(Writer w) throws IOException { w.write("/*\n"); - for (int i = 0; i < license.length; ++i) { - if (license[i].equals("")) { + for (int i = 0; i < LICENSE.length; ++i) { + if (LICENSE[i].equals("")) { w.write(" *\n"); } else { - w.write(" * " + license[i] + "\n"); + w.write(" * " + LICENSE[i] + "\n"); } } w.write(" */\n"); w.write("\n"); - w.write("/* " + id + " */\n"); + w.write("/* " + ID + " */\n"); } /** @@ -94,11 +97,11 @@ public final class License { * @throws IOException if the write operation fails */ public static void writeXMLLicenseId(Writer w) throws IOException { - for (int i = 0; i < license.length; ++i) { - w.write(String.format("<!-- %-" + MAX_LENGTH + "s -->\n", new Object[] {license[i]})); + for (int i = 0; i < LICENSE.length; ++i) { + w.write(String.format("<!-- %-" + maxLength + "s -->\n", new Object[] {LICENSE[i]})); } w.write("\n"); - w.write("<!-- " + id + " -->\n"); + w.write("<!-- " + ID + " -->\n"); } /** diff --git a/src/documentation/content/.htaccess b/src/documentation/content/.htaccess index 5203ea63e..b020b2422 100644 --- a/src/documentation/content/.htaccess +++ b/src/documentation/content/.htaccess @@ -1,38 +1,39 @@ # redirect moved files -RedirectMatch Permanent ^/fop/anttask(.*) http://xmlgraphics.apache.org/fop/0.95/anttask$1 -RedirectMatch Permanent ^/fop/compiling(.*) http://xmlgraphics.apache.org/fop/0.95/compiling$1 -RedirectMatch Permanent ^/fop/configuration(.*) http://xmlgraphics.apache.org/fop/0.95/configuration$1 -RedirectMatch Permanent ^/fop/embedding(.*) http://xmlgraphics.apache.org/fop/0.95/embedding$1 -RedirectMatch Permanent ^/fop/extensions(.*) http://xmlgraphics.apache.org/fop/0.95/extensions$1 -RedirectMatch Permanent ^/fop/fonts(.*) http://xmlgraphics.apache.org/fop/0.95/fonts$1 -RedirectMatch Permanent ^/fop/graphics(.*) http://xmlgraphics.apache.org/fop/0.95/graphics$1 -RedirectMatch Permanent ^/fop/hyphenation(.*) http://xmlgraphics.apache.org/fop/0.95/hyphenation$1 -RedirectMatch Permanent ^/fop/intermediate(.*) http://xmlgraphics.apache.org/fop/0.95/intermediate$1 -RedirectMatch Permanent ^/fop/output(.*) http://xmlgraphics.apache.org/fop/0.95/output$1 -RedirectMatch Permanent ^/fop/pdfa(.*) http://xmlgraphics.apache.org/fop/0.95/pdfa$1 -RedirectMatch Permanent ^/fop/pdfencryption(.*) http://xmlgraphics.apache.org/fop/0.95/pdfencryption$1 -RedirectMatch Permanent ^/fop/pdfx(.*) http://xmlgraphics.apache.org/fop/0.95/pdfx$1 -RedirectMatch Permanent ^/fop/running(.*) http://xmlgraphics.apache.org/fop/0.95/running$1 -RedirectMatch Permanent ^/fop/servlets(.*) http://xmlgraphics.apache.org/fop/0.95/servlets$1 -RedirectMatch Permanent ^/fop/upgrading(.*) http://xmlgraphics.apache.org/fop/0.95/upgrading$1 +RedirectMatch Permanent ^/fop/anttask(.*) http://xmlgraphics.apache.org/fop/1.0/anttask$1 +RedirectMatch Permanent ^/fop/compiling(.*) http://xmlgraphics.apache.org/fop/1.0/compiling$1 +RedirectMatch Permanent ^/fop/configuration(.*) http://xmlgraphics.apache.org/fop/1.0/configuration$1 +RedirectMatch Permanent ^/fop/embedding(.*) http://xmlgraphics.apache.org/fop/1.0/embedding$1 +RedirectMatch Permanent ^/fop/extensions(.*) http://xmlgraphics.apache.org/fop/1.0/extensions$1 +RedirectMatch Permanent ^/fop/fonts(.*) http://xmlgraphics.apache.org/fop/1.0/fonts$1 +RedirectMatch Permanent ^/fop/graphics(.*) http://xmlgraphics.apache.org/fop/1.0/graphics$1 +RedirectMatch Permanent ^/fop/hyphenation(.*) http://xmlgraphics.apache.org/fop/1.0/hyphenation$1 +RedirectMatch Permanent ^/fop/intermediate(.*) http://xmlgraphics.apache.org/fop/1.0/intermediate$1 +RedirectMatch Permanent ^/fop/output(.*) http://xmlgraphics.apache.org/fop/1.0/output$1 +RedirectMatch Permanent ^/fop/pdfa(.*) http://xmlgraphics.apache.org/fop/1.0/pdfa$1 +RedirectMatch Permanent ^/fop/pdfencryption(.*) http://xmlgraphics.apache.org/fop/1.0/pdfencryption$1 +RedirectMatch Permanent ^/fop/pdfx(.*) http://xmlgraphics.apache.org/fop/1.0/pdfx$1 +RedirectMatch Permanent ^/fop/running(.*) http://xmlgraphics.apache.org/fop/1.0/running$1 +RedirectMatch Permanent ^/fop/servlets(.*) http://xmlgraphics.apache.org/fop/1.0/servlets$1 +RedirectMatch Permanent ^/fop/upgrading(.*) http://xmlgraphics.apache.org/fop/1.0/upgrading$1 # redirect to versioned documentation # Current stable release -Redirect Temp /fop/stable http://xmlgraphics.apache.org/fop/0.95 +Redirect Temp /fop/stable http://xmlgraphics.apache.org/fop/1.0 # Current unstable release (or trunk if no beta is the latest release) Redirect Temp /fop/unstable http://xmlgraphics.apache.org/fop/trunk # Latest release -Redirect Temp /fop/current http://xmlgraphics.apache.org/fop/0.95 -Redirect Temp /fop/latest http://xmlgraphics.apache.org/fop/0.95 +Redirect Temp /fop/current http://xmlgraphics.apache.org/fop/1.0 +Redirect Temp /fop/latest http://xmlgraphics.apache.org/fop/1.0 # Previous stable release -Redirect Temp /fop/previous http://xmlgraphics.apache.org/fop/0.94 +Redirect Temp /fop/previous http://xmlgraphics.apache.org/fop/0.95 # Old releases -Redirect Temp /fop/maintenance http://xmlgraphics.apache.org/fop/0.94 -Redirect Temp /fop/0.90alpha1 http://xmlgraphics.apache.org/fop/0.94 -Redirect Temp /fop/0.91beta http://xmlgraphics.apache.org/fop/0.94 -Redirect Temp /fop/0.92beta http://xmlgraphics.apache.org/fop/0.94 -Redirect Temp /fop/0.93 http://xmlgraphics.apache.org/fop/0.94 +Redirect Temp /fop/maintenance http://xmlgraphics.apache.org/fop/0.95 +Redirect Temp /fop/0.90alpha1 http://xmlgraphics.apache.org/fop/0.95 +Redirect Temp /fop/0.91beta http://xmlgraphics.apache.org/fop/0.95 +Redirect Temp /fop/0.92beta http://xmlgraphics.apache.org/fop/0.95 +Redirect Temp /fop/0.93 http://xmlgraphics.apache.org/fop/0.95 +Redirect Temp /fop/0.94 http://xmlgraphics.apache.org/fop/0.95 diff --git a/src/documentation/content/doap.rdf b/src/documentation/content/doap.rdf index 734e8339b..8ccd82bf6 100644 --- a/src/documentation/content/doap.rdf +++ b/src/documentation/content/doap.rdf @@ -77,22 +77,15 @@ <release> <Version> <name>Previous stable release</name> - <created>2007-08-23</created> - <revision>0.94</revision> - </Version> - </release> - <release> - <Version> - <name>Previous development release</name> - <created>2008-03-26</created> - <revision>0.95beta</revision> + <created>2008-08-05</created> + <revision>0.95</revision> </Version> </release> <release> <Version> <name>Latest stable release</name> - <created>2008-08-05</created> - <revision>0.95</revision> + <created>2010-07-21</created> + <revision>1.0</revision> </Version> </release> <repository> diff --git a/src/documentation/content/xdocs/0.94/extensions.xml b/src/documentation/content/xdocs/0.94/extensions.xml deleted file mode 100644 index 04d44ef6f..000000000 --- a/src/documentation/content/xdocs/0.94/extensions.xml +++ /dev/null @@ -1,121 +0,0 @@ -<?xml version="1.0" standalone="no"?> -<!-- - 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$ --> -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> -<document> - <header> - <title>Standard FOP Extensions</title> - <version>$Revision$</version> - </header> - <body> - <p> - By "extension", we mean any data that can be placed in the input XML document that - is not addressed by the XSL-FO standard. - By having a mechanism for supporting extensions, FOP is able to add features that - are not covered in the specification. - </p> - <p> - The extensions documented here are included with FOP, and are automatically available - to you. If you wish to add an extension of your own to FOP, please see the - <a href="../dev/extensions.html">Developers' Extension Page</a>. - </p> - <note>All extensions require the correct use of an appropriate namespace in your input document.</note> - <section id="svg"> - <title>SVG</title> - <p> - Please see the <a href="graphics.html#svg">SVG documentation</a> for more details. - </p> - </section> - <section id="fo-extensions"> - <title>FO Extensions</title> - <section id="fox-namespace"> - <title>Namespace</title> - <p> - By convention, FO extensions in FOP use the "fox" namespace prefix. - To use any of the FO extensions, add a namespace entry for - <code>http://xmlgraphics.apache.org/fop/extensions</code> to the root element: - </p> - <source><![CDATA[<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" - xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">]]></source> - </section> - <section id="bookmarks"> - <title>PDF Bookmarks</title> - <p> - In previous versions of Apache FOP there was a <code>fox:outline</code> element - which was used to create outlines in PDF files. The redesigned code makes use - of the new <a href="http://www.w3.org/TR/xsl11/#fo_bookmark-tree">bookmark feature defined in the latest XSL 1.1 working draft</a>. - </p> - </section> - <section id="named-destinations"> - <title>Anchors or Named Destinations</title> - <p>This extension element hasn't been reimplemented for the redesigned code, yet.</p> - <!--p>Use the fox:destination element to define "named destinations" inside a PDF document. -These are useful as fragment identifiers, e.g. "http://server/document.pdf#anchor-name". -fox:destination elements can be placed almost anywhere in the fo document, including a child of -root, a block-level element, or an inline-level element. -For the destination to actually work, it must correspond to an "id" attribute on some fo element -within the document. In other words, the "id" attribute actually creates the "view" within the -PDF document. The fox:destination simply gives that view an independent name. -</p> - <source><![CDATA[<fox:destination internal-destination="table-of-contents"/> -... -<fo:block id="table-of-contents">Table of Contents</fo:block>]]></source> - <warning>It is possible that in some future release of FOP, <em>all </em>elements with -"id" attributes will generate named-destinations, which will eliminate the need for -fox:destination.</warning--> - </section> - <section id="table-continue-label"> - <title>Table Continuation Label</title> - <p>This extension element hasn't been reimplemented for the redesigned code, yet.</p> - <!--p>Use the fox:continued-label element to create content in table-header and -table-footer cells that will appear only on pages after the first page that the table -appears. fox:continued-label is itself inline content, and is a container of fo:inline -content. This content will be laid out only if the table does not fit on a single page and flows -to following pages. Here is an example of FO code creating such a table-header:</p> -<source><![CDATA[<fo:table-header> - <fo:table-row> - <fo:table-cell> - <fo:block>Header column 1 with continued label - <fox:continued-label><fo:inline> (cont.)</fo:inline></fox:continued-label> - </fo:block> - </fo:table-cell> - <fo:table-cell> - <fo:block>Header column 2 with no continued label</fo:block> - </fo:table-cell> - </fo:table-row> -</fo:table-header>]]></source--> - </section> - <section id="widow-orphan-content-limit"> - <title>fox:orphan-content-limit and fox:widow-content-limit</title> - <p> - The two proprietary extension properties, fox:orphan-content-limit and - fox:widow-content-limit, are used to improve the layout of list-blocks and tables. - If you have a table with many entries, you don't want a single row to be left over - on a page. You will want to make sure that at least two or three lines are kept - together. The properties take an absolute length which specifies the area at the - beginning (fox:widow-content-limit) or at the end (fox:orphan-content-limit) of a - table or list-block. The properties are inherited and only have an effect on fo:table - and fo:list-block. An example: fox:widow-content-limit="3 * 1.2em" would make sure - the you'll have at least three lines (assuming line-height="1.2") together on a table - or list-block. - </p> - </section> - </section> - </body> -</document> - diff --git a/src/documentation/content/xdocs/0.94/fonts.xml b/src/documentation/content/xdocs/0.94/fonts.xml deleted file mode 100644 index 1f1c66b31..000000000 --- a/src/documentation/content/xdocs/0.94/fonts.xml +++ /dev/null @@ -1,322 +0,0 @@ -<?xml version="1.0" standalone="no"?> -<!-- - 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$ --> -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> -<document> - <header> - <title>Apache FOP: Fonts</title> - <version>$Revision$</version> - <authors> - <person name="Jeremias Märki" email=""/> - <person name="Tore Engvig" email=""/> - <person name="Adrian Cumiskey" email=""/> - </authors> - </header> - <body> - <section id="intro"> - <title>Summary</title> - <note>The FOP Font subsystem is currently undergoing a significant change. - The details provided here especially related to the generation of FOP Font - Metrics files and the FOP Font configuration are likely to change substantially - in the future. - </note> - <p>The following table summarizes the font capabilities of the various FOP renderers:</p> - <table> - <tr> - <th>Renderer</th> - <th>Base-14</th> - <th>AWT/OS</th> - <th>Custom</th> - <th>Custom Embedding</th> - </tr> - <tr> - <td>PDF</td> - <td>yes</td> - <td>no</td> - <td>yes</td> - <td>yes</td> - </tr> - <tr> - <td>PostScript</td> - <td>yes</td> - <td>no</td> - <td>yes</td> - <td>yes</td> - </tr> - <!--tr> NOT AVAILABLE YET!!! - <td>PCL</td> - <td>yes (modified)</td> - <td>no</td> - <td>no</td> - <td>no</td> - </tr--> - <tr> - <td>TXT</td> - <td>yes (used for layout but not for output)</td> - <td>no</td> - <td>yes (used for layout but not for output)</td> - <td>no</td> - </tr> - <tr> - <td>AWT</td> - <td>if available from OS</td> - <td>yes</td> - <td>yes</td> - <td>n/a (display only)</td> - </tr> - <tr> - <td>Print</td> - <td>if available from OS</td> - <td>yes</td> - <td>yes</td> - <td>controlled by OS printer driver</td> - </tr> - <tr> - <td>RTF</td> - <td>n/a (font metrics not needed)</td> - <td>n/a</td> - <td>n/a</td> - <td>n/a</td> - </tr> - <tr> - <td>MIF</td> - <td>n/a (font metrics not needed)</td> - <td>n/a</td> - <td>n/a</td> - <td>n/a</td> - </tr> - <tr> - <td>SVG</td> - <td>if available from OS</td> - <td>yes</td> - <td>no</td> - <td>no</td> - </tr> - <tr> - <td>XML</td> - <td>yes</td> - <td>no</td> - <td>yes</td> - <td>n/a</td> - </tr> - </table> - </section> - <section> - <title>Base-14 Fonts</title> - <p>The Adobe PDF Specification specifies a set of 14 fonts that must be available to every PDF reader: Helvetica (normal, bold, italic, bold italic), Times (normal, bold, italic, bold italic), Courier (normal, bold, italic, bold italic), Symbol and ZapfDingbats.</p> - </section> - <section id="awt"> - <title>AWT/Operating System Fonts</title> - <p>The AWT family of renderers (AWT, Print, SVG), use the Java AWT libraries for font metric information. Through operating system registration, the AWT libraries know what fonts are available on the system, and the font metrics for each one.</p> - </section> - <section id="custom"> - <title>Custom Fonts</title> - <p>Support for custom fonts is added by creating font metric files (written in XML) from the actual font files, and registering them with FOP. Currently only Type 1 and TrueType fonts can be added. -More information about fonts can be found at:</p> - <ul> - <li><a href="http://partners.adobe.com/asn/developer/type/ftypes.html">Adobe font types</a></li> - <li><a href="http://partners.adobe.com/asn/developer/technotes/fonts.html">Adobe Font Technote</a></li> - </ul> - <section id="type1-metrics"> - <title>Type 1 Font Metrics</title> - <p>FOP includes PFMReader, which reads the PFM file that normally comes with a Type 1 font, and generates an appropriate font metrics file for it. -To use it, run the class org.apache.fop.fonts.apps.PFMReader:</p> - <p>Windows (on JDK 1.4 and later):</p> - <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source> - <p>Windows (on JDK 1.3.x):</p> - <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar;lib\xml-apis.jar; - lib\xercesImpl.jar;lib\xalan.jar;lib\serializer.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source> - <p>Unix (on JDK 1.4 and later):</p> - <source>java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source> - <p>Unix (on JDK 1.3.1):</p> - <source>java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar:lib/xml-apis.jar: - lib/xercesImpl.jar:lib/xalan.jar:lib/serializer.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source> - <p>PFMReader [options]:</p> - <ul> - <li><strong>-fn <fontname></strong> By default, FOP uses the fontname from the -.pfm file when embedding the font. Use the "-fn" option to override this name with one you have -chosen. This may be useful in some cases to ensure that applications using the output document -(Acrobat Reader for example) use the embedded font instead of a local font with the same -name.</li> - </ul> - <note>The classpath in the above example has been simplified for readability. -You will have to adjust the classpath to the names of the actual JAR files in the lib directory. -xml-apis.jar, xercesImpl.jar, xalan.jar and serializer.jar are not necessary for JDK version 1.4 or later.</note> - <note>The tool will construct some values (FontBBox, StemV and ItalicAngle) based on assumptions and calculations which are only an approximation to the real values. -FontBBox and Italic Angle can be found in the human-readable part of the PFB file or in the AFM file. -The PFMReader tool does not yet interpret PFB or AFM files, so if you want to be correct, you may have to adjust the values in the XML file manually. -The constructed values however appear to have no visible influence.</note> - </section> - <section id="truetype-metrics"> - <title>TrueType Font Metrics</title> - <p>FOP includes TTFReader, which reads the TTF file and generates an appropriate font metrics file for it. -Use it in a similar manner to PFMReader. -For example, to create such a metrics file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:</p> - <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.TTFReader [options] - C:\myfonts\cmr10.ttf ttfcm.xml</source> - <p>TTFReader [options]:</p> - <ul> - <li><strong>-d <DEBUG | INFO ></strong> Sets the debug level (default is -INFO).</li> - <li><strong>-fn <fontname></strong> Same as for PFMReader.</li> - <li><strong>-ttcname <fontname></strong> If you're reading data from a -TrueType Collection (.ttc file) you must specify which font from the collection you will read -metrics from. -If you read from a .ttc file without this option, the fontnames will be listed for you.</li> - <li><strong>-enc ansi</strong> Creates a WinAnsi-encoded font metrics file. -Without this option, a CID-keyed font metrics file is created. -The table below summarizes the differences between these two encoding options as currently -used within FOP. -Please note that this information only applies to TrueType fonts and TrueType collections:</li> - </ul> - <table id="ttf-encoding"> - <tr> - <th>Issue</th> - <th>WinAnsi</th> - <th>CID-keyed</th> - </tr> - <tr> - <td>Usable Character Set</td> - <td>Limited to WinAnsi character set, which is roughly equivalent to iso-8889-1.</td> - <td>Limited only by the characters in the font itself.</td> - </tr> - <tr> - <td>Embedding the Font</td> - <td>Optional.</td> - <td>Mandatory. Not embedding the font produces invalid PDF documents.</td> - </tr> - </table> - <warning> - You may experience failures with certain TrueType fonts, especially if they don't contain - the so-called Unicode "cmap" table. TTFReader can currently not deal with font like this. - </warning> - </section> - <section id="truetype-collections-metrics"> - <title>TrueType Collections Font Metrics</title> - <p>TrueType collections (.ttc files) contain more than one font. -To create metrics files for these fonts, you must specify which font in the collection should be generated, by using the "-ttcname" option with the TTFReader.</p> - <p>To get a list of the fonts in a collection, just start the TTFReader as if it were a normal TrueType file (without the -ttcname option). -It will display all of the font names and exit with an Exception.</p> - <p>Here is an example of generating a metrics file for a .ttc file:</p> - <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" - msmincho.ttc msminch.xml</source> - </section> - <section id="register"> - <title>Register Fonts with FOP</title> - <p>You must tell FOP how to find and use the font metrics files by registering them in the <a href="configuration.html">FOP Configuration</a>. Add entries for your custom fonts, regardless of font type, to the configuration file in a manner similar to the following:</p> - <source><![CDATA[ -<fonts> - <!-- register a particular font --> - <font metrics-url="file:///C:/myfonts/FTL_____.xml" kerning="yes" - embed-url="file:///C:/myfonts/FTL_____.pfb"> - <font-triplet name="FrutigerLight" style="normal" weight="normal"/> - </font> - - <!-- register all the fonts found in a directory --> - <directory>C:\MyFonts1</directory> - - <!-- register all the fonts found in a directory - and all of its sub directories (use with care) --> - <directory recursive="true">C:\MyFonts2</directory> - - <!-- automatically detect operating system installed fonts --> - <auto-detect/> -</fonts>]]></source> - <note> - Review the documentation for <a href="configuration.html">FOP Configuration</a> for - instructions on making the FOP configuration available to FOP when it runs. Otherwise, - FOP has no way of finding your custom font information. - </note> - <ul> - <li> - URLs are used to access the font metric and font files. - Relative URLs are resolved relative to the font-base property (or base) if available. - See <a href="configuration.html">FOP: Configuration</a> for more information. - </li> - <li> - If relative URLs are specified, they are evaluated relative to the value of the - "font-base" setting. If there is no "font-base" setting, the fonts are evaluated - relative to the base directory. - </li> - <li>Either an "embed-url" or a "metrics-url" must be specified for font tag configurations.</li> - <li>The font "kerning" attribute is optional.</li> - <li>If embedding is off, the output will position the text correctly (from the metrics file), but it will not be displayed or printed correctly unless the viewer has the applicable font available to their local system.</li> - <li>When setting the "embed-url" attribute for Type 1 fonts, be sure to specify the PFB (actual font data), not PFM (font metrics) file that you used to generate the XML font metrics file.</li> - <li>The fonts "directory" tag can be used to register fonts contained within a single or list of directory paths. The "recursive" attribute can be specified to recursively add fonts from all sub directories.</li> - <li>Fonts registered with "font" tag configurations override fonts found by means of "directory" tag definitions.</li> - <li>Fonts found as a result of a "directory" tag configuration override fonts found as a result of the "auto-detect" tag being specified.</li> - <li>The fonts "auto-detect" tag can be used to automatically register fonts that are found to be installed on the native operating system. - <ul> - <li>On Unix platforms the autodetect feature looks in java user.home + "/.fonts", "/usr/local/fonts", "/usr/share/fonts" and "/usr/X11R6/lib/X11/fonts" for fonts it is able to use.</li> - <li>On Mac platforms the autodetect feature looks in java user.home + "/Library/Fonts/, "/Library/Fonts/", "/System/Library/Fonts/" and "/Network/Library/Fonts/" for fonts it is able to use.</li> - <li>On Windows platforms the autodetect feature attempts to determine the Windows fonts directory (usually C:\WINDOWS\FONTS) and also the existence of a PSFONTS directory for fonts it is able to use.</li> - </ul> - </li> - </ul> - <!--note>Cocoon users will need to setup the config, see FOPSerializer for more information.</note--> - </section> - <section id="embedding"> - <title>Embedding</title> - <note>The PostScript renderer does not yet support TrueType fonts, but can embed Type 1 fonts.</note> - <note>The font is simply embedded into the PDF file, it is not converted.</note> - <p>Font embedding is enabled in the userconfig.xml file and controlled by the embed-url attribute. -If you don't specify the embed-url attribute the font will not be embedded, but will only be referenced.</p> - <warning> - Omitting the embed-url attribute for CID-encoded TrueType fonts will currently produce invalid - PDF files! If you create the XML font metric file using the "-enc ansi" option, you can omit - the embed-url attribute for TrueType fonts but you're restricted to the WinAnsi character set. - </warning> - <p>When FOP embeds a font, it adds a prefix to the fontname to ensure that the name will not match the fontname of an installed font. -This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.</p> - <p>When embedding PostScript fonts, the entire font is always embedded.</p> - <p>When embedding TrueType fonts (ttf) or TrueType Collections (ttc), a subset of the - original font, containing only the glyphs used, is embedded in the output document.</p> - </section> - <section id="embedding-base14"> - <title>Explicitly embedding the base 14 fonts</title> - <p> - There are cases where you might want to force the embedding of one or more of the base 14 fonts that - can normally be considered available on the target platform (viewer, printer). One of these cases is - PDF/A which mandates the embedding of even the base 14 fonts. Embedding a font such as Helvetica or - Courier is straight-forward. The "Symbol" and "ZapfDingbats" fonts, however, currently present a - problem because FOP cannot correctly determine the encoding of these two single-byte fonts through - the PFM file. FOP now correctly interprets the "encoding" value in the XML font metrics file, but the - PFMReader application writes "UnknownEncoding" to the generated XML file. In order to embed "Symbol" - and "ZapfDingbats" you have to manually change the XML font metrics file and specify "SymbolEncoding" - or "ZapfdingbatsEncoding" encoding respectively as the value for the "encoding" element. - </p> - <p>Example:</p> - <source><![CDATA[ -<?xml version="1.0" encoding="UTF-8"?> -<font-metrics type="TYPE1"> - <font-name>Symbol</font-name> - <embed/> - <encoding>SymbolEncoding</encoding> - <cap-height>673</cap-height> - <x-height>766</x-height> - [..]]]></source> - </section> - </section> - </body> -</document> diff --git a/src/documentation/content/xdocs/0.94/graphics.xml b/src/documentation/content/xdocs/0.94/graphics.xml deleted file mode 100644 index 164069733..000000000 --- a/src/documentation/content/xdocs/0.94/graphics.xml +++ /dev/null @@ -1,401 +0,0 @@ -<?xml version="1.0" standalone="no"?> -<!-- - 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$ --> -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> -<document> - <header> - <title>Apache FOP: Graphics Formats</title> - <version>$Revision$</version> - </header> - <body> - <section id="support-overview"> - <title>Overview of Graphics Support</title> - <p> - The table below summarizes the <em>theoretical</em> support for graphical formats within FOP. In other words, within the constraints of the limitations listed here, these formats <em>should</em> work. However, many of them have not been tested, and there may be limitations that have not yet been discovered or documented. The packages needed to support some formats are not included in the FOP distribution and must be installed separately. Follow the links in the "Support Thru" column for more details. - </p> - <table> - <tr> - <th>Format</th> - <th>Type</th> - <th><a href="#native">FOP native support</a></th> - <th><a href="#batik">Batik SVG</a></th> - <th><a href="#batik-codecs">Batik codecs</a></th> - <th><a href="#imageio">Image I/O</a></th> - <th><a href="#jai">JAI</a></th> - <th><a href="#jimi">JIMI</a></th> - </tr> - <tr> - <td><a href="#bmp">BMP</a> (Microsoft Windows Bitmap)</td> - <td>bitmap</td> - <td>X</td> - <td></td> - <td></td> - <td></td> - <td></td> - <td></td> - </tr> - <tr> - <td><a href="#eps">EPS</a> (Encapsulated PostScript)</td> - <td>metafile (both bitmap and vector), probably most frequently used for vector drawings</td> - <td>(X)</td> - <td></td> - <td></td> - <td></td> - <td></td> - <td></td> - </tr> - <tr> - <td>GIF (Graphics Interchange Format)</td> - <td>bitmap</td> - <td>X</td> - <td></td> - <td></td> - <td>X</td> - <td>X</td> - <td>X</td> - </tr> - <tr> - <td><a href="#jpeg">JPEG</a> (Joint Photographic Experts Group)</td> - <td>bitmap</td> - <td>(X)</td> - <td></td> - <td></td> - <td>X</td> - <td></td> - <td></td> - </tr> - <tr> - <td><a href="#png">PNG</a> (Portable Network Graphic)</td> - <td>bitmap</td> - <td></td> - <td></td> - <td>X</td> - <td>X</td> - <td></td> - <td></td> - </tr> - <tr> - <td><a href="#svg">SVG</a> (Scalable Vector Graphics)</td> - <td>vector (with embedded bitmaps)</td> - <td></td> - <td>X</td> - <td></td> - <td></td> - <td></td> - <td></td> - </tr> - <tr> - <td><a href="#tiff">TIFF</a> (Tag Image Format File)</td> - <td>bitmap</td> - <td>(X)</td> - <td></td> - <td>X</td> - <td>X</td> - <td>X</td> - <td></td> - <!--td><a href="#native">FOP native</a> or <a href="#jai">JAI</a>, depending on the subformat. See <a href="#tiff">TIFF</a> for more details.(JIMI also supports TIFF, but this has not been implemented within FOP).</td--> - </tr> - <tr> - <td><a href="#emf">EMF</a> (Windows Enhanced Metafile)</td> - <td>vector (with embedded bitmaps)</td> - <td>(X)</td> - <td></td> - <td></td> - <td></td> - <td></td> - <td></td> - </tr> - </table> - <note>"(X)" means restricted support. Please see the details below.</note> - </section> - <section id="packages"> - <title>Graphics Packages</title> - <section id="native"> - <title>FOP Native</title> - <p> - FOP has native ability to handle some graphic file formats. - </p> - </section> - <section id="batik-codecs"> - <title>"Internal" codecs</title> - <p> - Apache XML Graphics Commons contains codecs for PNG and TIFF access. FOP can use these. - </p> - </section> - <section id="imageio"> - <title>Image I/O (JDK 1.4 or higher)</title> - <p> - For JDKs 1.4 or higher, FOP provides a wrapper to load images through the - <a class="fork" href="http://java.sun.com/j2se/1.4.2/docs/guide/imageio/index.html">JDK's Image I/O API</a> (JSR 015). - Image I/O allows to dynamically add additional image codecs. An example of such an add-on library are the - <a class="fork" href="http://java.sun.com/products/java-media/jai/">JAI Image I/O Tools</a> available from Sun. - </p> - </section> - <section id="jimi"> - <title>JIMI</title> - <p> - Because of licensing issues, the JIMI image library is not included in the FOP distribution. First, <a class="fork" href="http://java.sun.com/products/jimi">download</a> and install it. -Then, copy the file "JimiProClasses.zip" from the archive to {fop-install-dir}/lib/jimi-1.0.jar. Please note that FOP binary distributions are compiled with JIMI support, so there is no need for you to build FOP to add the support. If jimi-1.0.jar is installed in the right place, it will automatically be used by FOP, otherwise it will not. - </p> - </section> - <section id="jai"> - <title>JAI (Java Advanced Imaging API)</title> - <p> - FOP has been compiled with JAI support, but JAI is not included in the FOP distribution. -To use it, install <a href="http://java.sun.com/products/java-media/jai">JAI</a>, then copy the jai_core.jar and the jai_codec.jar files to {fop-install-dir}/lib. -JAI is much faster than JIMI, but is not available for all platforms. See <a href="http://java.sun.com/products/java-media/jai/forDevelopers/jaifaq.html#platforms">What platforms are supported?</a> on the JAI FAQ page for more details. - </p> - </section> - <section id="batik"> - <title>Apache Batik</title> - <p>Current FOP distributions include a distribution of the Apache <a class="fork" href="ext:batik">Batik</a> version 1.6. -It is automatically installed with FOP. -Because Batik's API changes frequently, it is highly recommended that you use the version that ships with FOP, at least when running FOP.</p> - <warning>Batik must be run in a graphical environment.</warning> - <p>Batik must be run in a graphical environment. -It uses AWT classes for rendering SVG, which in turn require an X server on Unixish systems. -If you run a server without X, or if you can't connect to the X server due to security restrictions or policies (a so-called "headless" environment), SVG rendering will fail.</p> - <p>Here are some workarounds:</p> - <ul> - <li>If you are using JDK 1.4, start it with the <code>-Djava.awt.headless=true</code> command line option.</li> - <li>Install an X server which provides an in-memory framebuffer without actually using a screen device or any display hardware. One example is Xvfb.</li> - <li>Install a toolkit which emulates AWT without the need for an underlying X server. One example is the <a href="http://www.eteks.com/pja/en">PJA toolkit</a>, which is free and comes with detailed installation instructions.</li> - </ul> - </section> - </section> - <section id="bmp"> - <title>BMP</title> - <p>FOP native support for BMP images is limited to the RGB color-space.</p> - </section> - <section id="eps"> - <title>EPS</title> - <p>FOP provides support for two output targets:</p> - <ul> - <li>PostScript (full support).</li> - <li> - PDF (partial support). Due to the lack of a built-in PostScript interpreter, FOP - can only embed the EPS file into the PDF. Acrobat Reader will not currently display - the EPS (it doesn't have a PostScript interpreter, either) but it will be shown - correctly when you print the PDF on a PostScript-capable printer. PostScript devices - (including GhostScript) will render the EPS correctly. - </li> - </ul> - <warning> - Please note that the EPS embedding feature has been <strong>deprecated</strong> in the - PDF specification version 1.4. You should not use this feature anymore, especially - since newer PDF tools don't support embedded EPS files anymore. - </warning> - <p> - Other output targets can't be supported at the moment because - FOP lacks a PostScript interpreter. Furthermore, FOP is not able - to parse the preview bitmaps sometimes contained in EPS files. - </p> - </section> - <section id="jpeg"> - <title>JPEG</title> - <p> - FOP native support of JPEG does not include all variants, especially those containing - unusual color lookup tables and color profiles. - If you have trouble with a JPEG image in FOP, try opening it with an image processing - program (such as Photoshop or Gimp) and then saving it. Specifying 24-bit color output - may also help. For the PDF and PostScript renderers most JPEG images can be passed - through without decompression. User reports indicate that grayscale, RGB, and - CMYK color-spaces are all rendered properly. - </p> - </section> - <section id="png"> - <title>PNG</title> - <p> - If using JAI for PNG support, only RGB and RGBA color-spaces are supported for - FOP rendering. - </p> - <p> - Transparency is supported but not guaranteed to work with every output format. - </p> - </section> - <section id="svg"> - <title>SVG</title> - <section id="svg-intro"> - <title>Introduction</title> - <p>FOP uses <a href="#batik"> Apache Batik</a> for SVG support. -This format can be handled as an <code>fo:instream-foreign-object</code> or in a separate -file referenced with <code>fo:external-graphic</code>.</p> - <note> -Batik's SVG Rasterizer utility may also be used to convert standalone SVG -documents into PDF. For more information please see the -<a href="http://xmlgraphics.apache.org/batik/svgrasterizer.html">SVG Rasterizer documentation</a> -on the Batik site. - </note> - </section> - <section id="svg-pdf-graphics"> - <title>Placing SVG Graphics into PDF</title> - <p> -The SVG is rendered into PDF by using PDF commands to draw and fill -lines and curves. This means that the graphical objects created with -this remain as vector graphics. The same applies to PostScript output. -For other output formats the SVG graphic will be converted to a bitmap -image. - </p> - <p> -There are a number of SVG things that cannot be converted directly into -PDF. Parts of the graphic such as effects, patterns and images are inserted -into the PDF as a raster graphic. The resolution of these raster images can - be controlled through the "target resolution" setting in the - <a href="configuration.html">configuration</a>.</p> - <p> -Currently transparency is limited in PDF so many svg images that -contain effects or graphics with transparent areas may not be displayed -correctly. - </p> - </section> - <section id="svg-pdf-text"> - <title>Placing SVG Text into PDF and PostScript</title> - <p>If possible, Batik will use normal PDF or PostScript text when inserting text. It does -this by checking if the text can be drawn normally and the font is -supported. This example svg <a href="../dev/svg/text.svg">text.svg</a> / -<!--link href="../dev/svg/text.pdf"-->text.pdf<!--/link--> -shows how various types and effects with text are handled. -Note that tspan and outlined text are not yet implemented.</p> - <p> -Otherwise, text is converted and drawn as a set of shapes by Batik, using the stroking text painter. -This means that a typical character will -have about 10 curves (each curve consists of at least 20 characters). -This can make the output files large and when it is viewed the -viewer may not normally draw those fine curves very well (In Adobe Acrobat, turning on -"Smooth Line Art" in the preferences will fix this). -If the text is inserted into the output file using the inbuilt text commands -it will use a single character. - </p> - <p> - Note that because SVG text can be rendered as either text or a vector graphic, you - may need to consider settings in your viewer for both. The Acrobat viewer has both - "smooth line art" and "smooth text" settings that may need to be set for SVG images - to be displayed nicely on your screen (see Edit / Preferences / Display). - This setting will not affect the printing of your document, which should be OK in - any case, but will only affect the quality of the screen display.</p> - </section> - <section id="svg-scaling"> - <title>Scaling</title> - <p> - Currently, SVG images are rendered with the dimensions specified <em>in the SVG - file</em>, within the viewport specified in the fo:external-graphic element. - For everything to work properly, the two should be equal. The SVG standard leaves - this issue as an implementation detail. FOP will probably implement a scaling - mechanism in the future. - </p> - <p> - If you use pixels to specify the size of an SVG graphic the "source resolution" setting - in the <a href="configuration.html">configuration</a> will be used to determine the - size of a pixel. The use of pixels to specify sizes is discouraged as they may - be interpreted differently in different environments. - </p> - </section> - <section id="svg-problems"> - <title>Known Problems</title> - <ul> - <li> -Soft mask transparency is combined with white so that it looks better -on pdf 1.3 viewers but this causes the soft mask to be slightly lighter -or darker on pdf 1.4 viewers. - </li> - <li> -There is some problem with a gradient inside a pattern causing a PDF -error when viewed in acrobat 5. - </li> - <li> -Text is not always handled correctly, it may select the wrong font -especially if characters have multiple fonts in the font list. - </li> - <li> -More PDF text handling could be implemented. -It could draw the string using the attributed character iterator -to handle tspans and other simple changes of text. - </li> - <li> -JPEG images are not inserted directly into the pdf document. -This area has not been implemented yet since the appropriate -method in batik is static. - </li> - <li> -Uniform transparency for images and other svg elements that are converted -into a raster graphic are not drawn properly in PDF. The image is opaque. - </li> - </ul> - </section> - </section> - <section id="tiff"> - <title>TIFF</title> - <p> - FOP-native TIFF support is limited to PDF and PostScript output only. Also, - according to user reports, FOP's native support for TIFF is limited to images with the - following characteristics (all must be true for successful rendering): - </p> - <ul> - <li>single channel images (i.e., bi-level and grayscale only)</li> - <li>uncompressed images, or images using CCITT T.4, CCITT T.6, or JPEG compression</li> - <li>images using white-is-zero encoding in the TIFF PhotometricInterpretation tag</li> - </ul> - <note> - Native support in this case means that the images can be embedded into the output format - without decoding it. - </note> - <p><em>JAI:</em> Supports RGB and RGBA only for FOP rendering.</p> - </section> - <section id="emf"> - <title>EMF</title> - <p>Windows Enhanced Metafiles (EMF) are only supported in RTF output.</p> - </section> - <section id="resolution"> - <title>Graphics Resolution</title> - <p> - Some bitmapped image file formats store a dots-per-inch (dpi) or other resolution - values. FOP tries to use this resolution information whenever possible to determine - the image's intrinsic size. This size is used during the layout process when it is not - superceeded by an explicit size on fo:external-graphic (content-width and content-height - properties). - </p> - <p> - Please note that not all images contain resolution information. If it's not available - 72 dpi is assumed (the default resolution of PDF and PostScript). - </p> - <p> - Bitmap images are generally embedded into the output format at their original resolution - (as is). No resampling of the image is performed. Explicit resampling is on our wishlist, - but hasn't been implemented, yet. Bitmaps included in SVG graphics may be resampled to - the resolution specified in the "target resolution" setting in the - <a href="configuration.html">configuration</a> if SVG filters are applied. This can be - used as a work-around to resample images in FO documents. - </p> - </section> - <section id="caching"> - <title>Image caching</title> - <p> - FOP caches images between runs. There is one cache per FopFactory instance. The URI is - used as a key to identify images which means that when a particular URI appears again, - the image is taken from the cache. If you have a servlet that generates a different - image each time it is called with the same URL you need to use a constantly - changing dummy parameter on the URL to avoid caching. - </p> - <p> - The image cache has been improved considerably in the redesigned code. Therefore, a - resetCache() method like in earlier versions of FOP has become unnecessary. If you - still experience OutOfMemoryErrors, please notify us. - </p> - </section> - </body> -</document> diff --git a/src/documentation/content/xdocs/0.94/intermediate.xml b/src/documentation/content/xdocs/0.94/intermediate.xml deleted file mode 100644 index 4744185aa..000000000 --- a/src/documentation/content/xdocs/0.94/intermediate.xml +++ /dev/null @@ -1,146 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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$ --> -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> -<document> - <header> - <title>Intermediate Format</title> - <version>$Revision$</version> - </header> - <body> - <note> - Please note that the intermediate format is an <strong>advanced feature</strong> and can be ignored by most - users of Apache FOP. - </note> - <section id="introduction"> - <title>Introduction</title> - <p> - The intermediate format (IF) is a proprietary XML format that represents the area tree - generated by the layout engine. The area tree is conceptually defined in the - <a href="http://www.w3.org/TR/2001/REC-xsl-20011015/slice1.html#section-N742-Formatting">XSL-FO specification in chapter 1.1.2</a>. - The IF can be generated through the area tree XML Renderer (the XMLRenderer). - </p> - <p> - The intermediate format can be used to generate intermediate documents that are modified - before they are finally rendered to their ultimate output format. Modifications include - adjusting and changing trait values, adding or modifying area objects, inserting prefabricated - pages, overlays, imposition (n-up, rotation, scaling etc.). Multiple IF files can be combined - to a single output file. - </p> - </section> - <section id="usage"> - <title>Usage of the Intermediate Format</title> - <p> - As already mentioned, the IF is generated by using the <strong>XMLRenderer</strong> (MIME type: - <strong>application/X-fop-areatree</strong>). So, you basically set the right MIME type for - the output format and process your FO files as if you would create a PDF file. However, there - is an important detail to consider: The various Renderers don't all use the same font sources. - To be able to create the right area tree for the ultimate output file, you need to create - the IF file using the right font setup. This is achieved by telling the XMLRenderer to mimic - another renderer. This is done by calling the XMLRenderer's mimicRenderer() method with an - instance of the ultimate target renderer as the single parameter. This has a consequence: An - IF file rendered with the Java2DRenderer may not look as expected when it was actually generated - for the PDF renderer. For renderers that use the same font setup, this restriction does not - apply (PDF and PS, for example). Generating the intermediate format file is the first step. - </p> - <p> - The second step is to reparse the IF file using the <strong>AreaTreeParser</strong> which is - found in the org.apache.fop.area package. The pages retrieved from the IF file are added to an - AreaTreeModel instance from where they are normally rendered using one of the available Renderer - implementations. You can find examples for the IF processing in the - <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/intermediate/"><code>examples/embedding</code></a> - directory in the FOP distribution - </p> - <p> - The basic pattern to parse the IF format looks like this: - </p> - <source><![CDATA[ -FopFactory fopFactory = FopFactory.newInstance(); - -// Setup output -OutputStream out = new java.io.FileOutputStream(pdffile); -out = new java.io.BufferedOutputStream(out); -try { - //Setup fonts and user agent - FontInfo fontInfo = new FontInfo(); - FOUserAgent userAgent = fopFactory.newFOUserAgent(); - - //Construct the AreaTreeModel that will received the individual pages - AreaTreeModel treeModel = new RenderPagesModel(userAgent, - MimeConstants.MIME_PDF, fontInfo, out); - - //Parse the IF file into the area tree - AreaTreeParser parser = new AreaTreeParser(); - Source src = new StreamSource(myIFFile); - parser.parse(src, treeModel, userAgent); - - //Signal the end of the processing. The renderer can finalize the target document. - treeModel.endDocument(); -} finally { - out.close(); -}]]></source> - <p> - This example simply reads an IF file and renders it to a PDF file. Please note, that in normal - FOP operation you're shielded from having to instantiate the FontInfo object yourself. This - is normally a task of the AreaTreeHandler which is not present in this scenario. The same - applies to the AreaTreeModel instance, in this case an instance of a subclass called - RenderPagesModel. RenderPagesModel is ideal in this case as it has very little overhead - processing the individual pages. An important line in the example is the call to - <code>endDocument()</code> on the AreaTreeModel. This lets the Renderer know that the processing - is now finished. - </p> - <p> - The intermediate format can also be used from the <a href="running.html#standalone-start">command-line</a> - by using the "-atin" parameter for specifying the area tree XML as input file. You can also - specify a "mimic renderer" by inserting a MIME type between "-at" and the output file. - </p> - <section id="concat"> - <title>Concatenating Documents</title> - <p> - This initial example is obviously not very useful. It would be faster to create the PDF file - directly. As the <a href="http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/examples/embedding/java/embedding/intermediate/ExampleConcat.java">ExampleConcat.java</a> - example shows you can easily parse multiple IF files in a row and add the parsed pages to the - same AreaTreeModel instance which essentially concatenates all the input document to one single - output document. - </p> - </section> - <section id="modifying"> - <title>Modifying Documents</title> - <p> - One of the most important use cases for the intermediate format is obviously modifying the area - tree XML before finally rendering it to the target format. You can easily use XSLT to process - the IF file according to your needs. Please note, that we will currently not formally describe - the intermediate format. You need to have a good understanding its structure so you don't - create any non-parseable files. We may add an XML Schema and more detailed documentation at a - later time. You're invited to help us with that. - </p> - </section> - <section id="advanced"> - <title>Advanced Use</title> - <p> - The generation of the intermediate format as well as it parsing process has been designed to allow - for maximum flexibility and optimization. Please note that you can call <code>setTransformerHandler()</code> on - XMLRenderer to give the XMLRenderer your own TransformerHandler instance in case you would like to - do custom serialization (to a W3C DOM, for example) and/or to directly modify the area tree using - XSLT. The AreaTreeParser on the other side allows you to retrieve a ContentHandler instance where - you can manually send SAX events to to start the parsing process (see <code>getContentHandler()</code>). - </p> - </section> - </section> - </body> -</document> diff --git a/src/documentation/content/xdocs/1.0/accessibility.xml b/src/documentation/content/xdocs/1.0/accessibility.xml new file mode 100644 index 000000000..f3c66e06a --- /dev/null +++ b/src/documentation/content/xdocs/1.0/accessibility.xml @@ -0,0 +1,167 @@ +<?xml version="1.0" standalone="no"?> +<!-- + 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$ --> +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "document-v20.dtd"> +<document> + <header> + <title>Accessibility</title> + </header> + <body> + <section id="overview"> + <title>Overview</title> + <p> + This page describes the + <a href="http://en.wikipedia.org/wiki/Accessibility">accessibility</a> + features of Apache FOP. + <a href="http://www.section508.gov/">Section 508</a> defines accessibility in the context + of electronic documents for the USA but other countries have similar requirements. + </p> + <p> + Accessibility features are available only for the PDF output format and there are some + implementation limitations. Also, certain actions must be undertaken by the content creator + to ensure that FOP can create a truly accessible document. + </p> + </section> + <section> + <title>Enabling accessibility</title> + <p>There are 3 ways to enable accessibility:</p> + <ol> + <li> + <strong>Command line:</strong> The command line option -a turns on accessibility: + <code>fop -a -fo mydocument.fo -pdf mydocument.pdf</code> + </li> + <li> + <strong>Embedding:</strong> <code>userAgent.setAccessibility(true);</code> + </li> + <li> + <strong>Optional setting in fop.xconf file:</strong> + <pre> + <fop version="1.0"> + <accessibility>true</accessibility> + ... + </fop> + </pre> + </li> + </ol> + <p> + When accessibility is enabled, additional information relating to the logical structure of + the document is added to the PDF. That information allows the PDF viewer (or a + text-to-speech application) to retrieve the natural reading order of the document. + </p> + <note>The processing of the logical structure is memory-hungry. You may need to adjust the + Java heap size in order to process larger files.</note> + </section> + <section id="source"> + <title>Changes to your XSL-FO input files</title> + <p> + Apache FOP cannot automatically generate accessible PDFs. Some of the work can only be + performed by the content provider. Following are some changes that may be necessary to + your XSL-FO content in order to generate really accessible documents: + </p> + <ul> + <li>Table cells must have a table row as their parent.</li> + <li> + Images must have an alternate text: use the <code>fox:alt-text</code> extension attribute + (in the <a href="extensions.html#fox-namespace">fox namespace</a>) on + <code>fo:external-graphic</code> and <code>fo:instream-foreign-object</code> to specify a + short text describing the image. + </li> + <li> + Ensure that the order of <code>fo:block-container</code> elements in a page corresponds to + the reading order. + </li> + <li> + Specify the natural language of the document using the language and country properties + (or via the <code>xml:lang</code> shorthand property). + </li> + </ul> + </section> + <section id="customTags"> + <title>Customized Tagging</title> + <p>The <a href="#PDFReference">PDF Reference</a> defines a set of standard Structure Types to + tag content. For example, ‘P’ is used for identifying paragraphs, ‘H1’ to ‘H6’ for headers, + ‘L’ for lists, ‘Div’ for block-level groups of elements, etc. This standard set is aimed at + improving interoperability between applications producing or consuming PDF. </p> + <p>FOP provides a default mapping of Formatting Objects to elements from that standard set. + For example, <code>fo:page-sequence</code> is mapped to ‘Part’, <code>fo:block</code> is + mapped to ‘P’, <code>fo:list-block</code> to ‘L’, etc.</p> + <p>You may want to customize that mapping to improve the accuracy of the tagging or deal with + particular FO constructs. For example, you may want to make use of the ‘H1’ to ‘H6’ tags to + make the hierarchical structure of the document appear in the PDF. This is achieved by using + the <code>role</code> XSL-FO property:</p> + <source>... +<fo:block role="H1" font-weight="bold">I. A Level 1 Heading</fo:block> +<fo:block>This is the first paragraph of the first section...</fo:block> +...</source> + <p>If a non-standard structure type is specified, FOP will issue a warning and fall back to + the default tag associated to the Formatting Object.</p> + </section> + <section id="testing"> + <title>Testing</title> + <p> + Accessible PDFs can be tested, for example, using Adobe Acrobat Professional. Its + Accessibility Check feature creates a report indicating any deficiencies with a PDF + document. Alternatively, you can just let a screen reader read the document aloud. + </p> + </section> + <section id="limitations"> + <title>Limitations</title> + <p> + Accessibility support in Apache FOP is relatively new, so there are certain + limitations. Please help us identify and close any gaps. + </p> + <ul> + <li> + The natural language can currently only be specified at the page-sequence level. The + document language is derived from the language of the first page-sequence. It is + currently not possible to override the language inside the content below the + page-sequence level. + </li> + <li> + It's currently not possible to specify the expanded form of an abbreviation or acronym. + </li> + <li> + SVG graphics (or images in general) are treated as a single figure. Text contained in + SVGs is not accessible. It's only possible to work with <code>fox:alt-text</code>. + </li> + <li> + The side regions (region-before, region-after etc.) are currently not specially + identified. Screen readers may read their content at page changes. + </li> + </ul> + </section> + <section id="links"> + <title>Related Links</title> + <p> + Many resources providing guidance about creating accessible documents can be found on the + web. Here are a few links, along with additional resources around the topic: + </p> + <ul> + <li><a href="http://www.section508.gov/">US Government - Website on Section 508</a></li> + <li><a href="http://en.wikipedia.org/wiki/Accessibility">Wikipedia on Accessibility in general</a></li> + <li><a href="http://en.wikipedia.org/wiki/Portable_Document_Format#Accessibility">Wikipedia on Accessibility in PDF</a></li> + <li id="PDFReference"> + <a href="http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf">PDF + Reference 1.4</a> (look up chapters 9.7 "Tagged PDF" and 9.8 "Accessibility Support") + </li> + <li><a href="pdfa.html">PDF/A support in Apache FOP</a></li> + <li><a href="http://wiki.apache.org/xmlgraphics-fop/PDF_Accessibility">Developer-oriented details on the accessibility features (on the Wiki)</a></li> + </ul> + </section> + </body> +</document> diff --git a/src/documentation/content/xdocs/0.94/anttask.xml b/src/documentation/content/xdocs/1.0/anttask.xml index 44550c3d7..a543a5623 100644 --- a/src/documentation/content/xdocs/0.94/anttask.xml +++ b/src/documentation/content/xdocs/1.0/anttask.xml @@ -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> @@ -148,6 +158,11 @@ (<code>true</code>) or not (<code>false</code>). <strong>Currently doesn't work in FOP Trunk!!!</strong></td> <td>No, default is <code>true</code></td> </tr> + <tr> + <td>throwexceptions</td> + <td>Controls whether or not an exception is thrown if an error occurs during rendering.</td> + <td>Default is <code>true</code></td> + </tr> </table> <p/> <table><caption>Parameters specified as nested elements</caption> @@ -191,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> diff --git a/src/documentation/content/xdocs/0.94/compiling.xml b/src/documentation/content/xdocs/1.0/compiling.xml index c6c17a3c0..98a6dfb6d 100644 --- a/src/documentation/content/xdocs/0.94/compiling.xml +++ b/src/documentation/content/xdocs/1.0/compiling.xml @@ -41,7 +41,7 @@ <section id="env-jdk"> <title>JDK</title> <p> - Building FOP requires a minimum Java Development Kit (JDK/SDK) of 1.3 + Building FOP requires a minimum Java Development Kit (JDK/SDK) of 1.4 (A Java Runtime Environment is not sufficient). </p> </section> @@ -59,14 +59,14 @@ <p> The build script uses <a href="ext:ant">Apache Ant</a>, a popular Java-based build tool, which usually requires that the environment variable JAVA_HOME point to - your local JDK root directory. This is true even if you use JDK 1.3 or above, which normally + your local JDK root directory. This is true even if you use JDK 1.4 or above, which normally does not need this setting. </p> </section> <section id="env-ant"> <title>Apache Ant</title> <p> - <a href="ext:ant">Apache Ant</a> must be installed in order to + <a href="ext:ant">Apache Ant</a> (Version 1.7 or later) must be installed in order to build FOP. Following best practices we don't include Ant with FOP anymore. You can find the <a href="ext:ant/manual/">instructions to install Ant in the Ant manual</a> on the web. </p> diff --git a/src/documentation/content/xdocs/0.94/configuration.xml b/src/documentation/content/xdocs/1.0/configuration.xml index 656c3b706..eaa788990 100644 --- a/src/documentation/content/xdocs/0.94/configuration.xml +++ b/src/documentation/content/xdocs/1.0/configuration.xml @@ -152,6 +152,18 @@ <td>"height" 11 inches, "width" 8.26 inches</td> </tr> <tr> + <td>prefer-renderer</td> + <td>boolean (true, false)</td> + <td> + By default, FOP prefers the newer output implementations based on the + <code>IFDocumentHandler</code> interface. If no such implementation can be found for + a given MIME type, it looks for an implementation of the <code>Renderer</code> interface. + If necessary, you can invert the lookup order to prefer the Renderer variant over the + IFDocumentHandler variant by setting this value to true. + </td> + <td>false</td> + </tr> + <tr> <td>use-cache</td> <td>boolean (true, false)</td> <td>All fonts information that has been gathered as a result of "directory" @@ -206,6 +218,42 @@ <!-- etc. etc..... --> </fop>]]></source> </section> + <section id="image-loading"> + <title>Image Loading Customization</title> + <p> + Apache FOP uses the image loading framework from + <a href="http://xmlgraphics.apache.org/commons/">Apache XML Graphics Commons</a> to load + images using various plug-ins. Every image loader plug-in has a hard-coded usage penalty + that influences which solution is chosen if there are multiple possibilities to load an image. + Sometimes, though, these penalties need to be tweaked and this can be done in the FOP + configuration. An example: + </p> + <source><![CDATA[<fop version="1.0"> + [..] + <image-loading> + <penalty value="10000" + class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawCCITTFax"/> + <penalty value="INFINITE" + class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderInternalTIFF"/> + </image-loading> + <renderers.... +</fop>]]></source> + <p> + The first penalty element increases the penalty for the raw CCITT loader. This practically + forces the decoding of CCITT compressed TIFF images except if there are no TIFF codecs + available. + </p> + <p> + The second penalty element sets an "infinite" penalty for the TIFF loader using the internal + TIFF codec. This practically disables that plug-in as it will never be chosen as a possible + solution. + </p> + <p> + Negative penalties are possible to promote a plug-in but a negative penalty sum will be + treated as zero penalty in most cases. For more details on the image loading framework, + please consult the documentation there. + </p> + </section> <section id="renderers"> <title>Renderer configuration</title> <p> @@ -277,7 +325,44 @@ <output-profile>C:\FOP\Color\EuropeISOCoatedFOGRA27.icc</output-profile> <fonts.... + </renderer>]]></source> + <p> + Some people don't have high requirements on color fidelity but instead want the smallest + PDF file sizes possible. In this case it's possible to disable the default sRGB color space + which XSL-FO requires. This will cause RGB colors to be generated as device-specific RGB. + Please note that this option is unavailable (and will cause an error) if you enable + PDF/A or PDF/X functionality or if you specify an output profile. This setting will make the + PDF about 4KB smaller. To disable the sRGB color space add the following setting: + </p> + <source><![CDATA[ + <renderer mime="application/pdf"> + <filterList... + + <disable-srgb-colorspace>true</disable-srgb-colorspace> + + <fonts.... + </renderer>]]></source> + + <p>FOP supports encryption of PDF output, thanks to Patrick C. Lankswert. + This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text + from the document and doing annotations. It is also possible to ask the user for a password in + order to view the contents. Note that there already exist third party applications which can + decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the + degree of protection is limited. For further information about features and restrictions + regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical + documentation on the Adobe web site.</p> + <source><![CDATA[ + <renderer mime="application/pdf"> + <encryption-params> + <user-password>testuserpass</user-password> + <owner-password>testownerpass</owner-password> + <noprint/> + <nocopy/> + <noedit/> + <noannotations/> + </encryption-params> </renderer>]]></source> + </section> <section id="ps-renderer"> <title>Special Settings for the PostScript Renderer</title> @@ -331,19 +416,42 @@ to "bitmap" which causes all text to be rendered as bitmaps. </p> </section> - </section> - <section id="fonts"> - <title>Apache FOP Font Config</title> - <p> - Apache FOP has special Font configuration considerations, which are explained - in detail on the <a href="fonts.html">Fonts</a> page. - </p> + <section id="afp-renderer"> + <title>Special Settings for the AFP Renderer</title> + <p> + </p> + <p> + Additionally, there are certain settings that control how the renderer handles various elements. + </p> +<source><![CDATA[<renderer mime="application/x-afp"> + <images mode="b+w" bits-per-pixel="8" native="true"/> + <renderer-resolution>240</renderer-resolution> + + <!-- a default external resource group file --> + <resource-group-file>resources.afp</resource-group-file> +</renderer>]]></source> + <p> + The default value for the images "mode" setting is "b+w" (black and white). When the images "mode" setting is "b+w" a "bits-per-pixel" setting can be provided to aid the grayscale conversion process. With this setting all images referenced in your source document are converted to an IOCA FS45 grayscale bitmap image form. + When the setting is "color" all images are converted to an IOCA FS45 color bitmap image form. When "native" setting is "true", all images encountered (TIFF, GIF, JPEG and Encapsulated Postscript etc.) will be embedded directly in the datastream in their native form using a MO:DCA Object Container. + </p> + <p> + The default value for the "renderer-resolution" is 240 dpi. + </p> + <!-- + <p> + The default value for the MO:DCA "interchange-set" is "MO:DCA-L". Other compliance settings include presentation interchange sets "MO:DCA-P IS/1" and "MO:DCA-P IS/2" (Resource Groups). + </p> + --> + <p> + By default if there is no configuration definition for "resource-group-file", external resources will be placed in a file called resources.afp. + </p> + </section> </section> - <section> - <title>When it does not work</title> + <section> + <title>When it does not work</title> - <p>FOP searches the configuration file for the information it + <p>FOP searches the configuration file for the information it expects, at the position it expects. When that information is not present, FOP will not complain, it will just continue. When there is other information in the file, FOP will not complain, it will just @@ -351,14 +459,14 @@ ignore it. That means that when your configuration information is in the file but in a different XML element, or in a different XML path, than FOP expects, it will be silently ignored.</p> - <p>Check the following possibilities:</p> + <p>Check the following possibilities:</p> - <ul> - <li>The format of the configuration file has changed + <ul> + <li>The format of the configuration file has changed considerably between FOP 0.20.5 and FOP 1.0 and its beta versions. Did you convert your file to the new format?</li> - <li>The FOP distribution contains a schema for configuration + <li>The FOP distribution contains a schema for configuration files, at src/foschema/fop-configuration.xsd. Did you validate your configuration file against it? Add the following schema location to the <code>schema</code> element: @@ -373,13 +481,13 @@ and run the configuration file through a validating schema parser. Note that the schema cannot detect all errors, and that it is stricter about the order of some elements than FOP itself is.</li> - <li>Run FOP in debug mode (command line option + <li>Run FOP in debug mode (command line option <code>-d</code>). This makes FOP report which configuration information it finds. Check if FOP finds what you expect.</li> - </ul> + </ul> - </section> + </section> </body> </document> diff --git a/src/documentation/content/xdocs/0.94/embedding.xml b/src/documentation/content/xdocs/1.0/embedding.xml index 3e3c964f8..3289e68c7 100644 --- a/src/documentation/content/xdocs/0.94/embedding.xml +++ b/src/documentation/content/xdocs/1.0/embedding.xml @@ -29,7 +29,7 @@ <section id="overview"> <title>Overview</title> <p> - Review <a href="running.html">Running FOP</a> for important information that applies + Review <a href="running.html">Running FOP</a> for important information that applies to embedded applications as well as command-line use, such as options and performance. </p> <p> @@ -54,7 +54,7 @@ <section id="basics"> <title>Basic Usage Pattern</title> <p> - Apache FOP relies heavily on JAXP. It uses SAX events exclusively to receive the XSL-FO + Apache FOP relies heavily on JAXP. It uses SAX events exclusively to receive the XSL-FO input document. It is therefore a good idea that you know a few things about JAXP (which is a good skill anyway). Let's look at the basic usage pattern for FOP... </p> @@ -82,14 +82,14 @@ try { // Step 4: Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - - // Step 5: Setup input and output for XSLT transformation + + // Step 5: Setup input and output for XSLT transformation // Setup input stream Source src = new StreamSource(new File("C:/Temp/myfile.fo")); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Step 6: Start XSLT transformation and FOP processing transformer.transform(src, res); @@ -102,13 +102,13 @@ try { </p> <ul> <li> - <strong>Step 1:</strong> You create a new FopFactory instance. The FopFactory instance holds + <strong>Step 1:</strong> You create a new FopFactory instance. The FopFactory instance holds references to configuration information and cached data. It's important to reuse this instance if you plan to render multiple documents during a JVM's lifetime. </li> <li> <strong>Step 2:</strong> You set up an OutputStream that the generated document - will be written to. It's a good idea to buffer the OutputStream as demonstrated + will be written to. It's a good idea to buffer the OutputStream as demonstrated to improve performance. </li> <li> @@ -119,26 +119,26 @@ try { OutputStream you've setup up in step 2. </li> <li> - <strong>Step 4</strong> We recommend that you use JAXP Transformers even - if you don't do XSLT transformations to generate the XSL-FO file. This way - you can always use the same basic pattern. The example here sets up an - "identity transformer" which just passes the input (Source) unchanged to the - output (Result). You don't have to work with a SAXParser if you don't do any + <strong>Step 4</strong> We recommend that you use JAXP Transformers even + if you don't do XSLT transformations to generate the XSL-FO file. This way + you can always use the same basic pattern. The example here sets up an + "identity transformer" which just passes the input (Source) unchanged to the + output (Result). You don't have to work with a SAXParser if you don't do any XSLT transformations. </li> <li> - <strong>Step 5:</strong> Here you set up the input and output for the XSLT - transformation. The Source object is set up to load the "myfile.fo" file. - The Result is set up so the output of the XSLT transformation is sent to FOP. - The FO file is sent to FOP in the form of SAX events which is the most efficient - way. Please always avoid saving intermediate results to a file or a memory buffer + <strong>Step 5:</strong> Here you set up the input and output for the XSLT + transformation. The Source object is set up to load the "myfile.fo" file. + The Result is set up so the output of the XSLT transformation is sent to FOP. + The FO file is sent to FOP in the form of SAX events which is the most efficient + way. Please always avoid saving intermediate results to a file or a memory buffer because that affects performance negatively. </li> <li> - <strong>Step 6:</strong> Finally, we start the XSLT transformation by starting - the JAXP Transformer. As soon as the JAXP Transformer starts to send its output - to FOP, FOP itself starts its processing in the background. When the - <code>transform()</code> method returns FOP will also have finished converting + <strong>Step 6:</strong> Finally, we start the XSLT transformation by starting + the JAXP Transformer. As soon as the JAXP Transformer starts to send its output + to FOP, FOP itself starts its processing in the background. When the + <code>transform()</code> method returns FOP will also have finished converting the FO file to a PDF file and you can close the OutputStream. <note label="Tip!"> It's a good idea to enclose the whole conversion in a try..finally statement. If @@ -148,16 +148,16 @@ try { </li> </ul> <p> - If you're not totally familiar with JAXP Transformers, please have a look at the + If you're not totally familiar with JAXP Transformers, please have a look at the <a href="#examples">Embedding examples</a> below. The section contains examples for all sorts of use cases. If you look at all of them in turn you should be able to see the patterns in use and the flexibility this approach offers without adding too much complexity. </p> <p> - This may look complicated at first, but it's really just the combination of an + This may look complicated at first, but it's really just the combination of an XSL transformation and a FOP run. It's also easy to comment out the FOP part - for debugging purposes, for example when you're tracking down a bug in your + for debugging purposes, for example when you're tracking down a bug in your stylesheet. You can easily write the XSL-FO output from the XSL transformation to a file to check if that part generates the expected output. An example for that can be found in the <a href="#examples">Embedding examples</a> (See "ExampleXML2FO"). @@ -166,40 +166,50 @@ try { <title>Logging</title> <p> Logging is now a little different than it was in FOP 0.20.5. We've switched from - Avalon Logging to <a href="ext:jakarta/commons/logging">Jakarta Commons Logging</a>. + Avalon Logging to <a href="ext:commons-logging">Jakarta Commons Logging</a>. While with Avalon Logging the loggers were directly given to FOP, FOP now retrieves its logger(s) through a statically available LogFactory. This is similar to the general pattern that you use when you work with Apache Log4J directly, for example. - We call this "static logging" (Commons Logging, Log4J) as opposed to "instance logging" + We call this "static logging" (Commons Logging, Log4J) as opposed to "instance logging" (Avalon Logging). This has a consequence: You can't give FOP a logger for each processing run anymore. The log output of multiple, simultaneously running FOP instances is sent to the same logger. </p> - <note> - We know this may be an issue in multi-threaded server environments if you'd like to - know what's going on in every single FOP processing run. We're planning to add an - additional feedback facility to FOP which can be used to obtain all sorts of specific - feedback (validation messages, layout problems etc.). "Static logging" is mainly - interesting for a developer working on FOP and for advanced users who are debugging - FOP. We don't consider the logging output to be useful to normal FOP users. Please - have some patience until we can add this feature or jump in and help us build it. We've - set up a <a href="http://wiki.apache.org/xmlgraphics-fop/ProcessingFeedback">Wiki page</a> - which documents what we're going to build. - </note> <p> - By default, <a href="ext:jakarta/commons/logging">Jakarta Commons Logging</a> uses + By default, <a href="ext:commons-logging">Jakarta Commons Logging</a> uses JDK logging (available in JDKs 1.4 or higher) as its backend. You can configure Commons Logging to use an alternative backend, for example Log4J. Please consult the - <a href="ext:jakarta/commons/logging">documentation for Jakarta Commons Logging</a> on + <a href="ext:commons-logging">documentation for Jakarta Commons Logging</a> on how to configure alternative backends. </p> + <p> + As a result of the above we differentiate between two kinds of "logging": + </p> + <ul> + <li>(FOP-)Developer-oriented logging</li> + <li><a href="events.html">User/Integrator-oriented feedback</a> (NEW!)</li> + </ul> + <p> + The use of "feedback" instead of "logging" is intentional. Most people were using + log output as a means to get feedback from events within FOP. Therefore, FOP now + includes an <code>event</code> package which can be used to receive feedback from + the layout engine and other components within FOP <strong>per rendering run</strong>. + This feedback is not just some + text but event objects with parameters so these events can be interpreted by code. + Of course, there is a facility to turn these events into normal human-readable + messages. For details, please read on on the <a href="events.html">Events page</a>. + This leaves normal logging to be mostly a thing used by the FOP developers + although anyone can surely activate certain logging categories but the feedback + from the loggers won't be separated by processing runs. If this is required, + the <a href="events.html">Events subsystem</a> is the right approach. + </p> </section> - + <section id="render"> <title>Processing XSL-FO</title> <p> - Once the Fop instance is set up, call <code>getDefaultHandler()</code> to obtain a SAX - DefaultHandler instance to which you can send the SAX events making up the XSL-FO + Once the Fop instance is set up, call <code>getDefaultHandler()</code> to obtain a SAX + DefaultHandler instance to which you can send the SAX events making up the XSL-FO document you'd like to render. FOP processing starts as soon as the DefaultHandler's <code>startDocument()</code> method is called. Processing stops again when the DefaultHandler's <code>endDocument()</code> method is called. Please refer to the basic @@ -210,15 +220,15 @@ try { <section id="render-with-xslt"> <title>Processing XSL-FO generated from XML+XSLT</title> <p> - If you want to process XSL-FO generated from XML using XSLT we recommend - again using standard JAXP to do the XSLT part and piping the generated SAX - events directly through to FOP. The only thing you'd change to do that + If you want to process XSL-FO generated from XML using XSLT we recommend + again using standard JAXP to do the XSLT part and piping the generated SAX + events directly through to FOP. The only thing you'd change to do that on the basic usage pattern above is to set up the Transformer differently: </p> <source><![CDATA[ //without XSLT: //Transformer transformer = factory.newTransformer(); // identity transformer - + //with XSLT: Source xslt = new StreamSource(new File("mystylesheet.xsl")); Transformer transformer = factory.newTransformer(xslt);]]></source> @@ -227,14 +237,14 @@ try { <section id="input"> <title>Input Sources</title> <p> - The input XSL-FO document is always received by FOP as a SAX stream (see the + The input XSL-FO document is always received by FOP as a SAX stream (see the <a href="../dev/design/parsing.html">Parsing Design Document</a> for the rationale). </p> <p> - However, you may not always have your input document available as a SAX stream. + However, you may not always have your input document available as a SAX stream. But with JAXP it's easy to convert different input sources to a SAX stream so you can pipe it into FOP. That sounds more difficult than it is. You simply have - to set up the right Source instance as input for the JAXP transformation. + to set up the right Source instance as input for the JAXP transformation. A few examples: </p> <ul> @@ -263,8 +273,8 @@ try { <p> There are a variety of upstream data manipulations possible. For example, you may have a DOM and an XSL stylesheet; or you may want to - set variables in the stylesheet. Interface documentation and some cookbook - solutions to these situations are provided in + set variables in the stylesheet. Interface documentation and some cookbook + solutions to these situations are provided in <a href="http://xml.apache.org/xalan-j/usagepatterns.html">Xalan Basic Usage Patterns</a>. </p> </section> @@ -278,7 +288,7 @@ try { <title>Customizing the FopFactory</title> <p> The FopFactory holds configuration data and references to objects which are reusable over - multiple rendering runs. It's important to instantiate it only once (except in special + multiple rendering runs. It's important to instantiate it only once (except in special environments) and reuse it every time to create new FOUserAgent and Fop instances. </p> <p> @@ -289,34 +299,34 @@ try { <p> The <strong>font base URL</strong> to use when resolving relative URLs for fonts. Example: </p> - <source>fopFactory.setFontBaseURL("file:///C:/Temp/fonts");</source> + <source>fopFactory.getFontManager().setFontBaseURL("file:///C:/Temp/fonts");</source> </li> <li> <p> - The <strong>hyphenation base URL</strong> to use when resolving relative URLs for + The <strong>hyphenation base URL</strong> to use when resolving relative URLs for hyphenation patterns. Example: </p> <source>fopFactory.setHyphenBaseURL("file:///C:/Temp/hyph");</source> </li> <li> <p> - Disable <strong>strict validation</strong>. When disabled FOP is less strict about the rules + Disable <strong>strict validation</strong>. When disabled FOP is less strict about the rules established by the XSL-FO specification. Example: </p> <source>fopFactory.setStrictValidation(false);</source> </li> <li> <p> - Enable an <strong>alternative set of rules for text indents</strong> that tries to mimic the behaviour of many commercial - FO implementations, that chose to break the specification in this respect. The default of this option is - 'false', which causes Apache FOP to behave exactly as described in the specification. To enable the + Enable an <strong>alternative set of rules for text indents</strong> that tries to mimic the behaviour of many commercial + FO implementations, that chose to break the specification in this respect. The default of this option is + 'false', which causes Apache FOP to behave exactly as described in the specification. To enable the alternative behaviour, call: </p> <source>fopFactory.setBreakIndentInheritanceOnReferenceAreaBoundary(true);</source> </li> <li> <p> - Set the <strong>source resolution</strong> for the document. This is used internally to determine the pixel + Set the <strong>source resolution</strong> for the document. This is used internally to determine the pixel size for SVG images and bitmap images without resolution information. Default: 72 dpi. Example: </p> <source>fopFactory.setSourceResolution(96); // =96dpi (dots/pixels per Inch)</source> @@ -324,7 +334,7 @@ try { <li> <p> Manually add an <strong>ElementMapping instance</strong>. If you want to supply a special FOP extension - you can give the instance to the FOUserAgent. Normally, the FOP extensions can be automatically detected + you can give the instance to the FOUserAgent. Normally, the FOP extensions can be automatically detected (see the documentation on extension for more info). Example: </p> <source>fopFactory.addElementMapping(myElementMapping); // myElementMapping is a org.apache.fop.fo.ElementMapping</source> @@ -332,13 +342,13 @@ try { <li> <p> Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add - custom URI resolution functionality to FOP. For example, you can use + custom URI resolution functionality to FOP. For example, you can use <a href="ext:xml.apache.org/commons/resolver">Apache XML Commons Resolver</a> to make use of XCatalogs. Example: </p> <source>fopFactory.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolver</source> <note> Both the FopFactory and the FOUserAgent have a method to set a URIResolver. The URIResolver on the FopFactory - is primarily used to resolve URIs on factory-level (hyphenation patterns, for example) and it is always used + is primarily used to resolve URIs on factory-level (hyphenation patterns, for example) and it is always used if no other URIResolver (for example on the FOUserAgent) resolved the URI first. </note> </li> @@ -347,9 +357,9 @@ try { <section id="user-agent"> <title>Customizing the User Agent</title> <p> - The user agent is the entity that allows you to interact with a single rendering run, i.e. the processing of a single + The user agent is the entity that allows you to interact with a single rendering run, i.e. the processing of a single document. If you wish to customize the user agent's behaviour, the first step is to create your own instance - of FOUserAgent using the appropriate factory method on FopFactory and pass that + of FOUserAgent using the appropriate factory method on FopFactory and pass that to the factory method that will create a new Fop instance: </p> <source><![CDATA[ @@ -406,16 +416,16 @@ try { </li> <li> <p> - Set the <strong>target resolution</strong> for the document. This is used to - specify the output resolution for bitmap images generated by bitmap renderers - (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter + Set the <strong>target resolution</strong> for the document. This is used to + specify the output resolution for bitmap images generated by bitmap renderers + (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter effects and such. Default: 72 dpi. Example: </p> <source>userAgent.setTargetResolution(300); // =300dpi (dots/pixels per Inch)</source> </li> <li> <p> - Set <strong>your own Renderer instance</strong>. If you want to supply your own renderer or + Set <strong>your own Renderer instance</strong>. If you want to supply your own renderer or configure a Renderer in a special way you can give the instance to the FOUserAgent. Normally, the Renderer instance is created by FOP. Example: </p> @@ -423,8 +433,8 @@ try { </li> <li> <p> - Set <strong>your own FOEventHandler instance</strong>. If you want to supply your own FOEventHandler or - configure an FOEventHandler subclass in a special way you can give the instance to the FOUserAgent. Normally, + Set <strong>your own FOEventHandler instance</strong>. If you want to supply your own FOEventHandler or + configure an FOEventHandler subclass in a special way you can give the instance to the FOUserAgent. Normally, the FOEventHandler instance is created by FOP. Example: </p> <source>userAgent.setFOEventHandlerOverride(myFOEventHandler); // myFOEventHandler is an org.apache.fop.fo.FOEventHandler</source> @@ -432,7 +442,7 @@ try { <li> <p> Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add - custom URI resolution functionality to FOP. For example, you can use + custom URI resolution functionality to FOP. For example, you can use <a href="ext:xml.apache.org/commons/resolver">Apache XML Commons Resolver</a> to make use of XCatalogs. Example: </p> <source>userAgent.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolver</source> @@ -452,7 +462,7 @@ try { <section id="config-external"> <title>Using a Configuration File</title> <p> - Instead of setting the parameters manually in code as shown above you can also set + Instead of setting the parameters manually in code as shown above you can also set many values from an XML configuration file: </p> <source><![CDATA[ @@ -479,7 +489,7 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> <p> Fop instances shouldn't (and can't) be reused. Please recreate Fop and FOUserAgent instances for each rendering run using the FopFactory. - This is a cheap operation as all reusable information is held in the + This is a cheap operation as all reusable information is held in the FopFactory. That's why it's so important to reuse the FopFactory instance. </p> </section> @@ -505,12 +515,12 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> <section id="render-info"> <title>Getting information on the rendering process</title> <p> - To get the number of pages that were rendered by FOP you can call - <code>Fop.getResults()</code>. This returns a <code>FormattingResults</code> object - where you can look up the number of pages produced. It also gives you the - page-sequences that were produced along with their id attribute and their - numbers of pages. This is particularly useful if you render multiple - documents (each enclosed by a page-sequence) and have to know the number of + To get the number of pages that were rendered by FOP you can call + <code>Fop.getResults()</code>. This returns a <code>FormattingResults</code> object + where you can look up the number of pages produced. It also gives you the + page-sequences that were produced along with their id attribute and their + numbers of pages. This is particularly useful if you render multiple + documents (each enclosed by a page-sequence) and have to know the number of pages of each document. </p> </section> @@ -522,19 +532,19 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> </p> <ul> <li> - Whenever possible, try to use SAX to couple the individual components involved + Whenever possible, try to use SAX to couple the individual components involved (parser, XSL transformer, SQL datasource etc.). </li> <li> - Depending on the target OutputStream (in case of a FileOutputStream, but not - for a ByteArrayOutputStream, for example) it may improve performance considerably - if you buffer the OutputStream using a BufferedOutputStream: + Depending on the target OutputStream (in case of a FileOutputStream, but not + for a ByteArrayOutputStream, for example) it may improve performance considerably + if you buffer the OutputStream using a BufferedOutputStream: <code>out = new java.io.BufferedOutputStream(out);</code> <br/> Make sure you properly close the OutputStream when FOP is finished. </li> <li> - Cache the stylesheet. If you use the same stylesheet multiple times + Cache the stylesheet. If you use the same stylesheet multiple times you can set up a JAXP <code>Templates</code> object and reuse it each time you do the XSL transformation. (More information can be found <a class="fork" href="http://www.javaworld.com/javaworld/jw-05-2003/jw-0502-xsl.html">here</a>.) @@ -547,6 +557,9 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> Fine-tune your stylesheet to make the XSLT process more efficient and to create XSL-FO that can be processed by FOP more efficiently. Less is more: Try to make use of property inheritance where possible. </li> + <li> + You may also wish to consider trying to reduce <a href="http://xmlgraphics.apache.org/fop/trunk/running.html#memory">memory usage</a>. + </li> </ul> </section> <section id="multithreading"> @@ -557,7 +570,7 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> If you encounter any suspicious behaviour, please notify us. </p> <p> - There is also a known issue with fonts being jumbled between threads when using + There is also a known issue with fonts being jumbled between threads when using the Java2D/AWT renderer (which is used by the -awt and -print output options). In general, you cannot safely run multiple threads through the AWT renderer. </p> @@ -565,7 +578,7 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> <section id="examples"> <title>Examples</title> <p> - The directory "{fop-dir}/examples/embedding" contains several working examples. + The directory "{fop-dir}/examples/embedding" contains several working examples. </p> <section id="ExampleFO2PDF"> <title>ExampleFO2PDF.java</title> @@ -579,104 +592,104 @@ file to PDF using FOP. </section> <section id="ExampleXML2FO"> <title>ExampleXML2FO.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2FO.java?view=markup"> example</a> -has nothing to do with FOP. It is there to show you how an XML +has nothing to do with FOP. It is there to show you how an XML file can be converted to XSL-FO using XSLT. The JAXP API is used to do the -transformation. Make sure you've got a JAXP-compliant XSLT processor in your +transformation. Make sure you've got a JAXP-compliant XSLT processor in your classpath (ex. <a href="http://xml.apache.org/xalan-j">Xalan</a>). </p> <figure src="images/EmbeddingExampleXML2FO.png" alt="Example XML to XSL-FO"/> </section> <section id="ExampleXML2PDF"> <title>ExampleXML2PDF.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup"> example</a> -demonstrates how you can convert an arbitrary XML file to PDF -using XSLT and XSL-FO/FOP. It is a combination of the first two examples -above. The example uses JAXP to transform the XML file to XSL-FO and FOP to +demonstrates how you can convert an arbitrary XML file to PDF +using XSLT and XSL-FO/FOP. It is a combination of the first two examples +above. The example uses JAXP to transform the XML file to XSL-FO and FOP to transform the XSL-FO to PDF. </p> <figure src="images/EmbeddingExampleXML2PDF.png" alt="Example XML to PDF (via XSL-FO)"/> <p> -The output (XSL-FO) from the XSL transformation is piped through to FOP using -SAX events. This is the most efficient way to do this because the -intermediate result doesn't have to be saved somewhere. Often, novice users -save the intermediate result in a file, a byte array or a DOM tree. We -strongly discourage you to do this if it isn't absolutely necessary. The +The output (XSL-FO) from the XSL transformation is piped through to FOP using +SAX events. This is the most efficient way to do this because the +intermediate result doesn't have to be saved somewhere. Often, novice users +save the intermediate result in a file, a byte array or a DOM tree. We +strongly discourage you to do this if it isn't absolutely necessary. The performance is significantly higher with SAX. </p> </section> <section id="ExampleObj2XML"> <title>ExampleObj2XML.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2XML.java?view=markup"> example</a> -is a preparatory example for the next one. It's an example that -shows how an arbitrary Java object can be converted to XML. It's an often -needed task to do this. Often people create a DOM tree from a Java object and +is a preparatory example for the next one. It's an example that +shows how an arbitrary Java object can be converted to XML. It's an often +needed task to do this. Often people create a DOM tree from a Java object and use that. This is pretty straightforward. The example here, however, shows how -to do this using SAX, which will probably be faster and not even more +to do this using SAX, which will probably be faster and not even more complicated once you know how this works. </p> <figure src="images/EmbeddingExampleObj2XML.png" alt="Example Java object to XML"/> <p> -For this example we've created two classes: ProjectTeam and ProjectMember -(found in xml-fop/examples/embedding/java/embedding/model). They represent -the same data structure found in -xml-fop/examples/embedding/xml/xml/projectteam.xml. We want to serialize to XML a -project team with several members which exist as Java objects. -Therefore we created the two classes: ProjectTeamInputSource and +For this example we've created two classes: ProjectTeam and ProjectMember +(found in xml-fop/examples/embedding/java/embedding/model). They represent +the same data structure found in +xml-fop/examples/embedding/xml/xml/projectteam.xml. We want to serialize to XML a +project team with several members which exist as Java objects. +Therefore we created the two classes: ProjectTeamInputSource and ProjectTeamXMLReader (in the same place as ProjectTeam above). </p> <p> -The XMLReader implementation (regard it as a special kind of XML parser) is -responsible for creating SAX events from the Java object. The InputSource +The XMLReader implementation (regard it as a special kind of XML parser) is +responsible for creating SAX events from the Java object. The InputSource class is only used to hold the ProjectTeam object to be used. </p> <p> -Have a look at the source of ExampleObj2XML.java to find out how this is -used. For more detailed information see other resources on JAXP (ex. +Have a look at the source of ExampleObj2XML.java to find out how this is +used. For more detailed information see other resources on JAXP (ex. <a class="fork" href="http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/3_generate.html">An older JAXP tutorial</a>). </p> </section> <section id="ExampleObj2PDF"> <title>ExampleObj2PDF.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup"> example</a> -combines the previous and the third to demonstrate +combines the previous and the third to demonstrate how you can transform a Java object to a PDF directly in one smooth run -by generating SAX events from the Java object that get fed to an XSL -transformation. The result of the transformation is then converted to PDF +by generating SAX events from the Java object that get fed to an XSL +transformation. The result of the transformation is then converted to PDF using FOP as before. </p> <figure src="images/EmbeddingExampleObj2PDF.png" alt="Example Java object to PDF (via XML and XSL-FO)"/> </section> <section id="ExampleDOM2PDF"> <title>ExampleDOM2PDF.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleDOM2PDF.java?view=markup"> example</a> -has FOP use a DOMSource instead of a StreamSource in order to +has FOP use a DOMSource instead of a StreamSource in order to use a DOM tree as input for an XSL transformation. </p> </section> <section id="ExampleSVG2PDF"> <title>ExampleSVG2PDF.java (PDF Transcoder example)</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleSVG2PDF.java?view=markup"> example</a> -shows the usage of the PDF Transcoder, a sub-application within FOP. +shows the usage of the PDF Transcoder, a sub-application within FOP. It is used to generate a PDF document from an SVG file. </p> </section> <section id="example-notes"> <title>Final notes</title> <p> -These examples should give you an idea of what's possible. It should be easy +These examples should give you an idea of what's possible. It should be easy to adjust these examples to your needs. Also, if you have other examples that you think should be added here, please let us know via either the fop-users or fop-dev mailing lists. Finally, for more help please send your questions to the fop-users diff --git a/src/documentation/content/xdocs/1.0/events.xml b/src/documentation/content/xdocs/1.0/events.xml new file mode 100644 index 000000000..017775f03 --- /dev/null +++ b/src/documentation/content/xdocs/1.0/events.xml @@ -0,0 +1,449 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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$ --> +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> +<document> + <header> + <title>Events/Processing Feedback</title> + <version>$Revision$</version> + </header> + <body> + <section id="introduction"> + <title>Introduction</title> + <p> + In versions until 0.20.5, FOP used + <a href="http://excalibur.apache.org/framework/index.html">Avalon-style Logging</a> where + it was possible to supply a logger per processing run. During the redesign + the logging infrastructure was switched over to + <a href="http://commons.apache.org/logging/">Commons Logging</a> which is (like Log4J or + java.util.logging) a "static" logging framework (the logger is accessed through static + variables). This made it very difficult in a multi-threaded system to retrieve information + for a single processing run. + </p> + <p> + With FOP's event subsystem, we'd like to close this gap again and even go further. The + first point is to realize that we have two kinds of "logging". Firstly, we have the logging + infrastructure for the (FOP) developer who needs to be able to enable finer log messages + for certain parts of FOP to track down a certain problem. Secondly, we have the user who + would like to be informed about missing images, overflowing lines or substituted fonts. + These messages (or events) are targeted at less technical people and may ideally be + localized (translated). Furthermore, tool and solution builders would like to integrate + FOP into their own solutions. For example, an FO editor should be able to point the user + to the right place where a particular problem occurred while developing a document template. + Finally, some integrators would like to abort processing if a resource (an image or a font) + has not been found, while others would simply continue. The event system allows to + react on these events. + </p> + <p> + On this page, we won't discuss logging as such. We will show how the event subsystem can + be used for various tasks. We'll first look at the event subsystem from the consumer side. + Finally, the production of events inside FOP will be discussed (this is mostly interesting + for FOP developers only). + </p> + </section> + <section id="consumer"> + <title>The consumer side</title> + <p> + The event subsystem is located in the <code>org.apache.fop.events</code> package and its + base is the <code>Event</code> class. An instance is created for each event and is sent + to a set of <code>EventListener</code> instances by the <code>EventBroadcaster</code>. + An <code>Event</code> contains: + </p> + <ul> + <li>an event ID,</li> + <li>a source object (which generated the event),</li> + <li>a severity level (Info, Warning, Error and Fatal Error) and</li> + <li>a map of named parameters.</li> + </ul> + <p> + The <code>EventFormatter</code> class can be used to translate the events into + human-readable, localized messages. + </p> + <p> + A full example of what is shown here can be found in the + <code>examples/embedding/java/embedding/events</code> directory in the FOP distribution. + The example can also be accessed + <a href="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/events/">via the web</a>. + </p> + <section id="write-listener"> + <title>Writing an EventListener</title> + <p> + The following code sample shows a very simple EventListener. It basically just sends + all events to System.out (stdout) or System.err (stderr) depending on the event severity. + </p> + <source><![CDATA[import org.apache.fop.events.Event; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; + +/** A simple event listener that writes the events to stdout and stderr. */ +public class SysOutEventListener implements EventListener { + + /** {@inheritDoc} */ + public void processEvent(Event event) { + String msg = EventFormatter.format(event); + EventSeverity severity = event.getSeverity(); + if (severity == EventSeverity.INFO) { + System.out.println("[INFO ] " + msg); + } else if (severity == EventSeverity.WARN) { + System.out.println("[WARN ] " + msg); + } else if (severity == EventSeverity.ERROR) { + System.err.println("[ERROR] " + msg); + } else if (severity == EventSeverity.FATAL) { + System.err.println("[FATAL] " + msg); + } else { + assert false; + } + } +}]]></source> + <p> + You can see that for every event the method <code>processEvent</code> of the + <code>EventListener</code> will be called. Inside this method you can do whatever + processing you would like including throwing a <code>RuntimeException</code>, if you want + to abort the current processing run. + </p> + <p> + The code above also shows how you can turn an event into a human-readable, localized + message that can be presented to a user. The <code>EventFormatter</code> class does + this for you. It provides additional methods if you'd like to explicitly specify + the locale. + </p> + <p> + It is possible to gather all events for a whole processing run so they can be + evaluated afterwards. However, care should be taken about memory consumption since + the events provide references to objects inside FOP which may themselves have + references to other objects. So holding on to these objects may mean that whole + object trees cannot be released! + </p> + </section> + <section id="add-listener"> + <title>Adding an EventListener</title> + <p> + To register the event listener with FOP, get the <code>EventBroadcaster</code> which + is associated with the user agent (<code>FOUserAgent</code>) and add it there: + </p> + <source><![CDATA[FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); +foUserAgent.getEventBroadcaster().addEventListener(new SysOutEventListener());]]></source> + <p> + Please note that this is done separately for each processing run, i.e. for each + new user agent. + </p> + </section> + <section id="listener-example1"> + <title>An additional listener example</title> + <p> + Here's an additional example of an event listener: + </p> + <p> + By default, FOP continues processing even if an image wasn't found. If you have + more strict requirements and want FOP to stop if an image is not available, you can + do something like the following in the simplest case: + </p> + <source><![CDATA[public class MyEventListener implements EventListener { + + public void processEvent(Event event) { + if ("org.apache.fop.ResourceEventProducer".equals( + event.getEventGroupID())) { + event.setSeverity(EventSeverity.FATAL); + } else { + //ignore all other events (or do something of your choice) + } + } + +}]]></source> + <p> + Increasing the event severity to FATAL will signal the event broadcaster to throw + an exception and stop further processing. In the above case, all resource-related + events will cause FOP to stop processing. + </p> + <p> + You can also customize the exception to throw (you can may throw a RuntimeException + or subclass yourself) and/or which event to respond to: + </p> + <source><![CDATA[public class MyEventListener implements EventListener { + + public void processEvent(Event event) { + if ("org.apache.fop.ResourceEventProducer.imageNotFound" + .equals(event.getEventID())) { + + //Get the FileNotFoundException that's part of the event's parameters + FileNotFoundException fnfe = (FileNotFoundException)event.getParam("fnfe"); + + throw new RuntimeException(EventFormatter.format(event), fnfe); + } else { + //ignore all other events (or do something of your choice) + } + } + +}]]></source> + <p> + This throws a <code>RuntimeException</code> with the <code>FileNotFoundException</code> + as the cause. Further processing effectively stops in FOP. You can catch the exception + in your code and react as you see necessary. + </p> + </section> + </section> + <section id="producer"> + <title>The producer side (for FOP developers)</title> + <p> + This section is primarily for FOP and FOP plug-in developers. It describes how to use + the event subsystem for producing events. + </p> + <note> + The event package has been designed in order to be theoretically useful for use cases + outside FOP. If you think this is interesting independently from FOP, please talk to + <a href="mailto:fop-dev@xmlgraphics.apache.org">us</a>. + </note> + <section id="basic-event-production"> + <title>Producing and sending an event</title> + <p> + The basics are very simple. Just instantiate an <code>Event</code> object and fill + it with the necessary parameters. Then pass it to the <code>EventBroadcaster</code> + which distributes the events to the interested listeneners. Here's a code example: + </p> + <source><![CDATA[Event ev = new Event(this, "complain", EventSeverity.WARN, + Event.paramsBuilder() + .param("reason", "I'm tired") + .param("blah", new Integer(23)) + .build()); +EventBroadcaster broadcaster = [get it from somewhere]; +broadcaster.broadcastEvent(ev); +]]></source> + <p> + The <code>Event.paramsBuilder()</code> is a + <a href="http://en.wikipedia.org/wiki/Fluent_interface">fluent interface</a> + to help with the build-up of the parameters. You could just as well instantiate a + <code>Map</code> (<code>Map<String, Object></code>) and fill it with values. + </p> + </section> + <section id="event-producer"> + <title>The EventProducer interface</title> + <p> + To simplify event production, the event subsystem provides the <code>EventProducer</code> + interface. You can create interfaces which extend <code>EventProducer</code>. These + interfaces will contain one method per event to be generated. By contract, each event + method must have as its first parameter a parameter named "source" (Type Object) which + indicates the object that generated the event. After that come an arbitrary number of + parameters of any type as needed by the event. + </p> + <p> + The event producer interface does not need to have any implementation. The implementation + is produced at runtime by a dynamic proxy created by <code>DefaultEventBroadcaster</code>. + The dynamic proxy creates <code>Event</code> instances for each method call against + the event producer interface. Each parameter (except "source") is added to the event's + parameter map. + </p> + <p> + To simplify the code needed to get an instance of the event producer interface it is + suggested to create a public inner provider class inside the interface. + </p> + <p> + Here's an example of such an event producer interface: + </p> + <source><![CDATA[public interface MyEventProducer extends EventProducer { + + public class Provider { + + public static MyEventProducer get(EventBroadcaster broadcaster) { + return (MyEventProducer)broadcaster.getEventProducerFor(MyEventProducer.class); + } + } + + /** + * Complain about something. + * @param source the event source + * @param reason the reason for the complaint + * @param blah the complaint + * @event.severity WARN + */ + void complain(Object source, String reason, int blah); + +}]]></source> + <p> + To produce the same event as in the first example above, you'd use the following code: + </p> + <source><![CDATA[EventBroadcaster broadcaster = [get it from somewhere]; +TestEventProducer producer = TestEventProducer.Provider.get(broadcaster); +producer.complain(this, "I'm tired", 23);]]></source> + </section> + <section id="event-model"> + <title>The event model</title> + <p> + Inside an invocation handler for a dynamic proxy, there's no information about + the names of each parameter. The JVM doesn't provide it. The only thing you know is + the interface and method name. In order to properly fill the <code>Event</code>'s + parameter map we need to know the parameter names. These are retrieved from an + event object model. This is found in the <code>org.apache.fop.events.model</code> + package. The data for the object model is retrieved from an XML representation of the + event model that is loaded as a resource. The XML representation is generated using an + Ant task at build time (<code>ant resourcegen</code>). The Ant task (found in + <code>src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java</code>) + scans FOP's sources for descendants of the <code>EventProducer</code> interface and + uses <a href="http://qdox.codehaus.org/">QDox</a> to parse these interfaces. + </p> + <p> + The event model XML files are generated during build by the Ant task mentioned above when + running the "resourcegen" task. So just run <code>"ant resourcegen"</code> if you receive + a <code>MissingResourceException</code> at runtime indicating that + <code>"event-model.xml"</code> is missing. + </p> + <p> + Primarily, the QDox-based collector task records the parameters' names and types. + Furthermore, it extracts additional attributes embedded as Javadoc comments from + the methods. At the moment, the only such attribute is "@event.severity" which indicates + the default event severity (which can be changed by event listeners). The example event + producer above shows the Javadocs for an event method. + </p> + <p> + There's one more information that is extracted from the event producer information for + the event model: an optional primary exception. The first exception in the "throws" + declaration of an event method is noted. It is used to throw an exception from + the invocation handler if the event has an event severity of "FATAL" when all + listeners have been called (listeners can update the event severity). Please note + that an implementation of + <code>org.apache.fop.events.EventExceptionManager$ExceptionFactory</code> has to be + registered for the <code>EventExceptionManager</code> to be able to construct the + exception from an event. + </p> + <p> + For a given application, there can be multiple event models active at the same time. + In FOP, each renderer is considered to be a plug-in and provides its own specific + event model. The individual event models are provided through an + <code>EventModelFactory</code>. This interface is implemented for each event model + and registered through the service provider mechanism + (see the <a href="#plug-ins">plug-ins section</a> for details). + </p> + </section> + <section id="event-severity"> + <title>Event severity</title> + <p> + Four different levels of severity for events has been defined: + </p> + <ol> + <li>INFO: informational only</li> + <li>WARN: a Warning</li> + <li>ERROR: an error condition from which FOP can recover. FOP will continue processing.</li> + <li>FATAL: a fatal error which causes an exception in the end and FOP will stop processing.</li> + </ol> + <p> + Event listeners can choose to ignore certain events based on their event severity. + Please note that you may recieve an event "twice" in a specific case: if there is + a fatal error an event is generated and sent to the listeners. After that an exception + is thrown with the same information and processing stops. If the fatal event is + shown to the user and the following exception is equally presented to the user it + may appear that the event is duplicated. Of course, the same information is just + published through two different channels. + </p> + </section> + <section id="plug-ins"> + <title>Plug-ins to the event subsystem</title> + <p> + The event subsystem is extensible. There are a number of extension points: + </p> + <ul> + <li> + <strong><code>org.apache.fop.events.model.EventModelFactory</code>:</strong> Provides + an event model to the event subsystem. + </li> + <li> + <strong><code>org.apache.fop.events.EventExceptionManager$ExceptionFactory</code>:</strong> + Creates exceptions for events, i.e. turns an event into a specific exception. + </li> + </ul> + <p> + The names in bold above are used as filenames for the service provider files that + are placed in the <code>META-INF/services</code> directory. That way, they are + automatically detected. This is a mechanism defined by the + <a href="http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider">JAR file specification</a>. + </p> + </section> + <section id="l10n"> + <title>Localization (L10n)</title> + <p> + One goal of the event subsystem was to have localized (translated) event messages. + The <code>EventFormatter</code> class can be used to convert an event to a + human-readable message. Each <code>EventProducer</code> can provide its own XML-based + translation file. If there is none, a central translation file is used, called + "EventFormatter.xml" (found in the same directory as the <code>EventFormatter</code> + class). + </p> + <p> + The XML format used by the <code>EventFormatter</code> is the same as + <a href="ext:cocoon">Apache Cocoon's</a> catalog format. Here's an example: + </p> + <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?> +<catalogue xml:lang="en"> + <message key="locator"> + [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] + </message> + <message key="org.apache.fop.render.rtf.RTFEventProducer.explicitTableColumnsRequired"> + RTF output requires that all table-columns for a table are defined. Output will be incorrect.{{locator}} + </message> + <message key="org.apache.fop.render.rtf.RTFEventProducer.ignoredDeferredEvent"> + Ignored deferred event for {node} ({start,if,start,end}).{{locator}} + </message> +</catalogue> +]]></source> + <p> + The example (extracted from the RTF handler's event producer) has message templates for + two event methods. The class used to do variable replacement in the templates is + <code>org.apache.fop.util.text.AdvancedMessageFormat</code> which is more powerful + than the <code>MessageFormat</code> classes provided by the Java class library + (<code>java.util.text</code> package). + </p> + <p> + "locator" is a template that is reused by the other message templates + by referencing it through "{{locator}}". This is some kind of include command. + </p> + <p> + Normal event parameters are accessed by name inside single curly braces, for example: + "{node}". For objects, this format just uses the <code>toString()</code> method to turn + the object into a string, unless there is an <code>ObjectFormatter</code> registered + for that type (there's an example for <code>org.xml.sax.Locator</code>). + </p> + <p> + The single curly braces pattern supports additional features. For example, it is possible + to do this: "{start,if,start,end}". "if" here is a special field modifier that evaluates + "start" as a boolean and if that is true returns the text right after the second comma + ("start"). Otherwise it returns the text after the third comma ("end"). The "equals" + modifier is similar to "if" but it takes as an additional (comma-separated) parameter + right after the "equals" modifier, a string that is compared to the value of the variable. + An example: {severity,equals,EventSeverity:FATAL,,some text} (this adds "some text" if + the severity is not FATAL). + </p> + <p> + Additional such modifiers can be added by implementing the + <code>AdvancedMessageFormat$Part</code> and <code>AdvancedMessageFormat$PartFactory</code> + interfaces. + </p> + <p> + Square braces can be used to specify optional template sections. The whole section will + be omitted if any of the variables used within are unavailable. Pipe (|) characters can + be used to specify alternative sub-templates (see "locator" above for an example). + </p> + <p> + Developers can also register a function (in the above example: + <code>{#gatherContextInfo})</code> + to do more complex information rendering. These functions are implementations of the + <code>AdvancedMessageFormat$Function</code> interface. Please take care that this is + done in a locale-independent way as there is no locale information available, yet. + </p> + </section> + </section> + </body> +</document> diff --git a/src/documentation/content/xdocs/1.0/extensions.xml b/src/documentation/content/xdocs/1.0/extensions.xml new file mode 100644 index 000000000..107f6c5b3 --- /dev/null +++ b/src/documentation/content/xdocs/1.0/extensions.xml @@ -0,0 +1,340 @@ +<?xml version="1.0" standalone="no"?> +<!-- + 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$ --> +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> +<document> + <header> + <title>Standard FOP Extensions</title> + <version>$Revision$</version> + </header> + <body> + <p> + By "extension", we mean any data that can be placed in the input XML document that + is not addressed by the XSL-FO standard. + By having a mechanism for supporting extensions, FOP is able to add features that + are not covered in the specification. + </p> + <p> + The extensions documented here are included with FOP, and are automatically available + to you. If you wish to add an extension of your own to FOP, please see the + <a href="../dev/extensions.html">Developers' Extension Page</a>. + </p> + <note>All extensions require the correct use of an appropriate namespace in your input document.</note> + <section id="svg"> + <title>SVG</title> + <p> + Please see the <a href="graphics.html#svg">SVG documentation</a> for more details. + </p> + </section> + <section id="fo-extensions"> + <title>FO Extensions</title> + <section id="fox-namespace"> + <title>Namespace</title> + <p> + By convention, FO extensions in FOP use the "fox" namespace prefix. + To use any of the FO extensions, add a namespace entry for + <code>http://xmlgraphics.apache.org/fop/extensions</code> to the root element: + </p> + <source><![CDATA[<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">]]></source> + </section> + <section id="bookmarks"> + <title>PDF Bookmarks</title> + <p> + In previous versions of Apache FOP there was a <code>fox:outline</code> element + which was used to create outlines in PDF files. The redesigned code makes use + of the new <a href="http://www.w3.org/TR/xsl11/#fo_bookmark-tree">bookmark feature defined in the latest XSL 1.1 working draft</a>. + </p> + </section> + <section id="named-destinations"> + <title>Anchors or Named Destinations</title> + <p>Use the fox:destination element to define "named destinations" inside a PDF document. +These are useful as fragment identifiers, e.g. "http://server/document.pdf#anchor-name". +fox:destination elements can be placed almost anywhere in the fo document, including a child of +root, a block-level element, or an inline-level element. +For the destination to actually work, it must correspond to an "id" attribute on some fo element +within the document. In other words, the "id" attribute actually creates the "view" within the +PDF document. The fox:destination simply gives that view an independent name. +</p> + <source><![CDATA[<fox:destination internal-destination="table-of-contents"/> +... +<fo:block id="table-of-contents">Table of Contents</fo:block>]]></source> + <warning>It is possible that in some future release of FOP, <em>all </em>elements with +"id" attributes will generate named-destinations, which will eliminate the need for +fox:destination.</warning> + </section> + <section id="table-continue-label"> + <title>Table Continuation Label</title> + <p>This extension element hasn't been reimplemented for the redesigned code, yet.</p> + <!--p>Use the fox:continued-label element to create content in table-header and +table-footer cells that will appear only on pages after the first page that the table +appears. fox:continued-label is itself inline content, and is a container of fo:inline +content. This content will be laid out only if the table does not fit on a single page and flows +to following pages. Here is an example of FO code creating such a table-header:</p> +<source><![CDATA[<fo:table-header> + <fo:table-row> + <fo:table-cell> + <fo:block>Header column 1 with continued label + <fox:continued-label><fo:inline> (cont.)</fo:inline></fox:continued-label> + </fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Header column 2 with no continued label</fo:block> + </fo:table-cell> + </fo:table-row> +</fo:table-header>]]></source--> + </section> + <section id="widow-orphan-content-limit"> + <title>fox:orphan-content-limit and fox:widow-content-limit</title> + <p> + The two proprietary extension properties, fox:orphan-content-limit and + fox:widow-content-limit, are used to improve the layout of list-blocks and tables. + If you have a table with many entries, you don't want a single row to be left over + on a page. You will want to make sure that at least two or three lines are kept + together. The properties take an absolute length which specifies the area at the + beginning (fox:widow-content-limit) or at the end (fox:orphan-content-limit) of a + table or list-block. The properties are inherited and only have an effect on fo:table + and fo:list-block. An example: fox:widow-content-limit="3 * 1.2em" would make sure + the you'll have at least three lines (assuming line-height="1.2") together on a table + or list-block. + </p> + </section> + <section id="external-document"> + <title>fox:external-document</title> + <note> + This feature is incomplete. Support for multi-page documents will be added shortly. + At the moment, only single-page images will work. And this will not work with RTF output. + </note> + <p> + This is a proprietary extension element which allows to add whole images as pages to + an FO document. For example, if you have a scanned document or a fax as multi-page TIFF + file, you can append or insert this document using the <code>fox:external-document</code> + element. Each page of the external document will create one full page in the target + format. + </p> + <p> + The <code>fox:external-document</code> element is structurally a peer to + <code>fo:page-sequence</code>, so wherever you can put an <code>fo:page-sequence</code> + you could also place a <code>fox:external-document</code>. + Therefore, the specified contents for <code>fo:root</code> change to: + </p> + <p> + <code> + (layout-master-set, declarations?, bookmark-tree?, (page-sequence|page-sequence-wrapper|fox:external-document|fox:destination)+) + </code> + </p> + <section> + <title>Specification</title> + <p> + The <code>fox:external-document</code> extension formatting object is used to specify + how to create a (sub-)sequence of pages within a document. The content of these pages + comes from the individual subimages/pages of an image or paged document (for example: + multi-page TIFF in the form of faxes or scanned documents, or PDF files). The + formatting object creates the necessary areas to display one image per page. + </p> + <p> + In terms of page numbers, the behaviour is the same as for + <code>fo:page-sequence</code>. The placement of the image inside the page is similar + to that of <code>fo:external-graphic</code> or <code>fo:instream-foreign-object</code>, + i.e. the viewport (and therefore the page size) is defined by either the intrinsic + size of the image or by the size properties that apply to this formatting object. + </p> + <p>Content: EMPTY</p> + <p>The following properties apply to this formatting object:</p> + <ul> + <li>(Common Accessibility Properties) (not implemented, yet)</li> + <li>(Common Aural Properties) (not implemented, yet)</li> + <li>block-progression-dimension</li> + <li>content-height</li> + <li>content-type</li> + <li>content-width</li> + <li>display-align</li> + <li>height</li> + <li>id</li> + <li>inline-progression-dimension</li> + <li>overflow</li> + <li>pages: <page-set> (see below) (not implemented, yet)</li> + <li>reference-orientation</li> + <li>scaling</li> + <li>scaling-method</li> + <li>src</li> + <li>text-align</li> + <li>width</li> + </ul> + <p> + Datatype "page-set": Value: auto | <integer-range>, + Default: "auto" which means all pages/subimages of the document. + <integer-range> allows values such as "7" or "1-3" + </p> + <note> + <code>fox:external-document</code> is not suitable for concatenating FO documents. + For this, XInclude is recommended. + </note> + </section> + </section> + <section id="transform"> + <title>Free-form Transformation for fo:block-container</title> + <p> + For <code>fo:block-container</code> elements whose <code>absolute-position</code> set to + "absolute" or "fixed" you can use the extension attribute <code>fox:transform</code> + to apply a free-form transformation to the whole block-container. The content of the + <code>fox:transform</code> attribute is the same as for + <a href="http://www.w3.org/TR/SVG/coords.html#TransformAttribute">SVG's transform attribute</a>. + The transformation specified here is performed in addition to other implicit + transformations of the block-container (resulting from top, left and other properties) + and after them. + </p> + <p> + Examples: <code>fox:transform="rotate(45)"</code> would rotate the block-container + by 45 degrees clock-wise around its upper-left corner. + <code>fox:transform="translate(10000,0)"</code> would move the block-container to the + right by 10 points (=10000 millipoints, FOP uses millipoints internally!). + </p> + <note> + This extension attribute doesn't work for all output formats! It's currently only + supported for PDF, PS and Java2D-based renderers. + </note> + </section> + <section id="color-functions"> + <title>Color functions</title> + <p> + XSL-FO supports specifying color using the rgb(), rgb-icc() and system-color() functions. + Apache FOP provides additional color functions for special use cases. Please note that + using these functions compromises the interoperability of an FO document. + </p> + <section id="color-function-cmyk"> + <title>cmyk()</title> + <p><code>color cmyk(numeric, numeric, numeric, numeric)</code></p> + <p> + This function will construct a color in device-specific CMYK color space. The numbers + must be between 0.0 and 1.0. For output formats that don't support device-specific + color space the CMYK value is converted to an sRGB value. + </p> + </section> + <section id="pseudo-color-profiles"> + <title>#CMYK pseudo-profile</title> + <p><code>color rgb-icc(numeric, numeric, numeric, #CMYK, numeric, numeric, numeric, numeric)</code></p> + <p> + The <code>rgb-icc</code> function will respond to a pseudo-profile called "#CMYK" + which indicates a device-specific CMYK color space. The "#CMYK" profile is implicitely + available and doesn't have to be (and cannot be) defined through an + <code>fo:color-profile</code> element. It is provided for compatibility with certain + commercial XSL-FO implementations. Please note that this is not part of the official + specification but rather a convention. The following two color specifications are + equivalent: + </p> + <ul> + <li><code>cmyk(0%,0%,20%,40%)</code></li> + <li><code>rgb-icc(153, 153, 102, #CMYK, 0, 0, 0.2, 0.4)</code></li> + </ul> + </section> + </section> + <section id="prepress"> + <title>Prepress Support</title> + + <p> + This section defines a number of extensions related to + <a href="http://en.wikipedia.org/wiki/Prepress">prepress</a> support. + <code>fox:scale</code> defines a general scale factor for the generated pages. + <code>fox:bleed</code> defines the + <a href="http://en.wikipedia.org/wiki/Bleed_%28printing%29">bleed area</a> for a page. + <code>fox:crop-offset</code> defines the outer edges of the area in which crop marks, + registration marks, color bars and page information are placed. + For details, please read on below. + </p> + <note> + Those extensions have been implemented in the PDF and Java2D renderers only. + </note> + + <section id="scale"> + <title>fox:scale</title> + <p>Value: <number>{1,2}</p> + <p>Initial: 1</p> + <p>Applies to: fo:simple-page-master</p> + <p> + This property specifies a scale factor along resp. the x and y axes. If only one number + is provided it is used for both the x and y scales. A scale factor smaller than 1 + shrinks the page. A scale factor greater than 1 enlarges the page. + </p> + </section> + <section id="bleed"> + <title>fox:bleed</title> + <p> + Value: <length>{1,4} + </p> + <p> + Initial: 0pt + </p> + <p>Applies to: fo:simple-page-master</p> + <p> + If there is only one value, it applies to all sides. If there are two values, the top and bottom + bleed widths are set to the first value and the right and left bleed widths are set to the second. + If there are three values, the top is set to the first value, the left and right are set to the second, + and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and + left, respectively. + (Corresponds to <a href="http://www.w3.org/TR/xsl11/#padding">the definition of + padding</a>). + </p> + <p> + This extension indirectly defines the BleedBox and is calculated by expanding the TrimBox by + the bleed widths. The lengths must be non-negative. + </p> + </section> + <section id="cropOffset"> + <title>fox:crop-offset</title> + <p> + Value: <length>{1,4} + </p> + <p> + Initial: bleed (see below) + </p> + <p>Applies to: fo:simple-page-master</p> + <p> + Same behaviour as with fox:bleed. The initial value is set to the same values as the + fox:bleed property. + </p> + <p> + This extension indirectly defines the MediaBox and is calculated by expanding + the TrimBox by the crop offsets. The lengths must be non-negative. + </p> + </section> + <section id="cropBox"> + <title>fox:crop-box</title> + <p> + Value: [trim-box | bleed-box | media-box] + </p> + <p> + Initial: media-box + </p> + <p>Applies to: fo:simple-page-master</p> + <p> + The crop box controls how Acrobat displays the page (CropBox in PDF) or how the Java2DRenderer sizes + the output media. The PDF specification defines that the CropBox defaults to the MediaBox. This extension + follows that definition. To simplify usage and cover most use cases, the three supported enumeration + values "trim-box", "bleed-box" and "media-box" set the CropBox to one of those three other boxes. + </p> + <p> + If requested in the future, we could offer to specify the CropBox in absolute coordinates rather + than just by referencing another box. + </p> + </section> + </section> + </section> + </body> +</document> + diff --git a/src/documentation/content/xdocs/1.0/fonts.xml b/src/documentation/content/xdocs/1.0/fonts.xml new file mode 100644 index 000000000..dcd03e548 --- /dev/null +++ b/src/documentation/content/xdocs/1.0/fonts.xml @@ -0,0 +1,564 @@ +<?xml version="1.0" standalone="no"?> +<!-- + 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$ --> +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> +<document> + <header> + <title>Apache FOP: Fonts</title> + <version>$Revision$</version> + <authors> + <person name="Jeremias Märki" email=""/> + <person name="Tore Engvig" email=""/> + <person name="Adrian Cumiskey" email=""/> + <person name="Max Berger" email=""/> + </authors> + </header> + <body> + <section id="intro"> + <title>Summary</title> + <p>The following table summarizes the font capabilities of the various FOP renderers:</p> + <table> + <tr> + <th>Renderer</th> + <th>Base-14</th> + <th>AWT/OS</th> + <th>Custom</th> + <th>Custom Embedding</th> + </tr> + <tr> + <td>PDF</td> + <td>yes</td> + <td>no</td> + <td>yes</td> + <td>yes</td> + </tr> + <tr> + <td>PostScript</td> + <td>yes</td> + <td>no</td> + <td>yes</td> + <td>yes</td> + </tr> + <tr> + <td>PCL</td> + <td>yes (modified)</td> + <td>yes (painted as bitmaps)</td> + <td>yes (painted as bitmaps)</td> + <td>no</td> + </tr> + <tr> + <td>AFP</td> + <td>no</td> + <td>no</td> + <td>yes</td> + <td>yes</td> + </tr> + <tr> + <td>Java2D/AWT/Bitmap</td> + <td>if available from OS</td> + <td>yes</td> + <td>yes</td> + <td>n/a (display only)</td> + </tr> + <tr> + <td>Print</td> + <td>if available from OS</td> + <td>yes</td> + <td>yes</td> + <td>controlled by OS printer driver</td> + </tr> + <tr> + <td>RTF</td> + <td>n/a (font metrics not needed)</td> + <td>n/a</td> + <td>n/a</td> + <td>n/a</td> + </tr> + <tr> + <td>TXT</td> + <td>yes (used for layout but not for output)</td> + <td>no</td> + <td>yes (used for layout but not for output)</td> + <td>no</td> + </tr> +<!--tr> NOT AVAILABLE + <td>MIF</td> + <td>n/a (font metrics not needed)</td> + <td>n/a</td> + <td>n/a</td> + <td>n/a</td> + </tr--> +<!--tr> NOT AVAILABLE + <td>SVG</td> + <td>if available from OS</td> + <td>yes</td> + <td>no</td> + <td>no</td> + </tr--> + <tr> + <td>XML</td> + <td>yes</td> + <td>no</td> + <td>yes</td> + <td>n/a</td> + </tr> + </table> + </section> + <section> + <title>Base-14 Fonts</title> + <p> + The Adobe PostScript and PDF Specification specify a set of 14 fonts that must be + available to every PostScript interpreter and PDF reader: + Helvetica (normal, bold, italic, bold italic), + Times (normal, bold, italic, bold italic), + Courier (normal, bold, italic, bold italic), + Symbol and ZapfDingbats. + </p> + <p> + The following font family names are hard-coded into FOP for the Base-14 font set: + </p> + <table> + <tr> + <th>Base-14 font</th> + <th>font families</th> + </tr> + <tr> + <td>Helvetica</td> + <td>Helvetica, sans-serif, SansSerif</td> + </tr> + <tr> + <td>Times</td> + <td>Times, Times Roman, Times-Roman, serif, any</td> + </tr> + <tr> + <td>Courier</td> + <td>Courier, monospace, Monospaced</td> + </tr> + <tr> + <td>Symbol</td> + <td>Symbol</td> + </tr> + <tr> + <td>ZapfDingbats</td> + <td>ZapfDingbats</td> + </tr> + </table> + <p> + Please note that recent versions of Adobe Acrobat Reader replace + "Helvetica" with "Arial" and "Times" with "Times New Roman" internally. + GhostScript replaces "Helvetica" with "Nimbus Sans L" and "Times" with + "Nimbus Roman No9 L". Other document viewers may do similar font + substitutions. If you need to make sure that there are no such + substitutions, you need to specify an explicit font and embed it in + the target document. + </p> + </section> + <section id="missing-fonts"> + <title>Missing Fonts</title> + <p> + When FOP does not have a specific font at its disposal (because it's + not installed in the operating system or set up in FOP's configuration), + the font is replaced with "any". "any" is internally mapped to the + Base-14 font "Times" (see above). + </p> + </section> + <section id="missing-glyphs"> + <title>Missing Glyphs</title> + <p> + Every font contains a particular set of + <a href="http://en.wikipedia.org/wiki/Glyph">glyphs</a>. If no glyph can be found for + a given character, FOP will issue a warning and use the glpyh for "#" (if available) + instead. Before it does that, it consults a (currently hard-coded) registry of + glyph substitution groups (see Glyphs.java in Apache XML Graphics Commons). + This registry can supply alternative glyphs in some cases (like using space when a no-break + space is requested). But there's no guarantee that the result will be as expected (for + example, in the case of hyphens and similar glyphs). A better way is to use a font that + has all the necessary glyphs. This glyph substitution is only a last resort. + </p> + </section> + <section id="awt"> + <title>Java2D/AWT/Operating System Fonts</title> + <p> + The Java2D family of renderers (Java2D, AWT, Print, TIFF, PNG), use the + Java AWT subsystem for font metric information. Through operating system + registration, the AWT subsystem knows what fonts are available on the system, + and the font metrics for each one. + </p> + <p> + When working with one of these output formats and you're missing a font, just + install it in your operating system and they should be available for these + renderers. Please note that this is not true for other output formats such as + PDF or PostScript. + </p> + </section> + <section id="custom"> + <title>Custom Fonts</title> + <p> + Support for custom fonts is highly output format dependent (see above table). + This section shows how to add Type 1 and TrueType fonts to the PDF, PostScript and + Java2D-based renderers. Other renderers (like AFP) support other font formats. Details + in this case can be found on the page about <a href="output.html">output formats</a>. + </p> + <p> + In earlier FOP versions, it was always necessary to create an XML font metrics file + if you wanted to add a custom font. This unconvenient step has been removed and in + addition to that, FOP supports auto-registration of fonts, i.e. FOP can find fonts + installed in your operating system or can scan user-specified directories for fonts. + Font registration via XML font metrics file is still supported and may still be necessary + for some very special cases as fallback variant while we stabilize font auto-detection. + </p> + <p> + Basic information about fonts can be found at: + </p> + <ul> + <li> + <a href="http://partners.adobe.com/asn/developer/type/ftypes.html">Adobe font types</a> + </li> + <li> + <a href="http://partners.adobe.com/asn/developer/technotes/fonts.html">Adobe Font Technote</a> + </li> + </ul> + </section> + <section id="basics"> + <title>Basic font configuration</title> + <p> + If you want FOP to use custom fonts, you need to tell it where to find them. This + is done in the configuration file and once per renderer (because each output format + is a little different). In the basic form, you can either tell FOP to find your + operating system fonts or you can specify directories that it will search for + support fonts. These fonts will then automatically be registered. + </p> + <source><![CDATA[ +<renderers> + <renderer mime="application/pdf"> + <fonts> + <!-- register all the fonts found in a directory --> + <directory>C:\MyFonts1</directory> + + <!-- register all the fonts found in a directory and all of its sub directories (use with care) --> + <directory recursive="true">C:\MyFonts2</directory> + + <!-- automatically detect operating system installed fonts --> + <auto-detect/> + </fonts> + </renderer> +</renderers>]]></source> + <note> + Review the documentation for <a href="configuration.html">FOP Configuration</a> + for instructions on making the FOP configuration available to FOP when it runs. + Otherwise, FOP has no way of finding your custom font information. It is currently + not possible to easily configure fonts from Java code. + </note> + </section> + <section id="advanced"> + <title>Advanced font configuration</title> + <p> + The instructions found above should be sufficient for most users. Below are some + additional instructions in case the basic font configuration doesn't lead to + the desired results. + </p> + <section id="type1-metrics"> + <title>Type 1 Font Metrics</title> + <p>FOP includes PFMReader, which reads the PFM file that normally comes with a Type 1 font, and generates an appropriate font metrics file for it. + To use it, run the class org.apache.fop.fonts.apps.PFMReader:</p> + <p>Windows:</p> + <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source> + <p>Unix:</p> + <source>java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source> + <p>PFMReader [options]:</p> + <ul> + <li><strong>-fn <fontname></strong> By default, FOP uses the fontname from the + .pfm file when embedding the font. Use the "-fn" option to override this name with one you have + chosen. This may be useful in some cases to ensure that applications using the output document + (Acrobat Reader for example) use the embedded font instead of a local font with the same + name.</li> + </ul> + <note>The classpath in the above example has been simplified for readability. + You will have to adjust the classpath to the names of the actual JAR files in the lib directory. + xml-apis.jar, xercesImpl.jar, xalan.jar and serializer.jar are not necessary for JDK version 1.4 or later.</note> + <note>The tool will construct some values (FontBBox, StemV and ItalicAngle) based on assumptions and calculations which are only an approximation to the real values. + FontBBox and Italic Angle can be found in the human-readable part of the PFB file or in the AFM file. + The PFMReader tool does not yet interpret PFB or AFM files, so if you want to be correct, you may have to adjust the values in the XML file manually. + The constructed values however appear to have no visible influence.</note> + </section> + <section id="truetype-metrics"> + <title>TrueType Font Metrics</title> + <p>FOP includes TTFReader, which reads the TTF file and generates an appropriate font metrics file for it. + Use it in a similar manner to PFMReader. + For example, to create such a metrics file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:</p> + <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar + org.apache.fop.fonts.apps.TTFReader [options] + C:\myfonts\cmr10.ttf ttfcm.xml</source> + <p>TTFReader [options]:</p> + <ul> + <li><strong>-d <DEBUG | INFO ></strong> Sets the debug level (default is + INFO).</li> + <li><strong>-fn <fontname></strong> Same as for PFMReader.</li> + <li><strong>-ttcname <fontname></strong> If you're reading data from a + TrueType Collection (.ttc file) you must specify which font from the collection you will read + metrics from. + If you read from a .ttc file without this option, the fontnames will be listed for you.</li> + <li><strong>-enc ansi</strong> Creates a WinAnsi-encoded font metrics file. + Without this option, a CID-keyed font metrics file is created. + The table below summarizes the differences between these two encoding options as currently + used within FOP. + Please note that this information only applies to TrueType fonts and TrueType collections:</li> + </ul> + <table id="ttf-encoding"> + <tr> + <th>Issue</th> + <th>WinAnsi</th> + <th>CID-keyed</th> + </tr> + <tr> + <td>Usable Character Set</td> + <td>Limited to WinAnsi character set, which is roughly equivalent to iso-8889-1.</td> + <td>Limited only by the characters in the font itself.</td> + </tr> + <tr> + <td>Embedding the Font</td> + <td>Optional.</td> + <td>Mandatory. Not embedding the font produces invalid PDF documents.</td> + </tr> + </table> + <warning> + You may experience failures with certain TrueType fonts, especially if they don't contain + the so-called Unicode "cmap" table. TTFReader can currently not deal with font like this. + </warning> + </section> + <section id="truetype-collections-metrics"> + <title>TrueType Collections</title> + <p>TrueType collections (.ttc files) contain more than one font. + To create metrics files for these fonts, you must specify which font in the collection should be generated, by using the "-ttcname" option with the TTFReader.</p> + <p>To get a list of the fonts in a collection, just start the TTFReader as if it were a normal TrueType file (without the -ttcname option). + It will display all of the font names and exit with an Exception.</p> + <p>Here is an example of generating a metrics file for a .ttc file:</p> + <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar + org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" + msmincho.ttc msminch.xml</source> + <p> + Alternatively, the individual sub-fonts of a TrueType Collections can be selected + using the "sub-font" attribute on the "font" element. That means that generating + an XML font metrics file for TrueType collections is not necessary anymore. Example: + </p> + <source><![CDATA[<font embed-url="gulim.ttc" sub-font="GulimChe"> + <font-triplet name="GulimChe" style="normal" weight="normal"/> +</font>]]></source> + </section> + <section id="register"> + <title>Register Fonts with FOP</title> + <p>You must tell FOP how to find and use the font metrics files by registering them in the <a href="configuration.html">FOP Configuration</a>. Add entries for your custom fonts, regardless of font type, to the configuration file in a manner similar to the following:</p> + <source><![CDATA[ +<renderers> + <renderer mime="application/pdf"> + <fonts> + <!-- register a particular font --> + <font metrics-url="file:///C:/myfonts/FTL_____.xml" kerning="yes" + embed-url="file:///C:/myfonts/FTL_____.pfb" + encoding-mode="single-byte"> + <font-triplet name="FrutigerLight" style="normal" weight="normal"/> + </font> + + <!-- register all the fonts found in a directory --> + <directory>C:\MyFonts1</directory> + + <!-- register all the fonts found in a directory and all of its sub directories (use with care) --> + <directory recursive="true">C:\MyFonts2</directory> + + <!-- automatically detect operating system installed fonts --> + <auto-detect/> + </fonts> + </renderer> +</renderers>]]></source> + <ul> + <li> + URLs are used to access the font metric and font files. + Relative URLs are resolved relative to the font-base property (or base) if available. + See <a href="configuration.html">FOP: Configuration</a> for more information. + </li> + <li>The "metrics-url" attribute is generally not necessary except if you run into problems with certain fonts.</li> + <li>Either an "embed-url" or a "metrics-url" must be specified for font tag configurations.</li> + <li>The font "kerning" attribute is optional. Default is "true".</li> + <li>If embedding is off (i.e. embed-url is not set), the output will position the text correctly (from the metrics file), but it will not be displayed or printed correctly unless the viewer has the applicable font available to their local system.</li> + <li>When setting the "embed-url" attribute for Type 1 fonts, be sure to specify the PFB (actual font data), not PFM (font metrics) file that you used to generate the XML font metrics file.</li> + <li>The attribute "encoding-mode" is optional an may have the following values: + <ul> + <li>auto: default font encoding mode ("cid" for Truetype, "single-byte" for Type 1)</li> + <li>single-byte: use single-byte encodings in the target format (if applicable)</li> + <li>cid: encode as CID-keyed font (currently only supported for PDF output with TrueType fonts)</li> + </ul> + </li> + <li>The fonts "directory" tag can be used to register fonts contained within a single or list of directory paths. The "recursive" attribute can be specified to recursively add fonts from all sub directories.</li> + <li>The fonts "auto-detect" tag can be used to automatically register fonts that are found to be installed on the native operating system.</li> + <li>Fonts registered with "font" tag configurations override fonts found by means of "directory" tag definitions.</li> + <li>Fonts found as a result of a "directory" tag configuration override fonts found as a result of the "auto-detect" tag being specified.</li> + <li> + If relative URLs are specified, they are evaluated relative to the value of the + "font-base" setting. If there is no "font-base" setting, the fonts are evaluated + relative to the base directory. + </li> + </ul> +<!--note>Cocoon users will need to setup the config, see FOPSerializer for more information.</note--> + </section> + <section id="autodetect"> + <title>Auto-Detect and auto-embed feature</title> + <p>When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.</p> + <p>FOP will also auto-detect fonts which are available in the classpath, if they are described as "application/x-font" in the MANIFEST.MF file. For example, if your .jar file contains font/myfont.ttf:</p> + <source>Manifest-Version: 1.0 + + Name: font/myfont.ttf + Content-Type: application/x-font</source> + <p>This feature allows you to create JAR files containing fonts. The JAR files can be added to fop by providem them in the classpath, e.g. copying them into the lib/ directory.</p> + </section> + <section id="embedding"> + <title>Embedding</title> + <p> + By default, all fonts are embedded if an output format supports font embedding. In some + cases, however, it is preferred that some fonts are only referenced. When working + with referenced fonts it is important to be in control of the target environment where + the produced document is consumed, i.e. the necessary fonts have to be installed there. + </p> + <p> + There are two different ways how you can specify that a font should be referenced: + </p> + <ol> + <li> + When using the old-style "font" element to configure a single font, font referencing + is controlled by the embed-url attribute. If you don't specify the embed-url attribute + the font will not be embedded, but will only be referenced. + </li> + <li> + For automatically configured fonts there's a different mechanism to specify which + fonts should be referenced rather than embedded. This is done in the "referenced-fonts" + element in the configuration. Here's an example: + </li> + </ol> + <source><![CDATA[ +<fop version="1.0"> + <fonts> + <referenced-fonts> + <match font-family="Helvetica"/> + <match font-family="DejaVu.*"/> + </referenced-fonts> + </fonts> +</fop>]]></source> + <p> + At the moment, you can only match fonts against their font-family. It is possible to use + regular expressions as is shown in the second example above ("DejaVu.*"). The syntax for + the regular expressions used here are the one used by the + <a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html"><code>java.util.regex</code> package</a>. + So, in the above snippet "Helvetica" and all variants of the "DejaVu" font family are + referenced. If you want to reference all fonts, just specify <code>font-family=".*"</code>. + </p> + <p> + The <code>referenced-fonts</code> element can be placed either inside the general + <code>fonts</code> element (right under the root) or in the <code>fonts</code> element + under the renderer configuration. In the first case, matches apply to all renderers. + In the second case, matches only apply to the renderer where the element was specified. + Both cases can be used at the same time. + </p> + <p> + Various notes related to embedded fonts: + </p> + <ul> + <li>The PostScript renderer does not yet support TrueType fonts, but can embed Type 1 fonts.</li> + <li>The font is simply embedded into the PDF file, it is not converted.</li> + <li>When FOP embeds a font, it adds a prefix to the fontname to ensure that the name will not match the fontname of an installed font. + This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.</li> + <li>When embedding PostScript fonts, the entire font is always embedded.</li> + <li>When embedding TrueType fonts (ttf) or TrueType Collections (ttc), a subset of the + original font, containing only the glyphs used, is embedded in the output document. + That's the default, but if you specify encoding-mode="single-byte" (see above), the + complete font is embedded.</li> + </ul> + </section> + <section id="substitution"> + <title>Substitution</title> + <p>When a <substitutions/> section is defined in the configuration, FOP will re-map any font-family references found in your FO input to a given substitution font.</p> + <ul> + <li>If a <substitution/> is declared, it is mandatory that both a <from/> and <to/> child element is declared with a font-family attribute.</li> + <li>Both font-weight and font-style are optional attributes, if they are provided then a value of 'normal' is assumed.</li> + </ul> + <p>For example you could make all FO font-family references to 'Arial' with weights between 700 and 900 reference the normal 'Arial Black' font.</p> + <source><![CDATA[ +<fop version="1.0"> + <fonts> + <substitutions> + <substitution> + <from font-family="Arial" font-weight="700..900"/> + <to font-family="Arial Black"/> + </substitution> + <substitution> + <from font-family="FrutigerLight"/> + <to font-family="Times" font-weight="bold" font-style="italic"/> + </substitution> + </substitutions> + </fonts> +</fop>]]></source> + </section> +<!-- The following section should no longer be required + <section id="embedding-base14"> + <title>Explicitly embedding the base 14 fonts</title> + <p> + There are cases where you might want to force the embedding of one or more of the base 14 fonts that + can normally be considered available on the target platform (viewer, printer). One of these cases is + <a href="pdfa.html">PDF/A</a> which mandates the embedding of even the base 14 fonts. Embedding a font such as Helvetica or + Courier is straight-forward. The "Symbol" and "ZapfDingbats" fonts, however, currently present a + problem because FOP cannot correctly determine the encoding of these two single-byte fonts through + the PFM file. FOP now correctly interprets the "encoding" value in the XML font metrics file, but the + PFMReader application writes "UnknownEncoding" to the generated XML file. In order to embed "Symbol" + and "ZapfDingbats" you have to manually change the XML font metrics file and specify "SymbolEncoding" + or "ZapfdingbatsEncoding" encoding respectively as the value for the "encoding" element. + </p> + <p>Example:</p> + <source><![CDATA[ +<?xml version="1.0" encoding="UTF-8"?> +<font-metrics type="TYPE1"> + <font-name>Symbol</font-name> + <embed/> + <encoding>SymbolEncoding</encoding> + <cap-height>673</cap-height> + <x-height>766</x-height> + [..]]]></source> + </section--> + </section> + <section id="selection"> + <title>Font Selection Strategies</title> + <p> + There are two font selection strategies: character-by-character or auto. The default is auto.</p> + <p>Auto selected the first font from the list which is able to display the most characters in a given word. This means (assume font A has characters for abclmn, font B for lnmxyz, fontlist is A,B):</p> + <ul> + <li>aaa lll xxx would be displayed in fonts A A B</li> + <li>aaaxx would be displayed in font A</li> + <li>aaaxxx would be displayed in font A</li> + <li>aaaxxxx would be displayed in font B</li> + </ul> + <p>Character-by-Character is NOT yet supported!</p> + </section> + <section id="font-list"> + <title>Font List Command-Line Tool</title> + <p> + FOP contains a small command-line tool that lets you generate a list of all configured + fonts. Its class name is: <code>org.apache.fop.tools.fontlist.FontListMain</code>. + Run it with the "-?" parameter to get help for the various options. + </p> + </section> + </body> +</document> diff --git a/src/documentation/content/xdocs/0.94/fotree/disabled-testcases.xml b/src/documentation/content/xdocs/1.0/fotree/disabled-testcases.xml index 196eafcc4..196eafcc4 100644 --- a/src/documentation/content/xdocs/0.94/fotree/disabled-testcases.xml +++ b/src/documentation/content/xdocs/1.0/fotree/disabled-testcases.xml diff --git a/src/documentation/content/xdocs/1.0/graphics.xml b/src/documentation/content/xdocs/1.0/graphics.xml new file mode 100644 index 000000000..270d6b49b --- /dev/null +++ b/src/documentation/content/xdocs/1.0/graphics.xml @@ -0,0 +1,590 @@ +<?xml version="1.0" standalone="no"?> +<!-- + 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$ --> +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> +<document> + <header> + <title>Apache FOP: Graphics Formats</title> + <version>$Revision$</version> + </header> + <body> + <section id="introduction"> + <title>Introduction</title> + <p> + Some noteworthy features of the image handling subsystem are: + </p> + <ul> + <li> + The image libraries Jimi and JAI are not supported. Instead, Apache FOP uses the + Image I/O API that was introduced with Java 1.4 for all bitmap codecs. + </li> + <li> + Some bitmap images are not converted to a standardized 24 bit RGB image but are + instead handled in their native format. + </li> + <li> + A plug-in mechanism offers a possibility to add support for new formats without changing + the FOP's source code. + </li> + </ul> + <p> + The actual <a href="http://xmlgraphics.apache.org/commons/image-loader.html">image loading framework</a> + does not reside in Apache FOP, but in + <a href="ext:xmlgraphics.apache.org/commons/">XML Graphics Commons</a>. + </p> + </section> + <section id="support-overview"> + <title>Overview of Graphics Support</title> + <p> + The table below summarizes the <em>theoretical</em> support for graphical formats + within FOP. In other words, within the constraints of the limitations listed here, + these formats <em>should</em> work. However, many of them have not been tested, + and there may be limitations that have not yet been discovered or documented. + The packages needed to support some formats are not included in the FOP distribution + and must be installed separately. Follow the links in the "Support Through" columns + for more details. + </p> + <table> + <tr> + <th rowspan="2">Format</th> + <th rowspan="2">Type</th> + <th colspan="3">Support Through</th> + </tr> + <tr> + <th><a href="#native">Apache FOP (native)</a></th> + <th><a href="#batik">Apache Batik</a></th> + <th><a href="#imageio">Image I/O</a></th> + </tr> + <tr> + <td><a href="#bmp">BMP</a> (Microsoft Windows Bitmap)</td> + <td>bitmap</td> + <td></td> + <td></td> + <td>X [1]</td> + </tr> + <tr> + <td><a href="#emf">EMF</a> (Windows Enhanced Metafile)</td> + <td>vector (with embedded bitmaps)</td> + <td>(X)</td> + <td></td> + <td></td> + </tr> + <tr> + <td><a href="#eps">EPS</a> (Encapsulated PostScript)</td> + <td>metafile (both bitmap and vector), most frequently used for vector drawings</td> + <td>(X)</td> + <td></td> + <td></td> + </tr> + <tr> + <td>GIF (Graphics Interchange Format)</td> + <td>bitmap</td> + <td></td> + <td></td> + <td>X</td> + </tr> + <tr> + <td><a href="#jpeg">JPEG</a> (Joint Photographic Experts Group)</td> + <td>bitmap</td> + <td>(X)</td> + <td></td> + <td>X</td> + </tr> + <tr> + <td><a href="#png">PNG</a> (Portable Network Graphic)</td> + <td>bitmap</td> + <td></td> + <td></td> + <td>X</td> + </tr> + <tr> + <td><a href="#svg">SVG</a> (Scalable Vector Graphics)</td> + <td>vector (with embedded bitmaps)</td> + <td></td> + <td>X</td> + <td></td> + </tr> + <tr> + <td><a href="#tiff">TIFF</a> (Tag Image Format File)</td> + <td>bitmap</td> + <td>(X)</td> + <td></td> + <td>X [1]</td> + </tr> + <tr> + <td><a href="#wmf">WMF</a> (Windows Metafile)</td> + <td>vector (with embedded bitmaps)</td> + <td></td> + <td>(X)</td> + <td></td> + </tr> + </table> + <p> + Legend: + </p> + <ul> + <li>"(X)" means restricted support. Please see the details below.</li> + <li> + [1]: Requires the presence of <a href="http://jai-imageio.dev.java.net/">JAI Image I/O Tools</a> + (or an equivalent Image I/O compatible codec) in the classpath. JAI Image I/O Tools also + adds support for JPEG 2000, WBMP, RAW and PNM. Other Image I/O codecs may provide + support for additional formats. + </li> + </ul> + <note> + <a href="http://jai-imageio.dev.java.net/">JAI Image I/O Tools</a> is not the same as the + <a href="http://java.sun.com/javase/technologies/desktop/media/jai/">JAI library</a>! The + former simply exposes JAI's codecs using the Image I/O API but does not include all + the image manipulation functionality. + </note> + <section id="format-map"> + <title>Map of supported image formats by output format</title> + <p> + Not all image formats are supported for all output formats! For example, while you can + use EPS (Encapsulated PostScript) files when you generate PostScript output, this format + will not be supported by any other output format. Here's an overview of which image + formats are supported by which output format: + </p> + <table> + <tr> + <th>Image Format</th> + <th>PDF</th> + <th>PostScript</th> + <th>Java2D, PNG, TIFF, AWT</th> + <th>PCL</th> + <th>AFP</th> + <th>RTF</th> + </tr> + <tr> + <td><a href="#bmp">BMP</a> (Microsoft Windows Bitmap)</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + </tr> + <tr> + <td><a href="#emf">EMF</a> (Windows Enhanced Metafile)</td> + <td></td> + <td></td> + <td></td> + <td></td> + <td></td> + <td>X [1]</td> + </tr> + <tr> + <td><a href="#eps">EPS</a> (Encapsulated PostScript)</td> + <td></td> + <td>X [1]</td> + <td></td> + <td></td> + <td></td> + <td></td> + </tr> + <tr> + <td>GIF (Graphics Interchange Format)</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + </tr> + <tr> + <td><a href="#jpeg">JPEG</a> (Joint Photographic Experts Group)</td> + <td>X [1]</td> + <td>X [1]</td> + <td>X</td> + <td>X</td> + <td>X [1]</td> + <td>X</td> + </tr> + <tr> + <td><a href="#png">PNG</a> (Portable Network Graphic)</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + </tr> + <tr> + <td><a href="#svg">SVG</a> (Scalable Vector Graphics)</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + </tr> + <tr> + <td><a href="#tiff">TIFF</a> (Tag Image Format File)</td> + <td>X [2]</td> + <td>X [2]</td> + <td>X</td> + <td>X</td> + <td>X [2]</td> + <td>X</td> + </tr> + <tr> + <td><a href="#wmf">WMF</a> (Windows Metafile)</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + <td>X</td> + </tr> + </table> + <p> + Legend: + </p> + <ul> + <li> + [1]: Supported without the need to decode the image. + </li> + <li> + [2]: Supported without the need to decode the image, but only for certain subtypes. + </li> + </ul> + </section> + </section> + <section id="packages"> + <title>Graphics Packages</title> + <section id="native"> + <title>XML Graphics Commons Native</title> + <p> + <a href="ext:xmlgraphics.apache.org/commons">XML Graphics Commons</a> supports a number + of graphic file formats natively as basic functionality: all bitmap formats for which + there are Image I/O codecs available (JPEG, PNG, GIF, TIFF, etc.), EPS and EMF. + </p> + </section> + <section id="fop-native"> + <title>FOP Native</title> + <p> + FOP has no native image plug-ins for the image loading framework of its own but currently + hosts the Batik-dependent SVG and WMF plug-ins until they can be moved to + <a href="ext:xmlgraphics.apache.org/batik">Apache Batik</a>. + </p> + </section> + <section id="batik"> + <title>Apache Batik</title> + <p> + <a href="ext:xmlgraphics.apache.org/batik">Apache Batik</a> will later receive the + SVG and WMF plug-ins for the image loading framework that are currently hosted inside + FOP. + </p> + <p> + Current FOP distributions include a distribution of the + <a class="fork" href="ext:xmlgraphics.apache.org/batik">Apache Batik</a>. + Because Batik's API changes frequently, it is highly recommended that you use the + version that ships with FOP, at least when running FOP. + </p> + <warning>Batik must be run in a graphical environment.</warning> + <p> + Batik must be run in a graphical environment. + It uses AWT classes for rendering SVG, which in turn require an X server on Unixish + systems. If you run a server without X, or if you can't connect to the X server due to + security restrictions or policies (a so-called "headless" environment), SVG rendering + will fail. + </p> + <p>Here are some workarounds:</p> + <ul> + <li> + Start Java with the <code>-Djava.awt.headless=true</code> command line option. + </li> + <li> + Install an X server which provides an in-memory framebuffer without actually using a + screen device or any display hardware. One example is Xvfb. + </li> + <li> + Install a toolkit which emulates AWT without the need for an underlying X server. One + example is the <a href="http://www.eteks.com/pja/en">PJA toolkit</a>, which is free + and comes with detailed installation instructions. + </li> + </ul> + </section> + <section id="imageio"> + <title>Image I/O</title> + <p> + The image loading framework in <a href="ext:xmlgraphics.apache.org/commons">XML Graphics Commons</a> + provides a wrapper to load images through the + <a class="fork" href="http://java.sun.com/j2se/1.4.2/docs/guide/imageio/index.html">JDK's Image I/O API</a> (JSR 015). + Image I/O allows to dynamically add additional image codecs. An example of such an + add-on library are the + <a class="fork" href="http://java.sun.com/products/java-media/jai/">JAI Image I/O Tools</a> + available from Sun. + </p> + </section> + </section> + <section id="image-formats"> + <title>Details on image formats</title> + <section id="bmp"> + <title>BMP</title> + <p> + BMP images are supported through an Image I/O codec. There may be limitations of the + codec which are outside the control of Apache FOP. + </p> + </section> + <section id="emf"> + <title>EMF</title> + <p> + Windows Enhanced Metafiles (EMF) are only supported in RTF output where they are + embedded without decoding. + </p> + </section> + <section id="eps"> + <title>EPS</title> + <p>Apache FOP allows to use EPS files when generating PostScript output only.</p> + <p> + Other output targets can't be supported at the moment because + FOP lacks a PostScript interpreter. Furthermore, FOP is currently not able + to parse the preview bitmaps sometimes contained in EPS files. + </p> + </section> + <section id="gif"> + <title>GIF</title> + <p> + GIF images are supported through an Image I/O codec. Transparency is supported but + not guaranteed to work with every output format. + </p> + </section> + <section id="jpeg"> + <title>JPEG</title> + <p> + FOP native support (i.e. the handling of undecoded images) of JPEG does not include all + variants, especially those containing unusual color lookup tables and color profiles. + If you have trouble with a JPEG image in FOP, try opening it with an image processing + program (such as Photoshop or Gimp) and then saving it. Specifying 24-bit color output + may also help. For the PDF and PostScript renderers most JPEG images can be passed + through without decompression. User reports indicate that grayscale, RGB, and + CMYK color spaces are all rendered properly. However, for other output formats, the + JPEG images have to be decompressed. Tests have shown that there are some limitation + in some Image I/O codecs concerning images in the CMYK color space. Work-arounds are + in place but may not always work as expected. + </p> + </section> + <section id="png"> + <title>PNG</title> + <p> + PNG images are supported through an Image I/O codec. Transparency is supported but + not guaranteed to work with every output format. + </p> + </section> + <section id="svg"> + <title>SVG</title> + <section id="svg-intro"> + <title>Introduction</title> + <p>FOP uses <a href="#batik"> Apache Batik</a> for SVG support. + This format can be handled as an <code>fo:instream-foreign-object</code> or in a separate + file referenced with <code>fo:external-graphic</code>.</p> + <note> + Batik's SVG Rasterizer utility may also be used to convert standalone SVG + documents into PDF. For more information please see the + <a href="http://xmlgraphics.apache.org/batik/svgrasterizer.html">SVG Rasterizer documentation</a> + on the Batik site. + </note> + </section> + <section id="svg-pdf-graphics"> + <title>Placing SVG Graphics into PDF</title> + <p> + The SVG is rendered into PDF by using PDF commands to draw and fill + lines and curves. This means that the graphical objects created with + this remain as vector graphics. The same applies to PostScript output. + For other output formats the SVG graphic may be converted to a bitmap + image. + </p> + <p> + There are a number of SVG things that cannot be converted directly into + PDF. Parts of the graphic such as effects, patterns and images are inserted + into the PDF as a raster graphic. The resolution of these raster images can + be controlled through the "target resolution" setting in the + <a href="configuration.html">configuration</a>.</p> + <p> + Currently transparency is limited in PDF so some SVG images that + contain effects or graphics with transparent areas may not be displayed + correctly. + </p> + </section> + <section id="svg-pdf-text"> + <title>Placing SVG Text into PDF and PostScript</title> + <p>If possible, Batik will use normal PDF or PostScript text when inserting text. It does + this by checking if the text can be drawn normally and the font is + supported. This example svg <a href="../dev/svg/text.svg">text.svg</a> / + <a href="../dev/svg/text.pdf">text.pdf</a> / <a href="../dev/svg/text.png">text.png</a> + shows how various types and effects with text are handled. + Note that SVG font support is not yet implemented. Furthermore, text handling in + PostScript output is inferior to PDF output - more text will be painted as shapes in + PS than in PDF. + </p> + <p> + When there's no support to paint text using native text operations, + text is converted and drawn as a set of shapes by Batik, using the + stroking text painter. This means that a typical character will + have about 10 curves (each curve consists of at least 20 characters). + This can make the output files large and when it is viewed the + viewer may not normally draw those fine curves very well (In Adobe Acrobat, turning on + "Smooth Line Art" in the preferences will fix this). Copy/paste functionality + will not be supported in this case. + If the text is inserted into the output file using the inbuilt text commands + it will use a single character. + </p> + <p> + Note that because SVG text can be rendered as either text or a vector graphic, you + may need to consider settings in your viewer for both. The Acrobat viewer has both + "smooth line art" and "smooth text" settings that may need to be set for SVG images + to be displayed nicely on your screen (see Edit / Preferences / Display). + This setting will not affect the printing of your document, which should be OK in + any case, but will only affect the quality of the screen display. + </p> + </section> + <section id="svg-font-selection"> + <title>Font selection notes</title> + <p> + Apache Batik uses the AWT/Java2D subsystem as font source while FOP has its own font + subsystem. Great care has been taken that font selection does the best possible choices. + But it must be noted when creating PDF or PostScript that a font used in SVG graphics + needs to be registered with the operating system as well as in FOP's configuration. + By using FOP's font auto-detection, you simply have to install the font in the operating + system and not care about anything else. This is less of an issue if you create + formats like TIFFs, PNGs or PCL because in these cases SVG graphics are usually rendered + to bitmaps which means that on both sides (Batik and FOP), AWT/Java2D is used as the + single font source. + </p> + <p> + Whenever an SVG is converted into a PDF or PostScript file, the font that has been used + inside Batik has to be mapped to a font used by the actual output format. Features like + font substitution in FOP may need to be taken into account but can also be an advantage + when working around font mapping issues. Like for XSL-FO content, you'll get a warning + if a particular font could not be found and had to be substituted, or if a particular + glyph is missing in a font. + </p> + </section> + <section id="svg-scaling"> + <title>Scaling</title> + <p> + Currently, SVG images are rendered with the dimensions specified <em>in the SVG + file</em>, within the viewport specified in the fo:external-graphic element. + For everything to work properly, the two should be equal. The SVG standard leaves + this issue as an implementation detail. Additional scaling options are available + through XSL-FO means. + </p> + <p> + If you use pixels to specify the size of an SVG graphic the "source resolution" setting + in the <a href="configuration.html">configuration</a> will be used to determine the + size of a pixel. The use of pixels to specify sizes is discouraged as they may + be interpreted differently in different environments. + </p> + </section> + <section id="svg-problems"> + <title>Known Problems</title> + <ul> + <li> + Soft mask transparency is combined with white so that it looks better + on PDF 1.3 viewers but this causes the soft mask to be slightly lighter + or darker on PDF 1.4 viewers. + </li> + <li> + There is some problem with a gradient inside a pattern which may cause a PDF + error when viewed in Acrobat 5. + </li> + <li> + Text is not always handled correctly, it may select the wrong font + especially if characters have multiple fonts in the font list. + </li> + <li> + Uniform transparency for images and other SVG elements that are converted + into a raster graphic are not drawn properly in PDF. The image is opaque. + </li> + </ul> + </section> + </section> + <section id="tiff"> + <title>TIFF</title> + <p> + FOP can embed TIFF images without decompression into PDF, PostScript and AFP if they + have either CCITT T.4, CCITT T.6, or JPEG compression. Otherwise, a TIFF-capable + Image I/O codec is necessary for decoding the image. + </p> + <p> + There may be some limitation concerning images in the CMYK color space. + </p> + </section> + <section id="wmf"> + <title>WMF</title> + <p> + Windows Metafiles (WMF) are supported through classes in + <a href="ext:xmlgraphics.apache.org/batik">Apache Batik</a>. At the moment, support + for this format is experimental and may not always work as expected. + </p> + </section> + </section> + <section id="resolution"> + <title>Graphics Resolution</title> + <p> + Some bitmapped image file formats store a dots-per-inch (dpi) or other resolution + values. FOP tries to use this resolution information whenever possible to determine + the image's intrinsic size. This size is used during the layout process when it is not + superseded by an explicit size on fo:external-graphic (content-width and content-height + properties). + </p> + <p> + Please note that not all images contain resolution information. If it's not available + the source resolution set on the FopFactory (or through the user configuration XML) is used. + The default here is 72 dpi. + </p> + <p> + Bitmap images are generally embedded into the output format at their original resolution + (as is). No resampling of the image is performed. Explicit resampling is on our wishlist, + but hasn't been implemented, yet. Bitmaps included in SVG graphics may be resampled to + the resolution specified in the "target resolution" setting in the + <a href="configuration.html">configuration</a> if SVG filters are applied. This can be + used as a work-around to resample images in FO documents. + </p> + </section> + <section id="page-selection"> + <title>Page selection for multi-page formats</title> + <p> + Some image formats such as TIFF support multiple pages/sub-images per file. You can + select a particular page using a special URI fragment in the form: + <uri>#page=<nr> + (for example: <code>http://localhost/images/myimage.tiff#page=3</code>) + </p> + </section> + <section id="caching"> + <title>Image caching</title> + <p> + FOP caches images between runs. There is one cache per FopFactory instance. The URI is + used as a key to identify images which means that when a particular URI appears again, + the image is taken from the cache. If you have a servlet that generates a different + image each time it is called with the same URI you need to use a constantly + changing dummy parameter on the URI to avoid caching. + </p> + <p> + The image cache has been improved considerably in the redesigned code. Therefore, + resetting the image cache should be a thing of the past. If you + still experience OutOfMemoryErrors, please notify us. + </p> + <p> + If all else fails, the image cache can be cleared like this: + <code>fopFactory.getImageManager().getCache().clearCache();</code> + </p> + </section> + </body> +</document> diff --git a/src/documentation/content/xdocs/0.94/hyphenation.xml b/src/documentation/content/xdocs/1.0/hyphenation.xml index ed97c6868..ed97c6868 100644 --- a/src/documentation/content/xdocs/0.94/hyphenation.xml +++ b/src/documentation/content/xdocs/1.0/hyphenation.xml diff --git a/src/documentation/content/xdocs/0.94/index.xml b/src/documentation/content/xdocs/1.0/index.xml index 9bf46ccf5..7e9a1f6c7 100644 --- a/src/documentation/content/xdocs/0.94/index.xml +++ b/src/documentation/content/xdocs/1.0/index.xml @@ -19,22 +19,36 @@ <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> <document> <header> - <title>Apache FOP Version 0.94</title> + <title>Apache FOP Version 1.0</title> <version>$Revision$</version> </header> <body> <section id="intro"> <title>Introduction</title> <p> - The Apache FOP team is proud to present to you this production quality release. - We're still in the process of adding new features. We welcome any feedback you - might have and even more, any other form of help to get the project forward. + The Apache FOP team is proud to present to you this production + quality codebase. FOP 1.0 provides a good subset of the W3C + XSL-FO 1.0 and 1.1 Standards. Its stable, 1.0 designation + provides added recognition as the productive tool it has been + for years. + </p> + <p> + We remain committed to improving the tool, and we continue to + add new features. We welcome any feedback you might have and + even more, any other form of help to get the project forward. </p> <p> - This fifth release contains many bug fix release and new features compared - to 0.93. To see what has changed since the last release, please visit the - <a href="changes_0.94.html">Changes Page</a> and the <a href="releaseNotes_0.94.html">Release Notes</a>. + This release contains many bug fixes and new features compared + to the previous version. To see what has changed since the last release, please visit the + <a href="changes_1.0.html">Changes Page</a> and the + <a href="releaseNotes_1.0.html">Release Notes</a>. </p> + <p> + This release implements a good subset of the W3C XSL-FO 1.0 + and 1.1 Standards. For a detailed overview of FOP's + compliance, visit the <a href="../compliance.html">compliance + page</a>. + </p> </section> <section id="upgrading"> <title>Upgrading from an earlier version</title> @@ -42,7 +56,7 @@ If you're upgrading to this version from an earlier version of FOP, please read the information contained on the <a href="upgrading.html">Upgrading page</a>! </p> - </section> + </section> <section id="download"> <title>Download</title> <p> diff --git a/src/documentation/content/xdocs/1.0/intermediate.xml b/src/documentation/content/xdocs/1.0/intermediate.xml new file mode 100644 index 000000000..148e99360 --- /dev/null +++ b/src/documentation/content/xdocs/1.0/intermediate.xml @@ -0,0 +1,331 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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$ --> +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> +<document> + <header> + <title>Intermediate Format</title> + <version>$Revision$</version> + </header> + <body> + <note> + Please note that the intermediate formats described here are + <strong>advanced features</strong> and can be ignored by most users of Apache FOP. + </note> + <section id="introduction"> + <title>Introduction</title> + <p> + Apache FOP now provides two different so-called intermediate formats. The first one + (let's call it the area tree XML format) is basically a 1:1 XML representation of FOP's + area tree as generated by the layout engine. The area tree is conceptually defined in the + <a href="http://www.w3.org/TR/2001/REC-xsl-20011015/slice1.html#section-N742-Formatting">XSL-FO specification in chapter 1.1.2</a>. + Even though the area tree is mentioned in the XSL-FO specification, this part is not + standardized. Therefore, the area tree XML format is a FOP-proprietary XML file format. + The area tree XML can be generated through the area tree XML Renderer (the XMLRenderer). + </p> + <p> + The second intermediate format (which we shall name exactly like this: the intermediate + format) + is a recent addition which tries to meet a slightly different set of goals. It is highly + optimized for speed. + </p> + <p> + The intermediate format can be used to generate intermediate documents that are modified + before they are finally rendered to their ultimate output format. Modifications include + adjusting and changing trait values, adding or modifying area objects, inserting prefabricated + pages, overlays, imposition (n-up, rotation, scaling etc.). Multiple IF files can be combined + to a single output file. + </p> + </section> + <section id="which-if"> + <title>Which Intermediate Format to choose?</title> + <p> + Both formats have their use cases, so the choice you will make will depend on your + particular situation. Here is a list of strengths and use cases for both formats: + </p> + <section id="strengths-at"> + <title>Area Tree XML (AT XML)</title> + <ul> + <li>1:1 representation of FOP's area tree in XML.</li> + <li>Contains more structure information than the new intermediate format.</li> + <li>Used in FOP's layout engine test suite for regression testing.</li> + </ul> + </section> + <section id="strengths-if"> + <title>Intermediate Format (IF)</title> + <ul> + <li>Highly optimized for speed.</li> + <li>Smaller XML files.</li> + <li>Easier to post-process.</li> + <li>XML Schema is available.</li> + <li> + Recommended for use cases where documents are formatted concurrently and later + concatenated to a single print job. + </li> + </ul> + </section> + <p> + More technical information about the two formats can be found on the + <a href="http://wiki.apache.org/xmlgraphics-fop/AreaTreeIntermediateXml/NewDesign">FOP Wiki</a>. + </p> + </section> + <section id="architecture"> + <title>Architectural Overview</title> + <figure src="images/if-architecture-overview.png" + alt="Diagram with an architectural overview over the intermediate formats"/> + </section> + <section id="usage"> + <title>Usage of the Area Tree XML format (AT XML)</title> + <p> + As already mentioned, the area tree XML format is generated by using the + <strong>XMLRenderer</strong> (MIME type: <strong>application/X-fop-areatree</strong>). + So, you basically set the right MIME type for the output format and process your FO files + as if you would create a PDF file. + </p> + <p> + However, there is an important detail to consider: The + various Renderers don't all use the same font sources. To be able to create the right + area tree for the ultimate output format, you need to create the area tree XML file using + the right font setup. This is achieved by telling the XMLRenderer to mimic another + renderer. This is done by calling the XMLRenderer's mimicRenderer() method with an + instance of the ultimate target renderer as the single parameter. This has a consequence: + An area tree XML file rendered with the Java2DRenderer may not look as expected when it + was actually generated for the PDF renderer. For renderers that use the same font setup, + this restriction does not apply (PDF and PS, for example). Generating the area tree XML + format file is the first step. + </p> + <p> + The second step is to reparse the file using the <strong>AreaTreeParser</strong> which is + found in the org.apache.fop.area package. The pages retrieved from the area tree XML file + are added to an AreaTreeModel instance from where they are normally rendered using one of + the available Renderer implementations. You can find examples for the area tree XML + processing in the + <a href="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/intermediate/"><code>examples/embedding</code></a> + directory in the FOP distribution. + </p> + <p> + The basic pattern to parse the area tree XML format looks like this: + </p> + <source><![CDATA[ +FopFactory fopFactory = FopFactory.newInstance(); + +// Setup output +OutputStream out = new java.io.FileOutputStream(pdffile); +out = new java.io.BufferedOutputStream(out); +try { + //Setup fonts and user agent + FontInfo fontInfo = new FontInfo(); + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + //Construct the AreaTreeModel that will received the individual pages + AreaTreeModel treeModel = new RenderPagesModel(userAgent, + MimeConstants.MIME_PDF, fontInfo, out); + + //Parse the area tree file into the area tree + AreaTreeParser parser = new AreaTreeParser(); + Source src = new StreamSource(myIFFile); + parser.parse(src, treeModel, userAgent); + + //Signal the end of the processing. The renderer can finalize the target document. + treeModel.endDocument(); +} finally { + out.close(); +}]]></source> + <p> + This example simply reads an area tree file and renders it to a PDF file. Please note, that in normal + FOP operation you're shielded from having to instantiate the FontInfo object yourself. This + is normally a task of the AreaTreeHandler which is not present in this scenario. The same + applies to the AreaTreeModel instance, in this case an instance of a subclass called + RenderPagesModel. RenderPagesModel is ideal in this case as it has very little overhead + processing the individual pages. An important line in the example is the call to + <code>endDocument()</code> on the AreaTreeModel. This lets the Renderer know that the processing + is now finished. + </p> + <p> + The area tree XML format can also be used from the <a href="running.html#standalone-start">command-line</a> + by using the "-atin" parameter for specifying the area tree XML as input file. You can also + specify a "mimic renderer" by inserting a MIME type between "-at" and the output file. + </p> + <section id="concat"> + <title>Concatenating Documents</title> + <p> + This initial example is obviously not very useful. It would be faster to create the PDF file + directly. As the <a href="http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/examples/embedding/java/embedding/atxml/ExampleConcat.java">ExampleConcat.java</a> + example shows you can easily parse multiple area tree files in a row and add the parsed pages to the + same AreaTreeModel instance which essentially concatenates all the input document to one single + output document. + </p> + </section> + <section id="modifying"> + <title>Modifying Documents</title> + <p> + One of the most important use cases for this format is obviously modifying the area + tree XML before finally rendering it to the target format. You can easily use XSLT to process + the AT XML file according to your needs. Please note, that we will currently not formally describe + the area tree XML format. You need to have a good understanding its structure so you don't + create any non-parseable files. We may add an XML Schema and more detailed documentation at a + later time. You're invited to help us with that. + </p> + <note> + The area tree XML format is sensitive to changes in whitespace. If you're not careful, + the modified file may not render correctly. + </note> + </section> + <section id="advanced"> + <title>Advanced Use</title> + <p> + The generation of the area tree format as well as it parsing process has been designed to allow + for maximum flexibility and optimization. Please note that you can call <code>setTransformerHandler()</code> on + XMLRenderer to give the XMLRenderer your own TransformerHandler instance in case you would like to + do custom serialization (to a W3C DOM, for example) and/or to directly modify the area tree using + XSLT. The AreaTreeParser on the other side allows you to retrieve a ContentHandler instance where + you can manually send SAX events to to start the parsing process (see <code>getContentHandler()</code>). + </p> + </section> + </section> + <section id="usage-if"> + <title>Usage of the Intermediate Format (IF)</title> + <p> + The Intermediate Format (IF) is generated by the <strong>IFSerializer</strong> + (MIME type: <strong>application/X-fop-intermediate-format</strong>). + So, you basically set the right MIME type for the output format and process your FO files + as if you would create a PDF file. + </p> + <p> + The IFSerializer is an implementation of the <strong>IFDocumentHandler</strong> and + <strong>IFPainter</strong> interfaces. The <strong>IFRenderer</strong> class is responsible + for converting FOP's area tree into calls against these two interfaces. + </p> + <ul> + <li> + IFDocumentHandler: This interface is used on the document-level and defines the + overall structure of the Intermediate Format. + </li> + <li> + IFPainter: This interface is used to generate graphical page content like text, images + and borders. + </li> + </ul> + <p> + As with the AT XML, there is an important detail to consider: The various output + implementations don't all use the same font sources. To be able + to create the right IF for the ultimate output file, you need to create the IF file using + the right font setup. This is achieved by telling the IFRenderer (responsible for + converting the area tree into calls to the IFDocumentHandler and IFPainter interfaces) + to mimic another renderer. This is done by calling the IFSerializer's + mimicDocumentHandler() method with an instance of the ultimate target document handler + as the single parameter. This has a consequence: An IF file rendered with the + Java2DDocumentHandler may not look as expected when it was actually generated for the PDF + implementation. For implementations that use the same font setup, + this restriction does not apply (PDF and PS, for example). Generating the Intermediate + Format file is the first step. + </p> + <p> + The second step is to reparse the file using the <strong>IFParser</strong> which is + found in the org.apache.fop.render.intermediate package. The IFParser simply takes an + IFDocumentHandler instance against which it generates the appropriate calls. The IFParser + is implemented as a SAX ContentHandler so you're free to choose the method for + post-processing the IF file(s). You can use XSLT or write SAX- or DOM-based code to + manipulate the contents. You can find examples for the Intermediate Format + processing in the + <a href="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/intermediate/"><code>examples/embedding</code></a> + directory in the FOP distribution. + </p> + <p> + The basic pattern to parse the intermediate format looks like this: + </p> + <source><![CDATA[ +FopFactory fopFactory = FopFactory.newInstance(); + +// Setup output +OutputStream out = new java.io.FileOutputStream(pdffile); +out = new java.io.BufferedOutputStream(out); +try { + //Setup user agent + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + //Create IFDocumentHandler instance + IFDocumentHandler targetHandler; + String mime = MimeConstants.MIME_PDF; + targetHandler = fopFactory.getRendererFactory().createDocumentHandler( + userAgent, mime); + + //Setup fonts + IFUtil.setupFonts(targetHandler); + + //Tell the target handler where to write the PDF to + targetHandler.setResult(new StreamResult(pdffile)); + + //Parse the IF file + IFParser parser = new IFParser(); + Source src = new StreamSource(myIFFile); + parser.parse(src, targetHandler, userAgent); + +} finally { + out.close(); +}]]></source> + <p> + This example simply reads an intermediate file and renders it to a PDF file. Here + IFParser.parse() is used, but you can also just get a SAX ContentHandler by using the + IFParser.getContentHandler() method. + </p> + <section id="concat-if"> + <title>Concatenating Documents</title> + <p> + This initial example is obviously not very useful. It would be faster to create the PDF file + directly (without the intermediate step). As the + <a href="http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/examples/embedding/java/embedding/intermediate/ExampleConcat.java">ExampleConcat.java</a> + example shows you can easily parse multiple intermediate files in a row and use the + IFConcatenator class to concatenate page sequences from multiple source files to a single + output file. This particular example does the concatenation on the level of the + IFDocumentHandler interface. You could also do this in XSLT or using SAX on the XML level. + Whatever suits your process best. + </p> + </section> + <section id="modifying-if"> + <title>Modifying Documents</title> + <p> + One of the most important use cases for this format is obviously modifying the + intermediate format before finally rendering it to the target format. You can easily use + XSLT to process the IF file according to your needs. + </p> + <p> + There is an XML Schema (located under + <a href="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/documentation/intermediate-format-ng/">src/documentation/intermediate-format-ng</a>) + that helps you verify that your modified content is correct. + </p> + <p> + For certain output formats there's a caveat: Formats like AFP and PCL do not support + arbitrary transformations on the IF's "viewport" and "g" elements. Possible are + only rotations in 90 degree steps and translations. + </p> + </section> + <section id="advanced-if"> + <title>Advanced Use</title> + <p> + The generation of the intermediate format as well as it parsing process has been + designed to allow for maximum flexibility and optimization. So rather than just passing + in a StreamResult to IFSerializer's setResult() method, you can also use a SAXResult + or a DOMResult. And as you've already seen , the IFParser on the other side allows you + to retrieve a ContentHandler instance where you can manually send SAX events to + start the parsing process (see <code>getContentHandler()</code>). + </p> + </section> + </section> + </body> +</document> diff --git a/src/documentation/content/xdocs/0.94/known-issues.xml b/src/documentation/content/xdocs/1.0/known-issues.xml index 27ae55494..2ef4b7102 100644 --- a/src/documentation/content/xdocs/0.94/known-issues.xml +++ b/src/documentation/content/xdocs/1.0/known-issues.xml @@ -21,8 +21,9 @@ MIF and SVG output support have not been restored, yet. </known-issue> <known-issue> - Java2D/AWT support has been improved, but some problems remain, - for example with block-containers. + RTF output is inferior to other output formats supported by FOP. + For details, please see the "Output Targets" page of the release + you're using. </known-issue> <known-issue> Auto table layout is not implemented, yet. @@ -81,10 +82,6 @@ table-body, table-header, table-footer and table-row. </known-issue> <known-issue> - The backgrounds of table-body, table-header, table-footer and - table-column are not painted, yet. - </known-issue> - <known-issue> Border and padding conditionality are not supported on table-cells, yet. </known-issue> <known-issue> diff --git a/src/documentation/content/xdocs/0.94/knownissues_overview.xml b/src/documentation/content/xdocs/1.0/knownissues_overview.xml index 5720424b7..3f96a9b5c 100644 --- a/src/documentation/content/xdocs/0.94/knownissues_overview.xml +++ b/src/documentation/content/xdocs/1.0/knownissues_overview.xml @@ -49,7 +49,7 @@ This section lists disabled test cases in the test suite for the FO tree tests, at the time of the release. </p> - <xi:include href="cocoon://knownissues-raw-fotree_0.94.xml#xpointer(/document/body/*)"/> + <xi:include href="cocoon://knownissues-raw-fotree_1.0.xml#xpointer(/document/body/*)"/> </section> <section> <title>Layout Engine</title> @@ -57,12 +57,12 @@ This section lists disabled test cases in the test suite for the layout engine tests, at the time of the release. </p> - <xi:include href="cocoon://knownissues-raw-layoutengine_0.94.xml#xpointer(/document/body/*)"/> + <xi:include href="cocoon://knownissues-raw-layoutengine_1.0.xml#xpointer(/document/body/*)"/> </section> <section> <title>Other known issues</title> <p>This section lists other known issues.</p> - <xi:include href="cocoon://knownissues-raw-static_0.94.xml#xpointer(/document/body/*)"/> + <xi:include href="cocoon://knownissues-raw-static_1.0.xml#xpointer(/document/body/*)"/> </section> </section> </body> diff --git a/src/documentation/content/xdocs/0.94/layoutengine/disabled-testcases.xml b/src/documentation/content/xdocs/1.0/layoutengine/disabled-testcases.xml index d81c0dc27..1fb4f2926 100644 --- a/src/documentation/content/xdocs/0.94/layoutengine/disabled-testcases.xml +++ b/src/documentation/content/xdocs/1.0/layoutengine/disabled-testcases.xml @@ -27,13 +27,6 @@ nominal line.</description> </testcase> <testcase> - <name>Bugzilla #36391: reference-orientation</name> - <file>block-container_reference-orientation_bug36391.xml</file> - <description>There's a problem involving nested block-containers - and reference-orientation 180/-180.</description> - <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=36391</reference> - </testcase> - <testcase> <name>Auto-height block-containers produce fences</name> <file>block-container_space-before_space-after_3.xml</file> <description>Block-containers with no height currently don't @@ -48,8 +41,8 @@ <testcase> <name>Hyphenation with preserved linefeeds</name> <file>block_hyphenation_linefeed_preserve.xml</file> - <description>When hyphenation is enabled and linefeeds are preserved linefeeds - are painted as '#' and the text is output multiple times.</description> + <description>When hyphenation is enabled and linefeeds are preserved, + the text is output multiple times.</description> </testcase> <testcase> <name>linefeed-treatment</name> @@ -105,29 +98,6 @@ regions.</description> </testcase> <testcase> - <name>Footnotes swallowed in lists</name> - <file>footnote_in_list.xml</file> - <description>Element lists for lists are created by combining the - element lists from list-item-label and list-item-body. The - footnotes contained in the KnuthBlockBoxes are not propagated to - the combined element list.</description> - <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=37579</reference> - </testcase> - <testcase> - <name>Footnotes swallowed in tables</name> - <file>footnote_in_table.xml</file> - <description>Element lists for tables are created by combining the - element lists from the individual table-cells. The footnotes - contained in the KnuthBlockBoxes are not propagated to the combined - element list.</description> - <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 @@ -177,18 +147,6 @@ <reference>http://www.nabble.com/leaders-with-leader-pattern%3D%22use-content%22-t546244.html</reference> </testcase> <testcase> - <name>keep-with-previous doesn't work in lists</name> - <file>list-block_keep-with-previous.xml</file> - <description>Keep-with-previous doesn't work inside tables and - lists, yet.</description> - </testcase> - <testcase> - <name>keep-with-previous doesn't work in lists</name> - <file>list-item_block_keep-with-previous.xml</file> - <description>Keep-with-previous doesn't work inside tables and - lists, yet.</description> - </testcase> - <testcase> <name>Page breaking doesn't deal with IPD changes</name> <file>page-breaking_4.xml</file> <description>Page breaking currently doesn't support changing available IPD @@ -213,11 +171,6 @@ placed correctly.</description> </testcase> <testcase> - <name>page-number-citation-last: FOs spanning multiple pages are not properly handled.</name> - <file>page-number-citation-last_basic.xml</file> - <description>Resolution of forward references does not wait until an FO is fully finished when an FO spans multiple pages.</description> - </testcase> - <testcase> <name>IDs are not working on all FO elements</name> <file>page-number-citation_complex_1.xml</file> <description>The "id" attributes are not properly handled for all block-level FO elements.</description> @@ -245,54 +198,6 @@ <description>Column balancing doesn't work as expected.</description> </testcase> <testcase> - <name>No background-images on table-body</name> - <file>table-body_background-image.xml</file> - <description>The backgrounds of table-body, table-header, - table-footer and table-column are not painted, yet.</description> - </testcase> - <testcase> - <name>Collapsing Border Model NYI</name> - <file>table_border-collapse_collapse_1.xml</file> - <description>Border-collapse="collapse" is not yet - implemented.</description> - </testcase> - <testcase> - <name>Collapsing Border Model NYI</name> - <file>table_border-collapse_collapse_2.xml</file> - <description>Border-collapse="collapse" is not yet - implemented.</description> - </testcase> - <testcase> - <name>Problems with border and padding on tables</name> - <file>table_border_padding.xml</file> - <description>The element list seems to not be fully correct, yet, causing - the layout to look odd.</description> - </testcase> - <testcase> - <name>keep-with-previous doesn't work inside tables</name> - <file>table-cell_block_keep-with-previous.xml</file> - <description>Keep-with-previous doesn't work inside tables and - lists, yet.</description> - </testcase> - <testcase> - <name>Border and padding conditionality is NYI on table-cells</name> - <file>table-cell_border_padding_conditionality.xml</file> - <description>Border and padding conditionality are not supported - on table-cells, yet.</description> - </testcase> - <testcase> - <name>No background-images on table-header</name> - <file>table-header_background-image.xml</file> - <description>The backgrounds of table-body, table-header, - table-footer and table-column are not painted, yet.</description> - </testcase> - <testcase> - <name>keep-with-previous doesn't work on table-rows</name> - <file>table-row_keep-with-previous.xml</file> - <description>Keep-with-previous doesn't work inside tables and - lists, yet.</description> - </testcase> - <testcase> <name>table-cell empty area with marker.xml</name> <file>table-cell_empty_area_with_marker.xml</file> <description>A table-cell producing an empty area does currently not add any markers to a page. @@ -306,22 +211,15 @@ case should be revisited.</description> </testcase> <testcase> - <name>fo:wrapper around block-level content (with id)</name> - <file>wrapper_block_id.xml</file> - <description>"id" attributes on fo:wrapper around block-level content don't get - added to the area tree.</description> - </testcase> - <testcase> - <name>Bugzilla #40230: invalid extra page break</name> - <file>block_break-after_bug40230.xml</file> - <description>Currently an extra page is created even if there is nothing - after a block with break-after="page"</description> - <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=40230</reference> - </testcase> - <testcase> <name>Soft hyphen with normal hyphenation enabled</name> <file>block_shy_linebreaking_hyph.xml</file> <description>A soft hyphen should be a preferred as break compared to a normal hyphenation point but is not.</description> </testcase> + <testcase> + <name>Page-keep not respected in multi-column layout</name> + <file>keep_within-page_multi-column_overflow.xml</file> + <description>The block should cause overflow in the + last column on the page, rather than be broken.</description> + </testcase> </disabled-testcases> diff --git a/src/documentation/content/xdocs/1.0/metadata.xml b/src/documentation/content/xdocs/1.0/metadata.xml new file mode 100644 index 000000000..8c273fff5 --- /dev/null +++ b/src/documentation/content/xdocs/1.0/metadata.xml @@ -0,0 +1,243 @@ +<?xml version="1.0" standalone="no"?> +<!-- + 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$ --> +<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "document-v20.dtd"> +<document> + <header> + <title>Metadata</title> + </header> + <body> + <section id="overview"> + <title>Overview</title> + <p> + Document metadata is an important tool for categorizing and finding documents. + Various formats support different kinds of metadata representation and to + different levels. One of the more popular and flexible means of representing + document or object metadata is + <a href="http://www.adobe.com/products/xmp/">XMP (eXtensible Metadata Platform, specified by Adobe)</a>. + PDF 1.4 introduced the use of XMP. The XMP specification lists recommendation for + embedding XMP metdata in other document and image formats. Given its flexibility it makes + sense to make use this approach in the XSL-FO context. Unfortunately, unlike SVG which + also refers to XMP, XSL-FO doesn't recommend a preferred way of specifying document and + object metadata. Therefore, there's no portable way to represent metadata in XSL-FO + documents. Each implementation does it differently. + </p> + </section> + <section id="xmp-in-fo"> + <title>Embedding XMP in an XSL-FO document</title> + <p> + As noted above, there's no officially recommended way to embed metadata in XSL-FO. + Apache FOP supports embedding XMP in XSL-FO. Currently, only support for document-level + metadata is implemented. Object-level metadata will be implemented when there's + interest. + </p> + <p> + Document-level metadata can be specified in the <code>fo:declarations</code> element. + XMP specification recommends to use <code>x:xmpmeta</code>, <code>rdf:RDF</code>, and + <code>rdf:Description</code> elements as shown in example below. Both + <code>x:xmpmeta</code> and <code>rdf:RDF</code> elements are recognized as the top-level + element introducing an XMP fragment (as per the XMP specification). + </p> + <section id="xmp-example"> + <title>Example</title> + <source><![CDATA[[..] +</fo:layout-master-set> +<fo:declarations> + <x:xmpmeta xmlns:x="adobe:ns:meta/"> + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description rdf:about="" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <!-- Dublin Core properties go here --> + <dc:title>Document title</dc:title> + <dc:creator>Document author</dc:creator> + <dc:description>Document subject</dc:description> + </rdf:Description> + <rdf:Description rdf:about="" + xmlns:xmp="http://ns.adobe.com/xap/1.0/"> + <!-- XMP properties go here --> + <xmp:CreatorTool>Tool used to make the PDF</xmp:CreatorTool> + </rdf:Description> + </rdf:RDF> + </x:xmpmeta> +</fo:declarations> +<fo:page-sequence ... +[..]]]></source> + <note> + <code>fo:declarations</code> <strong>must</strong> be declared after + <code>fo:layout-master-set</code> and before the first <code>page-sequence</code>. + </note> + </section> + </section> + <section id="xmp-impl-in-fop"> + <title>Implementation in Apache FOP</title> + <p> + Currently, XMP support is only available for PDF output. + </p> + <p> + Originally, you could set some metadata information through FOP's FOUserAgent by + using its set*() methods (like setTitle(String) or setAuthor(String). These values are + directly used to set value in the PDF Info object. Since PDF 1.4, adding metadata as an + XMP document to a PDF is possible. That means that there are now two mechanisms in PDF + that hold metadata. + </p> + <p> + Apache FOP now synchronizes the Info and the Metadata object in PDF, i.e. when you + set the title and the author through the FOUserAgent, the two values will end up in + the (old) Info object and in the new Metadata object as XMP content. If instead of + FOUserAgent, you embed XMP metadata in the XSL-FO document (as shown above), the + XMP metadata will be used as-is in the PDF Metadata object and some values from the + XMP metadata will be copied to the Info object to maintain backwards-compatibility + for PDF readers that don't support XMP metadata. + </p> + <p> + The mapping between the Info and the Metadata object used by Apache FOP comes from + the <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38920">PDF/A-1 specification</a>. + For convenience, here's the mapping table: + </p> + <table> + <tr> + <th colspan="2">Document information dictionary</th> + <th colspan="3">XMP</th> + </tr> + <tr> + <th>Entry</th> + <th>PDF type</th> + <th>Property</th> + <th>XMP type</th> + <th>Category</th> + </tr> + <tr> + <td>Title</td> + <td>text string</td> + <td>dc:title</td> + <td>Text</td> + <td>External</td> + </tr> + <tr> + <td>Author</td> + <td>text string</td> + <td>dc:creator</td> + <td>seq Text</td> + <td>External</td> + </tr> + <tr> + <td>Subject</td> + <td>text string</td> + <td>dc:description["x-default"]</td> + <td>Text</td> + <td>External</td> + </tr> + <tr> + <td>Keywords</td> + <td>text string</td> + <td>pdf:Keywords</td> + <td>Text</td> + <td>External</td> + </tr> + <tr> + <td>Creator</td> + <td>text string</td> + <td>xmp:CreatorTool</td> + <td>Text</td> + <td>External</td> + </tr> + <tr> + <td>Producer</td> + <td>text string</td> + <td>pdf:Producer</td> + <td>Text</td> + <td>Internal</td> + </tr> + <tr> + <td>CreationDate</td> + <td>date</td> + <td>xmp:CreationDate</td> + <td>Date</td> + <td>Internal</td> + </tr> + <tr> + <td>ModDate</td> + <td>date</td> + <td>xmp:ModifyDate</td> + <td>Date</td> + <td>Internal</td> + </tr> + </table> + <note> + "Internal" in the Category column means that the user should not set this value. + It is set by the application. + </note> + <note> + The "Subject" used to be mapped to <code>dc:subject</code> in the initial publication of + PDF/A-1 (ISO 19005-1). In the + <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=45613">Technical Corrigendum 1</a> + this was changed to map to <code>dc:description["x-default"]</code>. + </note> + <section id="namespaces"> + <title>Namespaces</title> + <p> + Metadata is made of property sets where each property set uses a different namespace URI. + </p> + <p> + The following is a listing of namespaces that Apache FOP recognizes and acts upon, + mostly to synchronize the XMP metadata with the PDF Info dictionary: + </p> + <table> + <tr> + <th>Set/Schema</th> + <th>Namespace Prefix</th> + <th>Namespace URI</th> + </tr> + <tr> + <td>Dublin Core</td> + <td>dc</td> + <td>http://purl.org/dc/elements/1.1/</td> + </tr> + <tr> + <td>XMP Basic</td> + <td>xmp</td> + <td>http://ns.adobe.com/xap/1.0/</td> + </tr> + <tr> + <td>Adobe PDF Schema</td> + <td>pdf</td> + <td>http://ns.adobe.com/pdf/1.3/</td> + </tr> + </table> + <p> + Please refer to the <a href="http://partners.adobe.com/public/developer/en/xmp/sdk/XMPspecification.pdf">XMP Specification</a> + for information on other metadata namespaces. + </p> + <p> + Property sets (Namespaces) not listed here are simply passed through to the final + document (if supported). That is useful if you want to specify a custom metadata + schema. + </p> + </section> + </section> + <section id="links"> + <title>Links</title> + <ul> + <li><a href="http://www.adobe.com/products/xmp/">Adobe's Extensible Metadata Platform (XMP) website</a></li> + <li><a href="http://partners.adobe.com/public/developer/en/xmp/sdk/XMPspecification.pdf">Adobe XMP Specification</a></li> + <li><a href="http://partners.adobe.com/public/developer/en/xmp/sdk/XMPspecification.pdf">Adobe XMP Specification</a></li> + <li><a href="http://dublincore.org/">http://dublincore.org/</a></li> + </ul> + </section> + </body> +</document> diff --git a/src/documentation/content/xdocs/0.94/output.xml b/src/documentation/content/xdocs/1.0/output.xml index 998a5e1ce..63c84e6b0 100644 --- a/src/documentation/content/xdocs/0.94/output.xml +++ b/src/documentation/content/xdocs/1.0/output.xml @@ -48,6 +48,35 @@ The net effect is that the layout of a given FO document can be quite different between renderers that do not use the same font information. </p> + <p> + Theoretically, there's some potential to make the output of the PDF/PS renderers match + the output of the Java2D-based renderers. If FOP used the font metrics from its own + font subsystem but still used Java2D for text painting in the Java2D-based renderers, + this could probably be achieved. However, this approach hasn't been implemented, yet. + </p> + <p> + With a work-around, it is possible to match the PDF/PS output in a Java2D-based + renderer pretty closely. The clue is to use the + <a href="intermediate.html">intermediate format</a>. The trick is to layout the + document using FOP's own font subsystem but then render the document using Java2D. + Here are the necessary steps (using the command-line): + </p> + <ol> + <li> + Produce an IF file: <code>fop -fo myfile.fo -at application/pdf myfile.at.xml</code><br/> + Specifying "application/pdf" for the "-at" parameter causes FOP to use FOP's own + font subsystem (which is used by the PDF renderer). Note that no PDF file is created + in this step. + </li> + <li>Render to a PDF file: <code>fop -atin myfile.at.xml -pdf myfile.pdf</code></li> + <li>Render to a Java2D-based renderer: + <ul> + <li><code>fop -atin myfile.at.xml -print</code></li> + <li><code>fop -atin myfile.at.xml -awt</code></li> + <li><code>fop -atin myfile.at.xml -tiff myfile.tiff</code></li> + </ul> + </li> + </ol> </section> <section id="general-direct-output"> <title>Output to a Printer or Other Device</title> @@ -84,9 +113,9 @@ out = proc.getOutputStream();]]></source> compatible. </p> <p> - Note that FOP does not currently support "tagged PDF" or PDF/A-1a. - Support for <a href="pdfa.html">PDF/A-1b</a> and <a - href="pdfx.html">PDF/X</a> has recently been added, however. + Note that FOP does not currently support PDF/A-1a. + Support for <a href="accessibility.html">Tagged PDF</a>, <a href="pdfa.html">PDF/A-1b</a> + and <a href="pdfx.html">PDF/X</a> has recently been added, however. </p> <section id="pdf-fonts"> <title>Fonts</title> @@ -105,7 +134,7 @@ out = proc.getOutputStream();]]></source> <section id="pdf-postprocess"> <title>Post-processing</title> <p> - FOP does not currently support several desirable PDF features: XMP metadata and watermarks. + FOP does not currently support several desirable PDF features: watermarks and signatures. One workaround is to use Adobe Acrobat (the full version, not the Reader) to process the file manually or with scripting that it supports. </p> @@ -212,6 +241,8 @@ out = proc.getOutputStream();]]></source> <auto-rotate-landscape>false</auto-rotate-landscape> <language-level>3</language-level> <optimize-resources>false</optimize-resources> + <safe-set-page-device>false</safe-set-page-device> + <dsc-compliant>true</dsc-compliant> </renderer>]]></source> <p> The default value for the "auto-rotate-landscape" setting is "false". Setting it @@ -230,6 +261,20 @@ out = proc.getOutputStream();]]></source> reduce file size but can potentially increase the memory needed in the interpreter to process. </p> + <p> + The default value for the "safe-set-page-device" setting is "false". Setting it + to "true" will cause the renderer to invoke a postscript macro which guards against + the possibility of invalid/unsupported postscript key/values being issued to the + implementing postscript page device. + </p> + <p> + The default value for the "dsc-compliant" setting is "true". Setting it + to "false" will break DSC compliance by minimizing the number of setpagedevice + calls in the postscript document output. This feature may be useful when unwanted + blank pages are experienced in your postscript output. This problem is caused by + the particular postscript implementation issuing unwanted postscript subsystem + initgraphics/erasepage calls on each setpagedevice call. + </p> </section> <section id="ps-limitations"> <title>Limitations</title> @@ -313,6 +358,7 @@ out = proc.getOutputStream();]]></source> <source><![CDATA[<renderer mime="application/vnd.hp-PCL"> <rendering>quality</rendering> <text-rendering>bitmap</text-rendering> + <disable-pjl>false</disable-pjl> </renderer>]]></source> <p> The default value for the "rendering" setting is "speed" which causes borders @@ -328,6 +374,12 @@ out = proc.getOutputStream();]]></source> to "bitmap" which causes all text to be rendered as bitmaps. </p> <p> + The default value for the "disable-pjl" setting is "false". This means that + the PCL renderer usually generates PJL commands before and after the document + in order to switch a printer into PCL language. PJL commands can be disabled + if you set this value to "true". + </p> + <p> You can control the output resolution for the PCL using the "target resolution" setting on the FOUserAgent. The actual value will be rounded up to the next supported PCL resolution. Currently, only 300 and 600 dpi are supported which @@ -370,20 +422,92 @@ out = proc.getOutputStream();]]></source> Consult the technical reference for your printer for all available values. </p> </section> + <section id="pcl-output-bin"> + <title>Output Bin</title> + <p> + The <code>output-bin</code> extension attribute on fo:simple-page-master allows to + select the output bin into which the printed output should be fed. Example: + </p> + <source><![CDATA[ + <fo:layout-master-set> + <fo:simple-page-master master-name="simple" pcl:output-bin="2"> + ... + </fo:simple-page-master> + </fo:layout-master-set> +]]></source> + <p> + Note: the output bin number is a positive integer and the value depends on + the target printer. Not all PCL printers support the same output bins. + Usually, + "1" is the upper output bin, + "2" is the lower (rear) output bin. + Consult the technical reference for your printer for all available values. + </p> + </section> + <section id="pcl-duplex-mode"> + <title>Page Duplex Mode</title> + <p> + The duplex-mode extension attribute on fo:simple-page-master allows to + select the duplex mode to be used for a particular simple-page-master. + Example: + </p> + <source><![CDATA[ + <fo:layout-master-set> + <fo:simple-page-master master-name="simple" pcl:duplex-mode="0"> + ... + </fo:simple-page-master> + </fo:layout-master-set> +]]></source> + <p> + Note: the duplex is a positive integer and the value depends on + the target printer. Not all PCL printers support duplexing. + Usually, + "0" is simplex, + "1" is duplex (long-edge binding), + "2" is duplex (short-edge binding). + + Consult the technical reference for your printer for all available values. + </p> + </section> </section> </section> <section id="afp"> <title>AFP</title> - <warning>The AFP Renderer is a new addition (27-Apr-2006) to the sandbox and as such not yet fully tested or feature complete.</warning> <p> The FOP AFP Renderer deals with creating documents conforming to the IBM AFP document architecture also refered to as MO:DCA (Mixed Object Document Content Architecture). </p> + <p> + The mapping of XSL-FO elements to the major MO:DCA structures is as follows: + </p> + <table> + <tr> + <th>XSL-FO element</th> + <th>MO:DCA-P object</th> + </tr> + <tr> + <td>fo:root</td> + <td>Document</td> + </tr> + <tr> + <td>fo:page-sequence</td> + <td>Page Group</td> + </tr> + <tr> + <td>fo:simple-page-master</td> + <td>Page</td> + </tr> + </table> + <p> + FOP creates exactly one Document per Printfile with an optional Resource Group at the + beginning. FOP does not create document indices. + </p> <section id="afp-references"> <title>References</title> <ul> <li><a href="http://en.wikipedia.org/wiki/Advanced_Function_Presentation">AFP (Advanced Function Presentation)</a></li> <li><a href="http://wiki.apache.org/xmlgraphics-fop/AFPResources">AFP Resources on the FOP WIKI</a></li> + <li><a href="http://wiki.apache.org/xmlgraphics-fop/AFPOutput">Technical notes on AFP output in FOP</a></li> </ul> </section> <section id="afp-limitations"> @@ -399,10 +523,24 @@ out = proc.getOutputStream();]]></source> </li> </ul> </section> + <section id="afp-compatibility"> + <title>Deployment in older environments</title> + <p> + There are still a big number of older (or limited) MO:DCA/IPDS environments in production + out there. AFP has grown in functionality over time and not every environment supports the + latest features. We're trying to make AFP output work in as many environments as possible. + However, to make AFP output work on older environments it is recommended to set to + configuration to 1 bit per pixel (see below on how to do this). In this case, all images + are converted to bi-level images using IOCA function set 10 (FS10) and are enclosed in + page-segments since some implementation cannot deal with IOCA objects directly. + If a higher number of bits per pixel is configured, FOP has to switch to at least FS11 + which may not work everywhere. + </p> + </section> <section id="afp-configuration"> <title>Configuration</title> <section id="afp-font-config"> - <title>Fonts</title> + <title>Fonts</title> <p>The AFP Renderer requires special configuration particularly related to fonts. AFP Render configuration is done through the normal FOP configuration file. The MIME type for the AFP Renderer is application/x-afp which means the AFP Renderer section in the FOP configuration file @@ -411,18 +549,19 @@ out = proc.getOutputStream();]]></source> <!-- AFP Renderer --> ... </renderer>]]></source> - <p>There are 3 font configuration variants supported:</p> + <p>There are 4 font configuration variants supported:</p> <ol> <li>IBM Raster fonts</li> <li>IBM Outline fonts</li> + <li>IBM CID-keyed (Type 0) fonts</li> <li>FOP built-in Base14 fonts</li> </ol> <p>A typical raster font configuration looks like:</p> <source><![CDATA[ <!-- This is an example of mapping actual IBM raster fonts / code pages to a FOP font --> <font> <!-- The afp-font element defines the IBM code page, the matching Java encoding and the - path to the font --> - <afp-font type="raster" codepage="T1V10500" encoding="Cp500" path="fonts/ibm"> + base URI for the font --> + <afp-font type="raster" codepage="T1V10500" encoding="Cp500" base-uri="fonts/ibm/"> <!-- For a raster font a separate element for each font size is required providing the font size and the corresponding IBM Character set name --> <afp-raster-font size="7" characterset="C0N20070"/> @@ -448,15 +587,36 @@ out = proc.getOutputStream();]]></source> However, the characterset definition is now required within the afp-font element.</p> <source><![CDATA[ <font> <afp-font type="outline" codepage="T1V10500" encoding="Cp500" characterset="CZH200 " - path="fonts/ibm" /> + base-uri="file:/fonts/ibm" /> <font-triplet name="sans-serif" style="normal" weight="normal"/> <font-triplet name="Helvetica" style="normal" weight="normal"/> <font-triplet name="any" style="normal" weight="normal"/> </font> ]]></source> + <p> + If "base-uri" is missing or a relative URI, the fonts are resolved relative to + the font base URI specified in the configuration (or on the FopFactory). + </p> + <note> + Previously, the location of the font files was given by the "path" attribute. This is still + supported for the time being, but you should move to using the more flexible "base-uri" + attribute so you can profit from the power of URI resolvers. + </note> + <p>A CID-keyed font (Type 0, double-byte outline font) configuration is much the same as an outline font. + However, the characterset definition is now required within the afp-font element.</p> +<source><![CDATA[ <font> + <afp-font type="CIDKeyed" characterset="CZJHMNU" + codepage="T1120000" encoding="UnicodeBigUnmarked" + base-uri="file:/fonts/ibm" /> + <font-triplet name="J-Heisei Mincho" style="normal" weight="normal" /> + </font> +]]></source> + <p> +Note that the value of the encoding attribute in the example is the double-byte encoding 'UnicodeBigUnmarked' (UTF-16BE). + </p> <p>Experimentation has shown that the font metrics for the FOP built-in Base14 fonts are actually very similar to some of the IBM outline and raster fonts. In cases were the IBM font files are not - available the path attribute in the afp-font element can be replaced by a base14-font attribute + available the base-uri attribute in the afp-font element can be replaced by a base14-font attribute giving the name of the matching Base14 font. In this case the AFP Renderer will take the font metrics from the built-in font.</p> <source><![CDATA[ <!-- The following are examples of defining outline fonts based on FOP built-in @@ -527,20 +687,102 @@ out = proc.getOutputStream();]]></source> <font-triplet name="monospace" style="normal" weight="bold"/> <font-triplet name="Courier" style="normal" weight="bold"/> </font>]]></source> + <p> + By default, all manually configured fonts are embedded, unless they are matched in the + <a href="fonts.html#embedding"><code>referenced-fonts</code> section of the configuration file</a>. + However, the default fonts shown above will not be embedded. + </p> + </section> + <section id="afp-renderer-resolution-config"> + <title>Output Resolution</title> + <p>By default the AFP Renderer creates output with a resolution of 240 dpi. + This can be overridden by the <renderer-resolution/> configuration element. Example:</p> + <source><![CDATA[ + <renderer-resolution>240</renderer-resolution>]]></source> </section> <section id="afp-image-config"> <title>Images</title> <p>By default the AFP Renderer converts all images to 8 bit grey level. - This can be overridden by the <images> configuration element. Example:</p> + This can be overridden by the <images/> configuration element. Example:</p> <source><![CDATA[ <images mode="color" /> ]]></source> <p>This will put images as RGB images into the AFP output stream. The default setting is:</p> <source><![CDATA[ - <images mode="b+w" bits-per-pixel="8" /> + <images mode="b+w" bits-per-pixel="8" native="true"/> +]]></source> + <p>Only the values "color" and "b+w" are allowed for the mode attribute.</p> + <p>The bits-per-pixel attribute is ignored if mode is "color". For "b+w" mode is must be 1, 4, or 8.</p> + <source><![CDATA[ + <images native="true"/> ]]></source> - <p>Only the values "color" and "b+w" are allowed for the mode attribute. The bits-per-pixel - attribute is ignored if mode is "color". For "b+w" mode is must be 1, 4, or 8.</p> + <p>When the native attribute is specified and set to "true", all image resources will be natively injected + into the datastream using an object container rather than being converted into an IOCA FS45 image. + Support for native image formats (e.g. JPEG, TIFF, GIF) is not always available on printer implementations + so by default this configuration option is set to "false".</p> + <p> + Setting <code>cmyk="true"</code> on the <code>images</code> element will enable CMYK + colors. This will only have an effect if the color mode is set to "color". Example: + </p> + <source><![CDATA[ + <images mode="color" cmyk="true"/>]]></source> + <p> + When the color mode is set to 1 bit (bi-level), the "dithering-quality" attribute can + be used to select the level of quality to use when converting images to bi-level images. + Valid values for this attribute are floating point numbers from 0.0 (fastest) to + 1.0 (best), or special values: "minimum" (=0.0), "maximum" (1.0), + "medium" (0.5, the default). For the higher settings to work as expected, JAI needs to + be present in the classpath. If JAI is present, 0.0 results in a minimal darkness-level + switching between white and black. 0.5 does bayer-based dithering and 1.0 will use + error-diffusion dithering. The higher the value, the higher the quality and the slower + the processing of the images. + </p> + <source><![CDATA[ + <images mode="b+w" bits-per-pixel="1" dithering-quality="maximum"/>]]></source> + </section> + <section id="afp-shading-config"> + <title>Shading</title> + <p> + By default, filled rectangles are painted using their given color using a PTOCA I-axis rule + (DIR). But not all environments handle these colors correctly. That's why a setting is + supported that paints the rectangles using an ordered dither pattern (bi-level) with + an inline IOCA FS10 image that is used together with the "replicate and trim" mapping. + The optional "shading" element can be used to control the shading mode. Its default value + is "color". To enable the dithered mode, use "dithered". Example: + </p> + <source><![CDATA[ + <shading>dithered</shading> +]]></source> + </section> + <section id="afp-resource-group-file"> + <title>Resource Group File</title> + <p>By default the AFP Renderer will place all data resource objects such as images within + the document of the main output datastream. An external resource group file where document resources + may be specified with the <resource-group-file/> configuration element. Example:</p> + <source><![CDATA[ + <resource-group-file>external_resources.afp</resource-group-file> +]]></source> + <note>Be careful when using this option not to overwrite existing resource files from previous rendering runs.</note> + </section> + <section id="afp-resource-level-defaults"> + <title>Resource Level Defaults</title> + <p> + By default, bitmap image objects (or page segments derived from them) are put in the + print-file-level resource group and GOCA graphics are inlined for compatibility with + the AFP Workbench tool. + </p> + <p> + It is possible to override these defaults, either per image (see the + <link href="#afp-foreign-attributes-resource">afp:resource-level</link> + extension attribute below) or by specifying different defaults in the configuration: + </p> + <source><![CDATA[ +<default-resource-levels goca="print-file" bitmap="inline"/>]]></source> + <p> + "goca" refers to GOCA graphics and "bitmap" refers to IOCA images. The possible values + for the attributes are "inline" and "print-file". In the future, + additional possibilities may be added. + </p> </section> </section> <section id="afp-extensions"> @@ -552,21 +794,22 @@ out = proc.getOutputStream();]]></source> xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp"> ]]></source> <section id="afp-page-overlay"> - <title>Page Overlay Extension</title> + <title>Page Overlay (IPO) Extension</title> <p>The include-page-overlay extension element allows to define on a per simple-page-master basis a page overlay resource. Example:</p> <source><![CDATA[ <fo:layout-master-set> <fo:simple-page-master master-name="simple"> - <afp:include-page-overlay name="O1SAMP1 " /> + <afp:include-page-overlay name="O1SAMP1 " x="20mm" y="30mm" /> ... </fo:simple-page-master> </fo:layout-master-set> ]]></source> <p>The mandatory name attribute must refer to an 8 character (space padded) resource name that - must be known in the AFP processing environment.</p> + must be known in the AFP processing environment. Optional x and y attributes can be specified + to place the Overlay at an offset from the top left of the page.</p> </section> <section id="afp-page-segment"> - <title>Page Segment Extension</title> + <title>Page Segment (IPS) Extension</title> <p>The include-page-segment extension element allows to define resource substitution for fo:external-graphics elements. Example:</p> <source><![CDATA[ @@ -587,11 +830,21 @@ out = proc.getOutputStream();]]></source> fo:external-graphic elements and if it is identical (string matching is used) in the generated AFP the external graphic is replaced by a reference to the given resource. </p> + <p> + The effect here is that whenever FOP encounters the URI specified in the extension, + it will effectively generate code to include the page segment with the given name + instead of embedding the image referenced by the URI. The URI is still required as + the underlying image serves as a provider for the intrinsic size of the image + (At the moment, FOP is unable to extract the intrinsic size of the page segment from + an AFP resource file). For the image to appear in an AFP viewer or to be printed, the + AFP resource must be available on the target device. FOP does not embed the page + segment in the generated file. Please also note that page segments cannot be scaled. + They are always rendered in their intrinsic size. + </p> </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> + <title>Tag Logical Element (TLE) Extension</title> + <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"> @@ -601,12 +854,128 @@ out = proc.getOutputStream();]]></source> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> + [..] + <fo:page-sequence master-reference="simple"> + <afp:tag-logical-element name="foo" value="bar"/> + <fo:flow flow-name="xsl-region-body"> + [..] +]]></source> + <p> + The tag-logical-element extension element can appear within a simple-page-master + (page level) or it can appear as child of page-sequence (page group level). + Multiple tag-logical-element extension elements within a simple-page-master or + page-sequence are allowed. The name and value attributes are mandatory. + </p> + </section> + <section id="afp-no-operation"> + <title>No Operation (NOP) 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 tag-logical-element extension element can only occur within a simple-page-master. - Multiple tag-logical-element extension elements within a simple-page-master are allowed. - The name and value attributes are mandatory. + <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 id="afp-invoke-medium-map"> + <title>Invoke Medium Map (IMM) Extension</title> + <p> + The invoke-medium-map extension allows to generate IMM fields (Invoke Medium Map) in the + generated AFP output. 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:page-sequence master-reference="normal"> + <afp:invoke-medium-map name="MYMAP"/> + <fo:flow flow-name="xsl-region-body"> + [..] +]]></source> + <p> + The invoke-medium-map element is allowed as child of fo:page-sequence (page group + level) or fo:simple-page-master. It is NOT supported on document level (fo:root), yet. + FOP also doesn't support specifying medium maps inside XML (using BMM/EMM). It can + only reference an existing medium map by name. The medium map has to be constructed + through different means and available on the target platform. + </p> + </section> + <section id="afp-form-maps"> + <title>Form Maps/Defs</title> + <p> + Apache FOP supports embedding an external form map resource in the + generated AFP output. This is done using the <code>afp:include-form-map</code> + extension. An 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:declarations> + <afp:include-form-map name="F1SAMP1" src="file:f1samp1.fde"/> + </fo:declarations> +]]></source> + <p> + The <code>afp:include-form-map</code> is to be placed as a direct child of + <code>fo:declarations</code>. The <code>name</code> is an AFP resource name + (max. 8 characters) and the <code>src</code> attribute is the URI identifying the + external form map resource. When such a form map is embedded, you can use the + <code>afp:invoke-medium-map</code> extension (described above) to invoke any medium + map included in the form map. + </p> + <note> + Apache FOP doesn't support a way to define a form map or medium map using XML means + inside an XSL-FO document. You will have to build the form map with some third-party + tool. + </note> + </section> + </section> + <section id="afp-foreign-attributes"> + <title>Foreign Attributes</title> + <section id="afp-foreign-attributes-resource"> + <title>Resource</title> + <p>The resource foreign attributes provides the ability to name and control where data object resources + (e.g. images/scalable vector graphics) will reside in the AFP output. + The afp foreign attributes are only used in conjuntion with <fo:external-graphic/> and <instream-foreign-object/>. + 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:block> + <fo:external-graphic width="2.0cm" content-width="2.0cm" height="1.8cm" content-height="1.8cm" + src="examples/fo/graphics/xml_feather.gif" + afp:resource-name="feather" afp:resource-level="external" afp:resource-group-file="resources.afp"/> + </fo:block> + <fo:block> + <fo:instream-foreign-object height="758.047pt" content-height="758.047pt" width="576.96pt" content-width="576.96pt" + afp:resource-name"circles" afp:resource-level="inline"> + <svg xmlns="http://www.w3.org/2000/svg" width="12cm" height="12cm"> + <g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;"> + <circle cx="6cm" cy="2cm" r="100" style="fill:red;" transform="translate(0,50)" /> + <circle cx="6cm" cy="2cm" r="100" style="fill:blue;" transform="translate(70,150)" /> + <circle cx="6cm" cy="2cm" r="100" style="fill:green;" transform="translate(-70,150)"/> + </g> + </svg> + </fo:instream-foreign-object> + </fo:block> +]]></source> + <p>The resource-level attribute where the resource object will reside in the AFP output datastream. + The possible values for this are "inline", "print-file" and "external". + When "external" is used a resource-group-file attribute must also be specified. + Please refer to the <link href="#afp-resource-level-defaults">Resource Level Defaults</link> + above to see what is used if the resource-level attribute is not specified. + </p> + <p></p> + </section> </section> </section> <section id="rtf"> @@ -614,13 +983,37 @@ out = proc.getOutputStream();]]></source> <p> JFOR, an open source XSL-FO to RTF converter has been integrated into Apache FOP. This will create an RTF (rich text format) document that will - attempt to contain as much information from the fo document as - possible. The RTF output follows Microsoft's RTF specifications + attempt to contain as much information from the XSL-FO document as + possible. It should be noted that is not possible (due to RTF's limitations) to map all + XSL-FO features to RTF. For complex documents, the RTF output will never reach the feature + level from PDF, for example. Thus, using RTF output is only recommended for simple documents + such as letters. + </p> + <p> + The RTF output follows Microsoft's RTF specifications and produces best results on Microsoft Word. </p> <note>RTF output is currently unmaintained and lacks many features compared to other output formats. Using other editable formats like Open Document Format, instead of producing XSL-FO then RTF through FOP, might give better results.</note> + <p> + These are some known restrictions compared to other supported output formats (not a complete list): + </p> + <ul> + <li> + Not supported/implemented: + <ul> + <li>break-before/after (supported by the RTF library but not tied into the RTFHandler)</li> + <li>fo:page-number-citation-last</li> + <li>keeps (supported by the RTF library but not tied into the RTFHandler)</li> + <li>region-start/end (RTF limitation)</li> + <li>multiple columns</li> + </ul> + </li> + <li>Only a single page-master is supported</li> + <li>Not all variations of fo:leader are supported (RTF limitation)</li> + <li>percentages are not supported everywhere</li> + </ul> </section> <section id="xml"> <title>XML (Area Tree XML)</title> @@ -653,6 +1046,16 @@ out = proc.getOutputStream();]]></source> It is possible to directly print the document from the command line. This is done with the same code that renders to the Java2D/AWT renderer. </p> + <section id="print-issues"> + <title>Known issues</title> + <p> + If you run into the problem that the printed output is incomplete on Windows: + this often happens to users printing to a PCL printer. + There seems to be an incompatibility between Java and certain PCL printer drivers + on Windows. Since most network-enabled laser printers support PostScript, try + switching to the PostScript printer driver for that printer model. + </p> + </section> </section> <section id="bitmap"> <title>Bitmap (TIFF/PNG)</title> @@ -664,8 +1067,13 @@ out = proc.getOutputStream();]]></source> <p> Currently, two output formats are supported: PNG and TIFF. TIFF produces one file with multiple pages, while PNG output produces one file per - page. The quality of the bitmap depends on the target resolution setting - on the FOUserAgent. + page. Note: FOP can only produce multiple files (with PNG output) if + you can set a <code>java.io.File</code> indicating the primary PNG file + using the <code>FOUserAgent.setOutputFile(File)</code> method. + </p> + <p> + The quality of the bitmap depends on the target resolution setting + on the FOUserAgent and on further settings described below. </p> <section id="bitmap-configuration"> <title>Configuration</title> @@ -673,15 +1081,52 @@ out = proc.getOutputStream();]]></source> The TIFF and PNG renderer configuration currently allows the following settings: </p> <source><![CDATA[<renderer mime="image/png"> + <color-mode>rgba</color-mode> <transparent-page-background>true</transparent-page-background> + <background-color>white</background-color> + <anti-aliasing>true</anti-aliasing> + <rendering>quality</rendering> <fonts><!-- described elsewhere --></fonts> </renderer>]]></source> <p> - The default value for the "transparent-page-background" setting is "false" which - paints an opaque, white background for the whole image. If you set this to true, + The default value for the <code>"color-mode"</code> setting is <code>"rgba"</code> which + is equivalent to a 24bit RGB image with an 8bit alpha channel for transparency. + Valid values are: + </p> + <ul> + <li><code>rgba</code>: RGB with alpha channel (24bit + 8bit = 32bit)</li> + <li><code>rgb</code>: RGB (24bit)</li> + <li><code>gray</code>: gray (8bit)</li> + <li><code>bi-level</code> (or <code>binary</code>): bi-level (1bit)</li> + </ul> + <p> + Please note that there is currently no dithering or error diffusion available for bi-level + bitmap output. + </p> + <p> + The default value for the <code>"transparent-page-background"</code> setting is + <code>"false"</code> which paints an opaque, white background for the whole image. + If you set this to <code>"true"</code>, no such background will be painted and you will get a transparent image if an alpha channel is available in the output format. </p> + <p> + The default value for the <code>"background-color"</code> setting is <code>"white"</code>. + The color specifies in which color the page background is painted. It will only be + painted if <code>"transparent-page-background"</code> is not set to <code>"true"</code>. + All XSL-FO colors (including color functions) can be used. + </p> + <p> + The default value for the <code>"anti-aliasing"</code> setting is <code>"true"</code>. + You can set this value to <code>"false"</code> to disable anti-aliasing and + thus improve rendering speeds a bit at the loss of some image quality. + </p> + <p> + The default value for the <code>"rendering"</code> setting is <code>"true"</code>. + You can set this value to <code>"false"</code> to improve rendering speeds a bit + at the loss of some image quality. If this setting has an actual effect depends + on the JVM's Java2D backend. + </p> </section> <section id="tiff-configuration"> <title>TIFF-specific Configuration</title> @@ -702,17 +1147,22 @@ out = proc.getOutputStream();]]></source> actual codecs being available. Here is a list of possible values: </p> <ul> - <li>NONE (no compression)</li> - <li>PackBits (RLE, run-length encoding)</li> - <li>JPEG</li> - <li>Deflate</li> - <li>LZW</li> - <li>ZLib</li> - <li>CCITT T.4 (Fax Group 3)</li> - <li>CCITT T.6 (Fax Group 4)</li> + <li><code>NONE</code> (no compression)</li> + <li><code>PackBits</code> (RLE, run-length encoding)</li> + <li><code>JPEG</code></li> + <li><code>Deflate</code></li> + <li><code>LZW</code></li> + <li><code>ZLib</code></li> + <li><code>CCITT T.4</code> (Fax Group 3)</li> + <li><code>CCITT T.6</code> (Fax Group 4)</li> </ul> + <p> + This setting may override any setting made using the <code>"color-mode"</code>. For example, if + <code>"CCITT T.6"</code> is selected, the color mode is automatically forced to <code>"bi-level"</code> because + this compression format only supports bi-level images. + </p> <note> - If you want to use CCITT compression, please make sure you've got a J2SE 1.4 or later and + If you want to use CCITT compression, please make sure you've got <a href="http://java.sun.com/products/java-media/jai/current.html"> Java Advanced Imaging Image I/O Tools </a> @@ -721,6 +1171,17 @@ out = proc.getOutputStream();]]></source> Deflate and JPEG compression for writing. </note> </section> + <section id="bitmap-rendering-options"> + <title>Runtime Rendering Options</title> + <p> + The IF-based bitmap output implementations support a rendering option with the key + "target-bitmap-size" (value: java.awt.Dimension) that allows to force the pages to + be proportionally fit into a bitmap of a given size. This can be used to produce + thumbnails or little preview images of the individual pages. An example: + </p> + <source><![CDATA[userAgent.getRenderingOptions().put( + "target-bitmap-size", new Dimension(320, 200));]]></source> + </section> </section> <section id="txt"> <title>TXT</title> @@ -803,3 +1264,5 @@ out = proc.getOutputStream();]]></source> </body> </document> + + diff --git a/src/documentation/content/xdocs/0.94/pdfa.xml b/src/documentation/content/xdocs/1.0/pdfa.xml index 1b3b75561..db5f56482 100644 --- a/src/documentation/content/xdocs/0.94/pdfa.xml +++ b/src/documentation/content/xdocs/1.0/pdfa.xml @@ -28,9 +28,6 @@ <body> <section id="overview"> <title>Overview</title> - <warning> - Support for PDF/A is available beginning with version 0.92. - </warning> <p> PDF/A is a standard which turns PDF into an "electronic document file format for long-term preservation". PDF/A-1 is the first part of the @@ -56,8 +53,9 @@ lack of a full license to get a detailed error protocol. </p> <p> - <strong>PDF/A-1a</strong> is not implemented, yet. This is mostly because of the requirement - for tagged PDF which is not available in FOP, yet. + <strong>PDF/A-1a</strong> is based on PDF-A-1b and adds accessibility features + (such as Tagged PDF). This format is available within the limitation described on + the <a href="accessibility.html">Accessibility page</a>. </p> </section> <section id="command-line"> @@ -67,6 +65,9 @@ as a parameter. If there is a violation of one of the validation rules for PDF/A, an error message is presented and the processing stops. </p> + <p> + PDF/A-1a is enabled by specifying "-pdfprofile PDF/A-1a". + </p> </section> <section id="embedded"> <title>Usage (embedded)</title> @@ -83,6 +84,9 @@ Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent); If one of the validation rules of PDF/A is violated, an PDFConformanceException (descendant of RuntimeException) is thrown. </p> + <p> + For PDF/A-1a, just use the string "PDF/A-1a" instead of "PDF/A-1b". + </p> </section> <section id="rules"> <title>PDF/A in Action</title> @@ -121,12 +125,17 @@ Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent); embedded in clear text so non-PDF-aware applications can extract the XMP metadata. </li> </ul> + <note> + There are additional requirements if you want to enabled PDF/A-1a (Tagged PDF). This is + particularly the specification of the natural language and alternative descriptions for + images. Please refer to the <a href="accessibility.html">Accessibility page</a> for details. + </note> </section> <section id="profile-compatibility"> <title>PDF profile compatibility</title> <p> - The PDF profiles "PDF/X-3:2003" and "PDF/A-1b" are compatible and can both be - activated at the same time. + The PDF profiles "PDF/X-3:2003" and "PDF/A-1b" (or "PDF/A-1a") are compatible and can + both be activated at the same time. </p> </section> <section id="interoperability"> diff --git a/src/documentation/content/xdocs/0.94/pdfencryption.xml b/src/documentation/content/xdocs/1.0/pdfencryption.xml index c8cdbb29c..22d965057 100644 --- a/src/documentation/content/xdocs/0.94/pdfencryption.xml +++ b/src/documentation/content/xdocs/1.0/pdfencryption.xml @@ -204,15 +204,13 @@ Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent); </p> <ol> <li> - Download the binary distribution for your JDK version. If you have JDK - 1.3 or earlier you must also download a JCE from the same page. + Download the binary distribution for your JDK version. </li> <li> Unpack the distribution. Add the jar file to your classpath. A convenient way to use the jar on Linux is to simply drop it into the FOP lib directory, it will be automatically picked up by - <code>fop.sh</code>. If you have JDK 1.3 or earlier don't forget to - install the JCE as well. + <code>fop.sh</code>. </li> <li> Open the <code>java.security</code> file and add<br/> diff --git a/src/documentation/content/xdocs/0.94/pdfx.xml b/src/documentation/content/xdocs/1.0/pdfx.xml index 342a0ca4c..cf796c74d 100644 --- a/src/documentation/content/xdocs/0.94/pdfx.xml +++ b/src/documentation/content/xdocs/1.0/pdfx.xml @@ -28,8 +28,8 @@ <section id="overview"> <title>Overview</title> <warning> - Support for PDF/X was made available beginning with version 0.93. - This feature is new and may not be 100% complete, yet. Feedback is welcome. + Support for PDF/X is available beginning with version 0.93. This feature is new and + may not be 100% complete, yet. Feedback is welcome. </warning> <p> PDF/X is a standard which faciliates prepress digital data exchange using PDF. diff --git a/src/documentation/content/xdocs/0.94/running.xml b/src/documentation/content/xdocs/1.0/running.xml index c09f35fee..757e7aaa4 100644 --- a/src/documentation/content/xdocs/0.94/running.xml +++ b/src/documentation/content/xdocs/1.0/running.xml @@ -28,21 +28,24 @@ <title>System Requirements</title> <p>The following software must be installed:</p> <ul> - <li>Java 1.3.x or later Runtime Environment.</li> <li> - Apache FOP. The <a href="../download.html">FOP distribution</a> includes all libraries that you will - need to run a basic FOP installation. These can be found in the [fop-root]/lib directory. These - libraries include the following: + Java 1.4.x or later Runtime Environment. <ul> <li> - A JAXP-compatible XML Parser (FOP comes with <a class="fork" href="ext:xerces">Apache Xerces-J</a>). - </li> - <li> - A JAXP-compatible XSLT Processor (FOP comes with <a class="fork" href="ext:xalan">Apache Xalan-J</a>). + Many JREs >=1.4 contain older JAXP implementations (which often contain bugs). It's + usually a good idea to replace them with a current implementation. </li> + </ul> + </li> + <li> + Apache FOP. The <a href="../download.html">FOP distribution</a> includes all libraries that you will + need to run a basic FOP installation. These can be found in the [fop-root]/lib directory. These + libraries include the following: + <ul> + <li><a class="fork" href="ext:xmlgraphics.apache.org/commons">Apache XML Graphics Commons</a>, an shared library for Batik and FOP.</li> <li><a class="fork" href="ext:batik">Apache Batik</a>, an SVG library.</li> - <li><a class="fork" href="ext:jakarta/commons/logging">Apache Jakarta Commons Logging</a>, a logger abstraction kit.</li> - <li><a class="fork" href="ext:jakarta/commons/io">Apache Jakarta Commons IO</a>, a library with I/O utilities.</li> + <li><a class="fork" href="ext:commons-logging">Apache Commons Logging</a>, a logger abstraction kit.</li> + <li><a class="fork" href="ext:commons-io">Apache Commons IO</a>, a library with I/O utilities.</li> <li><a class="fork" href="ext:excalibur/framework">Apache Excalibur/Avalon Framework</a>, for XML configuration handling.</li> </ul> </li> @@ -51,8 +54,7 @@ <ul> <li> Graphics libraries. Generally, FOP contains direct support for the most important - bitmap image formats (including PNG, TIFF, JPEG and GIF). If you're using JDK 1.3, - you may need additional packages to get GIF images to work. See + bitmap image formats (including PNG, JPEG and GIF). See <a href="graphics.html">FOP: Graphics Formats</a> for details. </li> <li> @@ -62,7 +64,7 @@ <p>In addition, the following system requirements apply:</p> <ul> <li> - If you will be using FOP to process SVG, you must do so in a graphical environment. + If you will be using FOP to process SVG, you must do so in a graphical environment. See <a href="graphics.html#batik">FOP: Graphics (Batik)</a> for details. </li> </ul> @@ -72,19 +74,19 @@ <section id="install-instruct"> <title>Instructions</title> <p> - Basic FOP installation consists of first unzipping the <code>.gz</code> file that is the - distribution medium, then unarchiving the resulting <code>.tar</code> file in a - directory/folder that is convenient on your system. Please consult your operating system - documentation or Zip application software documentation for instructions specific to your + Basic FOP installation consists of first unzipping the <code>.gz</code> file that is the + distribution medium, then unarchiving the resulting <code>.tar</code> file in a + directory/folder that is convenient on your system. Please consult your operating system + documentation or Zip application software documentation for instructions specific to your site. </p> </section> <section id="install-problems"> <title>Problems</title> <p> - Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip - and unarchive their distribution media. This is a legacy of older Mac operating systems, - which had a 31-character pathname limit. Several Mac OSX users have recommended that + Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip + and unarchive their distribution media. This is a legacy of older Mac operating systems, + which had a 31-character pathname limit. Several Mac OSX users have recommended that Mac OSX users use the shell command <code>tar -xzf</code> instead. </p> </section> @@ -94,30 +96,31 @@ <section id="fop-script"> <title>Using the fop script or batch file</title> <p> - The usual and recommended practice for starting FOP from the command line is to run the + The usual and recommended practice for starting FOP from the command line is to run the batch file fop.bat (Windows) or the shell script fop (Unix/Linux). - These scripts require that the environment variable JAVA_HOME be - set to a path pointing to the appropriate Java installation on your system. Macintosh OSX - includes a Java environment as part of its distribution. We are told by Mac OSX users that + These scripts require that the environment variable JAVA_HOME be + set to a path pointing to the appropriate Java installation on your system. Macintosh OSX + includes a Java environment as part of its distribution. We are told by Mac OSX users that the path to use in this case is <code>/Library/Java/Home</code>. <strong>Caveat:</strong> - We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum - Java requirements, the two will inevitably not match on some systems. Please see - <a href="http://developer.apple.com/java/faq">Java on Mac OSX FAQ</a> for information as + We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum + Java requirements, the two will inevitably not match on some systems. Please see + <a href="http://developer.apple.com/java/faq">Java on Mac OSX FAQ</a> for information as it becomes available. </p> <source><![CDATA[ USAGE Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile> - [OPTIONS] - -d debug mode - -x dump configuration settings - -q quiet mode + [OPTIONS] + -version print FOP version and exit + -d debug mode + -x dump configuration settings + -q quiet mode -c cfg.xml use additional configuration file cfg.xml - -l lang the language to use for user information + -l lang the language to use for user information -r relaxed/less strict validation (where available) -dpi xxx target resolution in dots per inch (dpi) where xxx is a number -s for area tree XML, down to block areas only - -v to show FOP version being used + -v run in verbose mode (currently simply print FOP version and continue) -o [password] PDF file will be encrypted with option owner password -u [password] PDF file will be encrypted with option user password @@ -125,62 +128,73 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl -nocopy PDF file will be encrypted without copy content permission -noedit PDF file will be encrypted without edit content permission -noannotations PDF file will be encrypted without edit annotation permission + -a enables accessibility features (Tagged PDF etc., default off) -pdfprofile prof PDF file will be generated with the specified profile (Examples for prof: PDF/A-1b or PDF/X-3:2003) - [INPUT] - infile xsl:fo input file (the same as the next) - -fo infile xsl:fo input file - -xml infile xml input file, must be used together with -xsl - -atin infile area tree input file - -xsl stylesheet xslt stylesheet - + -conserve Enable memory-conservation policy (trades memory-consumption for disk I/O) + (Note: currently only influences whether the area tree is serialized.) + + [INPUT] + infile xsl:fo input file (the same as the next) + (use '-' for infile to pipe input from stdin) + -fo infile xsl:fo input file + -xml infile xml input file, must be used together with -xsl + -atin infile area tree input file + -ifin infile intermediate format input file + -imagein infile image input file (piping through stdin not supported) + -xsl stylesheet xslt stylesheet + -param name value <value> to use for parameter <name> in xslt stylesheet (repeat '-param name value' for each parameter) - - [OUTPUT] + + -catalog use catalog resolver for input XML and XSLT files + [OUTPUT] outfile input will be rendered as PDF into outfile + (use '-' for outfile to pipe output to stdout) -pdf outfile input will be rendered as PDF (outfile req'd) -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b") - -awt input will be displayed on screen + -awt input will be displayed on screen -rtf outfile input will be rendered as RTF (outfile req'd) - -pcl outfile input will be rendered as PCL (outfile req'd) - -ps outfile input will be rendered as PostScript (outfile req'd) + -pcl outfile input will be rendered as PCL (outfile req'd) + -ps outfile input will be rendered as PostScript (outfile req'd) -afp outfile input will be rendered as AFP (outfile req'd) -tiff outfile input will be rendered as TIFF (outfile req'd) -png outfile input will be rendered as PNG (outfile req'd) - -txt outfile input will be rendered as plain text (outfile req'd) - -at [mime] out representation of area tree as XML (outfile req'd) - specify optional mime output to allow AT to be converted + -txt outfile input will be rendered as plain text (outfile req'd) + -at [mime] out representation of area tree as XML (outfile req'd) + specify optional mime output to allow the AT to be converted + to final format later + -if [mime] out representation of document in intermediate format XML (outfile req'd) + specify optional mime output to allow the IF to be converted to final format later - -print input file will be rendered and sent to the printer - see options with "-print help" + -print input file will be rendered and sent to the printer + see options with "-print help" -out mime outfile input will be rendered using the given MIME type (outfile req'd) Example: "-out application/pdf D:\out.pdf" (Tip: "-out list" prints the list of supported MIME types) - -mif outfile input will be rendered as MIF (FrameMaker) (outfile req'd) - Experimental feature - requires additional fop-sandbox.jar. - -svg outfile input will be rendered as an SVG slides file (outfile req'd) + -svg outfile input will be rendered as an SVG slides file (outfile req'd) Experimental feature - requires additional fop-sandbox.jar. - -foout outfile input will only be XSL transformed. The intermediate - XSL-FO file is saved and no rendering is performed. + -foout outfile input will only be XSL transformed. The intermediate + XSL-FO file is saved and no rendering is performed. (Only available if you use -xml and -xsl parameters) [Examples] - Fop foo.fo foo.pdf - Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line) - Fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf - Fop -xml foo.xml -xsl foo.xsl -foout foo.fo - Fop foo.fo -mif foo.mif - Fop foo.fo -rtf foo.rtf - Fop foo.fo -print or Fop -print foo.fo - Fop foo.fo -awt]]></source> + fop foo.fo foo.pdf + fop -fo foo.fo -pdf foo.pdf (does the same as the previous line) + fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf + fop -xml foo.xml -xsl foo.xsl -foout foo.fo + fop -xml - -xsl foo.xsl -pdf - + fop foo.fo -mif foo.mif + fop foo.fo -rtf foo.rtf + fop foo.fo -print + fop foo.fo -awt]]></source> <p> - PDF encryption is only available if FOP was compiled with encryption support - <strong>and</strong> if compatible encryption support is available at run time. + PDF encryption is only available if FOP was compiled with encryption support + <strong>and</strong> if compatible encryption support is available at run time. Currently, only the JCE is supported. Check the <a href="pdfencryption.html">Details</a>. </p> </section> @@ -192,8 +206,8 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl org.apache.fop.cli.Main <arguments></code>. The arguments consist of the options and infile and outfile specifications as shown above for the standard scripts. You may wish to review - the standard scripts to make sure that - you get your environment properly configured. + the standard scripts to make sure that + you get your environment properly configured. </p> </section> <section id="jar-option"> @@ -214,7 +228,7 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl directory in a single directory. If you use hyphenation, you must also put <code>fop-hyph.jar</code> in that directory.</p> - <p>In both cases the arguments consist of the options and + <p>In both cases the arguments consist of the options and infile and outfile specifications as shown above for the standard scripts.</p> </section> @@ -222,65 +236,65 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl <title>FOP's dynamical classpath construction</title> <p>If FOP is started without a proper classpath, it tries to - add its dependencies dynamically. If the system property - <code>fop.home</code> contains the name of a directory, then - FOP uses that directory as the base directory for its - search. Otherwise the current working directory is the base - directory. If the base directory is called <code>build</code>, - then its parent directory becomes the base directory.</p> + add its dependencies dynamically. If the system property + <code>fop.home</code> contains the name of a directory, then + FOP uses that directory as the base directory for its + search. Otherwise the current working directory is the base + directory. If the base directory is called <code>build</code>, + then its parent directory becomes the base directory.</p> <p>FOP expects to find <code>fop.jar</code> in the - <code>build</code> subdirectory of the base directory, and - adds it to the classpath. Subsequently FOP adds all - <code>jar</code> files in the lib directory to the - classpath. The lib directory is either the <code>lib</code> - subdirectory of the base directory, or, if that does not - exist, the base directory itself.</p> + <code>build</code> subdirectory of the base directory, and + adds it to the classpath. Subsequently FOP adds all + <code>jar</code> files in the lib directory to the + classpath. The lib directory is either the <code>lib</code> + subdirectory of the base directory, or, if that does not + exist, the base directory itself.</p> <p>If the system property <code>fop.optional.lib</code> - contains the name of a directory, then all <code>jar</code> - files in that directory are also added to the classpath. See - the methods <code>getJARList</code> and - <code>checkDependencies</code> in - <code>org.apache.fop.cli.Main</code>.</p> + contains the name of a directory, then all <code>jar</code> + files in that directory are also added to the classpath. See + the methods <code>getJARList</code> and + <code>checkDependencies</code> in + <code>org.apache.fop.cli.Main</code>.</p> </section> </section> <section id="check-input"> <title>Using Xalan to Check XSL-FO Input</title> <p> - FOP sessions that use -xml and -xsl input instead of -fo input are actually - controlling two distinct conversions: Tranforming XML to XSL-FO, then formatting + FOP sessions that use -xml and -xsl input instead of -fo input are actually + controlling two distinct conversions: Tranforming XML to XSL-FO, then formatting the XSL-FO to PDF (or another FOP output format). - Although FOP controls both of these processes, the first is included merely as + Although FOP controls both of these processes, the first is included merely as a convenience and for performance reasons. Only the second is part of FOP's core processing. - If a user has a problem running FOP, it is important to determine which of these + If a user has a problem running FOP, it is important to determine which of these two processes is causing the problem. If the problem is in the first process, the user's stylesheet is likely the cause. - The FOP development team does not have resources to help with stylesheet issues, - although we have included links to some useful - <a href="../resources.html#specs">Specifications</a> and + The FOP development team does not have resources to help with stylesheet issues, + although we have included links to some useful + <a href="../resources.html#specs">Specifications</a> and <a href="../resources.html#articles">Books/Articles</a>. - If the problem is in the second process, FOP may have a bug or an unimplemented + If the problem is in the second process, FOP may have a bug or an unimplemented feature that does require attention from the FOP development team. </p> <note>The user is always responsible to provide correct XSL-FO code to FOP.</note> <p> - In the case of using -xml and -xsl input, although the user is responsible for - the XSL-FO code that is FOP's input, it is not visible to the user. To make the - intermediate FO file visible, the FOP distribution includes the "-foout" option - which causes FOP to run only the first (transformation) step, and write the + In the case of using -xml and -xsl input, although the user is responsible for + the XSL-FO code that is FOP's input, it is not visible to the user. To make the + intermediate FO file visible, the FOP distribution includes the "-foout" option + which causes FOP to run only the first (transformation) step, and write the results to a file. (See also the Xalan command-line below) </p> <note> - When asking for help on the FOP mailing lists, <em>never</em> attach XML and - XSL to illustrate the issue. Always run the XSLT step (-foout) and send the - resulting XSL-FO file instead. Of course, be sure that the XSL-FO file is + When asking for help on the FOP mailing lists, <em>never</em> attach XML and + XSL to illustrate the issue. Always run the XSLT step (-foout) and send the + resulting XSL-FO file instead. Of course, be sure that the XSL-FO file is correct before sending it. </note> <p> - The -foout option works the same way as if you would call the + The -foout option works the same way as if you would call the <a href="http://xml.apache.org/xalan-j/commandline.html">Xalan command-line</a>: </p> <p> @@ -302,39 +316,39 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl </p> <ul> <li> - Increase memory available to the JVM. See - <a href="http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/java.html">the -Xmx option</a> + Increase memory available to the JVM. See + <a href="http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/java.html">the -Xmx option</a> for more information. <warning> - It is usually unwise to increase the memory allocated to the JVM beyond the amount of + It is usually unwise to increase the memory allocated to the JVM beyond the amount of physical RAM, as this will generally cause significantly slower performance. </warning> </li> <li> Avoid forward references. Forward references are references to some later part of a document. - Examples include page number citations which refer to pages which follow the citation, - tables of contents at the beginning of a document, and page numbering schemes that - include the total number of pages in the document + Examples include page number citations which refer to pages which follow the citation, + tables of contents at the beginning of a document, and page numbering schemes that + include the total number of pages in the document (<a href="../faq.html#pagenum">"page N of TOTAL"</a>). - Forward references cause all subsequent pages to be held in memory until the reference + Forward references cause all subsequent pages to be held in memory until the reference can be resolved, i.e. until the page with the referenced element is encountered. - Forward references may be required by the task, but if you are getting a memory + Forward references may be required by the task, but if you are getting a memory overflow, at least consider the possibility of eliminating them. - A table of contents could be replaced by PDF bookmarks instead or moved to the end of + A table of contents could be replaced by PDF bookmarks instead or moved to the end of the document (reshuffle the paper could after printing). </li> <li> Avoid large images, especially if they are scaled down. If they need to be scaled, scale them in another application upstream from FOP. - For many image formats, memory consumption is driven mainly by the size of the image - file itself, not its dimensions (width*height), so increasing the compression rate + For many image formats, memory consumption is driven mainly by the size of the image + file itself, not its dimensions (width*height), so increasing the compression rate may help. </li> <li> Use multiple page sequences. FOP starts rendering after the end of a page sequence is encountered. - While the actual rendering is done page-by-page, some additional memory is + While the actual rendering is done page-by-page, some additional memory is freed after the page sequence has been rendered. This can be substantial if the page sequence contains lots of FO elements. </li> diff --git a/src/documentation/content/xdocs/0.94/servlets.xml b/src/documentation/content/xdocs/1.0/servlets.xml index 119ac701e..07c22312d 100644 --- a/src/documentation/content/xdocs/0.94/servlets.xml +++ b/src/documentation/content/xdocs/1.0/servlets.xml @@ -161,7 +161,7 @@ public void init() throws ServletException { <ul> <li> Instead of java.io.ByteArrayOutputStream consider using the ByteArrayOutputStream - implementation from the <a href="ext:jakarta/commons/io">Jakarta Commons IO project</a> which allocates less memory. + implementation from the <a href="ext:commons-io">Jakarta Commons IO project</a> which allocates less memory. The full class name is: <code>org.apache.commons.io.output.ByteArrayOutputStream</code> </li> <li> diff --git a/src/documentation/content/xdocs/0.94/upgrading.xml b/src/documentation/content/xdocs/1.0/upgrading.xml index a7d27cd1c..9f5879174 100644 --- a/src/documentation/content/xdocs/0.94/upgrading.xml +++ b/src/documentation/content/xdocs/1.0/upgrading.xml @@ -31,8 +31,10 @@ </p> <ul> <li> - More than half of the codebase has been rewritten over the last three years. With version 0.93 the code has reached <strong>production level</strong>, and - the tradition continues with version 0.94. + More than half of the codebase has been rewritten over the + last three years. With version 0.93 the code has reached + <strong>production level</strong>, and continues to improve with + version 0.94. </li> <li> The API of FOP has changed considerably and is not @@ -48,18 +50,17 @@ </li> <li> If you are using a configuration file for version 0.20.5, you have to rebuild it in the new format. The format - of the configuration files has changed since version 0.20.5. See <code>conf/fop.xconf</code> for + of the configuration files has changed since version 0.20.5. See conf/fop.xconf for an example configuration file. A XML Schema file can be found under - <code>src/foschema/fop-configuration.xsd</code>. + src/foschema/fop-configuration.xsd. </li> <li> - If you are using font metrics files for version 0.20.5 or - 0.92 or earlier, you have to regenerate them in the new - format. The new format is characterized by a version - attribute on the top-level font-metrics element, whose value - is 2.0. The absence of a version attribute will be - interpreted as version 1.0, and such metrics files will no - longer be parsed. + Beginning with version 0.94 you can skip the generation of + font metric files and remove the "font-metrics" attribute + in the font configuration. In the unlikely case that due to + a bug you still need to use font metrics files you will need + to regenerate the font metrics file if yours are from a FOP + version before 0.93. </li> <li> <p> @@ -69,7 +70,7 @@ </p> <note label="An example"> While FOP 0.20.5 allowed you to have empty <code>fo:table-cell</code> elements, the new code - will complain about that (unless <a href="/0.94/running.html#fop-script">relaxed validation is enabled</a> via the <code>-r</code> switch via the command line) because the specification + will complain about that (unless relaxed validation is enabled) because the specification demands at least one block-level element (<code>(%block;)+</code>, see <a href="http://www.w3.org/TR/xsl/#fo_table-cell">XSL-FO 1.1, 6.7.10</a>) inside an <code>fo:table-cell</code> element. @@ -121,11 +122,6 @@ The <code>fox:outline</code> extension is not implemented in this version anymore. It has been superseded by the new bookmark elements from XSL-FO 1.1. </li> - <li> - The <code>fox:destination</code> extension is also not implemented in this version - although it may be added in the future. See also - <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=37157">Bug 37157</a>. - </li> </ul> </section> </body> diff --git a/src/documentation/content/xdocs/compliance.ihtml b/src/documentation/content/xdocs/compliance.ihtml index 69b065e6e..b2ea6ed37 100644 --- a/src/documentation/content/xdocs/compliance.ihtml +++ b/src/documentation/content/xdocs/compliance.ihtml @@ -556,20 +556,19 @@ <th rowspan="2" align="center">Citation</th> <th rowspan="2">Object Name</th> <th rowspan="2" align="center">XSL-FO Conformance Level</th> - <th colspan="4" align="center">Support in FOP</th> + <th colspan="3" align="center">Support in FOP</th> <th rowspan="2">Comments</th> </tr> <tr> - <th align="center">0.20.5 (ancient)</th> - <th align="center">0.94 (stable)</th> <th align="center">0.95 (stable)</th> + <th align="center">1.0 (stable)</th> <th align="center">develop- ment</th> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e7057">§6.4</a></td> - <td class="category" colspan="7"><a name="fo-object-decl-section" id= + <td class="category" colspan="6"><a name="fo-object-decl-section" id= "fo-object-decl-section">Declarations and Pagination and Layout Formatting Objects</a></td> </tr> <tr> @@ -580,7 +579,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -588,7 +586,6 @@ "http://www.w3.org/TR/xsl/#fo_declarations">§6.4.3</a></td> <td><a name="fo-object-declarations" id="fo-object-declarations">declarations</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -599,7 +596,6 @@ "http://www.w3.org/TR/xsl/#fo_color-profile">§6.4.4</a></td> <td><a name="fo-object-color-profile" id="fo-object-color-profile">color-profile</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -613,7 +609,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -625,7 +620,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -637,7 +631,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -649,7 +642,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -661,7 +653,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -673,7 +664,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -686,7 +676,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -699,7 +688,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -708,16 +696,11 @@ <td><a name="fo-object-simple-page-master" id= "fo-object-simple-page-master">simple-page-master</a></td> <td class="basic">Basic</td> - <td class="yes">yes</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.94 and later] The page width may not change among pages of the same page-sequence - unless a forced break is inserted.</li> - </ul> - </td> + <td>The page width may not change among pages of the same page-sequence + unless a forced break is inserted.</td> </tr> <tr> <td align="center"><a href= @@ -727,7 +710,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td align="center"></td> </tr> <tr> @@ -738,7 +720,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -749,7 +730,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -760,7 +740,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -771,7 +750,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -782,7 +760,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -793,7 +770,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -801,7 +777,6 @@ "http://www.w3.org/TR/xsl/#fo_title">§6.4.21</a></td> <td><a name="fo-object-title" id="fo-object-title">title</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -815,7 +790,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -826,7 +800,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -837,7 +810,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -848,7 +820,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -859,7 +830,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -870,14 +840,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e9451">§6.5</a></td> - <td class="category" colspan="7"><a name="fo-object-block-section" id= + <td class="category" colspan="6"><a name="fo-object-block-section" id= "fo-object-block-section">Block Formatting Objects</a></td> </tr> <tr> @@ -888,7 +857,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -900,22 +868,13 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] Only works as direct child of fo:flow.</li> - <li>[0.20.5] For absolute positioning, use 'position="absolute"' (as - 'absolute-position="absolute"' is not implemented), and specify all four of "left", - "top", "width" and "height"</li> - <li>[0.94 and later] No known restrictions.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e9759">§6.6</a></td> - <td class="category" colspan="7"><a name="fo-object-inline-section" id= + <td class="category" colspan="6"><a name="fo-object-inline-section" id= "fo-object-inline-section">Inline Formatting Objects</a></td> </tr> <tr> @@ -926,7 +885,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -937,7 +895,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -949,7 +906,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -961,7 +917,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -973,13 +928,8 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> - <td> - <ul> - <li>Built-in support for SVG only, additional namespaces through optional - extensions.</li> - </ul> - </td> + <td>Built-in support for SVG only, additional namespaces through optional + extensions.</td> </tr> <tr> <td align="center"><a href= @@ -989,7 +939,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1001,7 +950,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1009,7 +957,6 @@ "http://www.w3.org/TR/xsl/#fo_leader">§6.6.9</a></td> <td><a name="fo-object-leader" id="fo-object-leader">leader</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -1023,7 +970,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1035,16 +981,8 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] Only works for table of contents without any problems. The case where the - page number doesn't fit on a line isn't handled, and any text on the same line and after - the page-number might not appear exactly where you want it to.</li> - <li>[0.94 and later] After the page number is known, no relayout is performed. The - appearance may be suboptimal depending on the use case.</li> - </ul> - </td> + <td>After the page number is known, no relayout is performed. The + appearance may be suboptimal depending on the use case.</td> </tr> <tr> <td align="center"><a href= @@ -1052,14 +990,13 @@ <td><a name="fo-object-page-number-citation-last" id= "fo-object-page-number-citation-last">page-number-citation-last</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> <td> <ul> - <li>[0.94 and 0.95] Works only for page-sequence so far.</li> - <li>[0.94 and later] After the page number is known, no relayout is performed. The + <li>Works only for page-sequence so far.</li> + <li>After the page number is known, no relayout is performed. The appearance may be suboptimal depending on the use case.</li> </ul> </td> @@ -1073,7 +1010,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1085,7 +1021,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1097,14 +1032,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e11404">§6.7</a></td> - <td class="category" colspan="7"><a name="fo-object-table-section" id= + <td class="category" colspan="6"><a name="fo-object-table-section" id= "fo-object-table-section">Table Formatting Objects</a></td> </tr> <tr> @@ -1116,7 +1050,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1127,28 +1060,17 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] Only border-collapse="separate"</li> - <li>[All] No support for auto layout yet</li> - </ul> - </td> + <td>No support for auto layout yet</td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#fo_table-column">§6.7.4</a></td> <td><a name="fo-object-table-column" id="fo-object-table-column">table-column</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] You must explicitly specify column widths.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -1158,7 +1080,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1169,7 +1090,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1180,7 +1100,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1191,7 +1110,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1202,7 +1120,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1210,7 +1127,6 @@ "http://www.w3.org/TR/xsl/#fo_table-cell">§6.7.10</a></td> <td><a name="fo-object-table-cell" id="fo-object-table-cell">table-cell</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -1220,7 +1136,7 @@ <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e12374">§6.8</a></td> - <td class="category" colspan="7"><a name="fo-object-list-section" id= + <td class="category" colspan="6"><a name="fo-object-list-section" id= "fo-object-list-section">List Formatting Objects</a></td> </tr> <tr> @@ -1231,7 +1147,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1242,7 +1157,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1253,7 +1167,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1265,14 +1178,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e12855">§6.9</a></td> - <td class="category" colspan="7"><a name="fo-object-link-section" id= + <td class="category" colspan="6"><a name="fo-object-link-section" id= "fo-object-link-section">Link and Multi Formatting Objects</a></td> </tr> <tr> @@ -1283,12 +1195,7 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> - <td> - <ul> - <li>both internal and external supported</li> - </ul> - </td> + <td>both internal and external supported</td> </tr> <tr> <td align="center"><a href= @@ -1298,7 +1205,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1309,7 +1215,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1320,7 +1225,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1332,7 +1236,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1344,14 +1247,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl11/#d0e13293">§6.10</a></td> - <td class="category" colspan="7"><a name="fo-object-indexing-section" id= + <td class="category" colspan="6"><a name="fo-object-indexing-section" id= "fo-object-indexing-section">Formatting Objects for Indexing</a></td> </tr> <tr> @@ -1362,7 +1264,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1373,7 +1274,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1384,7 +1284,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1395,7 +1294,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1406,7 +1304,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1417,7 +1314,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1428,7 +1324,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1439,64 +1334,47 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl11/#d0e14206">§6.11</a></td> - <td class="category" colspan="7"><a name="fo-object-bookmarks-section" id= + <td class="category" colspan="6"><a name="fo-object-bookmarks-section" id= "fo-object-bookmarks-section">Formatting Objects for Bookmarks</a></td> </tr> <tr> <td align="center"><a href="http://www.w3.org/TR/xsl11/#fo_bookmark-tree">§6.11.1</a></td> <td><a name="fo-object-bookmark-tree" id="fo-object-bookmark-tree">bookmark-tree</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] Uses the proprietary fox:outline extension.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href="http://www.w3.org/TR/xsl11/#fo_bookmark">§6.11.2</a></td> <td><a name="fo-object-bookmark" id="fo-object-bookmark">bookmark</a></td> <td class="extended">Extended</td> - <td class="no">no</td> - <td class="yes">yes</td> - <td class="yes">yes</td> - <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] Uses the proprietary fox:outline extension.</li> - </ul> - </td> + <td class="partial">partial</td> + <td class="partial">partial</td> + <td class="partial">partial</td> + <td>external-destination is not yet supported.</td> </tr> <tr> <td align="center"><a href="http://www.w3.org/TR/xsl11/#fo_bookmark-title">§6.11.3</a></td> <td><a name="fo-object-bookmark-title" id="fo-object-bookmark-title">bookmark-title</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] Uses the proprietary fox:outline extension.</li> - <li>[0.94 and later] color, font-style and font-weight are not supported, yet.</li> - </ul> - </td> + <td>color, font-style and font-weight are not supported, yet.</td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e14340">§6.12</a></td> - <td class="category" colspan="7"><a name="fo-object-outofline-section" id= + <td class="category" colspan="6"><a name="fo-object-outofline-section" id= "fo-object-outofline-section">Out-of-line Formatting Objects</a></td> </tr> <tr> @@ -1507,7 +1385,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1515,16 +1392,10 @@ "http://www.w3.org/TR/xsl/#fo_footnote">§6.12.3</a></td> <td><a name="fo-object-footnote" id="fo-object-footnote">footnote</a></td> <td class="extended">Extended</td> - <td class="yes">yes</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] Footnotes sometimes overlap with the main content</li> - <li>[0.94 and later] Restrictions with multi-column documents.</li> - </ul> - </td> + <td>Restrictions with multi-column documents.</td> </tr> <tr> <td align="center"><a href= @@ -1534,14 +1405,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e14653">§6.13</a></td> - <td class="category" colspan="7"><a name="fo-object-other-section" id= + <td class="category" colspan="6"><a name="fo-object-other-section" id= "fo-object-other-section">Other Formatting Objects</a></td> </tr> <tr> @@ -1552,7 +1422,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1563,7 +1432,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1571,15 +1439,10 @@ "http://www.w3.org/TR/xsl/#fo_wrapper">§6.13.4</a></td> <td><a name="fo-object-wrapper" id="fo-object-wrapper">wrapper</a></td> <td class="basic">Basic</td> - <td class="yes">yes</td> - <td class="partial">partial</td> <td class="partial">partial</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.95] Only works as expected with inline-level content.</li> - </ul> - </td> + <td class="yes">yes</td> + <td>Only works as expected with inline-level content.</td> </tr> <tr> <td align="center"><a href= @@ -1589,7 +1452,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1601,7 +1463,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1612,12 +1473,7 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> - <td> - <ul> - <li>[0.20.5] Uses the proprietary fox:outline extension to mimic table continued</li> - </ul> - </td> + <td> </td> </tr> </table> @@ -1631,20 +1487,19 @@ <th rowspan="2" align="center">Citation</th> <th rowspan="2">Property Name</th> <th rowspan="2" align="center">XSL-FO Conformance Level</th> - <th colspan="4" align="center">Support in FOP</th> + <th colspan="3" align="center">Support in FOP</th> <th rowspan="2">Comments</th> </tr> <tr> - <th align="center">0.20.5 (ancient)</th> - <th align="center">0.94 (stable)</th> <th align="center">0.95 (stable)</th> + <th align="center">1.0 (stable)</th> <th align="center">develop- ment</th> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-accessibility-properties">§7.5</a></td> - <td class="category" colspan="7"><a name="fo-property-commonaccess-section" id= + <td class="category" colspan="6"><a name="fo-property-commonaccess-section" id= "fo-property-commonaccess-section">Common Accessibility Properties</a></td> </tr> <tr> @@ -1656,7 +1511,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1667,14 +1521,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-absolute-position-properties">§7.6</a></td> - <td class="category" colspan="7"><a name="fo-property-commonabspos-section" id= + <td class="category" colspan="6"><a name="fo-property-commonabspos-section" id= "fo-property-commonabspos-section">Common Absolute Position Properties</a></td> </tr> <tr> @@ -1683,16 +1536,10 @@ <td><a name="fo-property-absolute-position" id= "fo-property-absolute-position">absolute-position</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] Use shorthand position="absolute" as a workaround.</li> - <li>[0.94 and later] No restrictions. The 0.20.5 work-around is not supported.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -1702,7 +1549,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1713,7 +1559,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1724,7 +1569,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -1735,14 +1579,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-aural-properties">§7.7</a></td> - <td class="category" colspan="7"><a name="fo-property-commonaural-section" id= + <td class="category" colspan="6"><a name="fo-property-commonaural-section" id= "fo-property-commonaural-section">Common Aural Properties</a></td> </tr> <tr> @@ -1948,7 +1791,7 @@ <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-border-padding-and-background-properties">§7.8</a></td> - <td class="category" colspan="7"><a name="fo-property-commonenv-section" id= + <td class="category" colspan="6"><a name="fo-property-commonenv-section" id= "fo-property-commonenv-section">Common Border, Padding, and Background Properties</a></td> </tr> <tr> @@ -1960,7 +1803,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -1970,15 +1812,9 @@ "fo-property-background-color">background-color</a></td> <td class="basic">Basic</td> <td class="yes">yes</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] not yet implemented for table-column, table-body, table-header and - table-footer.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -1987,15 +1823,9 @@ "fo-property-background-image">background-image</a></td> <td class="extended">Extended</td> <td class="yes">yes</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] not yet implemented for table-column, table-body, table-header and - table-footer.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2003,7 +1833,6 @@ <td><a name="fo-property-background-repeat" id= "fo-property-background-repeat">background-repeat</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -2015,11 +1844,10 @@ <td><a name="fo-property-background-position-horizontal" id= "fo-property-background-position-horizontal">background-position-horizontal</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td align="center">[0.94 and later] Ignored when background-repeat set to + <td align="center">Ignored when background-repeat set to "repeat" or "repeat-x"</td> </tr> <tr> @@ -2028,11 +1856,10 @@ <td><a name="fo-property-background-position-vertical" id= "fo-property-background-position-vertical">background-position-vertical</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td align="center">[0.94 and later] Ignored when background-repeat set to + <td align="center">Ignored when background-repeat set to "repeat" or "repeat-y"</td> </tr> <tr> @@ -2044,7 +1871,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2053,15 +1879,10 @@ <td><a name="fo-property-border-before-style" id= "fo-property-border-before-style">border-before-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2070,14 +1891,9 @@ "fo-property-border-before-width">border-before-width</a></td> <td class="basic">Basic</td> <td class="yes">yes</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] .conditionality not supported on fo:table-cell</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2088,7 +1904,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2097,15 +1912,10 @@ <td><a name="fo-property-border-after-style" id= "fo-property-border-after-style">border-after-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2114,14 +1924,9 @@ "fo-property-border-after-width">border-after-width</a></td> <td class="basic">Basic</td> <td class="yes">yes</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] .conditionality not supported on fo:table-cell</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2132,7 +1937,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2141,15 +1945,10 @@ <td><a name="fo-property-border-start-style" id= "fo-property-border-start-style">border-start-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2160,7 +1959,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2172,7 +1970,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2181,15 +1978,10 @@ <td><a name="fo-property-border-end-style" id= "fo-property-border-end-style">border-end-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2200,7 +1992,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2212,7 +2003,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2221,16 +2011,10 @@ <td><a name="fo-property-border-top-style" id= "fo-property-border-top-style">border-top-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> - </tr> +<td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#border-top-width">§7.8.21</a></td> @@ -2240,7 +2024,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2252,7 +2035,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2261,16 +2043,10 @@ <td><a name="fo-property-border-bottom-style" id= "fo-property-border-bottom-style">border-bottom-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> - </tr> +<td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#border-bottom-width">§7.8.24</a></td> @@ -2280,7 +2056,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2292,7 +2067,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2301,16 +2075,10 @@ <td><a name="fo-property-border-left-style" id= "fo-property-border-left-style">border-left-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> - </tr> +<td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#border-left-width">§7.8.27</a></td> @@ -2320,7 +2088,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2332,7 +2099,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2341,16 +2107,10 @@ <td><a name="fo-property-border-right-style" id= "fo-property-border-right-style">border-right-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> - </tr> +<td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#border-right-width">§7.8.30</a></td> @@ -2360,7 +2120,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2369,79 +2128,50 @@ <td><a name="fo-property-padding-before" id= "fo-property-padding-before">padding-before</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only one value allowed</li> - <li>[0.20.5] only implemented for blocks</li> - <li>[0.20.5] can't be used to make extra space (use indents + spaces instead)</li> - <li>[0.20.5] can be used to control how much the background-color extends beyond the - content rectangle</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#padding-after">§7.8.32</a></td> <td><a name="fo-property-padding-after" id="fo-property-padding-after">padding-after</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] same limitations as padding-before</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#padding-start">§7.8.33</a></td> <td><a name="fo-property-padding-start" id="fo-property-padding-start">padding-start</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] same limitations as padding-before</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#padding-end">§7.8.34</a></td> <td><a name="fo-property-padding-end" id="fo-property-padding-end">padding-end</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] same limitations as padding-before</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#padding-top">§7.8.35</a></td> <td><a name="fo-property-padding-top" id="fo-property-padding-top">padding-top</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] same limitations as padding-before</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2449,51 +2179,36 @@ <td><a name="fo-property-padding-bottom" id= "fo-property-padding-bottom">padding-bottom</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] same limitations as padding-before</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#padding-left">§7.8.37</a></td> <td><a name="fo-property-padding-left" id="fo-property-padding-left">padding-left</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] same limitations as padding-before</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#padding-right">§7.8.38</a></td> <td><a name="fo-property-padding-right" id="fo-property-padding-right">padding-right</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] same limitations as padding-before</li> - </ul> - </td> + <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-font-properties">§7.9</a></td> - <td class="category" colspan="7"><a name="fo-property-commonfont-section" id= + <td class="category" colspan="6"><a name="fo-property-commonfont-section" id= "fo-property-commonfont-section">Common Font Properties</a></td> </tr> <tr> @@ -2504,14 +2219,8 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] font-family lists are not supported, use a single font-family name</li> - <li>[0.94 and later] font-family lists are allowed but glyph based font selection is not - supported</li> - </ul> - </td> + <td>font-family lists are allowed but glyph based font selection is not + supported</td> </tr> <tr> <td align="center"><a href= @@ -2522,7 +2231,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2530,15 +2238,10 @@ "http://www.w3.org/TR/xsl/#font-size">§7.9.4</a></td> <td><a name="fo-property-font-size" id="fo-property-font-size">font-size</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] "smaller" and "larger" not implemented</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2548,7 +2251,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2560,7 +2262,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2568,22 +2269,16 @@ "http://www.w3.org/TR/xsl/#font-style">§7.9.7</a></td> <td><a name="fo-property-font-style" id="fo-property-font-style">font-style</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] "normal" is not supported</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#font-variant">§7.9.8</a></td> <td><a name="fo-property-font-variant" id="fo-property-font-variant">font-variant</a></td> <td class="basic">Basic</td> - <td class="yes">yes</td> <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> @@ -2597,19 +2292,13 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] "normal", "bolder" and "lighter" are not supported</li> - <li>[0.94 and later] TODO <relative> font weights</li> - </ul> - </td> + <td>TODO <relative> font weights</td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-hyphenation-properties">§7.10</a></td> - <td class="category" colspan="7"><a name="fo-property-commonhyphen-section" id= + <td class="category" colspan="6"><a name="fo-property-commonhyphen-section" id= "fo-property-commonhyphen-section">Common Hyphenation Properties</a></td> </tr> <tr> @@ -2620,14 +2309,8 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> - <td> - <ul> - <li>[0.94 and earlier] Only used for controlling hyphenation.</li> - <li>[trunk] For PDF output: Only 2-letter codes from ISO 3166 are supported properly to - identify the natural language!</li> - </ul> - </td> + <td>For PDF output: Only 2-letter codes from ISO 3166 are supported properly to + identify the natural language!</td> </tr> <tr> <td align="center"><a href= @@ -2637,14 +2320,8 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> - <td> - <ul> - <li>[0.94 and earlier] Only used for controlling hyphenation.</li> - <li>[trunk] For PDF output: Only 2-letter codes from ISO 639 are supported properly to - identify the natural language!</li> - </ul> - </td> + <td>For PDF output: Only 2-letter codes from ISO 639 are supported properly to + identify the natural language!</td> </tr> <tr> <td align="center"><a href= @@ -2654,7 +2331,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2665,7 +2341,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2677,7 +2352,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2689,7 +2363,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2701,14 +2374,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-margin-properties-block">§7.11</a></td> - <td class="category" colspan="7"><a name="fo-property-commonmarginblock-section" id= + <td class="category" colspan="6"><a name="fo-property-commonmarginblock-section" id= "fo-property-commonmarginblock-section">Common Margin Properties - Block</a></td> </tr> <tr> @@ -2716,60 +2388,40 @@ "http://www.w3.org/TR/xsl/#margin-top">§7.11.1</a></td> <td><a name="fo-property-margin-top" id="fo-property-margin-top">margin-top</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only on pages and regions</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#margin-bottom">§7.11.2</a></td> <td><a name="fo-property-margin-bottom" id="fo-property-margin-bottom">margin-bottom</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only on pages and regions</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#margin-left">§7.11.3</a></td> <td><a name="fo-property-margin-left" id="fo-property-margin-left">margin-left</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only on pages and regions</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#margin-right">§7.11.4</a></td> <td><a name="fo-property-margin-right" id="fo-property-margin-right">margin-right</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only on pages and regions</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -2779,13 +2431,7 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] space-before.optimum supported</li> - <li>[0.94 and later] Space adjustment may not fully work everywhere, yet.</li> - </ul> - </td> + <td>Space adjustment may not fully work everywhere, yet.</td> </tr> <tr> <td align="center"><a href= @@ -2795,13 +2441,7 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] space-after.optimum supported</li> - <li>[0.94 and later] Space adjustment may not fully work everywhere, yet.</li> - </ul> - </td> + <td>Space adjustment may not fully work everywhere, yet.</td> </tr> <tr> <td align="center"><a href= @@ -2811,7 +2451,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -2822,14 +2461,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-margin-properties-inline">§7.12</a></td> - <td class="category" colspan="7"><a name="fo-property-commonmargininline-section" id= + <td class="category" colspan="6"><a name="fo-property-commonmargininline-section" id= "fo-property-commonmargininline-section">Common Margin Properties - Inline</a></td> </tr> <tr> @@ -2840,7 +2478,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2851,7 +2488,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2862,7 +2498,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2873,7 +2508,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2884,7 +2518,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2895,14 +2528,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#common-relative-position-properties">§7.13</a></td> - <td class="category" colspan="7"><a name="fo-property-commonrelpos-section" id= + <td class="category" colspan="6"><a name="fo-property-commonrelpos-section" id= "fo-property-commonrelpos-section">Common Relative Position Properties</a></td> </tr> <tr> @@ -2913,7 +2545,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2924,7 +2555,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2935,7 +2565,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2946,7 +2575,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -2958,14 +2586,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#area-alignment">§7.14</a></td> - <td class="category" colspan="7"><a name="fo-property-areaalign-section" id= + <td class="category" colspan="6"><a name="fo-property-areaalign-section" id= "fo-property-areaalign-section">Area Alignment Properties</a></td> </tr> <tr> @@ -2974,7 +2601,6 @@ <td><a name="fo-property-alignment-adjust" id= "fo-property-alignment-adjust">alignment-adjust</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -2986,7 +2612,6 @@ <td><a name="fo-property-alignment-baseline" id= "fo-property-alignment-baseline">alignment-baseline</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -2998,15 +2623,10 @@ <td><a name="fo-property-baseline-shift" id= "fo-property-baseline-shift">baseline-shift</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] Only values "super" and "sub" have been implemented.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -3016,16 +2636,7 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] Implemented only for table-cell and block-container.</li> - <li>[0.20.5] For table-cell, the "height" attribute must be set for the parent table-row; - setting the height of the table or the table-cell results in vertical centering having no - effect.</li> - <li>[0.94 and later] TODO Check e-g, i-f-o.</li> - </ul> - </td> + <td>TODO Check e-g, i-f-o.</td> </tr> <tr> <td align="center"><a href= @@ -3033,7 +2644,6 @@ <td><a name="fo-property-dominant-baseline" id= "fo-property-dominant-baseline">dominant-baseline</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3048,14 +2658,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e22982">§7.15</a></td> - <td class="category" colspan="7"><a name="fo-property-areadim-section" id= + <td class="category" colspan="6"><a name="fo-property-areadim-section" id= "fo-property-areadim-section">Area Dimension Properties</a></td> </tr> <tr> @@ -3066,7 +2675,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3077,7 +2685,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3086,7 +2693,6 @@ <td><a name="fo-property-block-progression-dimension" id= "fo-property-block-progression-dimension">block-progression-dimension</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3098,30 +2704,20 @@ <td><a name="fo-property-content-height" id= "fo-property-content-height">content-height</a></td> <td class="extended">Extended</td> - <td class="no">no</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] values "scale-up-to-fit" and "scale-down-to-fit" not supported</li> - </ul> - </td> + <td class="yes">yes</td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#content-width">§7.15.5</a></td> <td><a name="fo-property-content-width" id="fo-property-content-width">content-width</a></td> <td class="extended">Extended</td> - <td class="no">no</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] values "scale-up-to-fit" and "scale-down-to-fit" not supported</li> - </ul> - </td> + <td class="yes">yes</td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -3131,7 +2727,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3140,7 +2735,6 @@ <td><a name="fo-property-inline-progression-dimension" id= "fo-property-inline-progression-dimension">inline-progression-dimension</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3152,8 +2746,7 @@ <td><a name="fo-property-max-height" id="fo-property-max-height">max-height</a></td> <td class="complete">Complete</td> <td class="no">no</td> - <td class="no">no</td> - <td class="no">no</td> + <td class="yes">yes</td> <td class="yes">yes</td> <td> </td> </tr> @@ -3163,8 +2756,7 @@ <td><a name="fo-property-max-width" id="fo-property-max-width">max-width</a></td> <td class="complete">Complete</td> <td class="no">no</td> - <td class="no">no</td> - <td class="no">no</td> + <td class="yes">yes</td> <td class="yes">yes</td> <td> </td> </tr> @@ -3174,8 +2766,7 @@ <td><a name="fo-property-min-height" id="fo-property-min-height">min-height</a></td> <td class="complete">Complete</td> <td class="no">no</td> - <td class="no">no</td> - <td class="no">no</td> + <td class="yes">yes</td> <td class="yes">yes</td> <td> </td> </tr> @@ -3185,8 +2776,7 @@ <td><a name="fo-property-min-width" id="fo-property-min-width">min-width</a></td> <td class="complete">Complete</td> <td class="no">no</td> - <td class="no">no</td> - <td class="no">no</td> + <td class="yes">yes</td> <td class="yes">yes</td> <td> </td> </tr> @@ -3195,7 +2785,6 @@ "http://www.w3.org/TR/xsl/#scaling">§7.15.12</a></td> <td><a name="fo-property-scaling" id="fo-property-scaling">scaling</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3210,7 +2799,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3221,14 +2809,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e24119">§7.16</a></td> - <td class="category" colspan="7"><a name="fo-property-blockandline-section" id= + <td class="category" colspan="6"><a name="fo-property-blockandline-section" id= "fo-property-blockandline-section">Block and Line-related Properties</a></td> </tr> <tr> @@ -3240,7 +2827,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3249,7 +2835,6 @@ <td><a name="fo-property-hyphenation-ladder-count" id= "fo-property-hyphenation-ladder-count">hyphenation-ladder-count</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3261,7 +2846,6 @@ <td><a name="fo-property-last-line-end-indent" id= "fo-property-last-line-end-indent">last-line-end-indent</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3275,7 +2859,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3284,7 +2867,6 @@ <td><a name="fo-property-line-height-shift-adjustment" id= "fo-property-line-height-shift-adjustment">line-height-shift-adjustment</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3296,15 +2878,10 @@ <td><a name="fo-property-line-stacking-strategy" id= "fo-property-line-stacking-strategy">line-stacking-strategy</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.94 and later] value "line-height" not supported</li> - </ul> - </td> + <td>value "line-height" not supported</td> </tr> <tr> <td align="center"><a href= @@ -3312,7 +2889,6 @@ <td><a name="fo-property-linefeed-treatment" id= "fo-property-linefeed-treatment">linefeed-treatment</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3324,16 +2900,11 @@ <td><a name="fo-property-white-space-treatment" id= "fo-property-white-space-treatment">white-space-treatment</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.94 and later] inline elements may interfere with correct handling of this property - in some cases</li> - </ul> - </td> + <td>inline elements may interfere with correct handling of this property + in some cases</td> </tr> <tr> <td align="center"><a href= @@ -3343,12 +2914,7 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>Only start, end, center and justify are supported</li> - </ul> - </td> + <td>Only start, end, center and justify are supported</td> </tr> <tr> <td align="center"><a href= @@ -3359,12 +2925,7 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>Only start, end, center and justify are supported</li> - </ul> - </td> + <td>Only start, end, center and justify are supported</td> </tr> <tr> <td align="center"><a href= @@ -3374,7 +2935,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3386,7 +2946,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3394,21 +2953,16 @@ "http://www.w3.org/TR/xsl/#wrap-option">§7.16.13</a></td> <td><a name="fo-property-wrap-option" id="fo-property-wrap-option">wrap-option</a></td> <td class="basic">Basic</td> - <td class="yes">yes</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.94 and later] Only supported on fo:block.</li> - </ul> - </td> + <td>Only supported on fo:block.</td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e25178">§7.17</a></td> - <td class="category" colspan="7"><a name="fo-property-char-section" id= + <td class="category" colspan="6"><a name="fo-property-char-section" id= "fo-property-char-section">Character Properties</a></td> </tr> <tr> @@ -3419,7 +2973,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3431,7 +2984,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3443,7 +2995,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3455,7 +3006,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3466,7 +3016,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3475,7 +3024,6 @@ <td><a name="fo-property-text-transform" id= "fo-property-text-transform">text-transform</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3490,7 +3038,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3498,7 +3045,6 @@ "http://www.w3.org/TR/xsl/#word-spacing">§7.17.8</a></td> <td><a name="fo-property-word-spacing" id="fo-property-word-spacing">word-spacing</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3508,7 +3054,7 @@ <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e25895">§7.18</a></td> - <td class="category" colspan="7"><a name="fo-property-color-section" id= + <td class="category" colspan="6"><a name="fo-property-color-section" id= "fo-property-color-section">Color-related Properties</a></td> </tr> <tr> @@ -3519,7 +3065,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3531,7 +3076,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3543,14 +3087,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e26080">§7.19</a></td> - <td class="category" colspan="7"><a name="fo-property-float-section" id= + <td class="category" colspan="6"><a name="fo-property-float-section" id= "fo-property-float-section">Float-related Properties</a></td> </tr> <tr> @@ -3561,7 +3104,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3572,7 +3114,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3584,14 +3125,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e26492">§7.20</a></td> - <td class="category" colspan="7"><a name="fo-property-keepsbreaks-section" id= + <td class="category" colspan="6"><a name="fo-property-keepsbreaks-section" id= "fo-property-keepsbreaks-section">Keeps and Breaks Properties</a></td> </tr> <tr> @@ -3600,14 +3140,9 @@ <td><a name="fo-property-break-after" id="fo-property-break-after">break-after</a></td> <td class="basic">Basic</td> <td class="yes">yes</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] Doesn't work on the last row of a table</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -3615,16 +3150,9 @@ <td><a name="fo-property-break-before" id="fo-property-break-before">break-before</a></td> <td class="basic">Basic</td> <td class="yes">yes</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94] Doesn't work on the first row of a table</li> - <li>[0.94] When set on the first child of an fo:table-cell, - the border-before is still painted on the previous page</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -3634,12 +3162,10 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> <td> <ul> - <li>[0.20.5] works only in table rows</li> - <li>[0.95 and earlier] <integer> values are not supported.</li> - <li>[Trunk] minimal support for <integer> value.</li> + <li>[0.95] <integer> values are not supported.</li> + <li>[1.0 and later] minimal support for <integer> value.</li> </ul> </td> </tr> @@ -3652,14 +3178,12 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> <td> <ul> - <li>[0.20.5] works only in table rows</li> - <li>[0.94 and later] works on all implemented block-level FOs, but not on inline-level + <li>works on all implemented block-level FOs, but not on inline-level FOs.</li> - <li>[0.95 and earlier] <integer> values are not supported.</li> - <li>[Trunk] minimal support for <integer> value.</li> + <li>[0.95] <integer> values are not supported.</li> + <li>[1.0 and later] minimal support for <integer> value.</li> </ul> </td> </tr> @@ -3672,17 +3196,14 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> <td> <ul> - <li>[0.20.5] works only in table rows</li> - <li>[0.94] works on all implemented FOs, except list- and table-related and - inline-level FOs.</li> <li>[0.95] works on all implemented FOs, except list- and inline-level FOs.</li> - <li>[Trunk] does not work on inline-level FOs.</li> - <li>[0.95 and earlier] <integer> values are not supported.</li> - <li>[Trunk] minimal support for <integer> value.</li> + <li>[1.0 and later] works on all implemented block-level + FOs, but not on inline-level FOs.</li> + <li>[0.95] <integer> values are not supported.</li> + <li>[1.0 and later] minimal support for <integer> value.</li> </ul> </td> </tr> @@ -3691,7 +3212,6 @@ "http://www.w3.org/TR/xsl/#orphans">§7.20.6</a></td> <td><a name="fo-property-orphans" id="fo-property-orphans">orphans</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3702,7 +3222,6 @@ "http://www.w3.org/TR/xsl/#widows">§7.20.7</a></td> <td><a name="fo-property-widows" id="fo-property-widows">widows</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3712,7 +3231,7 @@ <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e26965">§7.21</a></td> - <td class="category" colspan="7"><a name="fo-property-layout-section" id= + <td class="category" colspan="6"><a name="fo-property-layout-section" id= "fo-property-layout-section">Layout-related Properties</a></td> </tr> <tr> @@ -3723,7 +3242,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3731,7 +3249,6 @@ "http://www.w3.org/TR/xsl/#overflow">§7.21.2</a></td> <td><a name="fo-property-overflow" id="fo-property-overflow">overflow</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -3743,17 +3260,10 @@ <td><a name="fo-property-reference-orientation" id= "fo-property-reference-orientation">reference-orientation</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] Workaround for page-orientation (portrait vs. landscape) is to swap the - page-width and page-height properties.</li> - <li>[0.20.5] Workaround for block-container is to use SVG.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -3763,14 +3273,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e27308">§7.22</a></td> - <td class="category" colspan="7"><a name="fo-property-leader-section" id= + <td class="category" colspan="6"><a name="fo-property-leader-section" id= "fo-property-leader-section">Leader and Rule Properties</a></td> </tr> <tr> @@ -3779,16 +3288,10 @@ <td><a name="fo-property-leader-alignment" id= "fo-property-leader-alignment">leader-alignment</a></td> <td class="extended">Extended</td> - <td class="partial">partial</td> <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td> - <ul> - <li>[0.20.5] not value "page"</li> - <li>[0.94 and later] Not supported</li> - </ul> - </td> + <td>Not supported</td> </tr> <tr> <td align="center"><a href= @@ -3796,16 +3299,10 @@ <td><a name="fo-property-leader-pattern" id= "fo-property-leader-pattern">leader-pattern</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] not value "use-content"</li> - <li>[0.94 and later] Value "use-content" does not work in all circumstances.</li> - </ul> - </td> + <td>Value "use-content" does not work in all circumstances.</td> </tr> <tr> <td align="center"><a href= @@ -3816,7 +3313,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3824,15 +3320,10 @@ "http://www.w3.org/TR/xsl/#leader-length">§7.22.4</a></td> <td><a name="fo-property-leader-length" id="fo-property-leader-length">leader-length</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] leader-length.minimum is not used at all</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -3842,7 +3333,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3854,14 +3344,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e27719">§7.23</a></td> - <td class="category" colspan="7"><a name="fo-property-dynamiceffects-section" id= + <td class="category" colspan="6"><a name="fo-property-dynamiceffects-section" id= "fo-property-dynamiceffects-section">Properties for Dynamic Effects Formatting Objects</a></td> </tr> <tr> @@ -3872,7 +3361,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3883,7 +3371,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3894,7 +3381,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3905,7 +3391,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3917,7 +3402,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3929,7 +3413,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3941,7 +3424,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -3953,7 +3435,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -3963,17 +3444,11 @@ "fo-property-show-destination">show-destination</a></td> <td class="extended">Extended</td> <td class="no">no</td> - <td class="no">no</td> - <td class="no">no</td> <td class="partial">partial</td> - <td> - <ul> - <li>[FOP Trunk] only has effect in PDF output, for external PDF destinations (links pointing to destinations + <td class="partial">partial</td> + <td>[1.0 and later] only has effect in PDF output, for external PDF destinations (links pointing to destinations in <i>another</i> PDF), and only works reliably when the PDF is viewed in a standalone PDF viewer. - <p>Adobe's browser plugin, for example, ignores the <code>/NewWindow</code> flag. - </li> - </ul> - </td> + <p>Adobe's browser plugin, for example, ignores the <code>/NewWindow</code> flag.</td> </tr> <tr> <td align="center"><a href= @@ -3981,16 +3456,10 @@ <td><a name="fo-property-starting-state" id= "fo-property-starting-state">starting-state</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.94 and later] support for starting-state on <a href= - "#fo-bookmark">fo:bookmark</a></li> - </ul> - </td> + <td>support for starting-state on fo:bookmark</td> </tr> <tr> <td align="center"><a href= @@ -4000,7 +3469,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4012,7 +3480,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4024,7 +3491,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4036,14 +3502,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e28521">§7.24</a></td> - <td class="category" colspan="7"><a name="fo-property-indexing-section" id= + <td class="category" colspan="6"><a name="fo-property-indexing-section" id= "fo-property-indexing-section">Properties for Indexing</a></td> </tr> <tr> @@ -4054,7 +3519,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4065,7 +3529,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4076,7 +3539,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4088,7 +3550,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4100,7 +3561,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4112,7 +3572,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4123,14 +3582,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e28896">§7.25</a></td> - <td class="category" colspan="7"><a name="fo-property-markers-section" id= + <td class="category" colspan="6"><a name="fo-property-markers-section" id= "fo-property-markers-section">Properties for Markers</a></td> </tr> <tr> @@ -4139,7 +3597,6 @@ <td><a name="fo-property-marker-class-name" id= "fo-property-marker-class-name">marker-class-name</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4154,7 +3611,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4163,7 +3619,6 @@ <td><a name="fo-property-retrieve-class-name" id= "fo-property-retrieve-class-name">retrieve-class-name</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4175,7 +3630,6 @@ <td><a name="fo-property-retrieve-position" id= "fo-property-retrieve-position">retrieve-position</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4187,7 +3641,6 @@ <td><a name="fo-property-retrieve-boundary" id= "fo-property-retrieve-boundary">retrieve-boundary</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4202,14 +3655,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e29313">§7.26</a></td> - <td class="category" colspan="7"><a name="fo-property-numberstring-section" id= + <td class="category" colspan="6"><a name="fo-property-numberstring-section" id= "fo-property-numberstring-section">Properties for Number to String Conversion</a></td> </tr> <tr> @@ -4217,7 +3669,6 @@ "http://www.w3.org/TR/xsl/#format">§7.26.1</a></td> <td><a name="fo-property-format" id="fo-property-format">format</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4232,7 +3683,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4243,7 +3693,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4254,14 +3703,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e29484">§7.27</a></td> - <td class="category" colspan="7"><a name="fo-property-pagination-section" id= + <td class="category" colspan="6"><a name="fo-property-pagination-section" id= "fo-property-pagination-section">Pagination and Layout Properties</a></td> </tr> <tr> @@ -4273,7 +3721,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4284,7 +3731,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4295,7 +3741,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4306,7 +3751,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4317,7 +3761,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4326,7 +3769,6 @@ <td><a name="fo-property-force-page-count" id= "fo-property-force-page-count">force-page-count</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4341,7 +3783,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4352,7 +3793,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4364,7 +3804,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4376,7 +3815,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4387,7 +3825,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4398,7 +3835,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4409,7 +3845,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4418,15 +3853,9 @@ <td><a name="fo-property-page-position" id="fo-property-page-position">page-position</a></td> <td class="extended">Extended</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td class="partial">partial</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] "last" isn't implemented!</li> - <li>[0.95] value "only" not supported</li> - </ul> - </td> + <td class="yes">yes</td> + <td>value "only" not supported</td> </tr> <tr> <td align="center"><a href= @@ -4436,7 +3865,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4444,7 +3872,6 @@ "http://www.w3.org/TR/xsl/#precedence">§7.27.16</a></td> <td><a name="fo-property-precedence" id="fo-property-precedence">precedence</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4458,7 +3885,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4469,7 +3895,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4480,7 +3905,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4491,7 +3915,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4502,14 +3925,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e30798">§7.28</a></td> - <td class="category" colspan="7"><a name="fo-property-table-section" id= + <td class="category" colspan="6"><a name="fo-property-table-section" id= "fo-property-table-section">Table Properties</a></td> </tr> <tr> @@ -4521,7 +3943,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4533,7 +3954,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4542,15 +3962,10 @@ <td><a name="fo-property-border-collapse" id= "fo-property-border-collapse">border-collapse</a></td> <td class="extended">Extended</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.94 and later] Some small limitations</li> - </ul> - </td> + <td>Some small limitations</td> </tr> <tr> <td align="center"><a href= @@ -4561,7 +3976,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4570,7 +3984,6 @@ <td><a name="fo-property-border-separation" id= "fo-property-border-separation">border-separation</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4585,7 +3998,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4596,7 +4008,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4604,7 +4015,6 @@ "http://www.w3.org/TR/xsl/#column-number">§7.28.8</a></td> <td><a name="fo-property-column-number" id="fo-property-column-number">column-number</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4615,16 +4025,10 @@ "http://www.w3.org/TR/xsl/#column-width">§7.28.9</a></td> <td><a name="fo-property-column-width" id="fo-property-column-width">column-width</a></td> <td class="basic">Basic</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] "percentage" not implemented. Workaround is to use the XSL-FO - "proportional-column-width" function.</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -4634,7 +4038,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4642,7 +4045,6 @@ "http://www.w3.org/TR/xsl/#ends-row">§7.28.11</a></td> <td><a name="fo-property-ends-row" id="fo-property-ends-row">ends-row</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4654,7 +4056,6 @@ <td><a name="fo-property-number-columns-repeated" id= "fo-property-number-columns-repeated">number-columns-repeated</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4669,7 +4070,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4681,7 +4081,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4689,7 +4088,6 @@ "http://www.w3.org/TR/xsl/#starts-row">§7.28.15</a></td> <td><a name="fo-property-starts-row" id="fo-property-starts-row">starts-row</a></td> <td class="extended">Extended</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -4703,7 +4101,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4715,7 +4112,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4727,14 +4123,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#writing-mode-related">§7.29</a></td> - <td class="category" colspan="7"><a name="fo-property-writingmode-section" id= + <td class="category" colspan="6"><a name="fo-property-writingmode-section" id= "fo-property-writingmode-section">Writing-mode-related Properties</a></td> </tr> <tr> @@ -4745,7 +4140,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4757,7 +4151,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4769,7 +4162,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4780,7 +4172,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4791,7 +4182,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4802,7 +4192,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4813,14 +4202,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e32871">§7.30</a></td> - <td class="category" colspan="7"><a name="fo-property-misc-section" id= + <td class="category" colspan="6"><a name="fo-property-misc-section" id= "fo-property-misc-section">Miscellaneous Properties</a></td> </tr> <tr> @@ -4831,7 +4219,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4842,7 +4229,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4853,7 +4239,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4864,7 +4249,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4875,7 +4259,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4886,7 +4269,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4897,7 +4279,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4905,17 +4286,12 @@ "http://www.w3.org/TR/xsl/#id">§7.30.8</a></td> <td><a name="fo-property-id" id="fo-property-id">id</a></td> <td class="basic">Basic</td> - <td class="yes">yes</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.94 and later] IDs on table-header, table-footer, table-body, table-row, + <td>IDs on table-header, table-footer, table-body, table-row, table-and-caption, table-caption, inline-container and bidi-override are not available, - yet.</li> - </ul> - </td> + yet.</td> </tr> <tr> <td align="center"><a href= @@ -4925,7 +4301,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4936,7 +4311,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4948,7 +4322,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4960,7 +4333,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4971,7 +4343,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -4982,7 +4353,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -4993,7 +4363,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -5004,7 +4373,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5015,7 +4383,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -5026,14 +4393,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e33965">§7.31</a></td> - <td class="category" colspan="7"><a name="fo-property-shorthand-section" id= + <td class="category" colspan="6"><a name="fo-property-shorthand-section" id= "fo-property-shorthand-section">Shorthand Properties</a></td> </tr> <tr> @@ -5044,7 +4410,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -5053,7 +4418,6 @@ <td><a name="fo-property-background-position" id= "fo-property-background-position">background-position</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5064,7 +4428,6 @@ "http://www.w3.org/TR/xsl/#border">§7.31.3</a></td> <td><a name="fo-property-border" id="fo-property-border">border</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5078,7 +4441,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5086,15 +4448,10 @@ "http://www.w3.org/TR/xsl/#border-color">§7.31.5</a></td> <td><a name="fo-property-border-color" id="fo-property-border-color">border-color</a></td> <td class="complete">Complete</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only one value allowed</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -5104,7 +4461,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5115,7 +4471,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5123,15 +4478,10 @@ "http://www.w3.org/TR/xsl/#border-style">§7.31.8</a></td> <td><a name="fo-property-border-style" id="fo-property-border-style">border-style</a></td> <td class="complete">Complete</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only "solid" works</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -5139,7 +4489,6 @@ <td><a name="fo-property-border-spacing" id= "fo-property-border-spacing">border-spacing</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5153,7 +4502,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5164,7 +4512,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5183,49 +4530,30 @@ "http://www.w3.org/TR/xsl/#font">§7.31.13</a></td> <td><a name="fo-property-font" id="fo-property-font">font</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td> - <ul> - <li>[0.94 and later] Enum values other than "inherit" not yet supported.</li> - </ul> - </td> + <td>Enum values other than "inherit" not yet supported.</td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#margin">§7.31.14</a></td> <td><a name="fo-property-margin" id="fo-property-margin">margin</a></td> <td class="complete">Complete</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only on pages and regions</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#padding">§7.31.15</a></td> <td><a name="fo-property-padding" id="fo-property-padding">padding</a></td> <td class="complete">Complete</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] only one value allowed</li> - <li>[0.20.5] only implemented for blocks</li> - <li>[0.20.5] can't be used to make extra space (use indents + spaces instead)</li> - <li>[0.20.5] can be used to control how much the background-color extends beyond the - content rectangle</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -5233,7 +4561,6 @@ <td><a name="fo-property-page-break-after" id= "fo-property-page-break-after">page-break-after</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5245,7 +4572,6 @@ <td><a name="fo-property-page-break-before" id= "fo-property-page-break-before">page-break-before</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5257,7 +4583,6 @@ <td><a name="fo-property-page-break-inside" id= "fo-property-page-break-inside">page-break-inside</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5279,15 +4604,10 @@ "http://www.w3.org/TR/xsl/#position">§7.31.20</a></td> <td><a name="fo-property-position" id="fo-property-position">position</a></td> <td class="complete">Complete</td> - <td class="partial">partial</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.20.5] "inherit" not handled</li> - </ul> - </td> + <td> </td> </tr> <tr> <td align="center"><a href= @@ -5297,7 +4617,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -5309,20 +4628,13 @@ <td class="partial">partial</td> <td class="partial">partial</td> <td class="partial">partial</td> - <td class="partial">partial</td> - <td> - <ul> - <li>[0.20.5] Only works as a shorthand for baseline-shift property.</li> - <li>[0.94 and later] Percentages are not supported, yet.</li> - </ul> - </td> + <td>Percentages are not supported, yet.</td> </tr> <tr> <td align="center"><a href= "http://www.w3.org/TR/xsl/#white-space">§7.31.23</a></td> <td><a name="fo-property-white-space" id="fo-property-white-space">white-space</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5333,15 +4645,10 @@ "http://www.w3.org/TR/xsl/#xml.lang">§7.31.24</a></td> <td><a name="fo-property-xml:lang" id="fo-property-xml:lang">xml:lang</a></td> <td class="complete">Complete</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td> - <ul> - <li>[0.95] Very basic parsing; no validation of the specified value.</li> - </ul> - </td> + <td>Very basic parsing; no validation of the specified value.</td> </tr> </table> @@ -5356,20 +4663,19 @@ <th rowspan="2" align="center">Citation</th> <th rowspan="2">Function Name</th> <th rowspan="2" align="center">XSL-FO Conformance Level</th> - <th colspan="4" align="center">Support in FOP</th> + <th colspan="3" align="center">Support in FOP</th> <th rowspan="2">Comments</th> </tr> <tr> - <th align="center">0.20.5 (ancient)</th> - <th align="center">0.94 (stable)</th> <th align="center">0.95 (stable)</th> + <th align="center">1.0 (stable)</th> <th align="center">develop- ment</th> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e5860">§5.10.1</a></td> - <td class="category" colspan="7"><a name="fo-function-number-section" id= + <td class="category" colspan="6"><a name="fo-function-number-section" id= "fo-function-number-section">Number Functions</a></td> </tr> <tr> @@ -5380,7 +4686,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5391,7 +4696,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5402,7 +4706,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5413,7 +4716,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5424,7 +4726,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5435,14 +4736,13 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#expr-color-functions">§5.10.2</a></td> - <td class="category" colspan="7"><a name="fo-function-color-section" id= + <td class="category" colspan="6"><a name="fo-function-color-section" id= "fo-function-color-section">Color Functions</a></td> </tr> <tr> @@ -5453,7 +4753,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5461,7 +4760,6 @@ "http://www.w3.org/TR/xsl/#expr-color-functions">§5.10.2</a></td> <td><a name="fo-function-rgb-icc" id="fo-function-rgb-icc">rgb-icc</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5472,7 +4770,6 @@ "http://www.w3.org/TR/xsl/#expr-color-functions">§5.10.2</a></td> <td><a name="fo-function-system-color" id="fo-function-system-color">system-color</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5482,7 +4779,7 @@ <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e5948">§5.10.3</a></td> - <td class="category" colspan="7"><a name="fo-function-font-section" id= + <td class="category" colspan="6"><a name="fo-function-font-section" id= "fo-function-font-section">Font Functions</a></td> </tr> <tr> @@ -5493,14 +4790,13 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> <td class="category" align="center"><a href= "http://www.w3.org/TR/xsl/#d0e5961">§5.10.4</a></td> - <td class="category" colspan="7"><a name="fo-function-property-value-section" id= + <td class="category" colspan="6"><a name="fo-function-property-value-section" id= "fo-function-property-value-section">Property Value Functions</a></td> </tr> <tr> @@ -5512,7 +4808,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5523,7 +4818,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5534,7 +4828,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5545,7 +4838,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5557,7 +4849,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5569,7 +4860,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> <tr> @@ -5578,7 +4868,6 @@ <td><a name="fo-function-from-table-column" id= "fo-function-from-table-column">from-table-column</a></td> <td class="basic">Basic</td> - <td class="no">no</td> <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> @@ -5593,7 +4882,6 @@ <td class="yes">yes</td> <td class="yes">yes</td> <td class="yes">yes</td> - <td class="yes">yes</td> <td> </td> </tr> <tr> @@ -5605,7 +4893,6 @@ <td class="no">no</td> <td class="no">no</td> <td class="no">no</td> - <td class="no">no</td> <td> </td> </tr> </table> diff --git a/src/documentation/content/xdocs/dev/extensions.xml b/src/documentation/content/xdocs/dev/extensions.xml index 62e846c0f..769a663af 100644 --- a/src/documentation/content/xdocs/dev/extensions.xml +++ b/src/documentation/content/xdocs/dev/extensions.xml @@ -45,8 +45,8 @@ To add your own extension you need to do the following things. </p> <ol> <li>Write code that implements your extension functionality. The easiest place to -start is by looking at the code in org.apache.fop.extension, and by looking at the examples in the <code>examples</code> directory.</li> - <li>Create a class that implements the org.apache.fop.fo.ElementMapping interface. ElementMapping is a hashmap of all of the elements in a particular namespace, which makes it easier for FOP to create a different object for each element. +start is by looking at the code in org.apache.fop.fo.extensions, and by looking at the examples in the <code>examples</code> directory.</li> + <li>Create a class that extends the abstract org.apache.fop.fo.ElementMapping class. ElementMapping is a hashmap of all of the elements in a particular namespace, which makes it easier for FOP to create a different object for each element. ElementMapping objects are static to save on memory. They are loaded by FOP when parsing starts to validate input.</li> <li>Create the following file: "/META-INF/services/org.apache.fop.fo.ElementMapping", which should contain the fully qualified classname of your ElementMapping implementation class.</li> diff --git a/src/documentation/content/xdocs/dev/release.xml b/src/documentation/content/xdocs/dev/release.xml index ef9b34b1c..4e54df872 100644 --- a/src/documentation/content/xdocs/dev/release.xml +++ b/src/documentation/content/xdocs/dev/release.xml @@ -37,16 +37,26 @@ The purpose of documenting it here is to facilitate consistency, ensure that the <li>Determine whether further testing is required.</li> <li>Commit any outstanding changes</li> <li>Create a branch called <code>branches/fop-v_vv</code></li> - <li>Edit release notes (<code>README</code> and <code>status.xml</code> in the root).</li> - <li>Update the <code>index.xml</code>, <code>site.xml</code> and <code>download.xml</code> for the new version.</li> + <li>Edit release notes (<code>README</code> and + <code>status.xml</code> in the root).</li> + <li>Add the release to <code>news-data.xml</code>; + remove links to release notes of older versions from this file.</li> + <li>Update the FAQ (<code>faq.xml</code>) to the new release.</li> + <li>Check and update the copyright year in NOTICE and build.xml.</li> + <li>Update the file <code>doap.rdf</code>, and the files + <code>index.xml</code>, <code>site.xml</code>, + <code>download.xml</code>, <code>fo.xml</code>, + <code>maillist.xml</code>, <code>quickstartguide.xml</code>, + <code>faq.xml</code> and <code>status.xml</code> + in directory <code>xdocs</code> for the new version.</li> <li>Update the version numbers in the release column on the compliance page (<code>compliance.xml</code>); update the compliance in the release column to the current state (development column).</li> <li>Update version number in <code>build.xml</code> (not to be merged back into trunk).</li> <li>Copy trunk documentation directory to a new directory with - the version number, and update any links and the .htaccess - file for redirections.</li> + the new version number, and update the .htaccess file for + redirections.</li> <li>Copy <code>test/fotree/disabled-testcases.xml</code> and <code>test/layoutengine/disabled-testcases.xml</code> to the new version directory @@ -54,17 +64,20 @@ The purpose of documenting it here is to facilitate consistency, ensure that the <code><version>/layoutengine/disabled-testcases.xml</code>. Copy <code>known-issues.xml</code> to the new version directory. Copy <code>knownissues-overview.xml</code> from the - previous to the new version directory.</li> + current to the new version directory, and update the <code>xi:include</code> + links in it.</li> + <li>Update the tab names and directories in tabs.xml</li> <li>Delete the previous version directory.</li> + <li>Update index.xml in the new version directory.</li> <li>Build the dist files (<code>build[.sh] dist</code>) and upload them to your web directory on <code>people.apache.org</code></li> <li>Ask on fop-dev to check the branch and the generated dist files for errors.</li> - <li>Tag the source tree with the release ID. For example, if the release is 0.94: - <code>svn copy https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_94 https://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_94</code></li> + <li>Tag the source tree with the release ID. For example, if the release is 1.0: + <code>svn copy https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-1_0 https://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-1_0</code></li> <li>Make a fresh checkout with the just created tag: - <code>svn co https://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_94</code></li> + <code>svn co https://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-1_0</code></li> <li>Copy jimi and jai to lib/ (jimi-1.0.jar, jai_core.jar, jai_codec.jar)</li> <li>Copy jce-jdk13-119.jar from <link href="http://www.bouncycastle.org/latest_releases.html"> from http://www.bouncycastle.org/latest_releases.html</link> to lib/</li> @@ -74,15 +87,15 @@ The purpose of documenting it here is to facilitate consistency, ensure that the <li>Alternatively, create a build-local.properties file that points to the above libs.</li> <li>Run build[.sh] dist. Do this using Sun JDK 1.4.2_08 or later. A Forrest installation is needed.</li> <li>Create signatures. Don't forget to upload your KEY: - <code>gpg -a -b --force-v3-sigs fop-0.94-src.tar.gz</code> etc.</li> + <code>gpg -a -b --force-v3-sigs fop-1.0-src.tar.gz</code> etc.</li> <li>Upload the dist and signature files to your web directory on people.apache.org (An account on minotaur is needed): - <code>scp fop-0.94*.tar.gz* + <code>scp fop-1.0*.tar.gz* chrisg@people.apache.org:public_html/</code></li> <li>Check permissions: <code>chmod 664 ... ; chgrp xmlgraphics ...</code></li> - <li>Add MD5 sums: <code>md5 fop-0.94-src.tar.gz > - fop-0.94-src.tar.gz.md5</code> etc.</li> + <li>Add MD5 sums: <code>md5 fop-1.0-src.tar.gz > + fop-1.0-src.tar.gz.md5</code> etc.</li> <li>Make a test download.</li> <li>Start a vote for the release on <code>general@xmlgraphics.a.o</code>. The message should point diff --git a/src/documentation/content/xdocs/download.xml b/src/documentation/content/xdocs/download.xml index fb04d52e0..d8fbe9978 100644 --- a/src/documentation/content/xdocs/download.xml +++ b/src/documentation/content/xdocs/download.xml @@ -91,16 +91,16 @@ <tr> <td>Repository URL</td> <td> - <link href="http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95/"> - <code>http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95/</code> + <link href="http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-1_0/"> + <code>http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-1_0/</code> </link> </td> </tr> <tr> <td>Web view</td> <td> - <link href="http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95/"> - <code>http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95/</code> + <link href="http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-1_0/"> + <code>http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-1_0/</code> </link> </td> </tr> @@ -110,16 +110,16 @@ <tr> <td>Repository URL</td> <td> - <link href="http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_94/"> - <code>http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_94/</code> + <link href="http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95/"> + <code>http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95/</code> </link> </td> </tr> <tr> <td>Web view</td> <td> - <link href="http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_94/"> - <code>http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_94/</code> + <link href="http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95/"> + <code>http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95/</code> </link> </td> </tr> diff --git a/src/documentation/content/xdocs/examples.xml b/src/documentation/content/xdocs/examples.xml index 296b7550c..5df3c5804 100644 --- a/src/documentation/content/xdocs/examples.xml +++ b/src/documentation/content/xdocs/examples.xml @@ -82,7 +82,7 @@ </p> <p> Developers will find the first steps to a test suite for all implemented -formatting objects and properties in xml-fop/test/xml/. +formatting objects and properties in test/xml in the source distribution. </p> </section> <section> diff --git a/src/documentation/content/xdocs/faq.xml b/src/documentation/content/xdocs/faq.xml index 082a42ab7..c2f6cb7ca 100644 --- a/src/documentation/content/xdocs/faq.xml +++ b/src/documentation/content/xdocs/faq.xml @@ -136,14 +136,13 @@ <question>When is the next released planned?</question> <answer> <p> - When it's ready and the committers have enough time to go through - the time-consuming process of creating a release. We - released version 0.95 on August 6th, 2008, and intend to - release version 1.0 once we consider it "feature complete", major - work is still in progress regarding page flows with changing page width - (changing IPD, to be precise). If you - want to speed up the process, consider - <link href="dev/index.html#involved">contributing</link> to FOP.</p> + When it's ready and the committers have enough time to go + through the time-consuming process of creating a release. We + released version 1.0 on 21 July 2010, and will release version + 1.1 when we accumulated enough additions and bug fixes. If + you want to speed up the process, consider <link + href="dev/index.html#involved">contributing</link> to + FOP.</p> </answer> </faq> <faq id="redesign"> @@ -198,10 +197,8 @@ <p>If you are running FOP from the command line:</p> <ul> <li> - Use the <code>fop.bat</code>, <code>fop</code> or <code>fop.sh</code> command file from the FOP - distribution. If you have a FOP version older than 0.20.5, - ensure the directory where FOP and these files have been - installed is the current working directory. + Use the command file <code>fop.bat</code>, <code>fop.cmd</code> or <code>fop.js</code> on MS Windows, or <code>fop</code> on Unix/Linux from the FOP + distribution. </li> <li> If this doesn't help, check whether still all the jar files @@ -213,7 +210,7 @@ If you run FOP embedded in your servlet, web application or other Java application, check the classpath of the application. Check the also the information pertaining to <link - href="0.95/servlets.html#servlet-engine">servlet engines</link> + href="1.0/servlets.html#servlet-engine">servlet engines</link> for further hints. </p> <p> @@ -243,7 +240,7 @@ <question>I get an OutOfMemoryException.</question> <answer> <p> - See <link href="0.95/running.html#memory">FOP Memory</link>. + See <link href="1.0/running.html#memory">FOP Memory</link>. </p> </answer> </faq> @@ -304,7 +301,7 @@ <p> If you use XSLT, problems in your style sheet and in your source XML also can produce a NullPointerException. <link - href="0.95/running.html#check-input">Run the transformation + href="1.0/running.html#check-input">Run the transformation separately</link> to check for this, usually you'll get a detailed error message from the XSLT processor. </p> @@ -382,7 +379,7 @@ </p> <p> Try also setting the <link - href="0.95/configuration.html#general-elements">font-base + href="1.0/configuration.html#general-elements">font-base configuration</link>. </p> </answer> @@ -443,7 +440,7 @@ public class DefaultErrorListener implements ErrorListener { <p> To avoid the warning you can simply delete the old Font Cache file, which lives in ${base}\conf\font.cache (see <link - href="0.95/configuration.html#general-elements">font-base + href="1.0/configuration.html#general-elements">font-base configuration</link>). Or you can disable Font Caching altogether using the option "use-cache." </p> @@ -453,7 +450,7 @@ public class DefaultErrorListener implements ErrorListener { <part id="part-output"> <title>Problems with FOP output</title> <faq id="leader-expansion"> - <question>Leaders don't work anymore in 0.94 or later. Instead of + <question>Leaders don't work in current FOP. Instead of filling the line, only three dots or a short ruler is output.</question> <answer> @@ -534,7 +531,7 @@ Check the following:</p> <p>Other possibilities:</p> <ul> <li>The image format is not supported or not supported completely. - See <link href="0.95/graphics.html">FOP Graphics Formats</link> for a + See <link href="1.0/graphics.html">FOP Graphics Formats</link> for a list of supported formats and related issues.</li> <li>The graphic may be too large to fit into the intended space.</li> <li>There may be something (static content) that is obscuring the @@ -546,14 +543,14 @@ Check the following:</p> <faq id="png-fails"> <question>My graphical images do not work properly.</question> <answer> - <p>See <link href="0.95/graphics.html">FOP Graphics Formats</link> for a + <p>See <link href="1.0/graphics.html">FOP Graphics Formats</link> for a list of supported graphics formats and related issues.</p> </answer> </faq> <faq id="graphic-resolution"> <question>Why is my graphic rendered at a different resolution than it was created?</question> <answer> - <p>See <link href="0.95/graphics.html#resolution">Graphics Resolution</link>.</p> + <p>See <link href="1.0/graphics.html#resolution">Graphics Resolution</link>.</p> </answer> </faq> <faq id="keep-with"> @@ -561,17 +558,12 @@ Check the following:</p> don't work.</question> <answer> <p> - These properties are not implemented on version 0.20.5 and earlier, - except on table rows. More recent FOP releases have extensive support for - these properties. The current release, FOP 0.95, still supports the + Current FOP releases have extensive support for + these properties. The current release, FOP 1.0, still supports the values "always" and "never" only, no numerical values. There may be a few places where keep-* still don't work, this should be very rare. </p> <p> - If you still have to use FOP 0.20.5, you have to nest stuff to be - kept together in a table. - </p> - <p> The concept is called “blind table”. The table is used for pure layout reasons and is not obvious in the output. </p> @@ -604,9 +596,7 @@ Check the following:</p> <question>My tables are missing, or missing their content.</question> <answer> <p> - Check for <code>fo:table-body</code> around the rows. FOP up to 0.20.4 doesn't - raise an error if it is omitted, it just drops the content. More - recent releases will catch this problem. + Check for <code>fo:table-body</code> around the rows. Usually FOP will catch this problem. </p> <p> Also, the <code>fo:table-with-caption</code> element is not implemented, tables @@ -656,7 +646,7 @@ Check the following:</p> </answer> </faq> <faq id="keep-together"> - <question>FOP 0.95 and FOP 0.94 behave differently when <code>keep-together="always"</code> + <question>FOP behaves differently from earlier versions when <code>keep-together="always"</code> is set on table cells</question> <answer> <p>Support for inline-level keeps has been added in FOP 0.95, and setting @@ -712,7 +702,7 @@ Check the following:</p> <answer> <p>Make sure you have set the language and optionally the country attributes for an appropriate XSL-FO element (fo:page-sequence, fo:block or fo:character):</p> <source><![CDATA[<fo:page-sequence language="fi">]]></source> - <p>See <link href="0.95/hyphenation.html#support">Hyphenation Support</link> for details and instructions on using hyphenation with FOP.</p> + <p>See <link href="1.0/hyphenation.html#support">Hyphenation Support</link> for details and instructions on using hyphenation with FOP.</p> <p>Explicitly enable hyphenation for an appropriate XSL-FO element (fo:block, fo:character):</p> <source><![CDATA[<fo:block hyphenate="true">]]></source> </answer> @@ -721,7 +711,6 @@ Check the following:</p> <question>When I use margins, my content in a nested table or block-containers gets indented twice. Is this a bug?</question> <answer> <p> - (Applies to version 0.90 and later) No, although you might easily think so. The problem has to do with property inheritance of the start-indent and end-indent properties to which the margin properties are mapped. Apache @@ -747,7 +736,7 @@ Check the following:</p> than Java2D. These can lead to different layout decisions when the same document is rendered with different renderers. An alternative approach to fix this problem might be available but it hasn't been tested, yet. See also the - <link href="0.95/output.html#general-fonts">notes on fonts in the various output formats</link>. + <link href="1.0/output.html#general-fonts">notes on fonts in the various output formats</link>. </p> </answer> </faq> @@ -758,7 +747,7 @@ Check the following:</p> <question>How do I use FOP in a servlet?</question> <answer> <p> - See <link href="0.95/servlets.html">Using FOP in a Servlet</link>. + See <link href="1.0/servlets.html">Using FOP in a Servlet</link>. </p> </answer> </faq> @@ -767,7 +756,7 @@ Check the following:</p> transformation?</question> <answer> <p> - See <link href="0.95/servlets.html#xslt">Using FOP in a Servlet with XSLT Transformation</link>. + See <link href="1.0/servlets.html#xslt">Using FOP in a Servlet with XSLT Transformation</link>. </p> </answer> </faq> @@ -775,7 +764,7 @@ Check the following:</p> <question>How do I pass parameters to the XSLT transformation?</question> <answer> <p> - See <link href="0.95/servlets.html#xslt">Using FOP in a Servlet with XSLT Transformation</link>. + See <link href="1.0/servlets.html#xslt">Using FOP in a Servlet with XSLT Transformation</link>. </p> </answer> </faq> @@ -793,7 +782,7 @@ Check the following:</p> <question>How do I set the baseDir property in a servlet environment?</question> <answer> <p> - See <link href="0.95/embedding.html#config-internal">Setting the Configuration Programmatically</link>. + See <link href="1.0/embedding.html#config-internal">Setting the Configuration Programmatically</link>. </p> </answer> </faq> @@ -801,7 +790,7 @@ Check the following:</p> <question>How do I use a user configuration file from a servlet?</question> <answer> <p> - See <link href="0.95/embedding.html#config-external">Using a Configuration File in an Embedded App</link>. + See <link href="1.0/embedding.html#config-external">Using a Configuration File in an Embedded App</link>. </p> </answer> </faq> @@ -810,7 +799,7 @@ Check the following:</p> get FOP working for various servlet engines?</question> <answer> <p> - See <link href="0.95/servlets.html#servlet-engine">Servlet Engines</link>. + See <link href="1.0/servlets.html#servlet-engine">Servlet Engines</link>. </p> </answer> </faq> @@ -818,7 +807,7 @@ Check the following:</p> <question>Can FOP be used in multithreaded environments?</question> <answer> <p> - See <link href="0.95/embedding.html#multithreading">Multithreading FOP</link>. + See <link href="1.0/embedding.html#multithreading">Multithreading FOP</link>. </p> </answer> </faq> @@ -829,13 +818,13 @@ Check the following:</p> <question>The rendering of SVG text in my PDF is of poor quality. Can I control this?</question> <answer> - <p>See <link href="0.95/graphics.html#svg-pdf-text">Placing SVG Text into PDF</link>.</p> + <p>See <link href="1.0/graphics.html#svg-pdf-text">Placing SVG Text into PDF</link>.</p> </answer> </faq> <faq id="svg-headless"> <question>How do I use FOP with SVG on headless servers?</question> <answer> - <p>See <link href="0.95/graphics.html#batik">FOP: Graphics (Batik)</link>.</p> + <p>See <link href="1.0/graphics.html#batik">FOP: Graphics (Batik)</link>.</p> </answer> </faq> <faq id="svghangs"> @@ -898,14 +887,14 @@ Can I control this?</question> <faq id="svg-scaling"> <question>Why is my SVG rendered at a size different from that specified in my fo:external-graphic element?</question> <answer> - <p>See <link href="0.95/graphics.html#svg-scaling">SVG Scaling</link>.</p> + <p>See <link href="1.0/graphics.html#svg-scaling">SVG Scaling</link>.</p> </answer> </faq> <faq id="svg-attribute-required"> <question>FOP fails with something like "The attribute "width" of the element <rect> is required". What's wrong?</question> <answer> <p> - This phenomenon occurs since FOP 0.92 beta. It surfaced due to a change in the handling of non-FO namespaces. It's not a + This phenomenon is not a bug in FOP, but rather in the dependent packages: Apache Batik, Apache Xalan-J and SAXON. The bug in Apache Batik will be fixed in the next release. In the latest release of Apache Xalan-J, the bug is already fixed. It only occurs in the Xalan version bundled with Sun's JVM, because Sun uses a rather old version. @@ -931,7 +920,7 @@ Can I control this?</question> <question>How do I embed fonts in PDF?</question> <answer> <p> - See the <link href="0.95/fonts.html">Fonts</link> page for information + See the <link href="1.0/fonts.html">Fonts</link> page for information about embedding fonts. </p> </answer> @@ -950,7 +939,7 @@ Can I control this?</question> set. For a variety of reasons, even those are not completely guaranteed to work, for example you can't use the fi ligature from the standard serif font. Check the <link - href="0.95/output.html#pdf-fonts">overview</link> for the default + href="1.0/output.html#pdf-fonts">overview</link> for the default PDF fonts. </p> <p> @@ -958,7 +947,7 @@ Can I control this?</question> the desired character. Furthermore the font must be available on the machine where the PDF is viewed or it must have been embedded in the PDF file. See <link - href="0.95/fonts.html">embedding fonts</link>. + href="1.0/fonts.html">embedding fonts</link>. </p> <p> For most symbols, it is better to select the symbol font @@ -976,7 +965,7 @@ Can I control this?</question> <faq id="pdf-postprocess"> <question>What tools are available for post-processing my PDF document?</question> <answer> - <p>See <link href="0.95/output.html#pdf-postprocess">PDF Post-processing</link>.</p> + <p>See <link href="1.0/output.html#pdf-postprocess">PDF Post-processing</link>.</p> </answer> </faq> <faq id="pdf-security"> @@ -984,8 +973,8 @@ Can I control this?</question> to my PDF document?</question> <answer> <p> - See <link href="0.95/pdfencryption.html">PDF Encryption</link>. - See also <link href="0.95/output.html#pdf-postprocess">PDF Post-processing</link>. + See <link href="1.0/pdfencryption.html">PDF Encryption</link>. + See also <link href="1.0/output.html#pdf-postprocess">PDF Post-processing</link>. </p> </answer> </faq> @@ -993,13 +982,13 @@ Can I control this?</question> <question>How do I add document properties (title, author, etc.) to my PDF document?</question> <answer> - <p>See <link href="0.95/output.html#pdf-postprocess">PDF Post-processing</link>.</p> + <p>See <link href="1.0/metadata.html">Metadata</link>.</p> </answer> </faq> <faq id="pdf-watermark"> <question>How do I add watermarks to my PDF document?</question> <answer> - <p>See <link href="0.95/output.html#pdf-watermark">PDF Watermarks</link>.</p> + <p>See <link href="1.0/output.html#pdf-watermark">PDF Watermarks</link>.</p> </answer> </faq> <faq id="pdf-print-contortion"> @@ -1018,7 +1007,7 @@ Can I control this?</question> <question>How do I control the Acrobat bookmark display?</question> <answer> <p> - FOP versions 0.93 and later support the starting-state property of the XSL 1.1 + FOP supports the starting-state property of the XSL 1.1 <link href="http://www.w3.org/TR/xsl11/#fo_bookmark">fo:bookmark</link> element which can be used for this. The color, font-style and font-weight properties on @@ -1035,7 +1024,7 @@ Can I control this?</question> <answer> <p> This is a problem of Internet Explorer requesting the content several - times. Please see the <link href="0.95/servlets.html#ie">notes on Internet Explorer</link> + times. Please see the <link href="1.0/servlets.html#ie">notes on Internet Explorer</link> for more information. </p> </answer> diff --git a/src/documentation/content/xdocs/fo.xml b/src/documentation/content/xdocs/fo.xml index d0e73f302..6546478c9 100644 --- a/src/documentation/content/xdocs/fo.xml +++ b/src/documentation/content/xdocs/fo.xml @@ -519,7 +519,7 @@ This applies similarly to the extent of the after region and the bottom margin o <section id="external-resources"> <title>External Resources</title> <p>Resources needed by an XSL-FO file that are external to it (graphics, for example), are defined in the XSL-FO standard as being of type "uri-specification". This is defined in the standard at <jump href="http://www.w3.org/TR/xsl11/#datatype">Section 5.11 Property Datatypes</jump>, which includes a link to the URI standard itself. Refer to the XSL-FO and URI standards themselves for more detailed instructions.</p> - <p>URIs may be either absolute or relative to a base URI. (See <link href="0.94/configuration.html">FOP: Configuration</link> for information on setting the base URI for a FOP session). Here is an example referencing an external-graphic that is relative to the base URI:</p> + <p>URIs may be either absolute or relative to a base URI. (See <link href="1.0/configuration.html">FOP: Configuration</link> for information on setting the base URI for a FOP session). Here is an example referencing an external-graphic that is relative to the base URI:</p> <source><![CDATA[<fo:external-graphic src="url('images/logo.jpg')"/>]]></source> <p>Here is an example referencing an external-graphic that is an absolute URI on a local filesystem:</p> <source><![CDATA[fo:external-graphic src="url('file:d:///images/logo.jpg')"/>]]></source> diff --git a/src/documentation/content/xdocs/index.xml b/src/documentation/content/xdocs/index.xml index 0faa31a5f..ce40ca61c 100644 --- a/src/documentation/content/xdocs/index.xml +++ b/src/documentation/content/xdocs/index.xml @@ -29,13 +29,13 @@ <p>Apache FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects (XSL-FO) and an output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting - pages to a specified output. <link href="0.95/output.html">Output formats</link> + pages to a specified output. <link href="1.0/output.html">Output formats</link> currently supported include PDF, PS, PCL, AFP, XML (area tree representation), Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF. </p> <figure width="480" height="260" src="images/document.jpg" alt="Render Diagram" /> <p> - A stable release of the latest version of FOP (<link href="0.95/">0.95</link>) is + A stable release of the latest version of FOP (<link href="1.0/">1.0</link>) is available. It's the third stable release after the large redesign effort and implements a large subset of the <link href="http://www.w3.org/TR/xsl11/">XSL-FO Version 1.1 W3C @@ -69,7 +69,7 @@ The most common method is to convert semantic XML to XSL-FO, using an XSLT trans Portable Document Format Specification (Version 1.4) from Adobe Systems. </p> - <p>Conformance to the XML 1.0 Recommendation, XSLT 1.0 Recommendation and the XML Namespaces Recommendation is + <p>Conformance to the XML 1.0 and 1.1 Recommendations, XSLT 1.0 and 2.0 Recommendations and the XML Namespaces Recommendation is understood. Other relevant documents, such as the XPath and XLink Working Drafts, are referenced as necessary. The FOP Project will attempt to use the latest version of evolving specifications. </p> diff --git a/src/documentation/content/xdocs/maillist.xml b/src/documentation/content/xdocs/maillist.xml index becc32464..93a6b6cbe 100644 --- a/src/documentation/content/xdocs/maillist.xml +++ b/src/documentation/content/xdocs/maillist.xml @@ -84,7 +84,7 @@ href="dev/index.html#mail-fop-dev">Development pages</link>.</note> source, or other semantic XML? If so, the question is <em>almost certainly not appropriate to this list</em>. In general, the only input documents that are appropriate on this list are XSL-FO snippets. See <link - href="0.94/running.html#check-input">Running Xalan</link> for instructions about capturing the XSL-FO document that is actually submitted to FOP. If you haven't examined the XSL-FO document yourself, then you are not yet prepared to formulate a FOP-specific question.</li> + href="1.0/running.html#check-input">Running Xalan</link> for instructions about capturing the XSL-FO document that is actually submitted to FOP. If you haven't examined the XSL-FO document yourself, then you are not yet prepared to formulate a FOP-specific question.</li> <li>If you are providing one or more XSL-FO snippets: <ul> <li>Have you reduced them to the shortest possible complete, <strong>self-contained</strong> document that demonstrates the problem? Please do so.</li> diff --git a/src/documentation/content/xdocs/news-data.xml b/src/documentation/content/xdocs/news-data.xml index 8d876ea95..62908926c 100644 --- a/src/documentation/content/xdocs/news-data.xml +++ b/src/documentation/content/xdocs/news-data.xml @@ -17,6 +17,15 @@ --> <!-- $Id$ --> <news> + <item date="2010-07-21" title="Apache FOP 1.0 Released"> + <p> + The Apache FOP team is delighted to present you a production grade + release of the new FOP codebase. This release + contains many bug fixes and new features. See the <a + href="1.0/releaseNotes_1.0.html">Release Notes</a> for a list of + the most important changes. + </p> + </item> <item date="2009-12-14" title="New committer"> <p>Welcome Pascal Sancho!</p> </item> @@ -47,8 +56,7 @@ <item date="2007-08-24" title="Apache FOP 0.94 Released"> <p>The Apache FOP team is pleased to present you the second production grade release of the new FOP codebase. This release contains many bug - fixes and new features. See the <a - href="0.94/releaseNotes_0.94.html">Release Notes</a> for a list of + fixes and new features. See the Release Notes for a list of the most important changes.</p> </item> <item date="2007-01-26" title="New Committer"> diff --git a/src/documentation/content/xdocs/quickstartguide.xml b/src/documentation/content/xdocs/quickstartguide.xml index 7993e4bde..4ea1d0110 100644 --- a/src/documentation/content/xdocs/quickstartguide.xml +++ b/src/documentation/content/xdocs/quickstartguide.xml @@ -29,15 +29,15 @@ <p>The goal of this <strong>Quick Start Guide</strong> is to help novice users get Apache FOP up and running quickly. Typically, you'll need to:</p> <ol> <li><link href="download.html">Download FOP</link></li> - <li><link href="0.95/compiling.html">Build FOP</link> (you can skip this step if you download the binary distribution!)</li> - <li><link href="0.95/configuration.html">Configure FOP</link></li> - <li><link href="0.95/running.html">Run FOP</link></li> + <li><link href="1.0/compiling.html">Build FOP</link> (you can skip this step if you download the binary distribution!)</li> + <li><link href="1.0/configuration.html">Configure FOP</link></li> + <li><link href="1.0/running.html">Run FOP</link></li> </ol> <p>Here are some links to help you find out what FOP can do, as well as how and where to get help:</p> <ul> - <li><link href="0.95/embedding.html">Calling FOP from a Java Application</link></li> - <li><link href="0.95/servlets.html">Using FOP in Servlets</link></li> - <li><link href="0.95/anttask.html">Using FOP in an 'Ant' Build Script</link></li> + <li><link href="1.0/embedding.html">Calling FOP from a Java Application</link></li> + <li><link href="1.0/servlets.html">Using FOP in Servlets</link></li> + <li><link href="1.0/anttask.html">Using FOP in an 'Ant' Build Script</link></li> <li><link href="compliance.html" title="FOP Compliance">XSL-FO Compliance</link> (what FOP supports and what it doesn't)</li> <li><link href="faq.html">FAQs</link></li> <li><link href="gethelp.html">Getting Help</link></li> @@ -45,7 +45,7 @@ </ul> <p> Once you've familiarized yourself with the basics, you can get more detailed information, - in the detailed FOP <link href="0.95/index.html">product documentation</link>. + in the detailed FOP <link href="1.0/index.html">product documentation</link>. </p> </section> @@ -65,7 +65,7 @@ <li> Get a command prompt in the <fop-home> directory and write:<br/> Windows: <code>fop -fo examples/fo/basic/readme.fo -awt</code><br/> - Unix: <code>./fop.sh -fo examples/fo/basic/readme.fo -awt</code><br/> + Unix: <code>./fop -fo examples/fo/basic/readme.fo -awt</code><br/> </li> <li> If all went well, this should open a window showing you a "readme"-style document. @@ -112,7 +112,7 @@ Finally, let's put the previous two steps together: Go back to the command prompt and enter the following command:<br/> Windows: <code>fop -xml name.xml -xsl name2fo.xsl -pdf name.pdf</code><br/> - Unix: <code>./fop.sh -xml name.xml -xsl name2fo.xsl -pdf name.pdf</code><br/> + Unix: <code>./fop -xml name.xml -xsl name2fo.xsl -pdf name.pdf</code><br/> </li> <li> You've produced your first PDF with Apache FOP! Please open <code>name.pdf</code> diff --git a/src/documentation/content/xdocs/relnotes.xml b/src/documentation/content/xdocs/relnotes.xml deleted file mode 100644 index 0037817bd..000000000 --- a/src/documentation/content/xdocs/relnotes.xml +++ /dev/null @@ -1,551 +0,0 @@ -<?xml version="1.0" standalone="no"?> -<!-- - 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$ --> -<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> -<document> - <header> - <title>Release Notes</title> - <version>$Revision$</version> - </header> - - <body> -<section> - <title>FOP 0.92 beta</title> - <p> - This is the third release after the big redesign effort. FOP 0.92 beta has now - stabilized the API. In addition it contains many bug fixes and new features. - </p> - <p> - We would like to encourage you to download the code and to play with it. - We're still in the process of stabilizing - the code. We welcome any feedback you might have and even more, any - other form of help to get the project forward. - </p> - <p>Caveats:</p> - <ul> - <li> - This release is still a beta release. If you intend to use this software in a production - environment, please perform careful testing. - </li> - <li> - The API has changed between 0.91beta this release. - Please consult the <a href="0.94/upgrading.html">"Upgrading"</a> page for details. - </li> - <li> - You may experience different behaviour compared to version 0.20.5. - Please consult the <a href="0.94/upgrading.html">"Upgrading"</a> page for details. - </li> - </ul> - <p>Known Issues:</p> - <ul> - <li> - PCL, MIF and SVG output support have not been restored, yet. - </li> - <li> - Java2D/AWT support contains some problems, for example with - block-containers. - </li> - <li> - Auto table layout is not implemented, yet. - </li> - <li> - The collapsing border model on tables is not implemented, yet. Please - use border-collapse="separate" for now. - </li> - <li> - Footnotes may overlap with text of the region-body in multi-column - documents. - </li> - <li> - Space resolution does not work between footnote regions. - </li> - <li> - There's a problem involving nested block-containers and - reference-orientation 180/-180 (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=36391">Bugzilla #36391</a>) - </li> - <li> - block-containers with no height currently don't create a fence for - spaces as they should (they behave like a normal block). - </li> - <li> - Preserved linefeeds in fo:character are not handled correctly. - </li> - <li> - An empty block currently produces a fence for stacking constraints - which it shouldn't. - </li> - <li> - There are several small problems around white space handling. - </li> - <li> - Images currently don't shrink so they fit on a page when they are - too big and shrinking is allowed to happen. - </li> - <li> - Block-level content in fo:inlines may produce unwelcome results. - </li> - <li> - inline-container may not work as expected. - </li> - <li> - letter-spacing and word-spacing properties may not work as expected. - </li> - <li> - leaders with leader-pattern="use-content" may not work as expected. - </li> - <li> - keep-with-previous doesn't work inside tables and lists, yet. - </li> - <li> - White space on direct inline-level children of a marker is not - handled correctly. - </li> - <li> - If two consecutive pages don't have the same available width, the - content currently isn't properly fit into the available space on - the new page. - </li> - <li> - background-images on page-number-citations are not placed correctly. - </li> - <li> - Not all FO elements can be referenced by their "id", most notably: - table-body, table-header, table-footer and table-row. - </li> - <li> - The backgrounds of table-body, table-header, table-footer and - table-column are not painted, yet. - </li> - <li> - Border and padding conditionality are not supported on table-cells, yet. - </li> - <li> - Copy/Paste from PDF content in Acrobat Reader is not supported for - text using embedded TrueType fonts. - </li> - <li> - Column balancing in multi-column documents may not work as expected - (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=36356">Bugzilla #36356</a>) - </li> - <li> - Omitting fo:table-column or having fo:table-column without a column-width - and attempting to create columns implicitly from the first - table row is not implemented, yet (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=35656">Bugzilla #35656</a>). - </li> - <li> - Internal basic-links don't point to the exact location on a page, yet, as they - did in 0.20.5. Currently you land in the upper left corner of the page. - </li> - </ul> -</section> -<section> -<title>FOP 0.91 beta</title> - <p> - This is the second release after the big redesign effort. FOP 0.91 beta is mostly a bug - fix release but also contains some new features. - </p> - <p> - We would like to encourage you to download the code and to play with it. - We're still in the process of adding new major features and stabilizing - the code. We welcome any feedback you might have and even more, any - other form of help to get the project forward. - </p> - <p>Caveats:</p> - <ul> - <li> - This release is an beta release. If you intend to use this software in a production - environment, please perform careful testing. - </li> - <li> - The API is not to be considered stable, yet. Please be prepared - for the API to be changed in a backwards-incompatible way. - </li> - <li> - You may experience different behaviour compared to version 0.20.5. - Please consult the <a href="0.94/upgrading.html">"Upgrading"</a> page indicated above for details. - </li> - </ul> - <p>Known Issues:</p> - <ul> - <li> - PCL, MIF and SVG output support have not been restored, yet. - </li> - <li> - Java2D/AWT support contains some problems, for example with - block-containers. - </li> - <li> - Support for kerning has not been restored, yet. - </li> - <li> - Auto table layout is not implemented, yet. - </li> - <li> - The collapsing border model on tables is not implemented, yet. Please - use border-collapse="separate" for now. - </li> - <li> - Footnotes may overlap with text of the region-body in multi-column - documents. - </li> - <li> - Space resolution does not work between footnote regions. - </li> - <li> - There's a problem involving nested block-containers and - reference-orientation 180/-180 (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=36391">Bugzilla #36391</a>) - </li> - <li> - block-containers with no height currently don't create a fence for - spaces as they should (they behave like a normal block). - </li> - <li> - Preserved linefeeds in fo:character are not handled correctly. - </li> - <li> - Zero-width spaces are not handled correctly. - </li> - <li> - An empty block currently produces a fence for stacking constraints - which it shouldn't. - </li> - <li> - There are several small problems around white space handling. - </li> - <li> - Images currently don't shrink so they fit on a page when they are - too big and shrinking is allowed to happen. - </li> - <li> - Block-level content in fo:inlines may produce unwelcome results. - </li> - <li> - inline-container may not work as expected. - </li> - <li> - letter-spacing and word-spacing properties may not work as expected. - </li> - <li> - leaders with leader-pattern="use-content" may not work as expected. - </li> - <li> - keep-with-previous doesn't work inside tables and lists, yet. - </li> - <li> - White space on direct inline-level children of a marker is not - handled correctly. - </li> - <li> - If two consecutive pages don't have the same available width, the - content currently isn't properly fit into the available space on - the new page. - </li> - <li> - background-images on page-number-citations are not placed correctly. - </li> - <li> - Not all FO elements can be referenced by their "id", most notably: - table-body, table-header, table-footer and table-row. - </li> - <li> - The backgrounds of table-body, table-header, table-footer and - table-column are not painted, yet. - </li> - <li> - Border and padding conditionality are not supported on table-cells, yet. - </li> - <li> - Copy/Paste from PDF content in Acrobat Reader is not supported for - text using embedded TrueType fonts. - </li> - <li> - Column balancing in multi-column documents may not work as expected - (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=36356">Bugzilla #36356</a>) - </li> - <li> - Omitting fo:table-column or having fo:table-column without a column-width - and attempting to create columns implicitly from the first - table row is not implemented, yet (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=35656">Bugzilla #35656</a>). - </li> - <li> - Leaders with the "rule" pattern don't work for PostScript output. - </li> - <li> - break-after may in some cases cause subsequent content to be swallowed. - Please use break-before, if possible. - </li> - <li> - Internal basic-links don't point to the exact location on a page, yet, as they - did in 0.20.5. Currently you land in the upper left corner of the page. - </li> - </ul> -</section> -<section> - <title>FOP 0.90 alpha 1</title> - <p> - This is the first preview release after the big redesign effort. - </p> - <p> - We would like to encourage you to download the code and to play with it. - We're still in the process of adding new major features and stabilizing - the code. We welcome any feedback you might have and even more, any - other form of help to get the project forward. - </p> - <p>Caveats:</p> - <ul> - <li> - This release is a (unstable) preview release and not intended for use in a - production environment. Use at your own risk! - </li> - <li> - The API is not to be considered stable, yet. Please be prepared - for the API to be changed in a backwards-incompatible way. - </li> - <li> - You may experience different behaviour compared to version 0.20.5. - Please consult the <a href="0.94/upgrading.html">"Upgrading"</a> page indicated above for details. - </li> - </ul> - <p>Known Issues:</p> - <ul> - <li> - PCL, MIF and SVG output support have not been restored, yet. - </li> - <li> - Java2D/AWT support contains some problems, for example with - block-containers. - </li> - <li> - Support for kerning has not been restored, yet. - </li> - <li> - Auto table layout is not implemented, yet. - </li> - <li> - The collapsing border model on tables is not implemented, yet. Please - use border-collapse="separate" for now. - </li> - <li> - Footnotes may overlap with text of the region-body in multi-column - documents. - </li> - <li> - Space resolution does not work between footnote regions. - </li> - <li> - There's a problem involving nested block-containers and - reference-orientation 180/-180 (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=36391">Bugzilla #36391</a>) - </li> - <li> - block-containers with no height currently don't create a fence for - spaces as they should (they behave like a normal block). - </li> - <li> - Preserved linefeeds in fo:character are not handled correctly. - </li> - <li> - Zero-width spaces are not handled correctly. - </li> - <li> - An empty block currently produces a fence for stacking constraints - which it shouldn't. - </li> - <li> - There are several small problems around white space handling. - </li> - <li> - Images currently don't shrink so they fit on a page when they are - too big and shrinking is allowed to happen. - </li> - <li> - Block-level content in fo:inlines may produce unwelcome results. - </li> - <li> - inline-container may not work as expected. - </li> - <li> - letter-spacing and word-spacing properties may not work as expected. - </li> - <li> - leaders with leader-pattern="use-content" may not work as expected. - </li> - <li> - keep-with-previous doesn't work inside tables and lists, yet. - </li> - <li> - White space on direct inline-level children of a marker is not - handled correctly. - </li> - <li> - If two consecutive pages don't have the same available width, the - content currently isn't properly fit into the available space on - the new page. - </li> - <li> - background-images on page-number-citations are not placed correctly. - </li> - <li> - Not all FO elements can be referenced by their "id", most notably: - table-body, table-header, table-footer and table-row. - </li> - <li> - The backgrounds of table-body, table-header, table-footer and - table-column are not painted, yet. - </li> - <li> - Border and padding conditionality are not supported on table-cells, yet. - </li> - <li> - Copy/Paste from PDF content in Acrobat Reader is not supported for - text using embedded TrueType fonts. - </li> - <li> - Column balancing in multi-column documents may not work as expected - (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=36356">Bugzilla #36356</a>) - </li> - <li> - Omitting fo:table-column or having fo:table-column without a column-width - and attempting to create columns implicitly from the first - table row is not implemented, yet (<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=35656">Bugzilla #35656</a>). - </li> - <li> - Leaders with the "rule" pattern don't work for PostScript output. - </li> - </ul> -</section> -<section> - <title>FOP 0.20.5</title> - <p>This was the last release in the 0.20.x series (aka maintenance branch).</p> - <p>Important changes since the last release (0.20.4):</p> - <ul> - <li>Some hyphenation patterns (cs, da, de, de_DR, el, en, en_US, fr, nl, - no, sk, tr) have been removed due to licensing reasons - (en_GB hyphenation has been renamed to en). - We're still working on this issue - (see <a href="http://wiki.apache.org/xmlgraphics-fop/FOPAudits/March2003"> - Wiki</a> for details). - </li> - <li>Documentation is now built with <a href="http://xml.apache.org/forrest/"> - Forrest</a> (version 0.4). You need to install Forrest if you want build the docs - yourself. (See - <a href="http://xml.apache.org/forrest/your-project.html">Using Forrest</a>) - </li> - <li>The following JARs have been updated: - Xerces to version 2.2.1, Xalan to version 2.4.1 and Batik to version 1.5beta4. - </li> - <li>FOP has been compiled with Jimi support, but Jimi is not included in the - FOP distribution. To use it, first download - <a href="http://java.sun.com/products/jimi/">Jimi</a>, then extract - the archive, then - copy JimiProClasses.zip to FOP's lib dir and rename it to jimi-1.0.jar. - </li> - <li>FOP has been compiled with JAI support, but JAI is not included in the - FOP distribution. To use it, simply install - <a href="http://java.sun.com/products/java-media/jai">JAI</a>. - </li> - <li>Links in PDF won't generate multiple link rectangles anymore. If this causes - a problem you can set the system property "links.merge" to "no". - </li> - <li>FOP has been compiled with cryptography support. See - <a href="0.94/pdfencryption.html"> - PDF encryption</a> for details about installation and usage. - </li> - <li>The behaviour of leader has changed. See - <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=19341">bug #19341</a>, - <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=19465">bug #19465</a> - and <code>leader.fo</code> (examples). - </li> - <li> - For a more detailed list of changes, see the CHANGES file in the root of the - FOP distribution. - </li> - </ul> - -</section> -<section> - <title>FOP 0.20.4</title> - <p>Important changes since 0.20.3:</p> - <ul> - <li>FOP should now work with any JAXP1.1 compliant parser/transformer. - It has been successfully tested with Xerces/Xalan, Saxon and JDK1.4 - (which includes Crimson and Xalan). - </li> - <li>The following JARs have been updated: - Xerces to version 2.0.1, Xalan to version 2.3.1 and Batik to version 1.5beta2. - </li> - <li>FOP has been compiled with Jimi support this time - but you still have to download - <a href="http://java.sun.com/products/jimi/">Jimi</a> - and copy it to lib/ to get PNG support (no need to build FOP yourself though). - </li> - <li>Building FOP with JDK1.2 does not work. Running is ok except - support for additional truetype fonts in AWT Viewer. - </li> - <li>Logging has been changed from LogKit to Avalon's Logger Interface. - (see <a href="0.94/embedding.html">Embedding</a> for details). - </li> - <li>Building under JDK 1.4: - You need to add a method in - <code>src/org/apache/fop/svg/PDFGraphics2D.java</code> - (search for jdk1.4 and remove the comments) - </li> - <li>To decrease the size of the distributions, ant, xml-docs, design-docs - and the hyphenation sources have been removed from the binary distribution. - Javadocs have been removed from the source distribution (use - <code>build javadocs</code> to generate them). - </li> - <li>Documentaion generation is broken in the maintenance branch at the moment - (Stylebook needs xerces1). The docs for this release are generated from the trunk. - </li> - <li> - For a more detailed list of changes, see the CHANGES file in the root of the FOP distribution. - </li> - </ul> - </section> - -<section> - <title>FOP 0.20.3</title> - <p>Important Information:</p> - <ul> - <li>This version supports the - <a href="http://www.w3.org/TR/2001/REC-xsl-20011015/">XSL-FO Version 1.0 - W3C Recommendation</a> syntax. So don't forget to update your - Stylesheets: - <br/>Just rename the <code>master-name</code> property to <code>master-reference</code> - on <code>fo:page-sequence</code>, <code>fo:single-page-master-reference</code>, - <code>fo:repeatable-page-master-reference</code> and - <code>fo:conditional-page-master-reference</code>.</li> - <li>JDK 1.2 (or later) is required</li> - <li>Jimi has been removed for licensing reasons - <br/>If you need PNG support you have to download - <a href="http://java.sun.com/products/jimi/">Jimi</a>, - copy it to lib/ and build FOP yourself</li> - <li>Building under JDK 1.4: - <br/>You need to add a method in - <code>src/org/apache/fop/svg/PDFGraphics2D.java</code> - (search for jdk1.4 and remove the comments) - </li> - <li> - For a more detailed list of changes, see the CHANGES file in the root of the FOP distribution. - </li> - </ul> - </section> - - </body> -</document> - diff --git a/src/documentation/content/xdocs/resources.xml b/src/documentation/content/xdocs/resources.xml index db45d7437..708f10334 100644 --- a/src/documentation/content/xdocs/resources.xml +++ b/src/documentation/content/xdocs/resources.xml @@ -37,24 +37,29 @@ <section id="specs-xslt"> <title>XSLT</title> <ul> - <li><jump href="http://www.w3.org/TR/xslt">XSLT Recommendation</jump></li> + <li><jump href="http://www.w3.org/TR/xslt">XSLT 1.0 Recommendation</jump></li> + <li><jump href="http://www.w3.org/TR/xslt20">XSLT 2.0 Recommendation</jump></li> </ul> </section> <section id="specs-xml"> <title>XML</title> <ul> - <li><jump href="http://www.w3.org/TR/REC-xml">XML Recommendation</jump></li> + <li><jump href="http://www.w3.org/TR/xml">XML 1.0 </jump></li> + <li><jump href="http://www.w3.org/TR/xml11">XML 1.1 </jump></li> <li><jump href="http://sax.sourceforge.net/">Simple API for XML (SAX)</jump></li> <li><jump href="http://www.w3.org/TR/REC-DOM-Level-1">Document Object Model (DOM)</jump></li> - <li><jump href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML Recommendation</jump></li> + <li><jump href="http://www.w3.org/TR/DOM-Level-2-Core">Document Object Model (DOM) Level 2 Core Specification</jump></li> + <li><jump href="http://www.w3.org/TR/DOM-Level-3-Core">Document Object Model (DOM) Level 3 Core Specification</jump></li> + <li><jump href="http://www.w3.org/TR/xml-names/">Namespaces in XML 1.0 </jump></li> + <li><jump href="http://www.w3.org/TR/xml-names11/">Namespaces in XML 1.1</jump></li> </ul> </section> <section id="specs-java"> <title>Java</title> <ul> - <li><jump href="http://java.sun.com/j2se/1.3/docs/api/index.html">Java JDK 1.3 Documentation</jump></li> - <li><jump href="http://java.sun.com/j2se/1.4/docs/api/index.html">Java JDK 1.4 Documentation</jump></li> - <li><jump href="http://java.sun.com/j2se/1.5/docs/api/index.html">Java JDK 1.5 Documentation</jump></li> + <li><jump href="http://java.sun.com/j2se/1.4/docs/api/index.html">Java 2 Platform, Standard Edition, v 1.4.2 API Specification</jump></li> + <li><jump href="http://java.sun.com/j2se/1.5/docs/api/index.html">Java 2 Platform Standard Edition 5.0 API Specification </jump></li> + <li><jump href="http://java.sun.com/javase/6/docs/api/index.html">Java Platform, Standard Edition 6 API Specification</jump></li> </ul> </section> <section id="specs-pdf"> @@ -83,13 +88,15 @@ <title>XSL-FO</title> <ul> <li>[online book] <jump href="http://www.ibiblio.org/xml/books/bible2/chapters/ch18.html">The XML Bible</jump>, by Elliotte Rusty Harold. Chapter 18 of XSL Formatting Objects</li> +<!-- <li>[online article] <jump href="http://www.sun.com/software/xml/developers/slides-dtd/">Using Formatting Objects with the Slides DTD</jump>, by Paul Sandoz.</li> +--> <li>[online article] <jump href="http://www.xml.com/pub/a/2001/01/17/xsl-fo/index.html">Using XSL Formatting Objects</jump>, by J. David Eisenberg.</li> <li>[online reference] <jump href="http://zvon.org/xxl/xslfoReference/Output/index.html">XSL FO reference</jump>, by Miloslav Nic.</li> <li>[online reference] <jump href="http://www.dpawson.co.uk/xsl/sect3/index.html">Dave Pawson's XSL-FO FAQ</jump>.</li> <li>[book] <jump href="http://www.oreilly.com/catalog/xslfo">XSL-FO</jump>, by Dave Pawson, O'Reilly & Associates, 2002, ISBN 0-596-00355-2. See online version above.</li> - <li>[book] <jump href="http://www.phptr.com/browse/product.asp?product_id={CEA527AF-412D-49DA-8C1F-46E0A519B8D8}">Definitive XSL-FO</jump>, by G. Ken Holman, Prentice Hall PTR, 2003, ISBN 0-131-40374-5.</li> - <li>[book] <jump href="http://www.sams.com/catalog/product.asp?product_id={F7ADFA46-6AF1-497C-9163-0D6337F727B3}">XSL Formatting Objects Developer's Handbook</jump>, by Doug Lovell, Sams, 2002, ISBN 0-672-32281-1.</li> + <li>[book] <jump href="http://www.amazon.com/exec/obidos/ASIN/0131403745/ref=ase_cranesoftwrig-20">Definitive XSL-FO</jump>, by G. Ken Holman, Prentice Hall PTR, 2003, ISBN 0-131-40374-5.</li> + <li>[book] <jump href="http://www.amazon.com/XSL-Formatting-Objects-Developers-Handbook/dp/0672322811">XSL Formatting Objects Developer's Handbook</jump>, by Doug Lovell, Sams, 2002, ISBN 0-672-32281-1.</li> <li>[book] <jump href="http://www.cranesoftwrights.com/training/index.htm#pfux">Practical Formatting Using XSLFO</jump>, Crane Softwrights Ltd., 2003, ISBN 1-894049-11-X.</li> </ul> </section> @@ -97,12 +104,13 @@ <title>XSLT</title> <ul> <li>[online resource] <jump href="http://www.w3.org/Style/XSL/">Extensible Stylesheet Language Family (XSL)</jump>, W3C XSL Family page.</li> - <li>[book] <jump href="http://wrox.com/books/1861005067.htm">XSLT Programmer's Reference</jump>, by Michael H. Kay, Wrox Press, ISBN 1-861-00506-7.</li> + <li>[book] <jump href="http://www.amazon.com/XSLT-Programmers-Reference-2nd-Michael/dp/1861005067">XSLT Programmer's Reference</jump>, by Michael H. Kay, Wrox Press, ISBN 1-861-00506-7.</li> + <li>[book] <jump href="http://www.wrox.com/WileyCDA/WroxTitle/XSLT-2-0-and-XPath-2-0-Programmer-s-Reference-4th-Edition.productCd-0470192747.html">XSLT2 and XPath2 Programmer's Reference</jump>, by Michael H. Kay, Wrox Press, ISBN: 978-0-470-19274-0.</li> <li>[book] <jump href="http://www.oreilly.com/catalog/xslt">XSLT</jump>, by Doug Tidwell, O'Reilly & Associates, 2001, ISBN 0-596-00053-7.</li> <li>[book] <jump href="http://www.oreilly.com/catalog/xsltckbk">XSLT Cookbook</jump>, by Sal Mangano, O'Reilly & Associates, 2002, ISBN 0-596-00372-2.</li> <li>[article] <jump href="http://www.dpawson.co.uk/xsl/index.html">Dave Pawson's XSL FAQ</jump>.</li> <li>[book] <jump href="http://www.oreilly.com/catalog/xpathpointer">XPath and XPointer: Locating Content in XML Documents</jump>, by John E. Simpson, O'Reilly & Associates, 2002, ISBN 0-596-00291-2.</li> - <li>[book] <jump href="http://www.wiley.com/cda/product/0,,0471416207,00.html">XSL Essentials</jump>, by Michael Fitzgerald, John Wiley & Sons, 2001, ISBN 0-471-41620-7.</li> + <li>[book] <jump href="http://www.amazon.com/XSL-Essentials-Michael-Fitzgerald/dp/0471416207">XSL Essentials</jump>, by Michael Fitzgerald, John Wiley & Sons, 2001, ISBN 0-471-41620-7.</li> <li>[book] <jump href="http://www.oreilly.com/catalog/javaxslt">Java and XSLT</jump>, by Eric M. Burke, O'Reilly & Associates, 2001, ISBN 0-596-00143-6.</li> </ul> </section> @@ -110,7 +118,7 @@ <title>XML</title> <ul> <li>[online book] <jump href="http://www.ibiblio.org/xml/books/bible2">The XML Bible</jump>, by Elliotte Rusty Harold. See hardcopy version below.</li> - <li>[book] <jump href="http://www.wiley.com/cda/product/0,,0764547607,00.html">The XML Bible</jump>, by Elliotte Rusty Harold, John Wiley & Sons, ISBN 0-764-54760-7. See online version above.</li> + <li>[book] <jump href="http://www.amazon.com/XML-Bible-Elliotte-Rusty-Harold/dp/0764547607">The XML Bible</jump>, by Elliotte Rusty Harold, John Wiley & Sons, ISBN 0-764-54760-7. See online version above.</li> <li>[online resource] A great number of additional XML-related books and articles can be found at the <jump href="http://xml.oreilly.com">O'Reilly XML Site</jump>.</li> </ul> </section> @@ -204,10 +212,9 @@ <section id="products-pdf"> <title>PDF post-processors</title> <ul> - <li>[software] <jump href="http://incubator.apache.org/pdfbox">Apache PDFBox</jump> (Incubating, Apache License V2.0)</li> + <li>[software] <jump href="http://pdfbox.apache.org">Apache PDFBox</jump> (Apache License V2.0)</li> <li>[software] <jump href="http://www.lowagie.com/iText">iText</jump> (MPL and LGPL)</li> - <li>[software] <jump href="http://www.etymon.com/pjc">PJ Classic</jump> by Etymon (GPL)</li> - <li>[software] <jump href="http://www.etymon.com/pjx">PJ Professional</jump> by Etymon (commercial)</li> + <li>[software] <jump href="http://www.etymon.com/epub.html">PJX</jump> by Etymon (GPL)</li> <li>[software] <jump href="http://www.accesspdf.com/pdftk/">pdftk</jump> the pdf toolkit</li> </ul> </section> @@ -227,11 +234,13 @@ <title>Other products</title> <ul> <li>[software] <jump href="http://foray.sourceforge.net/">FOray</jump> a renderer for converting XML files to PDF via XSL Formatting Object elements (FOP fork)</li> +<!-- <li>[software] <jump href="http://defoe.sourceforge.net/folio">Folio</jump> a renderer for XML files containing Formatting Object elements (aka FOP Alt.Design)</li> +--> <li>[software] <jump href="http://xmlroff.org/">xmlroff</jump> an open source XSL-FO implementation written in C (BSD-style license)</li> <li>[commercial software developer] <jump href="http://antennahouse.com/product.htm">Antenna House</jump> - XSL Formatter, WordMLToFo, XML Editor...</li> - <li>[commercial software developer] <jump href="http://www.renderx.net/">RenderX</jump> XEP, EnMasse, Docbench...</li> + <li>[commercial software developer] <jump href="http://www.renderx.com/tools/index.html">RenderX</jump> XEP, EnMasse, Docbench...</li> <li>[software] <jump href="http://html2fo.sourceforge.net/">html2fo</jump> is a converter from HTML to XSL-FO (GPL).</li> <li>[software] <jump href="http://wh2fo.sourceforge.net/">wh2fo</jump> is a converter from Word HTML to XSL-FO (MPL).</li> diff --git a/src/documentation/content/xdocs/site.xml b/src/documentation/content/xdocs/site.xml index f65b7fa65..2d55ae3f2 100644 --- a/src/documentation/content/xdocs/site.xml +++ b/src/documentation/content/xdocs/site.xml @@ -56,14 +56,15 @@ <!-- END Home tab --> - + <!-- - BEGIN Version 0.94 documentation tab + BEGIN Version 0.95 documentation tab --> - <trunk label="FOP 0.94" href="0.94/" tab="previousversion"> + <trunk label="FOP 0.95" href="0.95/" tab="previousversion"> <about label="About" href="index.html"/> - <release label="Release Notes" href="releaseNotes_0.94.html"/> - <changes label="Changes" href="changes_0.94.html"/> + <release label="Release Notes" href="releaseNotes_0.95.html"/> + <changes label="Changes (0.95)" href="changes_0.95.html"/> + <changes-beta label="Changes (0.95beta)" href="changes_0.95beta.html"/> <knownissues label="Known Issues" href="knownissues_overview.html"/> <upgrading label="Upgrading" href="upgrading.html"/> @@ -86,21 +87,21 @@ <fonts label="Fonts" href="fonts.html"/> <hyphenation label="Hyphenation" href="hyphenation.html"/> <extensions label="Extensions" href="extensions.html"/> + <metadata label="Metadata" href="metadata.html"/> </features> </trunk> <!-- - END Version 0.94 documentation tab + END Version 0.95 documentation tab --> <!-- - BEGIN Version 0.95 documentation tab + BEGIN Version 1.0 documentation tab --> - <trunk label="FOP 0.95" href="0.95/" tab="stableversion"> + <trunk label="FOP 1.0" href="1.0/" tab="stableversion"> <about label="About" href="index.html"/> - <release label="Release Notes" href="releaseNotes_0.95.html"/> - <changes label="Changes (0.95)" href="changes_0.95.html"/> - <changes-beta label="Changes (0.95beta)" href="changes_0.95beta.html"/> + <release label="Release Notes" href="releaseNotes_1.0.html"/> + <changes label="Changes (1.0)" href="changes_1.0.html"/> <knownissues label="Known Issues" href="knownissues_overview.html"/> <upgrading label="Upgrading" href="upgrading.html"/> @@ -123,12 +124,14 @@ <fonts label="Fonts" href="fonts.html"/> <hyphenation label="Hyphenation" href="hyphenation.html"/> <extensions label="Extensions" href="extensions.html"/> + <events label="Events" href="events.html"/> <metadata label="Metadata" href="metadata.html"/> + <accessibility label="Accessibility" href="accessibility.html"/> </features> </trunk> <!-- - END Version 0.95 documentation tab + END Version 1.0 documentation tab --> <!-- @@ -221,7 +224,7 @@ <deploy label="Deploy" href="dev/" tab="development"> <doc label="Doc Mgmt" href="doc.html"/> <release label="Release" href="release.html"/> - <bugs label="Bugs" href="http://issues.apache.org/bugzilla/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Fop&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&order=bugs.component"/> + <bugs label="Bugs" href="http://issues.apache.org/bugzilla/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Fop&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&order=bug_severity%2Cpriority%20DESC"/> </deploy> <resources label="Resources" href="dev/" tab="development"> @@ -245,8 +248,6 @@ </xmlgraphics.apache.org> <svn-repo href="http://svn.apache.org/repos/asf/xmlgraphics/fop/"> <trunk href="trunk/"/> - <stable href="tags/fop-0_94"/> - <maintenance href="branches/fop-0_20_2-maintain/"/> </svn-repo> <forrest.apache.org href="http://forrest.apache.org/"/> <xml.apache.org href="http://xml.apache.org/"> diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index fa3e2e643..fa52809e5 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -27,31 +27,27 @@ <body> <section> <title>Status</title> - <p>[last updated 4 March 2008]</p> - <figure width="585" height="175" src="images/track.png" alt="Planning and branches of FOP development"/> + <p>[last updated 5 July 2010]</p> <p> - This is the development status of Apache FOP. Development on - the maintenance branch where FOP 0.20.5 came from has been - halted. The code base has been largely redesigned. The new - code base has reached release 0.95. + FOP version 0.95 was released on 5 August 2008. FOP version 1.0 was released on 21 July 2010. </p> </section> <section> <title>Development Status</title> - <p>The FOP code base has been largely rewritten, to address - design issues for layout and performance. The new design makes - it better possible to be conformant to the spec and be able to - handle large documents.</p> - <p>The redesign of the code base has largely been completed. The - new code reached production quality with release 0.93. In the - course of 2008 or 2009 we hope to release version 1.0.</p> + + <p>The FOP code base is gradually evolving, from version 0.90 + released on 22 November 2005, to version 1.0 released on 21 July + 2010. Further releases in the 1.x series may be expected.</p> + <p>FOP releases before version 0.90 were based on a different + code base. The last release in that series was version 0.20.5, + released on 18 July 2003. This series is no longer maintained.</p> <p> If you're looking for a long-term road-map we have to disappoint you. This is Open Source and we're mostly volunteers working in their free time. What we have is an idea where we want to go. How fast we get there depends on the available time, on how well our ideas work out while developing and on you! There's a <a href="http://wiki.apache.org/xmlgraphics-fop/RoadMap">document in the Wiki</a> - where you can get a glimpse of what points we're currently focusing on. + where ideas for new developments may be registered and documented. </p> <section id="component-status"> <title>Status of the individual components</title> @@ -131,180 +127,5 @@ </table> </section> </section> - <section> - <title>Maintenance Status</title> - <p> - The latest release of the maintenance branch is FOP 0.20.5, released on July 18th, 2003. - The maintenance branch has been frozen in 2004 so the team can concentrate on the new code - base. - </p> - </section> - <!--section id="stats"> - <title>Statistics</title> - <table> - <tr> - <th> </th> - <th>0.20.5</th> - <th>Development (aka trunk, redesign) as of August 1, 2003</th> - </tr> - <tr> - <td colspan="3"> </td> - </tr> - <tr> - <th colspan="3">Binaries</th> - </tr> - <tr> - <td>fop jar</td> - <td>1,485 kb</td> - <td>2,132 kb</td> - </tr> - <tr> - <td>hyphenation (in fop.jar)</td> - <td>348 kb</td> - <td>1,358 kb</td> - </tr> - <tr> - <td>ant jar</td> - <td> </td> - <td>707 kb</td> - </tr> - <tr> - <td>avalon-framework jar</td> - <td>62 kb</td> - <td>72 kb</td> - </tr> - <tr> - <td>batik jar</td> - <td>2,063 kb</td> - <td>2,213 kb</td> - </tr> - <tr> - <td>commons-io-dev jar</td> - <td> </td> - <td>71 kb</td> - </tr> - <tr> - <td>commons-lang jar</td> - <td> </td> - <td>190 kb</td> - </tr> - <tr> - <td>servlet jar</td> - <td> </td> - <td>39 kb</td> - </tr> - <tr> - <td>xalan jar</td> - <td>1,007 kb</td> - <td>1,007 kb</td> - </tr> - <tr> - <td>xerces jar</td> - <td>816 kb</td> - <td>816 kb</td> - </tr> - <tr> - <td>xml-apis jar</td> - <td>112 kb</td> - <td>112 kb</td> - </tr> - <tr> - <th colspan="3">Lines of Source Code, using "find . -iname "*.java" | xargs cat | wc -l"</th> - </tr> - <tr> - <td>org.apache.fop.fo.*</td> - <td>20,297</td> - <td>22,306</td> - </tr> - <tr> - <td>org.apache.fop.layout.*</td> - <td>9,444</td> - <td>4,238</td> - </tr> - <tr> - <td>org.apache.fop.layoutmgr.*</td> - <td> </td> - <td>10,069</td> - </tr> - <tr> - <td>org.apache.fop.area.*</td> - <td> </td> - <td>5,791</td> - </tr> - <tr> - <td>org.apache.fop.render.*</td> - <td>18,387</td> - <td>11,527</td> - </tr> - <tr> - <td>org.apache.fop.pdf.*</td> - <td>10,203</td> - <td>15,669</td> - </tr> - <tr> - <td>org.apache.fop.rtf.*</td> - <td>0</td> - <td>12,747</td> - </tr> - <tr> - <td>Other</td> - <td>29,821</td> - <td>32,543</td> - </tr> - <tr> - <td>Total</td> - <td>88,152</td> - <td>114,890</td> - </tr> - <tr> - <th colspan="3">Files, using "find . -iname "*.java" | wc -l"</th> - </tr> - <tr> - <td>org.apache.fop.fo.*</td> - <td>122</td> - <td>127</td> - </tr> - <tr> - <td>org.apache.fop.layout.*</td> - <td>49</td> - <td>24</td> - </tr> - <tr> - <td>org.apache.fop.layoutmgr.*</td> - <td> </td> - <td>38</td> - </tr> - <tr> - <td>org.apache.fop.area.*</td> - <td> </td> - <td>39</td> - </tr> - <tr> - <td>org.apache.fop.render.*</td> - <td>48</td> - <td>36</td> - </tr> - <tr> - <td>org.apache.fop.pdf.*</td> - <td>51</td> - <td>70</td> - </tr> - <tr> - <td>org.apache.fop.rtf.*</td> - <td> </td> - <td>80</td> - </tr> - <tr> - <td>Other</td> - <td>129</td> - <td>140</td> - </tr> - <tr> - <td>Total</td> - <td>399</td> - <td>554</td> - </tr> - </table> - </section--> </body> </document> diff --git a/src/documentation/content/xdocs/tabs.xml b/src/documentation/content/xdocs/tabs.xml index 9b423f996..a9c458fe3 100644 --- a/src/documentation/content/xdocs/tabs.xml +++ b/src/documentation/content/xdocs/tabs.xml @@ -21,8 +21,8 @@ <tabs software="FOP" title="FOP" copyright="@year@ The Apache Software Foundation" xmlns:xlink="http://www.w3.org/1999/xlink"> <tab label="Home" dir=""/> - <tab label="Version 0.94" dir="0.94/"/> <tab label="Version 0.95" dir="0.95/"/> + <tab label="Version 1.0" dir="1.0/"/> <tab label="FOP Trunk" dir="trunk/"/> <tab label="Development" dir="dev/"/> </tabs> diff --git a/src/documentation/content/xdocs/team.xml b/src/documentation/content/xdocs/team.xml index add9c651a..ff763ebd1 100644 --- a/src/documentation/content/xdocs/team.xml +++ b/src/documentation/content/xdocs/team.xml @@ -40,8 +40,9 @@ is a Java/VB Programmer from England.</li> <li id="jb"><link href="mailto:jay@bryantcs.com">Jay Bryant</link> (JB) is a freelance information architect in Austin, TX.</li> - <li id="ac"><link href="mailto:acumiskey@apache.org">Adrian Cumiskey</link> (AC), - is a Java and Perl Programmer from St Albans, United Kingdom.</li> + <li id="ac"><link href="mailto:acumiskey AT apache.org">Adrian Cumiskey</link> (AC) + is an XP/Agile practitioner with interests in open source content management and electronic + document generation. He is a UK expat now residing in Singapore.</li> <li id="ad"><link href="mailto:adelmelle@apache.org">Andreas Delmelle</link> (AD)</li> <!-- Luca prefers the mail address with "AT", to stop spam, etc. --> <li id="lf"><link href="mailto:lfurini AT cs.unibo.it">Luca Furini</link> (LF) diff --git a/src/documentation/content/xdocs/trunk/configuration.xml b/src/documentation/content/xdocs/trunk/configuration.xml index eaa788990..aae7de7f0 100644 --- a/src/documentation/content/xdocs/trunk/configuration.xml +++ b/src/documentation/content/xdocs/trunk/configuration.xml @@ -151,6 +151,7 @@ default-page-settings element to specify the two values.</td> <td>"height" 11 inches, "width" 8.26 inches</td> </tr> + <!-- Disabled: no simultaneous Renderer and IF implementations at the moment <tr> <td>prefer-renderer</td> <td>boolean (true, false)</td> @@ -163,6 +164,7 @@ </td> <td>false</td> </tr> + --> <tr> <td>use-cache</td> <td>boolean (true, false)</td> @@ -176,8 +178,7 @@ <tr> <td>cache-file</td> <td>String</td> - <td>This options specifies the file/directory path of the fop cache file. - This option can also be specified on the command-line using the -cache option. + <td>This option specifies the file/directory path of the fop cache file. This file is currently only used to cache font triplet information for future reference.</td> <td>${base}/conf/fop.cache</td> </tr> diff --git a/src/documentation/content/xdocs/trunk/embedding.xml b/src/documentation/content/xdocs/trunk/embedding.xml index 362062bbe..3289e68c7 100644 --- a/src/documentation/content/xdocs/trunk/embedding.xml +++ b/src/documentation/content/xdocs/trunk/embedding.xml @@ -29,7 +29,7 @@ <section id="overview"> <title>Overview</title> <p> - Review <a href="running.html">Running FOP</a> for important information that applies + Review <a href="running.html">Running FOP</a> for important information that applies to embedded applications as well as command-line use, such as options and performance. </p> <p> @@ -54,7 +54,7 @@ <section id="basics"> <title>Basic Usage Pattern</title> <p> - Apache FOP relies heavily on JAXP. It uses SAX events exclusively to receive the XSL-FO + Apache FOP relies heavily on JAXP. It uses SAX events exclusively to receive the XSL-FO input document. It is therefore a good idea that you know a few things about JAXP (which is a good skill anyway). Let's look at the basic usage pattern for FOP... </p> @@ -82,14 +82,14 @@ try { // Step 4: Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - - // Step 5: Setup input and output for XSLT transformation + + // Step 5: Setup input and output for XSLT transformation // Setup input stream Source src = new StreamSource(new File("C:/Temp/myfile.fo")); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Step 6: Start XSLT transformation and FOP processing transformer.transform(src, res); @@ -102,13 +102,13 @@ try { </p> <ul> <li> - <strong>Step 1:</strong> You create a new FopFactory instance. The FopFactory instance holds + <strong>Step 1:</strong> You create a new FopFactory instance. The FopFactory instance holds references to configuration information and cached data. It's important to reuse this instance if you plan to render multiple documents during a JVM's lifetime. </li> <li> <strong>Step 2:</strong> You set up an OutputStream that the generated document - will be written to. It's a good idea to buffer the OutputStream as demonstrated + will be written to. It's a good idea to buffer the OutputStream as demonstrated to improve performance. </li> <li> @@ -119,26 +119,26 @@ try { OutputStream you've setup up in step 2. </li> <li> - <strong>Step 4</strong> We recommend that you use JAXP Transformers even - if you don't do XSLT transformations to generate the XSL-FO file. This way - you can always use the same basic pattern. The example here sets up an - "identity transformer" which just passes the input (Source) unchanged to the - output (Result). You don't have to work with a SAXParser if you don't do any + <strong>Step 4</strong> We recommend that you use JAXP Transformers even + if you don't do XSLT transformations to generate the XSL-FO file. This way + you can always use the same basic pattern. The example here sets up an + "identity transformer" which just passes the input (Source) unchanged to the + output (Result). You don't have to work with a SAXParser if you don't do any XSLT transformations. </li> <li> - <strong>Step 5:</strong> Here you set up the input and output for the XSLT - transformation. The Source object is set up to load the "myfile.fo" file. - The Result is set up so the output of the XSLT transformation is sent to FOP. - The FO file is sent to FOP in the form of SAX events which is the most efficient - way. Please always avoid saving intermediate results to a file or a memory buffer + <strong>Step 5:</strong> Here you set up the input and output for the XSLT + transformation. The Source object is set up to load the "myfile.fo" file. + The Result is set up so the output of the XSLT transformation is sent to FOP. + The FO file is sent to FOP in the form of SAX events which is the most efficient + way. Please always avoid saving intermediate results to a file or a memory buffer because that affects performance negatively. </li> <li> - <strong>Step 6:</strong> Finally, we start the XSLT transformation by starting - the JAXP Transformer. As soon as the JAXP Transformer starts to send its output - to FOP, FOP itself starts its processing in the background. When the - <code>transform()</code> method returns FOP will also have finished converting + <strong>Step 6:</strong> Finally, we start the XSLT transformation by starting + the JAXP Transformer. As soon as the JAXP Transformer starts to send its output + to FOP, FOP itself starts its processing in the background. When the + <code>transform()</code> method returns FOP will also have finished converting the FO file to a PDF file and you can close the OutputStream. <note label="Tip!"> It's a good idea to enclose the whole conversion in a try..finally statement. If @@ -148,16 +148,16 @@ try { </li> </ul> <p> - If you're not totally familiar with JAXP Transformers, please have a look at the + If you're not totally familiar with JAXP Transformers, please have a look at the <a href="#examples">Embedding examples</a> below. The section contains examples for all sorts of use cases. If you look at all of them in turn you should be able to see the patterns in use and the flexibility this approach offers without adding too much complexity. </p> <p> - This may look complicated at first, but it's really just the combination of an + This may look complicated at first, but it's really just the combination of an XSL transformation and a FOP run. It's also easy to comment out the FOP part - for debugging purposes, for example when you're tracking down a bug in your + for debugging purposes, for example when you're tracking down a bug in your stylesheet. You can easily write the XSL-FO output from the XSL transformation to a file to check if that part generates the expected output. An example for that can be found in the <a href="#examples">Embedding examples</a> (See "ExampleXML2FO"). @@ -170,7 +170,7 @@ try { While with Avalon Logging the loggers were directly given to FOP, FOP now retrieves its logger(s) through a statically available LogFactory. This is similar to the general pattern that you use when you work with Apache Log4J directly, for example. - We call this "static logging" (Commons Logging, Log4J) as opposed to "instance logging" + We call this "static logging" (Commons Logging, Log4J) as opposed to "instance logging" (Avalon Logging). This has a consequence: You can't give FOP a logger for each processing run anymore. The log output of multiple, simultaneously running FOP instances is sent to the same logger. @@ -204,12 +204,12 @@ try { the <a href="events.html">Events subsystem</a> is the right approach. </p> </section> - + <section id="render"> <title>Processing XSL-FO</title> <p> - Once the Fop instance is set up, call <code>getDefaultHandler()</code> to obtain a SAX - DefaultHandler instance to which you can send the SAX events making up the XSL-FO + Once the Fop instance is set up, call <code>getDefaultHandler()</code> to obtain a SAX + DefaultHandler instance to which you can send the SAX events making up the XSL-FO document you'd like to render. FOP processing starts as soon as the DefaultHandler's <code>startDocument()</code> method is called. Processing stops again when the DefaultHandler's <code>endDocument()</code> method is called. Please refer to the basic @@ -220,15 +220,15 @@ try { <section id="render-with-xslt"> <title>Processing XSL-FO generated from XML+XSLT</title> <p> - If you want to process XSL-FO generated from XML using XSLT we recommend - again using standard JAXP to do the XSLT part and piping the generated SAX - events directly through to FOP. The only thing you'd change to do that + If you want to process XSL-FO generated from XML using XSLT we recommend + again using standard JAXP to do the XSLT part and piping the generated SAX + events directly through to FOP. The only thing you'd change to do that on the basic usage pattern above is to set up the Transformer differently: </p> <source><![CDATA[ //without XSLT: //Transformer transformer = factory.newTransformer(); // identity transformer - + //with XSLT: Source xslt = new StreamSource(new File("mystylesheet.xsl")); Transformer transformer = factory.newTransformer(xslt);]]></source> @@ -237,14 +237,14 @@ try { <section id="input"> <title>Input Sources</title> <p> - The input XSL-FO document is always received by FOP as a SAX stream (see the + The input XSL-FO document is always received by FOP as a SAX stream (see the <a href="../dev/design/parsing.html">Parsing Design Document</a> for the rationale). </p> <p> - However, you may not always have your input document available as a SAX stream. + However, you may not always have your input document available as a SAX stream. But with JAXP it's easy to convert different input sources to a SAX stream so you can pipe it into FOP. That sounds more difficult than it is. You simply have - to set up the right Source instance as input for the JAXP transformation. + to set up the right Source instance as input for the JAXP transformation. A few examples: </p> <ul> @@ -273,8 +273,8 @@ try { <p> There are a variety of upstream data manipulations possible. For example, you may have a DOM and an XSL stylesheet; or you may want to - set variables in the stylesheet. Interface documentation and some cookbook - solutions to these situations are provided in + set variables in the stylesheet. Interface documentation and some cookbook + solutions to these situations are provided in <a href="http://xml.apache.org/xalan-j/usagepatterns.html">Xalan Basic Usage Patterns</a>. </p> </section> @@ -288,7 +288,7 @@ try { <title>Customizing the FopFactory</title> <p> The FopFactory holds configuration data and references to objects which are reusable over - multiple rendering runs. It's important to instantiate it only once (except in special + multiple rendering runs. It's important to instantiate it only once (except in special environments) and reuse it every time to create new FOUserAgent and Fop instances. </p> <p> @@ -299,34 +299,34 @@ try { <p> The <strong>font base URL</strong> to use when resolving relative URLs for fonts. Example: </p> - <source>fopFactory.setFontBaseURL("file:///C:/Temp/fonts");</source> + <source>fopFactory.getFontManager().setFontBaseURL("file:///C:/Temp/fonts");</source> </li> <li> <p> - The <strong>hyphenation base URL</strong> to use when resolving relative URLs for + The <strong>hyphenation base URL</strong> to use when resolving relative URLs for hyphenation patterns. Example: </p> <source>fopFactory.setHyphenBaseURL("file:///C:/Temp/hyph");</source> </li> <li> <p> - Disable <strong>strict validation</strong>. When disabled FOP is less strict about the rules + Disable <strong>strict validation</strong>. When disabled FOP is less strict about the rules established by the XSL-FO specification. Example: </p> <source>fopFactory.setStrictValidation(false);</source> </li> <li> <p> - Enable an <strong>alternative set of rules for text indents</strong> that tries to mimic the behaviour of many commercial - FO implementations, that chose to break the specification in this respect. The default of this option is - 'false', which causes Apache FOP to behave exactly as described in the specification. To enable the + Enable an <strong>alternative set of rules for text indents</strong> that tries to mimic the behaviour of many commercial + FO implementations, that chose to break the specification in this respect. The default of this option is + 'false', which causes Apache FOP to behave exactly as described in the specification. To enable the alternative behaviour, call: </p> <source>fopFactory.setBreakIndentInheritanceOnReferenceAreaBoundary(true);</source> </li> <li> <p> - Set the <strong>source resolution</strong> for the document. This is used internally to determine the pixel + Set the <strong>source resolution</strong> for the document. This is used internally to determine the pixel size for SVG images and bitmap images without resolution information. Default: 72 dpi. Example: </p> <source>fopFactory.setSourceResolution(96); // =96dpi (dots/pixels per Inch)</source> @@ -334,7 +334,7 @@ try { <li> <p> Manually add an <strong>ElementMapping instance</strong>. If you want to supply a special FOP extension - you can give the instance to the FOUserAgent. Normally, the FOP extensions can be automatically detected + you can give the instance to the FOUserAgent. Normally, the FOP extensions can be automatically detected (see the documentation on extension for more info). Example: </p> <source>fopFactory.addElementMapping(myElementMapping); // myElementMapping is a org.apache.fop.fo.ElementMapping</source> @@ -342,13 +342,13 @@ try { <li> <p> Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add - custom URI resolution functionality to FOP. For example, you can use + custom URI resolution functionality to FOP. For example, you can use <a href="ext:xml.apache.org/commons/resolver">Apache XML Commons Resolver</a> to make use of XCatalogs. Example: </p> <source>fopFactory.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolver</source> <note> Both the FopFactory and the FOUserAgent have a method to set a URIResolver. The URIResolver on the FopFactory - is primarily used to resolve URIs on factory-level (hyphenation patterns, for example) and it is always used + is primarily used to resolve URIs on factory-level (hyphenation patterns, for example) and it is always used if no other URIResolver (for example on the FOUserAgent) resolved the URI first. </note> </li> @@ -357,9 +357,9 @@ try { <section id="user-agent"> <title>Customizing the User Agent</title> <p> - The user agent is the entity that allows you to interact with a single rendering run, i.e. the processing of a single + The user agent is the entity that allows you to interact with a single rendering run, i.e. the processing of a single document. If you wish to customize the user agent's behaviour, the first step is to create your own instance - of FOUserAgent using the appropriate factory method on FopFactory and pass that + of FOUserAgent using the appropriate factory method on FopFactory and pass that to the factory method that will create a new Fop instance: </p> <source><![CDATA[ @@ -416,16 +416,16 @@ try { </li> <li> <p> - Set the <strong>target resolution</strong> for the document. This is used to - specify the output resolution for bitmap images generated by bitmap renderers - (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter + Set the <strong>target resolution</strong> for the document. This is used to + specify the output resolution for bitmap images generated by bitmap renderers + (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter effects and such. Default: 72 dpi. Example: </p> <source>userAgent.setTargetResolution(300); // =300dpi (dots/pixels per Inch)</source> </li> <li> <p> - Set <strong>your own Renderer instance</strong>. If you want to supply your own renderer or + Set <strong>your own Renderer instance</strong>. If you want to supply your own renderer or configure a Renderer in a special way you can give the instance to the FOUserAgent. Normally, the Renderer instance is created by FOP. Example: </p> @@ -433,8 +433,8 @@ try { </li> <li> <p> - Set <strong>your own FOEventHandler instance</strong>. If you want to supply your own FOEventHandler or - configure an FOEventHandler subclass in a special way you can give the instance to the FOUserAgent. Normally, + Set <strong>your own FOEventHandler instance</strong>. If you want to supply your own FOEventHandler or + configure an FOEventHandler subclass in a special way you can give the instance to the FOUserAgent. Normally, the FOEventHandler instance is created by FOP. Example: </p> <source>userAgent.setFOEventHandlerOverride(myFOEventHandler); // myFOEventHandler is an org.apache.fop.fo.FOEventHandler</source> @@ -442,7 +442,7 @@ try { <li> <p> Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add - custom URI resolution functionality to FOP. For example, you can use + custom URI resolution functionality to FOP. For example, you can use <a href="ext:xml.apache.org/commons/resolver">Apache XML Commons Resolver</a> to make use of XCatalogs. Example: </p> <source>userAgent.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolver</source> @@ -462,7 +462,7 @@ try { <section id="config-external"> <title>Using a Configuration File</title> <p> - Instead of setting the parameters manually in code as shown above you can also set + Instead of setting the parameters manually in code as shown above you can also set many values from an XML configuration file: </p> <source><![CDATA[ @@ -489,7 +489,7 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> <p> Fop instances shouldn't (and can't) be reused. Please recreate Fop and FOUserAgent instances for each rendering run using the FopFactory. - This is a cheap operation as all reusable information is held in the + This is a cheap operation as all reusable information is held in the FopFactory. That's why it's so important to reuse the FopFactory instance. </p> </section> @@ -515,12 +515,12 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> <section id="render-info"> <title>Getting information on the rendering process</title> <p> - To get the number of pages that were rendered by FOP you can call - <code>Fop.getResults()</code>. This returns a <code>FormattingResults</code> object - where you can look up the number of pages produced. It also gives you the - page-sequences that were produced along with their id attribute and their - numbers of pages. This is particularly useful if you render multiple - documents (each enclosed by a page-sequence) and have to know the number of + To get the number of pages that were rendered by FOP you can call + <code>Fop.getResults()</code>. This returns a <code>FormattingResults</code> object + where you can look up the number of pages produced. It also gives you the + page-sequences that were produced along with their id attribute and their + numbers of pages. This is particularly useful if you render multiple + documents (each enclosed by a page-sequence) and have to know the number of pages of each document. </p> </section> @@ -532,19 +532,19 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> </p> <ul> <li> - Whenever possible, try to use SAX to couple the individual components involved + Whenever possible, try to use SAX to couple the individual components involved (parser, XSL transformer, SQL datasource etc.). </li> <li> - Depending on the target OutputStream (in case of a FileOutputStream, but not - for a ByteArrayOutputStream, for example) it may improve performance considerably - if you buffer the OutputStream using a BufferedOutputStream: + Depending on the target OutputStream (in case of a FileOutputStream, but not + for a ByteArrayOutputStream, for example) it may improve performance considerably + if you buffer the OutputStream using a BufferedOutputStream: <code>out = new java.io.BufferedOutputStream(out);</code> <br/> Make sure you properly close the OutputStream when FOP is finished. </li> <li> - Cache the stylesheet. If you use the same stylesheet multiple times + Cache the stylesheet. If you use the same stylesheet multiple times you can set up a JAXP <code>Templates</code> object and reuse it each time you do the XSL transformation. (More information can be found <a class="fork" href="http://www.javaworld.com/javaworld/jw-05-2003/jw-0502-xsl.html">here</a>.) @@ -570,7 +570,7 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> If you encounter any suspicious behaviour, please notify us. </p> <p> - There is also a known issue with fonts being jumbled between threads when using + There is also a known issue with fonts being jumbled between threads when using the Java2D/AWT renderer (which is used by the -awt and -print output options). In general, you cannot safely run multiple threads through the AWT renderer. </p> @@ -578,7 +578,7 @@ fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source> <section id="examples"> <title>Examples</title> <p> - The directory "{fop-dir}/examples/embedding" contains several working examples. + The directory "{fop-dir}/examples/embedding" contains several working examples. </p> <section id="ExampleFO2PDF"> <title>ExampleFO2PDF.java</title> @@ -592,104 +592,104 @@ file to PDF using FOP. </section> <section id="ExampleXML2FO"> <title>ExampleXML2FO.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2FO.java?view=markup"> example</a> -has nothing to do with FOP. It is there to show you how an XML +has nothing to do with FOP. It is there to show you how an XML file can be converted to XSL-FO using XSLT. The JAXP API is used to do the -transformation. Make sure you've got a JAXP-compliant XSLT processor in your +transformation. Make sure you've got a JAXP-compliant XSLT processor in your classpath (ex. <a href="http://xml.apache.org/xalan-j">Xalan</a>). </p> <figure src="images/EmbeddingExampleXML2FO.png" alt="Example XML to XSL-FO"/> </section> <section id="ExampleXML2PDF"> <title>ExampleXML2PDF.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup"> example</a> -demonstrates how you can convert an arbitrary XML file to PDF -using XSLT and XSL-FO/FOP. It is a combination of the first two examples -above. The example uses JAXP to transform the XML file to XSL-FO and FOP to +demonstrates how you can convert an arbitrary XML file to PDF +using XSLT and XSL-FO/FOP. It is a combination of the first two examples +above. The example uses JAXP to transform the XML file to XSL-FO and FOP to transform the XSL-FO to PDF. </p> <figure src="images/EmbeddingExampleXML2PDF.png" alt="Example XML to PDF (via XSL-FO)"/> <p> -The output (XSL-FO) from the XSL transformation is piped through to FOP using -SAX events. This is the most efficient way to do this because the -intermediate result doesn't have to be saved somewhere. Often, novice users -save the intermediate result in a file, a byte array or a DOM tree. We -strongly discourage you to do this if it isn't absolutely necessary. The +The output (XSL-FO) from the XSL transformation is piped through to FOP using +SAX events. This is the most efficient way to do this because the +intermediate result doesn't have to be saved somewhere. Often, novice users +save the intermediate result in a file, a byte array or a DOM tree. We +strongly discourage you to do this if it isn't absolutely necessary. The performance is significantly higher with SAX. </p> </section> <section id="ExampleObj2XML"> <title>ExampleObj2XML.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2XML.java?view=markup"> example</a> -is a preparatory example for the next one. It's an example that -shows how an arbitrary Java object can be converted to XML. It's an often -needed task to do this. Often people create a DOM tree from a Java object and +is a preparatory example for the next one. It's an example that +shows how an arbitrary Java object can be converted to XML. It's an often +needed task to do this. Often people create a DOM tree from a Java object and use that. This is pretty straightforward. The example here, however, shows how -to do this using SAX, which will probably be faster and not even more +to do this using SAX, which will probably be faster and not even more complicated once you know how this works. </p> <figure src="images/EmbeddingExampleObj2XML.png" alt="Example Java object to XML"/> <p> -For this example we've created two classes: ProjectTeam and ProjectMember -(found in xml-fop/examples/embedding/java/embedding/model). They represent -the same data structure found in -xml-fop/examples/embedding/xml/xml/projectteam.xml. We want to serialize to XML a -project team with several members which exist as Java objects. -Therefore we created the two classes: ProjectTeamInputSource and +For this example we've created two classes: ProjectTeam and ProjectMember +(found in xml-fop/examples/embedding/java/embedding/model). They represent +the same data structure found in +xml-fop/examples/embedding/xml/xml/projectteam.xml. We want to serialize to XML a +project team with several members which exist as Java objects. +Therefore we created the two classes: ProjectTeamInputSource and ProjectTeamXMLReader (in the same place as ProjectTeam above). </p> <p> -The XMLReader implementation (regard it as a special kind of XML parser) is -responsible for creating SAX events from the Java object. The InputSource +The XMLReader implementation (regard it as a special kind of XML parser) is +responsible for creating SAX events from the Java object. The InputSource class is only used to hold the ProjectTeam object to be used. </p> <p> -Have a look at the source of ExampleObj2XML.java to find out how this is -used. For more detailed information see other resources on JAXP (ex. +Have a look at the source of ExampleObj2XML.java to find out how this is +used. For more detailed information see other resources on JAXP (ex. <a class="fork" href="http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/3_generate.html">An older JAXP tutorial</a>). </p> </section> <section id="ExampleObj2PDF"> <title>ExampleObj2PDF.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup"> example</a> -combines the previous and the third to demonstrate +combines the previous and the third to demonstrate how you can transform a Java object to a PDF directly in one smooth run -by generating SAX events from the Java object that get fed to an XSL -transformation. The result of the transformation is then converted to PDF +by generating SAX events from the Java object that get fed to an XSL +transformation. The result of the transformation is then converted to PDF using FOP as before. </p> <figure src="images/EmbeddingExampleObj2PDF.png" alt="Example Java object to PDF (via XML and XSL-FO)"/> </section> <section id="ExampleDOM2PDF"> <title>ExampleDOM2PDF.java</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleDOM2PDF.java?view=markup"> example</a> -has FOP use a DOMSource instead of a StreamSource in order to +has FOP use a DOMSource instead of a StreamSource in order to use a DOM tree as input for an XSL transformation. </p> </section> <section id="ExampleSVG2PDF"> <title>ExampleSVG2PDF.java (PDF Transcoder example)</title> - <p>This + <p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleSVG2PDF.java?view=markup"> example</a> -shows the usage of the PDF Transcoder, a sub-application within FOP. +shows the usage of the PDF Transcoder, a sub-application within FOP. It is used to generate a PDF document from an SVG file. </p> </section> <section id="example-notes"> <title>Final notes</title> <p> -These examples should give you an idea of what's possible. It should be easy +These examples should give you an idea of what's possible. It should be easy to adjust these examples to your needs. Also, if you have other examples that you think should be added here, please let us know via either the fop-users or fop-dev mailing lists. Finally, for more help please send your questions to the fop-users diff --git a/src/documentation/content/xdocs/trunk/fonts.xml b/src/documentation/content/xdocs/trunk/fonts.xml index df2ed72b8..dcd03e548 100644 --- a/src/documentation/content/xdocs/trunk/fonts.xml +++ b/src/documentation/content/xdocs/trunk/fonts.xml @@ -215,7 +215,7 @@ in this case can be found on the page about <a href="output.html">output formats</a>. </p> <p> - Prior to FOP version 0.94, it was always necessary to create an XML font metrics file + In earlier FOP versions, it was always necessary to create an XML font metrics file if you wanted to add a custom font. This unconvenient step has been removed and in addition to that, FOP supports auto-registration of fonts, i.e. FOP can find fonts installed in your operating system or can scan user-specified directories for fonts. diff --git a/src/documentation/content/xdocs/trunk/graphics.xml b/src/documentation/content/xdocs/trunk/graphics.xml index 725c1839f..270d6b49b 100644 --- a/src/documentation/content/xdocs/trunk/graphics.xml +++ b/src/documentation/content/xdocs/trunk/graphics.xml @@ -26,19 +26,15 @@ <section id="introduction"> <title>Introduction</title> <p> - After the Apache FOP 0.94 release, the image handling subsystem has been rewritten in - order to improve the range of supported images and image subtypes, to lower the - overall memory consumption when handling images, to produce smaller output files and to - increase the performance in certain areas. Of course, this causes a few changes most of - which the user will probably not notice. The most important changes are: + Some noteworthy features of the image handling subsystem are: </p> <ul> <li> - The image libraries Jimi and JAI are no longer supported. Instead, Apache FOP uses the + The image libraries Jimi and JAI are not supported. Instead, Apache FOP uses the Image I/O API that was introduced with Java 1.4 for all bitmap codecs. </li> <li> - Some bitmap images are no longer converted to a standardized 24 bit RGB image but are + Some bitmap images are not converted to a standardized 24 bit RGB image but are instead handled in their native format. </li> <li> @@ -48,7 +44,7 @@ </ul> <p> The actual <a href="http://xmlgraphics.apache.org/commons/image-loader.html">image loading framework</a> - no longer resides in Apache FOP, but was instead placed in + does not reside in Apache FOP, but in <a href="ext:xmlgraphics.apache.org/commons/">XML Graphics Commons</a>. </p> </section> diff --git a/src/documentation/content/xdocs/trunk/output.xml b/src/documentation/content/xdocs/trunk/output.xml index 7a91992ca..1766cd493 100644 --- a/src/documentation/content/xdocs/trunk/output.xml +++ b/src/documentation/content/xdocs/trunk/output.xml @@ -113,9 +113,9 @@ out = proc.getOutputStream();]]></source> compatible. </p> <p> - Note that FOP does not currently support "tagged PDF" or PDF/A-1a. - Support for <a href="pdfa.html">PDF/A-1b</a> and <a - href="pdfx.html">PDF/X</a> has recently been added, however. + Note that FOP does not currently support PDF/A-1a. + Support for <a href="accessibility.html">Tagged PDF</a>, <a href="pdfa.html">PDF/A-1b</a> + and <a href="pdfx.html">PDF/X</a> has recently been added, however. </p> <section id="pdf-fonts"> <title>Fonts</title> @@ -194,32 +194,76 @@ out = proc.getOutputStream();]]></source> e.printStackTrace(); } }]]></source> - <p> - Check the iText tutorial and documentation for setting access flags, password, - encryption strength and other parameters. - </p> - </section> - <section id="pdf-watermark"> - <title>Watermarks</title> - <p> - In addition to the <a href="#pdf-postprocess">PDF Post-processing</a> options, consider the following workarounds: - </p> - <ul> - <li> - Use a background image for the body region. - </li> - <li> - (submitted by Trevor Campbell) Place an image in a - region that overlaps the flowing text. For example, make - region-before large enough to contain your image. Then include a - block (if necessary, use an absolutely positioned block-container) - containing the watermark image in the static-content for the - region-before. Note that the image will be drawn on top of the - normal content. - </li> - </ul> + <p> + Check the iText tutorial and documentation for setting access flags, password, + encryption strength and other parameters. + </p> + </section> + <section id="pdf-watermark"> + <title>Watermarks</title> + <p> + In addition to the <a href="#pdf-postprocess">PDF Post-processing</a> options, consider the following workarounds: + </p> + <ul> + <li> + Use a background image for the body region. + </li> + <li> + (submitted by Trevor Campbell) Place an image in a + region that overlaps the flowing text. For example, make + region-before large enough to contain your image. Then include a + block (if necessary, use an absolutely positioned block-container) + containing the watermark image in the static-content for the + region-before. Note that the image will be drawn on top of the + normal content. + </li> + </ul> + </section> + <section id="pdf-extensions"> + <title>Extensions</title> + <p>The PDF Renderer supports some PDF specific extensions which can be embedded + into the input FO document. To use the extensions the appropriate namespace must + be declared in the fo:root element like this:</p> + <source><![CDATA[ +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"> + ]]></source> + <section id="pdf-embedded-file"> + <title>Embedded Files</title> + <p> + It is possible to attach/embed arbitrary files into a PDF file. You can give a name and + a description of the file. Example: + </p> + <source><![CDATA[ + <fo:declarations> + <pdf:embedded-file filename="image.jpg" src="url(file:///C:/Temp/myimage.jpg)" description="My image"/> + <pdf:embedded-file src="url(file:///C:/Temp/MyTextDoc.odt)"/> + </fo:declarations> + ]]></source> + <p> + <code>pdf:embedded-file</code> must be a child of <code>fo:declarations</code>. + The "src" property is used to reference the file that is to be embedded. This property + uses the "uri-specification" datatype from the XSL-FO specification. + The "filename" property is optional. If it is missing the filename is automatically set + from the URI/IRI of the "src" property. An optional description can also be added to + further describe the file attachment. + </p> + <p> + It is also possible to reference an embedded file from an <code>fo:basic-link</code>. + Use the special "embedded-file:" URI scheme with the filename as single argument after + the URI scheme. Example: + </p> + <source><![CDATA[ +<fo:basic-link external-destination="url(embedded-file:image.jpg)">Attached Image</fo:basic-link> +]]></source> + <p> + Note: Not all PDF Viewers (including some Acrobat Versions) will open the embedded file + when clicking on the link. In that case, the user will have to open he attachment via + the separate list of file attachments. + </p> + </section> + </section> </section> -</section> <section id="ps"> <title>PostScript</title> <p> diff --git a/src/documentation/content/xdocs/trunk/running.xml b/src/documentation/content/xdocs/trunk/running.xml index 38e31cc6c..11dc2848a 100644 --- a/src/documentation/content/xdocs/trunk/running.xml +++ b/src/documentation/content/xdocs/trunk/running.xml @@ -38,8 +38,8 @@ </ul> </li> <li> - Apache FOP. The <a href="../download.html">FOP distribution</a> includes all libraries that you will - need to run a basic FOP installation. These can be found in the [fop-root]/lib directory. These + Apache FOP. The <a href="../download.html">FOP distribution</a> includes all libraries that you will + need to run a basic FOP installation. These can be found in the [fop-root]/lib directory. These libraries include the following: <ul> <li><a class="fork" href="ext:xmlgraphics.apache.org/commons">Apache XML Graphics Commons</a>, an shared library for Batik and FOP.</li> @@ -54,7 +54,7 @@ <ul> <li> Graphics libraries. Generally, FOP contains direct support for the most important - bitmap image formats (including PNG, JPEG and GIF). See + bitmap image formats (including PNG, JPEG and GIF). See <a href="graphics.html">FOP: Graphics Formats</a> for details. </li> <li> @@ -64,7 +64,7 @@ <p>In addition, the following system requirements apply:</p> <ul> <li> - If you will be using FOP to process SVG, you must do so in a graphical environment. + If you will be using FOP to process SVG, you must do so in a graphical environment. See <a href="graphics.html#batik">FOP: Graphics (Batik)</a> for details. </li> </ul> @@ -74,19 +74,19 @@ <section id="install-instruct"> <title>Instructions</title> <p> - Basic FOP installation consists of first unzipping the <code>.gz</code> file that is the - distribution medium, then unarchiving the resulting <code>.tar</code> file in a - directory/folder that is convenient on your system. Please consult your operating system - documentation or Zip application software documentation for instructions specific to your + Basic FOP installation consists of first unzipping the <code>.gz</code> file that is the + distribution medium, then unarchiving the resulting <code>.tar</code> file in a + directory/folder that is convenient on your system. Please consult your operating system + documentation or Zip application software documentation for instructions specific to your site. </p> </section> <section id="install-problems"> <title>Problems</title> <p> - Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip - and unarchive their distribution media. This is a legacy of older Mac operating systems, - which had a 31-character pathname limit. Several Mac OSX users have recommended that + Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip + and unarchive their distribution media. This is a legacy of older Mac operating systems, + which had a 31-character pathname limit. Several Mac OSX users have recommended that Mac OSX users use the shell command <code>tar -xzf</code> instead. </p> </section> @@ -96,30 +96,31 @@ <section id="fop-script"> <title>Using the fop script or batch file</title> <p> - The usual and recommended practice for starting FOP from the command line is to run the + The usual and recommended practice for starting FOP from the command line is to run the batch file fop.bat (Windows) or the shell script fop (Unix/Linux). - These scripts require that the environment variable JAVA_HOME be - set to a path pointing to the appropriate Java installation on your system. Macintosh OSX - includes a Java environment as part of its distribution. We are told by Mac OSX users that + These scripts require that the environment variable JAVA_HOME be + set to a path pointing to the appropriate Java installation on your system. Macintosh OSX + includes a Java environment as part of its distribution. We are told by Mac OSX users that the path to use in this case is <code>/Library/Java/Home</code>. <strong>Caveat:</strong> - We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum - Java requirements, the two will inevitably not match on some systems. Please see - <a href="http://developer.apple.com/java/faq">Java on Mac OSX FAQ</a> for information as + We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum + Java requirements, the two will inevitably not match on some systems. Please see + <a href="http://developer.apple.com/java/faq">Java on Mac OSX FAQ</a> for information as it becomes available. </p> <source><![CDATA[ USAGE Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile> - [OPTIONS] - -d debug mode - -x dump configuration settings - -q quiet mode + [OPTIONS] + -version print FOP version and exit + -d debug mode + -x dump configuration settings + -q quiet mode -c cfg.xml use additional configuration file cfg.xml - -l lang the language to use for user information + -l lang the language to use for user information -r relaxed/less strict validation (where available) -dpi xxx target resolution in dots per inch (dpi) where xxx is a number -s for area tree XML, down to block areas only - -v to show FOP version being used + -v run in verbose mode (currently simply print FOP version and continue) -o [password] PDF file will be encrypted with option owner password -u [password] PDF file will be encrypted with option user password @@ -127,62 +128,76 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl -nocopy PDF file will be encrypted without copy content permission -noedit PDF file will be encrypted without edit content permission -noannotations PDF file will be encrypted without edit annotation permission + -a enables accessibility features (Tagged PDF etc., default off) -pdfprofile prof PDF file will be generated with the specified profile (Examples for prof: PDF/A-1b or PDF/X-3:2003) - [INPUT] - infile xsl:fo input file (the same as the next) - -fo infile xsl:fo input file - -xml infile xml input file, must be used together with -xsl - -atin infile area tree input file - -xsl stylesheet xslt stylesheet - + -conserve enable memory-conservation policy (trades memory-consumption for disk I/O) + (Note: currently only influences whether the area tree is serialized.) + + -cache specifies a file/directory path location + -flush flushes the current font cache file + + [INPUT] + infile xsl:fo input file (the same as the next) + (use '-' for infile to pipe input from stdin) + -fo infile xsl:fo input file + -xml infile xml input file, must be used together with -xsl + -atin infile area tree input file + -ifin infile intermediate format input file + -imagein infile image input file (piping through stdin not supported) + -xsl stylesheet xslt stylesheet + -param name value <value> to use for parameter <name> in xslt stylesheet (repeat '-param name value' for each parameter) - - [OUTPUT] + + -catalog use catalog resolver for input XML and XSLT files + [OUTPUT] outfile input will be rendered as PDF into outfile + (use '-' for outfile to pipe output to stdout) -pdf outfile input will be rendered as PDF (outfile req'd) -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b") - -awt input will be displayed on screen + -awt input will be displayed on screen -rtf outfile input will be rendered as RTF (outfile req'd) - -pcl outfile input will be rendered as PCL (outfile req'd) - -ps outfile input will be rendered as PostScript (outfile req'd) + -pcl outfile input will be rendered as PCL (outfile req'd) + -ps outfile input will be rendered as PostScript (outfile req'd) -afp outfile input will be rendered as AFP (outfile req'd) -tiff outfile input will be rendered as TIFF (outfile req'd) -png outfile input will be rendered as PNG (outfile req'd) - -txt outfile input will be rendered as plain text (outfile req'd) - -at [mime] out representation of area tree as XML (outfile req'd) - specify optional mime output to allow AT to be converted + -txt outfile input will be rendered as plain text (outfile req'd) + -at [mime] out representation of area tree as XML (outfile req'd) + specify optional mime output to allow the AT to be converted + to final format later + -if [mime] out representation of document in intermediate format XML (outfile req'd) + specify optional mime output to allow the IF to be converted to final format later - -print input file will be rendered and sent to the printer - see options with "-print help" + -print input file will be rendered and sent to the printer + see options with "-print help" -out mime outfile input will be rendered using the given MIME type (outfile req'd) Example: "-out application/pdf D:\out.pdf" (Tip: "-out list" prints the list of supported MIME types) - -mif outfile input will be rendered as MIF (FrameMaker) (outfile req'd) - Experimental feature - requires additional fop-sandbox.jar. - -svg outfile input will be rendered as an SVG slides file (outfile req'd) + -svg outfile input will be rendered as an SVG slides file (outfile req'd) Experimental feature - requires additional fop-sandbox.jar. - -foout outfile input will only be XSL transformed. The intermediate - XSL-FO file is saved and no rendering is performed. + -foout outfile input will only be XSL transformed. The intermediate + XSL-FO file is saved and no rendering is performed. (Only available if you use -xml and -xsl parameters) [Examples] - Fop foo.fo foo.pdf - Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line) - Fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf - Fop -xml foo.xml -xsl foo.xsl -foout foo.fo - Fop foo.fo -mif foo.mif - Fop foo.fo -rtf foo.rtf - Fop foo.fo -print or Fop -print foo.fo - Fop foo.fo -awt]]></source> + fop foo.fo foo.pdf + fop -fo foo.fo -pdf foo.pdf (does the same as the previous line) + fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf + fop -xml foo.xml -xsl foo.xsl -foout foo.fo + fop -xml - -xsl foo.xsl -pdf - + fop foo.fo -mif foo.mif + fop foo.fo -rtf foo.rtf + fop foo.fo -print + fop foo.fo -awt]]></source> <p> - PDF encryption is only available if FOP was compiled with encryption support - <strong>and</strong> if compatible encryption support is available at run time. + PDF encryption is only available if FOP was compiled with encryption support + <strong>and</strong> if compatible encryption support is available at run time. Currently, only the JCE is supported. Check the <a href="pdfencryption.html">Details</a>. </p> </section> @@ -194,8 +209,8 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl org.apache.fop.cli.Main <arguments></code>. The arguments consist of the options and infile and outfile specifications as shown above for the standard scripts. You may wish to review - the standard scripts to make sure that - you get your environment properly configured. + the standard scripts to make sure that + you get your environment properly configured. </p> </section> <section id="jar-option"> @@ -251,38 +266,38 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl <section id="check-input"> <title>Using Xalan to Check XSL-FO Input</title> <p> - FOP sessions that use -xml and -xsl input instead of -fo input are actually - controlling two distinct conversions: Tranforming XML to XSL-FO, then formatting + FOP sessions that use -xml and -xsl input instead of -fo input are actually + controlling two distinct conversions: Tranforming XML to XSL-FO, then formatting the XSL-FO to PDF (or another FOP output format). - Although FOP controls both of these processes, the first is included merely as + Although FOP controls both of these processes, the first is included merely as a convenience and for performance reasons. Only the second is part of FOP's core processing. - If a user has a problem running FOP, it is important to determine which of these + If a user has a problem running FOP, it is important to determine which of these two processes is causing the problem. If the problem is in the first process, the user's stylesheet is likely the cause. - The FOP development team does not have resources to help with stylesheet issues, - although we have included links to some useful - <a href="../resources.html#specs">Specifications</a> and + The FOP development team does not have resources to help with stylesheet issues, + although we have included links to some useful + <a href="../resources.html#specs">Specifications</a> and <a href="../resources.html#articles">Books/Articles</a>. - If the problem is in the second process, FOP may have a bug or an unimplemented + If the problem is in the second process, FOP may have a bug or an unimplemented feature that does require attention from the FOP development team. </p> <note>The user is always responsible to provide correct XSL-FO code to FOP.</note> <p> - In the case of using -xml and -xsl input, although the user is responsible for - the XSL-FO code that is FOP's input, it is not visible to the user. To make the - intermediate FO file visible, the FOP distribution includes the "-foout" option - which causes FOP to run only the first (transformation) step, and write the + In the case of using -xml and -xsl input, although the user is responsible for + the XSL-FO code that is FOP's input, it is not visible to the user. To make the + intermediate FO file visible, the FOP distribution includes the "-foout" option + which causes FOP to run only the first (transformation) step, and write the results to a file. (See also the Xalan command-line below) </p> <note> - When asking for help on the FOP mailing lists, <em>never</em> attach XML and - XSL to illustrate the issue. Always run the XSLT step (-foout) and send the - resulting XSL-FO file instead. Of course, be sure that the XSL-FO file is + When asking for help on the FOP mailing lists, <em>never</em> attach XML and + XSL to illustrate the issue. Always run the XSLT step (-foout) and send the + resulting XSL-FO file instead. Of course, be sure that the XSL-FO file is correct before sending it. </note> <p> - The -foout option works the same way as if you would call the + The -foout option works the same way as if you would call the <a href="http://xml.apache.org/xalan-j/commandline.html">Xalan command-line</a>: </p> <p> @@ -304,39 +319,39 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl </p> <ul> <li> - Increase memory available to the JVM. See - <a href="http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/java.html">the -Xmx option</a> + Increase memory available to the JVM. See + <a href="http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/java.html">the -Xmx option</a> for more information. <warning> - It is usually unwise to increase the memory allocated to the JVM beyond the amount of + It is usually unwise to increase the memory allocated to the JVM beyond the amount of physical RAM, as this will generally cause significantly slower performance. </warning> </li> <li> Avoid forward references. Forward references are references to some later part of a document. - Examples include page number citations which refer to pages which follow the citation, - tables of contents at the beginning of a document, and page numbering schemes that - include the total number of pages in the document + Examples include page number citations which refer to pages which follow the citation, + tables of contents at the beginning of a document, and page numbering schemes that + include the total number of pages in the document (<a href="../faq.html#pagenum">"page N of TOTAL"</a>). - Forward references cause all subsequent pages to be held in memory until the reference + Forward references cause all subsequent pages to be held in memory until the reference can be resolved, i.e. until the page with the referenced element is encountered. - Forward references may be required by the task, but if you are getting a memory + Forward references may be required by the task, but if you are getting a memory overflow, at least consider the possibility of eliminating them. - A table of contents could be replaced by PDF bookmarks instead or moved to the end of + A table of contents could be replaced by PDF bookmarks instead or moved to the end of the document (reshuffle the paper could after printing). </li> <li> Avoid large images, especially if they are scaled down. If they need to be scaled, scale them in another application upstream from FOP. - For many image formats, memory consumption is driven mainly by the size of the image - file itself, not its dimensions (width*height), so increasing the compression rate + For many image formats, memory consumption is driven mainly by the size of the image + file itself, not its dimensions (width*height), so increasing the compression rate may help. </li> <li> Use multiple page sequences. FOP starts rendering after the end of a page sequence is encountered. - While the actual rendering is done page-by-page, some additional memory is + While the actual rendering is done page-by-page, some additional memory is freed after the page sequence has been rendered. This can be substantial if the page sequence contains lots of FO elements. </li> diff --git a/src/documentation/skinconf.xml b/src/documentation/skinconf.xml index ccafd9541..8190982e3 100644 --- a/src/documentation/skinconf.xml +++ b/src/documentation/skinconf.xml @@ -378,6 +378,7 @@ which will be used to configure the chosen Forrest skin. <height>125</height> </credit> --> + <!-- <credit box-location="alt2"> <name>ApacheCon US 2009</name> <url>http://us.apachecon.com/</url> @@ -385,6 +386,7 @@ which will be used to configure the chosen Forrest skin. <width>125</width> <height>125</height> </credit> + --> <credit role="pdf"> <name>PDF created by Apache FOP</name> diff --git a/src/java/META-INF/services/org.apache.fop.fo.ElementMapping b/src/java/META-INF/services/org.apache.fop.fo.ElementMapping index b62f36196..6f4374a93 100644 --- a/src/java/META-INF/services/org.apache.fop.fo.ElementMapping +++ b/src/java/META-INF/services/org.apache.fop.fo.ElementMapping @@ -9,3 +9,4 @@ org.apache.fop.fo.extensions.xmp.RDFElementMapping org.apache.fop.render.ps.extensions.PSExtensionElementMapping org.apache.fop.render.afp.extensions.AFPElementMapping org.apache.fop.render.pcl.extensions.PCLElementMapping +org.apache.fop.render.pdf.extensions.PDFElementMapping diff --git a/src/java/META-INF/services/org.apache.fop.render.Renderer b/src/java/META-INF/services/org.apache.fop.render.Renderer index 0e6f12cb5..2bf59a805 100644 --- a/src/java/META-INF/services/org.apache.fop.render.Renderer +++ b/src/java/META-INF/services/org.apache.fop.render.Renderer @@ -1,10 +1,6 @@ -org.apache.fop.render.pdf.PDFRendererMaker -org.apache.fop.render.ps.PSRendererMaker org.apache.fop.render.txt.TXTRendererMaker org.apache.fop.render.bitmap.PNGRendererMaker org.apache.fop.render.bitmap.TIFFRendererMaker org.apache.fop.render.xml.XMLRendererMaker org.apache.fop.render.awt.AWTRendererMaker org.apache.fop.render.print.PrintRendererMaker -org.apache.fop.render.afp.AFPRendererMaker -org.apache.fop.render.pcl.PCLRendererMaker
\ No newline at end of file diff --git a/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler b/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler deleted file mode 100644 index 3f8c8dea6..000000000 --- a/src/java/META-INF/services/org.apache.fop.render.afp.AFPImageHandler +++ /dev/null @@ -1,5 +0,0 @@ -org.apache.fop.render.afp.AFPImageHandlerRenderedImage -org.apache.fop.render.afp.AFPImageHandlerRawCCITTFax -org.apache.fop.render.afp.AFPImageHandlerRawStream -org.apache.fop.render.afp.AFPImageHandlerGraphics2D -org.apache.fop.render.afp.AFPImageHandlerXML diff --git a/src/java/META-INF/services/org.apache.fop.render.pdf.PDFImageHandler b/src/java/META-INF/services/org.apache.fop.render.pdf.PDFImageHandler deleted file mode 100644 index 18fc3e96a..000000000 --- a/src/java/META-INF/services/org.apache.fop.render.pdf.PDFImageHandler +++ /dev/null @@ -1,5 +0,0 @@ -org.apache.fop.render.pdf.PDFImageHandlerRawJPEG -org.apache.fop.render.pdf.PDFImageHandlerRawCCITTFax -org.apache.fop.render.pdf.PDFImageHandlerGraphics2D -org.apache.fop.render.pdf.PDFImageHandlerRenderedImage -org.apache.fop.render.pdf.PDFImageHandlerXML diff --git a/src/java/org/apache/fop/ResourceEventProducer.java b/src/java/org/apache/fop/ResourceEventProducer.java index a87b2d0ec..926b7c92b 100644 --- a/src/java/org/apache/fop/ResourceEventProducer.java +++ b/src/java/org/apache/fop/ResourceEventProducer.java @@ -39,7 +39,10 @@ public interface ResourceEventProducer extends EventProducer { /** * Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/afp/AFPBorderPainter.java b/src/java/org/apache/fop/afp/AFPBorderPainter.java index 85046dbed..958a955b8 100644 --- a/src/java/org/apache/fop/afp/AFPBorderPainter.java +++ b/src/java/org/apache/fop/afp/AFPBorderPainter.java @@ -40,7 +40,7 @@ public class AFPBorderPainter extends AbstractAFPPainter { } /** {@inheritDoc} */ - public void paint(PaintingInfo paintInfo) { + public void paint(PaintingInfo paintInfo) { // CSOK: MethodLength BorderPaintingInfo borderPaintInfo = (BorderPaintingInfo)paintInfo; float w = borderPaintInfo.getX2() - borderPaintInfo.getX1(); float h = borderPaintInfo.getY2() - borderPaintInfo.getY1(); @@ -60,6 +60,7 @@ public class AFPBorderPainter extends AbstractAFPPainter { float y2 = unitConv.pt2units(borderPaintInfo.getY2()); switch (paintingState.getRotation()) { + default: case 0: x1 += at.getTranslateX(); y1 += at.getTranslateY(); @@ -89,8 +90,8 @@ public class AFPBorderPainter extends AbstractAFPPainter { AFPLineDataInfo lineDataInfo = new AFPLineDataInfo(); lineDataInfo.setColor(borderPaintInfo.getColor()); lineDataInfo.setRotation(paintingState.getRotation()); - lineDataInfo.x1 = Math.round(x1); - lineDataInfo.y1 = Math.round(y1); + lineDataInfo.setX1 ( Math.round(x1) ); + lineDataInfo.setY1 ( Math.round(y1) ); float thickness; if (borderPaintInfo.isHorizontal()) { thickness = y2 - y1; @@ -105,83 +106,91 @@ public class AFPBorderPainter extends AbstractAFPPainter { int thickness3 = (int)Math.floor(thickness / 3f); lineDataInfo.setThickness(thickness3); if (borderPaintInfo.isHorizontal()) { - lineDataInfo.x2 = Math.round(x2); - lineDataInfo.y2 = lineDataInfo.y1; + lineDataInfo.setX2 ( Math.round(x2) ); + lineDataInfo.setY2 ( lineDataInfo.getY1() ); dataStream.createLine(lineDataInfo); int distance = thickness3 * 2; lineDataInfo = new AFPLineDataInfo(lineDataInfo); - lineDataInfo.y1 += distance; - lineDataInfo.y2 += distance; + lineDataInfo.setY1 ( lineDataInfo.getY1() + distance ); + lineDataInfo.setY2 ( lineDataInfo.getY2() + distance ); dataStream.createLine(lineDataInfo); } else { - lineDataInfo.x2 = lineDataInfo.x1; - lineDataInfo.y2 = Math.round(y2); + lineDataInfo.setX2 ( lineDataInfo.getX1() ); + lineDataInfo.setY2 ( Math.round(y2) ); dataStream.createLine(lineDataInfo); int distance = thickness3 * 2; lineDataInfo = new AFPLineDataInfo(lineDataInfo); - lineDataInfo.x1 += distance; - lineDataInfo.x2 += distance; + lineDataInfo.setX1 ( lineDataInfo.getX1() + distance ); + lineDataInfo.setX2 ( lineDataInfo.getX2() + distance ); dataStream.createLine(lineDataInfo); } break; case Constants.EN_DASHED: - int thick = lineDataInfo.thickness * 3; + int thick = lineDataInfo.getThickness() * 3; if (borderPaintInfo.isHorizontal()) { - lineDataInfo.x2 = lineDataInfo.x1 + thick; - lineDataInfo.y2 = lineDataInfo.y1; + lineDataInfo.setX2 ( lineDataInfo.getX1() + thick ); + lineDataInfo.setY2 ( lineDataInfo.getY1() ); int ex2 = Math.round(x2); - while (lineDataInfo.x1 + thick < ex2) { + while (lineDataInfo.getX1() + thick < ex2) { dataStream.createLine(lineDataInfo); - lineDataInfo.x1 += 2 * thick; - lineDataInfo.x2 = lineDataInfo.x1 + thick; + lineDataInfo.setX1 ( lineDataInfo.getX1() + 2 * thick ); + lineDataInfo.setX2 ( lineDataInfo.getX1() + thick ); } } else { - lineDataInfo.x2 = lineDataInfo.x1; - lineDataInfo.y2 = lineDataInfo.y1 + thick; + lineDataInfo.setX2 ( lineDataInfo.getX1() ); + lineDataInfo.setY2 ( lineDataInfo.getY1() + thick ); int ey2 = Math.round(y2); - while (lineDataInfo.y1 + thick < ey2) { + while (lineDataInfo.getY1() + thick < ey2) { dataStream.createLine(lineDataInfo); - lineDataInfo.y1 += 2 * thick; - lineDataInfo.y2 = lineDataInfo.y1 + thick; + lineDataInfo.setY1 ( lineDataInfo.getY1() + 2 * thick ); + lineDataInfo.setY2 ( lineDataInfo.getY1() + thick ); } } break; case Constants.EN_DOTTED: if (borderPaintInfo.isHorizontal()) { - lineDataInfo.x2 = lineDataInfo.x1 + lineDataInfo.thickness; - lineDataInfo.y2 = lineDataInfo.y1; + lineDataInfo.setX2 ( lineDataInfo.getX1() + lineDataInfo.getThickness() ); + lineDataInfo.setY2 ( lineDataInfo.getY1() ); int ex2 = Math.round(x2); - while (lineDataInfo.x1 + lineDataInfo.thickness < ex2) { + while (lineDataInfo.getX1() + lineDataInfo.getThickness() < ex2) { dataStream.createLine(lineDataInfo); - lineDataInfo.x1 += 3 * lineDataInfo.thickness; - lineDataInfo.x2 = lineDataInfo.x1 + lineDataInfo.thickness; + lineDataInfo.setX1 ( lineDataInfo.getX1() + 3 * lineDataInfo.getThickness() ); + lineDataInfo.setX2 ( lineDataInfo.getX1() + lineDataInfo.getThickness() ); } } else { - lineDataInfo.x2 = lineDataInfo.x1; - lineDataInfo.y2 = lineDataInfo.y1 + lineDataInfo.thickness; + lineDataInfo.setX2 ( lineDataInfo.getX1() ); + lineDataInfo.setY2 ( lineDataInfo.getY1() + lineDataInfo.getThickness() ); int ey2 = Math.round(y2); - while (lineDataInfo.y1 + lineDataInfo.thickness < ey2) { + while (lineDataInfo.getY1() + lineDataInfo.getThickness() < ey2) { dataStream.createLine(lineDataInfo); - lineDataInfo.y1 += 3 * lineDataInfo.thickness; - lineDataInfo.y2 = lineDataInfo.y1 + lineDataInfo.thickness; + lineDataInfo.setY1 ( lineDataInfo.getY1() + 3 * lineDataInfo.getThickness() ); + lineDataInfo.setY2 ( lineDataInfo.getY1() + lineDataInfo.getThickness() ); } } break; case Constants.EN_GROOVE: case Constants.EN_RIDGE: //TODO - lineDataInfo.x2 = Math.round(x2); + int yNew; + lineDataInfo.setX2 ( Math.round(x2) ); float colFactor = (borderPaintInfo.getStyle() == Constants.EN_GROOVE ? 0.4f : -0.4f); float h3 = (y2 - y1) / 3; - lineDataInfo.color = ColorUtil.lightenColor(borderPaintInfo.getColor(), -colFactor); - lineDataInfo.thickness = Math.round(h3); - lineDataInfo.y1 = lineDataInfo.y2 = Math.round(y1); + lineDataInfo.setColor + ( ColorUtil.lightenColor(borderPaintInfo.getColor(), -colFactor) ); + lineDataInfo.setThickness ( Math.round(h3) ); + yNew = Math.round(y1); + lineDataInfo.setY1 ( yNew ); + lineDataInfo.setY2 ( yNew ); dataStream.createLine(lineDataInfo); - lineDataInfo.color = borderPaintInfo.getColor(); - lineDataInfo.y1 = lineDataInfo.y2 = Math.round(y1 + h3); + lineDataInfo.setColor ( borderPaintInfo.getColor() ); + yNew = Math.round(y1 + h3); + lineDataInfo.setY1 ( yNew ); + lineDataInfo.setY2 ( yNew ); dataStream.createLine(lineDataInfo); - lineDataInfo.color = ColorUtil.lightenColor(borderPaintInfo.getColor(), colFactor); - lineDataInfo.y1 = lineDataInfo.y2 = Math.round(y1 + h3 + h3); + lineDataInfo.setColor ( ColorUtil.lightenColor(borderPaintInfo.getColor(), colFactor) ); + yNew = Math.round(y1 + h3 + h3); + lineDataInfo.setY1 ( yNew ); + lineDataInfo.setY2 ( yNew ); dataStream.createLine(lineDataInfo); break; case Constants.EN_HIDDEN: @@ -191,11 +200,11 @@ public class AFPBorderPainter extends AbstractAFPPainter { case Constants.EN_SOLID: default: if (borderPaintInfo.isHorizontal()) { - lineDataInfo.x2 = Math.round(x2); - lineDataInfo.y2 = lineDataInfo.y1; + lineDataInfo.setX2 ( Math.round(x2) ); + lineDataInfo.setY2 ( lineDataInfo.getY1() ); } else { - lineDataInfo.x2 = lineDataInfo.x1; - lineDataInfo.y2 = Math.round(y2); + lineDataInfo.setX2 ( lineDataInfo.getX1() ); + lineDataInfo.setY2 ( Math.round(y2) ); } dataStream.createLine(lineDataInfo); } diff --git a/src/java/org/apache/fop/afp/AFPDataObjectInfo.java b/src/java/org/apache/fop/afp/AFPDataObjectInfo.java index 158189b76..7589ef4fe 100644 --- a/src/java/org/apache/fop/afp/AFPDataObjectInfo.java +++ b/src/java/org/apache/fop/afp/AFPDataObjectInfo.java @@ -19,9 +19,6 @@ package org.apache.fop.afp; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.fop.afp.modca.Registry; import org.apache.fop.afp.modca.triplets.MappingOptionTriplet; @@ -29,7 +26,6 @@ import org.apache.fop.afp.modca.triplets.MappingOptionTriplet; * A list of parameters associated with an AFP data objects */ public class AFPDataObjectInfo { - private static final Log log = LogFactory.getLog("org.apache.xmlgraphics.afp"); /** the object area info */ private AFPObjectAreaInfo objectAreaInfo; @@ -197,9 +193,9 @@ public class AFPDataObjectInfo { } /** - * Sets the data width resolution + * Sets the data height resolution * - * @param dataWidthRes the data width resolution + * @param dataHeightRes the data height resolution */ public void setDataHeightRes(int dataHeightRes) { this.dataHeightRes = dataHeightRes; diff --git a/src/java/org/apache/fop/afp/AFPEventProducer.java b/src/java/org/apache/fop/afp/AFPEventProducer.java index 6e6cb529e..87f978add 100644 --- a/src/java/org/apache/fop/afp/AFPEventProducer.java +++ b/src/java/org/apache/fop/afp/AFPEventProducer.java @@ -28,7 +28,10 @@ import org.apache.fop.events.EventProducer; public interface AFPEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + static final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/afp/AFPGraphics2D.java b/src/java/org/apache/fop/afp/AFPGraphics2D.java index fa9c0d7bf..af58b5471 100644 --- a/src/java/org/apache/fop/afp/AFPGraphics2D.java +++ b/src/java/org/apache/fop/afp/AFPGraphics2D.java @@ -75,7 +75,7 @@ import org.apache.fop.svg.NativeImageHandler; */ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHandler { - private static final Log log = LogFactory.getLog(AFPGraphics2D.class); + private static final Log LOG = LogFactory.getLog(AFPGraphics2D.class); private static final int X = 0; @@ -321,7 +321,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand graphicsObj.setLineType(type); } } else { - log.warn("Unsupported Stroke: " + stroke.getClass().getName()); + LOG.warn("Unsupported Stroke: " + stroke.getClass().getName()); } } @@ -339,7 +339,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand if (paint instanceof Color) { return true; } - log.debug("NYI: applyPaint() " + paint + " fill=" + fill); + LOG.debug("NYI: applyPaint() " + paint + " fill=" + fill); if (paint instanceof TexturePaint) { // TexturePaint texturePaint = (TexturePaint)paint; // BufferedImage bufferedImage = texturePaint.getImage(); @@ -490,7 +490,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand currentPosition = new double[]{openingCoords[0], openingCoords[1]}; break; default: - log.debug("Unrecognised path iterator type"); + LOG.debug("Unrecognised path iterator type"); break; } } @@ -498,13 +498,13 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand /** {@inheritDoc} */ public void draw(Shape shape) { - log.debug("draw() shape=" + shape); + LOG.debug("draw() shape=" + shape); doDrawing(shape, false); } /** {@inheritDoc} */ public void fill(Shape shape) { - log.debug("fill() shape=" + shape); + LOG.debug("fill() shape=" + shape); doDrawing(shape, true); } @@ -516,7 +516,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand */ public void handleIOException(IOException ioe) { // TODO Surely, there's a better way to do this. - log.error(ioe.getMessage()); + LOG.error(ioe.getMessage()); ioe.printStackTrace(); } @@ -659,29 +659,29 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand /** {@inheritDoc} */ public void drawRenderableImage(RenderableImage img, AffineTransform xform) { - log.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform); + LOG.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform); } /** {@inheritDoc} */ public FontMetrics getFontMetrics(Font f) { - log.debug("getFontMetrics() NYI: f=" + f); + LOG.debug("getFontMetrics() NYI: f=" + f); return null; } /** {@inheritDoc} */ public void setXORMode(Color col) { - log.debug("setXORMode() NYI: col=" + col); + LOG.debug("setXORMode() NYI: col=" + col); } /** {@inheritDoc} */ public void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y, float width, float height) { - log.debug("NYI: addNativeImage() " + "image=" + image + LOG.debug("NYI: addNativeImage() " + "image=" + image + ",x=" + x + ",y=" + y + ",width=" + width + ",height=" + height); } /** {@inheritDoc} */ public void copyArea(int x, int y, int width, int height, int dx, int dy) { - log.debug("copyArea() NYI: "); + LOG.debug("copyArea() NYI: "); } } diff --git a/src/java/org/apache/fop/afp/AFPLineDataInfo.java b/src/java/org/apache/fop/afp/AFPLineDataInfo.java index a056ebf1f..108b98596 100644 --- a/src/java/org/apache/fop/afp/AFPLineDataInfo.java +++ b/src/java/org/apache/fop/afp/AFPLineDataInfo.java @@ -25,25 +25,25 @@ import java.awt.Color; public class AFPLineDataInfo { /** the x1 coordinate */ - int x1; + private int x1; /** the y1 coordinate */ - int y1; + private int y1; /** the x2 coordinate */ - int x2; + private int x2; /** the y2 coordinate */ - int y2; + private int y2; /** the thickness */ - int thickness; + private int thickness; /** the painting color */ - Color color; + private Color color; /** the rotation */ - int rotation = 0; + private int rotation = 0; /** * Default constructor diff --git a/src/java/org/apache/fop/afp/AFPPaintingState.java b/src/java/org/apache/fop/afp/AFPPaintingState.java index e92a6cdb2..85d3e914b 100644 --- a/src/java/org/apache/fop/afp/AFPPaintingState.java +++ b/src/java/org/apache/fop/afp/AFPPaintingState.java @@ -26,7 +26,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.xmlgraphics.java2d.color.ColorConverter; import org.apache.xmlgraphics.java2d.color.DefaultColorConverter; -import org.apache.xmlgraphics.java2d.color.GrayScaleColorConverter; import org.apache.fop.afp.fonts.AFPPageFonts; import org.apache.fop.util.AbstractPaintingState; diff --git a/src/java/org/apache/fop/afp/AFPRectanglePainter.java b/src/java/org/apache/fop/afp/AFPRectanglePainter.java index 5b79a3f57..7b8a616da 100644 --- a/src/java/org/apache/fop/afp/AFPRectanglePainter.java +++ b/src/java/org/apache/fop/afp/AFPRectanglePainter.java @@ -42,6 +42,7 @@ public class AFPRectanglePainter extends AbstractAFPPainter { RectanglePaintingInfo rectanglePaintInfo = (RectanglePaintingInfo)paintInfo; int pageWidth = dataStream.getCurrentPage().getWidth(); int pageHeight = dataStream.getCurrentPage().getHeight(); + int yNew; AFPUnitConverter unitConv = paintingState.getUnitConverter(); float width = unitConv.pt2units(rectanglePaintInfo.getWidth()); @@ -52,31 +53,39 @@ public class AFPRectanglePainter extends AbstractAFPPainter { AffineTransform at = paintingState.getData().getTransform(); AFPLineDataInfo lineDataInfo = new AFPLineDataInfo(); - lineDataInfo.color = paintingState.getColor(); - lineDataInfo.rotation = paintingState.getRotation(); - lineDataInfo.thickness = Math.round(height); + lineDataInfo.setColor ( paintingState.getColor() ); + lineDataInfo.setRotation ( paintingState.getRotation() ); + lineDataInfo.setThickness ( Math.round(height) ); - switch (lineDataInfo.rotation) { + switch (lineDataInfo.getRotation()) { + default: case 0: - lineDataInfo.x1 = Math.round((float)at.getTranslateX() + x); - lineDataInfo.y1 = lineDataInfo.y2 = Math.round((float)at.getTranslateY() + y); - lineDataInfo.x2 = Math.round((float)at.getTranslateX() + x + width); + lineDataInfo.setX1 ( Math.round((float)at.getTranslateX() + x) ); + yNew = Math.round((float)at.getTranslateY() + y); + lineDataInfo.setY1 ( yNew ); + lineDataInfo.setY2 ( yNew ); + lineDataInfo.setX2 ( Math.round((float)at.getTranslateX() + x + width) ); break; case 90: - lineDataInfo.x1 = Math.round((float)at.getTranslateY() + x); - lineDataInfo.y1 = lineDataInfo.y2 - = pageWidth - Math.round((float)at.getTranslateX()) + Math.round(y); - lineDataInfo.x2 = Math.round(width + (float)at.getTranslateY() + x); + lineDataInfo.setX1 ( Math.round((float)at.getTranslateY() + x) ); + yNew = pageWidth - Math.round((float)at.getTranslateX()) + Math.round(y); + lineDataInfo.setY1 ( yNew ); + lineDataInfo.setY2 ( yNew ); + lineDataInfo.setX2 ( Math.round(width + (float)at.getTranslateY() + x) ); break; case 180: - lineDataInfo.x1 = pageWidth - Math.round((float)at.getTranslateX() - x); - lineDataInfo.y1 = lineDataInfo.y2 = pageHeight - Math.round((float)at.getTranslateY() - y); - lineDataInfo.x2 = pageWidth - Math.round((float)at.getTranslateX() - x - width); + lineDataInfo.setX1 ( pageWidth - Math.round((float)at.getTranslateX() - x) ); + yNew = pageHeight - Math.round((float)at.getTranslateY() - y); + lineDataInfo.setY1 ( yNew ); + lineDataInfo.setY2 ( yNew ); + lineDataInfo.setX2 ( pageWidth - Math.round((float)at.getTranslateX() - x - width) ); break; case 270: - lineDataInfo.x1 = pageHeight - Math.round((float)at.getTranslateY() - x); - lineDataInfo.y1 = lineDataInfo.y2 = Math.round((float)at.getTranslateX() + y); - lineDataInfo.x2 = pageHeight - Math.round((float)at.getTranslateY() - x - width); + lineDataInfo.setX1 ( pageHeight - Math.round((float)at.getTranslateY() - x) ); + yNew = Math.round((float)at.getTranslateX() + y); + lineDataInfo.setY1 ( yNew ); + lineDataInfo.setY2 ( yNew ); + lineDataInfo.setX2 ( pageHeight - Math.round((float)at.getTranslateY() - x - width) ); break; } dataStream.createLine(lineDataInfo); diff --git a/src/java/org/apache/fop/afp/AFPStreamer.java b/src/java/org/apache/fop/afp/AFPStreamer.java index 7e208bb6e..33d1dbf90 100644 --- a/src/java/org/apache/fop/afp/AFPStreamer.java +++ b/src/java/org/apache/fop/afp/AFPStreamer.java @@ -31,6 +31,7 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.afp.modca.ResourceGroup; import org.apache.fop.afp.modca.StreamedResourceGroup; @@ -39,7 +40,7 @@ import org.apache.fop.afp.modca.StreamedResourceGroup; */ public class AFPStreamer implements Streamable { /** Static logging instance */ - private static final Log log = LogFactory.getLog(AFPStreamer.class); + private static final Log LOG = LogFactory.getLog(AFPStreamer.class); private static final String AFPDATASTREAM_TEMP_FILE_PREFIX = "AFPDataStream_"; @@ -119,7 +120,7 @@ public class AFPStreamer implements Streamable { if (level.isExternal()) { String filePath = level.getExternalFilePath(); if (filePath == null) { - log.warn("No file path provided for external resource, using default."); + LOG.warn("No file path provided for external resource, using default."); filePath = defaultResourceGroupFilePath; } resourceGroup = (ResourceGroup)pathResourceGroupMap.get(filePath); @@ -128,7 +129,7 @@ public class AFPStreamer implements Streamable { try { os = new BufferedOutputStream(new FileOutputStream(filePath)); } catch (FileNotFoundException fnfe) { - log.error("Failed to create/open external resource group file '" + LOG.error("Failed to create/open external resource group file '" + filePath + "'"); } finally { if (os != null) { diff --git a/src/java/org/apache/fop/afp/AbstractAFPPainter.java b/src/java/org/apache/fop/afp/AbstractAFPPainter.java index 1358f8072..e0da25ff9 100644 --- a/src/java/org/apache/fop/afp/AbstractAFPPainter.java +++ b/src/java/org/apache/fop/afp/AbstractAFPPainter.java @@ -32,7 +32,9 @@ public abstract class AbstractAFPPainter { /** Static logging instance */ protected static Log log = LogFactory.getLog("org.apache.xmlgraphics.afp"); + /** data stream */ protected final DataStream dataStream; + /** painting state */ protected final AFPPaintingState paintingState; /** diff --git a/src/java/org/apache/fop/afp/DataStream.java b/src/java/org/apache/fop/afp/DataStream.java index 110fd2773..843e3fa65 100644 --- a/src/java/org/apache/fop/afp/DataStream.java +++ b/src/java/org/apache/fop/afp/DataStream.java @@ -30,8 +30,8 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.afp.fonts.AFPFontAttributes; import org.apache.fop.afp.fonts.AFPFont; +import org.apache.fop.afp.fonts.AFPFontAttributes; import org.apache.fop.afp.fonts.CharacterSet; import org.apache.fop.afp.modca.AbstractPageObject; import org.apache.fop.afp.modca.Document; @@ -42,10 +42,10 @@ import org.apache.fop.afp.modca.PageObject; import org.apache.fop.afp.modca.ResourceGroup; import org.apache.fop.afp.modca.TagLogicalElementBean; import org.apache.fop.afp.modca.triplets.FullyQualifiedNameTriplet; -import org.apache.fop.afp.ptoca.PtocaProducer; import org.apache.fop.afp.ptoca.PtocaBuilder; -import org.apache.fop.util.CharUtilities; +import org.apache.fop.afp.ptoca.PtocaProducer; import org.apache.fop.fonts.Font; +import org.apache.fop.util.CharUtilities; /** * A data stream is a continuous ordered stream of data elements and objects @@ -65,7 +65,7 @@ import org.apache.fop.fonts.Font; public class DataStream { /** Static logging instance */ - protected static final Log log = LogFactory.getLog("org.apache.xmlgraphics.afp"); + protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp"); /** Boolean completion indicator */ private boolean complete = false; @@ -162,7 +162,7 @@ public class DataStream { public void endDocument() throws IOException { if (complete) { String msg = "Invalid state - document already ended."; - log.warn("endDocument():: " + msg); + LOG.warn("endDocument():: " + msg); throw new IllegalStateException(msg); } @@ -356,11 +356,12 @@ public class DataStream { * @param letterSpacing letter spacing to draw text with * @param wordSpacing word Spacing to draw text with * @param font is the font to draw text with - * @param charSet is the AFP Character Set to use with the text + * @param charSet is the AFP Character Set to use with the text * @throws UnsupportedEncodingException thrown if character encoding is not supported */ - public void createText(final AFPTextDataInfo textDataInfo, final int letterSpacing, final int wordSpacing, - final Font font, final CharacterSet charSet) throws UnsupportedEncodingException { + public void createText + ( final AFPTextDataInfo textDataInfo, final int letterSpacing, final int wordSpacing, + final Font font, final CharacterSet charSet) throws UnsupportedEncodingException { int rotation = paintingState.getRotation(); if (rotation != 0) { textDataInfo.setRotation(rotation); diff --git a/src/java/org/apache/fop/afp/Factory.java b/src/java/org/apache/fop/afp/Factory.java index 9d9b83875..ef68a22fb 100644 --- a/src/java/org/apache/fop/afp/Factory.java +++ b/src/java/org/apache/fop/afp/Factory.java @@ -21,8 +21,6 @@ package org.apache.fop.afp; import java.io.OutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.fop.afp.goca.GraphicsData; import org.apache.fop.afp.ioca.ImageContent; import org.apache.fop.afp.ioca.ImageRasterData; @@ -65,9 +63,6 @@ import org.apache.fop.afp.util.StringUtils; */ public class Factory { - /** Static logging instance */ - private static final Log log = LogFactory.getLog(Factory.class); - private static final String OBJECT_ENVIRONMENT_GROUP_NAME_PREFIX = "OEG"; private static final String ACTIVE_ENVIRONMENT_GROUP_NAME_PREFIX = "AEG"; @@ -541,7 +536,10 @@ public class Factory { /** * Creates a new PTOCA {@link PresentationTextDescriptor} - * + * @param width presentation width + * @param height presentation height + * @param widthRes resolution of presentation width + * @param heightRes resolution of presentation height * @return a new {@link PresentationTextDescriptor} */ public PresentationTextDescriptor createPresentationTextDataDescriptor( diff --git a/src/java/org/apache/fop/afp/GrayScaleColorConverter.java b/src/java/org/apache/fop/afp/GrayScaleColorConverter.java new file mode 100644 index 000000000..d9c85ca96 --- /dev/null +++ b/src/java/org/apache/fop/afp/GrayScaleColorConverter.java @@ -0,0 +1,61 @@ +/*
+ * 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.afp;
+
+import java.awt.Color;
+
+import org.apache.xmlgraphics.java2d.color.ColorConverter;
+
+import org.apache.fop.util.ColorUtil;
+
+/**
+ * Converts to grayscale using the standard RED=30%, GREEN=59% and BLUE=11%
+ * weights (see http://en.wikipedia.org/wiki/Grayscale)
+ */
+final class GrayScaleColorConverter implements ColorConverter {
+
+ private static final int RED_WEIGHT = 77;
+ private static final int GREEN_WEIGTH = 150;
+ private static final int BLUE_WEIGHT = 28;
+
+ private static final GrayScaleColorConverter SINGLETON = new GrayScaleColorConverter();
+
+ private GrayScaleColorConverter() { }
+
+ /**
+ * static factory
+ *
+ * @return singleton instance of GrayScaleColorConverter
+ */
+ public static GrayScaleColorConverter getInstance() {
+ return SINGLETON;
+ }
+
+ /**
+ * The color is converted to CMYK with just the K component {@inheritDoc}
+ */
+ public Color convert(Color color) {
+
+ float kValue = (RED_WEIGHT * color.getRed() + GREEN_WEIGTH * color.getGreen() + BLUE_WEIGHT
+ * color.getBlue()) / 255.0f / 255.0f;
+
+ return ColorUtil.toCMYKGrayColor(kValue);
+ }
+}
diff --git a/src/java/org/apache/fop/afp/Startable.java b/src/java/org/apache/fop/afp/Startable.java index fd05b8455..62995d4d5 100644 --- a/src/java/org/apache/fop/afp/Startable.java +++ b/src/java/org/apache/fop/afp/Startable.java @@ -27,7 +27,7 @@ public interface Startable { /** * Sets whether or not this object has started or not * - * @param complete true if this object has started + * @param started true if this object has started */ void setStarted(boolean started); diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSet.java b/src/java/org/apache/fop/afp/fonts/CharacterSet.java index fec2e6741..7123d4138 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSet.java +++ b/src/java/org/apache/fop/afp/fonts/CharacterSet.java @@ -21,7 +21,6 @@ package org.apache.fop.afp.fonts; import java.io.File; import java.io.UnsupportedEncodingException; -import java.net.URI; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; @@ -102,7 +101,8 @@ public class CharacterSet { * @param encoding the encoding of the font * @param name the character set name * @param path the path to the installed afp fonts - * @deprecated Please use {@link #CharacterSet(String, String, String, URI)} instead. + * @deprecated Please use + * {@link #CharacterSet(String, String, String, ResourceAccessor)} instead. */ public CharacterSet(String codePage, String encoding, String name, String path) { this(codePage, encoding, name, diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java b/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java index 7d2c46bc6..d575e2ae1 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java +++ b/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java @@ -114,8 +114,9 @@ public class CharacterSetBuilder { */ private final SoftMapCache characterSetsCache = new SoftMapCache(true); - - private CharacterSetBuilder() { } + /** Default constructor. */ + protected CharacterSetBuilder() { + } /** * Factory method for the single-byte implementation of AFPFontReader. diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java b/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java index 84e4b7a69..b7246f35b 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java +++ b/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java @@ -279,7 +279,7 @@ public class CharacterSetOrientation { * Returns the space increment. * @return the space increment */ - public int getSpaceIncrement(){ + public int getSpaceIncrement() { return this.spaceIncrement; } @@ -295,7 +295,7 @@ public class CharacterSetOrientation { * Returns the em space increment. * @return the em space increment */ - public int getEmSpaceIncrement(){ + public int getEmSpaceIncrement() { return this.emSpaceIncrement; } diff --git a/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java b/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java index 9f5dcbcf7..4514eac5d 100644 --- a/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java +++ b/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java @@ -36,7 +36,7 @@ public class DoubleByteFont extends AbstractOutlineFont { private static final Set IDEOGRAPHIC = new java.util.HashSet(); static { IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS); - //IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT); //Java 1.5 + //IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT);//Java 1.5 IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS); IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A); //IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B); //Java 1.1 diff --git a/src/java/org/apache/fop/afp/fonts/OutlineFont.java b/src/java/org/apache/fop/afp/fonts/OutlineFont.java index 26488e54d..d4fd0624d 100644 --- a/src/java/org/apache/fop/afp/fonts/OutlineFont.java +++ b/src/java/org/apache/fop/afp/fonts/OutlineFont.java @@ -24,7 +24,11 @@ package org.apache.fop.afp.fonts; */ public class OutlineFont extends AbstractOutlineFont { - /** {@inheritDoc} */ + /** + * Construct outline font with specified name and character set. + * @param name font's name + * @param charSet font's character set + */ public OutlineFont(String name, CharacterSet charSet) { super(name, charSet); } diff --git a/src/java/org/apache/fop/afp/fonts/RasterFont.java b/src/java/org/apache/fop/afp/fonts/RasterFont.java index cba608471..2a4d5d270 100644 --- a/src/java/org/apache/fop/afp/fonts/RasterFont.java +++ b/src/java/org/apache/fop/afp/fonts/RasterFont.java @@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory; public class RasterFont extends AFPFont { /** Static logging instance */ - protected static final Log log = LogFactory.getLog("org.apache.fop.afp.fonts"); + protected static final Log LOG = LogFactory.getLog("org.apache.fop.afp.fonts"); private final SortedMap/*<Integer,CharacterSet>*/ charSets = new java.util.TreeMap/*<Integer,CharacterSet>*/(); @@ -117,7 +117,7 @@ public class RasterFont extends AFPFont { substitutionCharSets.put(requestedSize, csm); String msg = "No " + (size / 1000f) + "pt font " + getFontName() + " found, substituted with " + fontSize.intValue() / 1000f + "pt font"; - log.warn(msg); + LOG.warn(msg); } } @@ -125,7 +125,7 @@ public class RasterFont extends AFPFont { // Still no match -> error String msg = "No font found for font " + getFontName() + " with point size " + size / 1000f; - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } @@ -144,7 +144,7 @@ public class RasterFont extends AFPFont { return csm.getFirstChar(); } else { String msg = "getFirstChar() - No character set found for font:" + getFontName(); - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } } @@ -161,7 +161,7 @@ public class RasterFont extends AFPFont { return csm.getLastChar(); } else { String msg = "getLastChar() - No character set found for font:" + getFontName(); - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } diff --git a/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java b/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java index 3c3442def..f5db5ce46 100644 --- a/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java +++ b/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java @@ -32,6 +32,7 @@ public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder /** array of x/y coordinates */ protected int[] coords = null; + /** if true, then uses relative drawing order */ protected boolean relative = false; /** @@ -51,7 +52,7 @@ public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder * Constructor * * @param coords the x/y coordinates for this object - * @param relative + * @param relative true if relative drawing order */ public AbstractGraphicsCoord(int[] coords, boolean relative) { this(coords); diff --git a/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java b/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java index 1162e83aa..8d94bf9fc 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java @@ -73,7 +73,6 @@ public final class GraphicsChainedSegment extends AbstractGraphicsDrawingOrderCo return NAME_LENGTH; } - /** {@inheritDoc} */ byte getOrderCode() { return 0x70; } diff --git a/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java b/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java index 6d6e44c97..dc61f1034 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java @@ -52,8 +52,6 @@ public class GraphicsCharacterString extends AbstractGraphicsCoord { * Constructor (relative positioning) * * @param str the character string - * @param x the x coordinate - * @param y the y coordinate */ public GraphicsCharacterString(String str) { super(null); diff --git a/src/java/org/apache/fop/afp/goca/GraphicsFillet.java b/src/java/org/apache/fop/afp/goca/GraphicsFillet.java index 9dad2fe1c..d935f6550 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsFillet.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsFillet.java @@ -29,6 +29,7 @@ public final class GraphicsFillet extends AbstractGraphicsCoord { * Constructor * * @param coords the x/y coordinates for this object + * @param relative true if uses relative drawing order */ public GraphicsFillet(int[] coords, boolean relative) { super(coords, relative); diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetMix.java b/src/java/org/apache/fop/afp/goca/GraphicsSetMix.java index dfb5ae0d2..6551470cc 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetMix.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsSetMix.java @@ -27,7 +27,10 @@ import java.io.OutputStream; */ public class GraphicsSetMix extends AbstractGraphicsDrawingOrder { + /** default mode */ public static final byte MODE_DEFAULT = 0x00; + + /** overpaint mode */ public static final byte MODE_OVERPAINT = 0x02; /** the mix mode value */ diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java b/src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java index e2cc081ce..e3968d824 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java @@ -84,7 +84,7 @@ public class GraphicsSetPatternSymbol extends AbstractGraphicsDrawingOrder { /** * Main constructor * - * @param symb the pattern symbol to use + * @param pattern the pattern symbol to use */ public GraphicsSetPatternSymbol(byte pattern) { this.pattern = pattern; diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java index 4d45b22cb..aba02f76c 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java @@ -75,7 +75,7 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder { } else if (colSpaceType == ColorSpace.TYPE_RGB) { colspace = RGB; } else { - log.error("unsupported colorspace " + colSpaceType); + LOG.error("unsupported colorspace " + colSpaceType); colspace = RGB; } diff --git a/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java b/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java index 5c1b9da94..b0cce02e1 100644 --- a/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java +++ b/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java @@ -85,9 +85,9 @@ public class IDEStructureParameter implements Streamable { } /** - * Sets - * @param numComponents - * @param bitsPerComponent + * Sets uniform bits per component. + * @param numComponents the number of components + * @param bitsPerComponent number of bits per component */ public void setUniformBitsPerComponent(int numComponents, int bitsPerComponent) { if (bitsPerComponent < 0 || bitsPerComponent >= 256) { diff --git a/src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java b/src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java index 789eeb950..9a5d4b402 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java +++ b/src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java @@ -26,7 +26,10 @@ package org.apache.fop.afp.ioca; * shades of grey (betweeen 0 and 16) the lower the number being the * darker the shade. The image data dimensions are 64 x 8. */ -public class ImageRasterPattern { +public final class ImageRasterPattern { + + private ImageRasterPattern() { + } /** * The Raster Pattern for Greyscale 16 diff --git a/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java b/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java index 45239a6cf..4b1439da0 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java +++ b/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java @@ -27,6 +27,7 @@ import java.util.Iterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.afp.Streamable; import org.apache.fop.afp.util.BinaryUtils; @@ -38,11 +39,12 @@ import org.apache.fop.afp.util.BinaryUtils; public abstract class AbstractAFPObject implements Streamable { /** Static logging instance */ - protected static final Log log = LogFactory.getLog("org.apache.xmlgraphics.afp.modca"); + protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp.modca"); /** the structured field class id */ protected static final byte SF_CLASS = (byte)0xD3; + /** the structure field header */ protected static final byte[] SF_HEADER = new byte[] { 0x5A, // Structured field identifier 0x00, // Length byte 1 @@ -187,7 +189,8 @@ public abstract class AbstractAFPObject implements Streamable { 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"); + LOG.warn("truncated character string '" + + str + "', longer than " + maxLength + " chars"); } return str; } diff --git a/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java b/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java index abc3aea87..d06311a47 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java +++ b/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java @@ -73,7 +73,7 @@ public abstract class AbstractEnvironmentGroup extends AbstractNamedAFPObject { mpo.addOverlay(name); } catch (MaximumSizeExceededException ex) { // Should never happen (but log just in case) - log.error("createOverlay():: resulted in a MaximumSizeExceededException"); + LOG.error("createOverlay():: resulted in a MaximumSizeExceededException"); } } } @@ -88,6 +88,11 @@ public abstract class AbstractEnvironmentGroup extends AbstractNamedAFPObject { return (MapPageOverlay)getLastElement(this.mapPageOverlays); } + /** + * Get last element. + * @param list of elements + * @return last element or null if none + */ protected Object getLastElement(List list) { if (list != null && list.size() > 0) { return list.get(list.size() - 1); diff --git a/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java b/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java index 4e0dbc349..b349e1f7d 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java +++ b/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java @@ -73,7 +73,7 @@ public abstract class AbstractNamedAFPObject extends AbstractTripletStructuredOb name = (name + " ").substring(0, afpNameLen); } else if (name.length() > afpNameLen) { String truncatedName = name.substring(nameLen - afpNameLen, nameLen); - log.warn("Constructor:: name '" + name + "'" + LOG.warn("Constructor:: name '" + name + "'" + " truncated to " + afpNameLen + " chars" + " ('" + truncatedName + "')"); name = truncatedName; @@ -83,7 +83,7 @@ public abstract class AbstractNamedAFPObject extends AbstractTripletStructuredOb nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING); } catch (UnsupportedEncodingException usee) { nameBytes = name.getBytes(); - log.warn( + LOG.warn( "Constructor:: UnsupportedEncodingException translating the name " + name); } diff --git a/src/java/org/apache/fop/afp/modca/AbstractPageObject.java b/src/java/org/apache/fop/afp/modca/AbstractPageObject.java index af676410f..1454cf96d 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractPageObject.java +++ b/src/java/org/apache/fop/afp/modca/AbstractPageObject.java @@ -166,8 +166,7 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject implemen * Helper method to create text on the current page, this method delegates * to the presentation text object in order to construct the text. * - * @param textDataInfo - * the afp text data + * @param producer the producer * @throws UnsupportedEncodingException thrown if character encoding is not supported */ public void createText(PtocaProducer producer) throws UnsupportedEncodingException { @@ -258,6 +257,7 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject implemen * the x coordinate of the page segment. * @param y * the y coordinate of the page segment. + * @param hard true if hard page segment possible */ public void createIncludePageSegment(String name, int x, int y, boolean hard) { IncludePageSegment ips = factory.createIncludePageSegment(name, x, y); diff --git a/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java b/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java index efc38f3b8..4b269086e 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java +++ b/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java @@ -27,8 +27,6 @@ import java.util.List; 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; @@ -150,7 +148,7 @@ public class AbstractTripletStructuredObject extends AbstractStructuredObject { if (fqNameTriplet != null) { return fqNameTriplet.getFullyQualifiedName(); } - log.warn(this + " has no fully qualified name"); + LOG.warn(this + " has no fully qualified name"); return null; } diff --git a/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java b/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java index ecdfa0157..696787bc4 100644 --- a/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java +++ b/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java @@ -185,7 +185,7 @@ public final class ActiveEnvironmentGroup extends AbstractEnvironmentGroup { mapCodedFont.addFont(fontRef, font, size, orientation); } catch (MaximumSizeExceededException ex) { // Should never happen (but log just in case) - log.error("createFont():: resulted in a MaximumSizeExceededException"); + LOG.error("createFont():: resulted in a MaximumSizeExceededException"); } } } @@ -205,6 +205,10 @@ public final class ActiveEnvironmentGroup extends AbstractEnvironmentGroup { } } + /** + * Add map page segment. + * @param name of segment to add + */ public void addMapPageSegment(String name) { try { needMapPageSegment().addPageSegment(name); diff --git a/src/java/org/apache/fop/afp/modca/GraphicsObject.java b/src/java/org/apache/fop/afp/modca/GraphicsObject.java index b677a0f7c..11af83cab 100644 --- a/src/java/org/apache/fop/afp/modca/GraphicsObject.java +++ b/src/java/org/apache/fop/afp/modca/GraphicsObject.java @@ -98,7 +98,7 @@ public class GraphicsObject extends AbstractDataObject { getObjectEnvironmentGroup().setDataDescriptor(graphicsDataDescriptor); } - /** {@inheritDoc} */ + /** @param object the structured data */ public void addObject(StructuredData object) { if (currentData == null) { newData(); @@ -385,7 +385,11 @@ public class GraphicsObject extends AbstractDataObject { } /** the internal graphics state */ - private static class GraphicsState { + private static final class GraphicsState { + + private GraphicsState() { + } + /** the current color */ private Color color; diff --git a/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java b/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java index 386d2f40f..f11201c88 100644 --- a/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java +++ b/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java @@ -29,8 +29,11 @@ import org.apache.fop.afp.util.BinaryUtils; */ public class ImageDataDescriptor extends AbstractDescriptor { + /** function set fs10 */ public static final byte FUNCTION_SET_FS10 = 0x0A; + /** function set fs11 */ public static final byte FUNCTION_SET_FS11 = 0x0B; + /** function set fs45 */ public static final byte FUNCTION_SET_FS45 = 45; private byte functionSet = FUNCTION_SET_FS11; // FCNSET = IOCA FS 11 diff --git a/src/java/org/apache/fop/afp/modca/IncludeObject.java b/src/java/org/apache/fop/afp/modca/IncludeObject.java index 2dff6bd87..46b4a31f2 100644 --- a/src/java/org/apache/fop/afp/modca/IncludeObject.java +++ b/src/java/org/apache/fop/afp/modca/IncludeObject.java @@ -116,8 +116,9 @@ public class IncludeObject extends AbstractNamedAFPObject { /** * Sets the x and y offset of the content area to the object area - * used in conjunction with the {@link MappingOptionTriplet.POSITION} and - * {@link MappingOptionTriplet.POSITION_AND_TRIM}. + * used in conjunction with the + * {@link MappingOptionTriplet#POSITION} and + * {@link MappingOptionTriplet#POSITION_AND_TRIM}. * * @param x the X-axis origin defined in the object * @param y the Y-axis origin defined in the object diff --git a/src/java/org/apache/fop/afp/modca/MapCodedFont.java b/src/java/org/apache/fop/afp/modca/MapCodedFont.java index 084ae4b4c..69d8ccf31 100644 --- a/src/java/org/apache/fop/afp/modca/MapCodedFont.java +++ b/src/java/org/apache/fop/afp/modca/MapCodedFont.java @@ -180,7 +180,7 @@ public class MapCodedFont extends AbstractStructuredObject { if (cs == null) { String msg = "Character set not found for font " + font.getFontName() + " with point size " + size; - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } @@ -243,7 +243,7 @@ public class MapCodedFont extends AbstractStructuredObject { } else { String msg = "Font of type " + font.getClass().getName() + " not recognized."; - log.error(msg); + LOG.error(msg); throw new FontRuntimeException(msg); } @@ -264,7 +264,10 @@ public class MapCodedFont extends AbstractStructuredObject { /** * Private utility class used as a container for font attributes */ - private class FontDefinition { + private static final class FontDefinition { + + private FontDefinition() { + } /** * The code page of the font diff --git a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java b/src/java/org/apache/fop/afp/modca/MapPageOverlay.java index 9fd3c7059..6f5855c93 100644 --- a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java +++ b/src/java/org/apache/fop/afp/modca/MapPageOverlay.java @@ -69,14 +69,14 @@ public class MapPageOverlay extends AbstractAFPObject { throw new IllegalArgumentException("The name of overlay " + name + " must be 8 characters"); } - if (log.isDebugEnabled()) { - log.debug("addOverlay():: adding overlay " + name); + if (LOG.isDebugEnabled()) { + LOG.debug("addOverlay():: adding overlay " + name); } try { byte[] data = name.getBytes(AFPConstants.EBCIDIC_ENCODING); getOverlays().add(data); } catch (UnsupportedEncodingException usee) { - log.error("addOverlay():: UnsupportedEncodingException translating the name " + LOG.error("addOverlay():: UnsupportedEncodingException translating the name " + name); } } diff --git a/src/java/org/apache/fop/afp/modca/MapPageSegment.java b/src/java/org/apache/fop/afp/modca/MapPageSegment.java index e2afd0257..8bb7afe46 100644 --- a/src/java/org/apache/fop/afp/modca/MapPageSegment.java +++ b/src/java/org/apache/fop/afp/modca/MapPageSegment.java @@ -67,8 +67,8 @@ public class MapPageSegment extends AbstractAFPObject { throw new IllegalArgumentException("The name of page segment " + name + " must not be longer than 8 characters"); } - if (log.isDebugEnabled()) { - log.debug("addPageSegment():: adding page segment " + name); + if (LOG.isDebugEnabled()) { + LOG.debug("addPageSegment():: adding page segment " + name); } getPageSegments().add(name); } @@ -124,7 +124,7 @@ public class MapPageSegment extends AbstractAFPObject { byte[] nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING); System.arraycopy(nameBytes, 0, data, pos, nameBytes.length); } catch (UnsupportedEncodingException usee) { - log.error("UnsupportedEncodingException translating the name " + LOG.error("UnsupportedEncodingException translating the name " + name); } pos += 8; diff --git a/src/java/org/apache/fop/afp/modca/ObjectContainer.java b/src/java/org/apache/fop/afp/modca/ObjectContainer.java index e5a57ebe9..515425906 100644 --- a/src/java/org/apache/fop/afp/modca/ObjectContainer.java +++ b/src/java/org/apache/fop/afp/modca/ObjectContainer.java @@ -113,9 +113,9 @@ public class ObjectContainer extends AbstractDataObject { } /** - * Sets the inputstream for the the object container data + * Sets the data for the the object container * - * @param inputStream the inputstream for the object container data + * @param data a byte array */ public void setData(byte[] data) { this.data = data; diff --git a/src/java/org/apache/fop/afp/modca/PageGroup.java b/src/java/org/apache/fop/afp/modca/PageGroup.java index f70b6fc52..895ec1259 100644 --- a/src/java/org/apache/fop/afp/modca/PageGroup.java +++ b/src/java/org/apache/fop/afp/modca/PageGroup.java @@ -100,6 +100,7 @@ public class PageGroup extends AbstractResourceEnvironmentGroupContainer { return this.getName(); } + /** @return the TLE sequence number */ public int getTleSequence() { return tleSequence; } diff --git a/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java b/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java index ff16e89b6..a7ce0ea0b 100644 --- a/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java +++ b/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java @@ -60,9 +60,13 @@ public class PreprocessPresentationObject extends AbstractTripletStructuredObjec } } + /** 0 degrees orientation */ public static final byte ORIENTATION_ZERO_DEGREES = 1; + /** 90 degrees orientation */ public static final byte ORIENTATION_90_DEGREES = 2; + /** 180 degrees orientation */ public static final byte ORIENTATION_180_DEGREES = 4; + /** 270 degrees orientation */ public static final byte ORIENTATION_270_DEGREES = 8; /** diff --git a/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java b/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java index 9b15de8c1..ee48f86be 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java +++ b/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java @@ -31,6 +31,11 @@ public class CommentTriplet extends AbstractTriplet { private final String commentString; + /** + * Construct a triplet. + * @param id the triplet identification number + * @param commentString a comment + */ public CommentTriplet(byte id, String commentString) { super(id); this.commentString = commentString; diff --git a/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java b/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java index 8430a47ee..df5d7553d 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java +++ b/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java @@ -182,7 +182,8 @@ public class ObjectClassificationTriplet extends AbstractTriplet { data[5] = 0x00; // reserved (must be zero) // StrucFlgs - Information on the structure of the object container - byte[] structureFlagsBytes = getStructureFlagsAsBytes(dataInContainer, containerHasOEG, dataInOCD); + byte[] structureFlagsBytes + = getStructureFlagsAsBytes(dataInContainer, containerHasOEG, dataInOCD); data[6] = structureFlagsBytes[0]; data[7] = structureFlagsBytes[1]; diff --git a/src/java/org/apache/fop/afp/modca/triplets/Triplet.java b/src/java/org/apache/fop/afp/modca/triplets/Triplet.java index 726727e3e..7234645f8 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/Triplet.java +++ b/src/java/org/apache/fop/afp/modca/triplets/Triplet.java @@ -22,64 +22,123 @@ package org.apache.fop.afp.modca.triplets; import org.apache.fop.afp.Streamable; import org.apache.fop.afp.StructuredData; +/** + * Triplet interface. + */ public interface Triplet extends Streamable, StructuredData { + + /** maximum length */ int MAX_LENGTH = 254; + /** CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER identifier */ byte CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER = 0x01; - /** Triplet identifiers */ + /** FULLY_QUALIFIED_NAME triplet identifier */ byte FULLY_QUALIFIED_NAME = 0x02; + /** MAPPING_OPTION triplet identifier */ byte MAPPING_OPTION = 0x04; + /** OBJECT_CLASSIFICATION triplet identifier */ byte OBJECT_CLASSIFICATION = 0x10; + /** MODCA_INTERCHANGE_SET triplet identifier */ byte MODCA_INTERCHANGE_SET = 0x18; + /** FONT_DESCRIPTOR_SPECIFICATION triplet identifier */ byte FONT_DESCRIPTOR_SPECIFICATION = 0x1F; + /** OBJECT_FUNCTION_SET_SPECIFICATION triplet identifier */ byte OBJECT_FUNCTION_SET_SPECIFICATION = 0x21; + /** EXTENDED_RESOURCE_LOCAL_IDENTIFIER triplet identifier */ byte EXTENDED_RESOURCE_LOCAL_IDENTIFIER = 0x22; + /** RESOURCE_LOCAL_IDENTIFIER triplet identifier */ byte RESOURCE_LOCAL_IDENTIFIER = 0x24; + /** RESOURCE_SECTION_NUMBER triplet identifier */ byte RESOURCE_SECTION_NUMBER = 0x25; + /** CHARACTER_ROTATION triplet identifier */ byte CHARACTER_ROTATION = 0x26; + /** OBJECT_BYTE_OFFSET triplet identifier */ byte OBJECT_BYTE_OFFSET = 0x2D; + /** ATTRIBUTE_VALUE triplet identifier */ byte ATTRIBUTE_VALUE = 0x36; + /** DESCRIPTOR_POSITION triplet identifier */ byte DESCRIPTOR_POSITION = 0x43; + /** MEDIA_EJECT_CONTROL triplet identifier */ byte MEDIA_EJECT_CONTROL = 0x45; + /** PAGE_OVERLAY_CONDITIONAL_PROCESSING triplet identifier */ byte PAGE_OVERLAY_CONDITIONAL_PROCESSING = 0x46; + /** RESOURCE_USAGE_ATTRIBUTE triplet identifier */ byte RESOURCE_USAGE_ATTRIBUTE = 0x47; + /** MEASUREMENT_UNITS triplet identifier */ byte MEASUREMENT_UNITS = 0x4B; + /** OBJECT_AREA_SIZE triplet identifier */ byte OBJECT_AREA_SIZE = 0x4C; + /** AREA_DEFINITION triplet identifier */ byte AREA_DEFINITION = 0x4D; + /** COLOR_SPECIFICATION triplet identifier */ byte COLOR_SPECIFICATION = 0x4E; + /** ENCODING_SCHEME_ID triplet identifier */ byte ENCODING_SCHEME_ID = 0x50; + /** MEDIUM_MAP_PAGE_NUMBER triplet identifier */ byte MEDIUM_MAP_PAGE_NUMBER = 0x56; + /** OBJECT_BYTE_EXTENT triplet identifier */ byte OBJECT_BYTE_EXTENT = 0x57; + /** OBJECT_STRUCTURED_FIELD_OFFSET triplet identifier */ byte OBJECT_STRUCTURED_FIELD_OFFSET = 0x58; + /** OBJECT_STRUCTURED_FIELD_EXTENT triplet identifier */ byte OBJECT_STRUCTURED_FIELD_EXTENT = 0x59; + /** OBJECT_OFFSET triplet identifier */ byte OBJECT_OFFSET = 0x5A; + /** FONT_HORIZONTAL_SCALE_FACTOR triplet identifier */ byte FONT_HORIZONTAL_SCALE_FACTOR = 0x5D; + /** OBJECT_COUNT triplet identifier */ byte OBJECT_COUNT = 0x5E; + /** OBJECT_DATE_AND_TIMESTAMP triplet identifier */ byte OBJECT_DATE_AND_TIMESTAMP = 0x62; + /** COMMENT triplet identifier */ byte COMMENT = 0x65; + /** MEDIUM_ORIENTATION triplet identifier */ byte MEDIUM_ORIENTATION = 0x68; + /** RESOURCE_OBJECT_INCLUDE triplet identifier */ byte RESOURCE_OBJECT_INCLUDE = 0x6C; + /** PRESENTATION_SPACE_RESET_MIXING triplet identifier */ byte PRESENTATION_SPACE_RESET_MIXING = 0x70; + /** PRESENTATION_SPACE_MIXING_RULE triplet identifier */ byte PRESENTATION_SPACE_MIXING_RULE = 0x71; + /** UNIVERSAL_DATE_AND_TIMESTAMP triplet identifier */ byte UNIVERSAL_DATE_AND_TIMESTAMP = 0x72; + /** TONER_SAVER triplet identifier */ byte TONER_SAVER = 0x74; + /** COLOR_FIDELITY triplet identifier */ byte COLOR_FIDELITY = 0x75; + /** FONT_FIDELITY triplet identifier */ byte FONT_FIDELITY = 0x78; + /** ATTRIBUTE_QUALIFIER triplet identifier */ byte ATTRIBUTE_QUALIFIER = (byte)0x80; + /** PAGE_POSITION_INFORMATION triplet identifier */ byte PAGE_POSITION_INFORMATION = (byte)0x81; + /** PARAMETER_VALUE triplet identifier */ byte PARAMETER_VALUE = (byte)0x82; + /** PRESENTATION_CONTROL triplet identifier */ byte PRESENTATION_CONTROL = (byte)0x83; + /** FONT_RESOLUTION_AND_METRIC_TECHNOLOGY triplet identifier */ byte FONT_RESOLUTION_AND_METRIC_TECHNOLOGY = (byte)0x84; + /** FINISHING_OPERATION triplet identifier */ byte FINISHING_OPERATION = (byte)0x85; + /** TEXT_FIDELITY triplet identifier */ byte TEXT_FIDELITY = (byte)0x86; + /** MEDIA_FIDELITY triplet identifier */ byte MEDIA_FIDELITY = (byte)0x87; + /** FINISHING_FIDELITY triplet identifier */ byte FINISHING_FIDELITY = (byte)0x88; + /** DATA_OBJECT_FONT_DESCRIPTOR triplet identifier */ byte DATA_OBJECT_FONT_DESCRIPTOR = (byte)0x8B; + /** LOCALE_SELECTOR triplet identifier */ byte LOCALE_SELECTOR = (byte)0x8C; + /** UP3I_FINISHING_OPERATION triplet identifier */ byte UP3I_FINISHING_OPERATION = (byte)0x8E; + /** COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR triplet identifier */ byte COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR = (byte)0x91; + /** RENDERING_INTENT triplet identifier */ byte RENDERING_INTENT = (byte)0x95; + /** CMR_TAG_FIDELITY triplet identifier */ byte CMR_TAG_FIDELITY = (byte)0x96; + /** DEVICE_APPEARANCE triplet identifier */ byte DEVICE_APPEARANCE = (byte)0x97; } diff --git a/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java b/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java index c702d72a8..cf00674fb 100644 --- a/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java +++ b/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java @@ -32,7 +32,7 @@ import org.apache.fop.afp.AFPLineDataInfo; public class LineDataInfoProducer implements PtocaProducer, PtocaConstants { /** Static logging instance */ - private static final Log log = LogFactory.getLog(LineDataInfoProducer.class); + private static final Log LOG = LogFactory.getLog(LineDataInfoProducer.class); private AFPLineDataInfo lineDataInfo; @@ -61,7 +61,7 @@ public class LineDataInfoProducer implements PtocaProducer, PtocaConstants { } else if (x1 == x2) { builder.drawBaxisRule(y2 - y1, thickness); } else { - log.error("Invalid axis rule: unable to draw line"); + LOG.error("Invalid axis rule: unable to draw line"); return; } } diff --git a/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java b/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java index 48c1001ef..883414fda 100644 --- a/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java +++ b/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java @@ -60,22 +60,21 @@ public class AFPBridgeContext extends AbstractFOPBridgeContext { /** * Constructs a new bridge context. * @param userAgent the user agent - * @param loader the Document Loader to use for referenced documents. + * @param documentLoader the Document Loader to use for referenced documents. * @param fontInfo the font list for the text painter, may be null * in which case text is painted as shapes - * @param linkTransform AffineTransform to properly place links, - * may be null * @param imageManager an image manager * @param imageSessionContext an image session context * @param linkTransform AffineTransform to properly place links, * may be null - * @param an AFPGraphics 2D implementation + * @param g2d an AFPGraphics 2D implementation */ public AFPBridgeContext(UserAgent userAgent, DocumentLoader documentLoader, FontInfo fontInfo, ImageManager imageManager, ImageSessionContext imageSessionContext, AffineTransform linkTransform, AFPGraphics2D g2d) { - super(userAgent, documentLoader, fontInfo, imageManager, imageSessionContext, linkTransform); + super(userAgent, documentLoader, fontInfo, imageManager, + imageSessionContext, linkTransform); this.g2d = g2d; } diff --git a/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java b/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java index 832397ea6..0a051e675 100644 --- a/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java +++ b/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java @@ -109,7 +109,8 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { } } - private static final Log log = LogFactory.getLog(AFPGraphicsConfiguration.class); + private static final Log LOG + = LogFactory.getLog(AFPGraphicsConfiguration.class); private AffineTransform defaultTransform = null; private AffineTransform normalizingTransform = null; @@ -121,7 +122,7 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { * @return the default transform for the configuration */ public AffineTransform getDefaultTransform() { - log.debug("getDefaultTransform()"); + LOG.debug("getDefaultTransform()"); if (defaultTransform == null) { defaultTransform = new AffineTransform(); } @@ -136,7 +137,7 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { * @return the normalizing transform for the configuration */ public AffineTransform getNormalizingTransform() { - log.debug("getNormalizingTransform()"); + LOG.debug("getNormalizingTransform()"); if (normalizingTransform == null) { normalizingTransform = new AffineTransform(2, 0, 0, 2, 0, 0); } @@ -145,7 +146,7 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration { /** {@inheritDoc} */ public GraphicsDevice getDevice() { - log.debug("getDevice()"); + LOG.debug("getDevice()"); return graphicsDevice; } } diff --git a/src/java/org/apache/fop/afp/svg/AFPTextHandler.java b/src/java/org/apache/fop/afp/svg/AFPTextHandler.java index b7393a3b2..13a32ee78 100644 --- a/src/java/org/apache/fop/afp/svg/AFPTextHandler.java +++ b/src/java/org/apache/fop/afp/svg/AFPTextHandler.java @@ -21,7 +21,6 @@ package org.apache.fop.afp.svg; import java.awt.Color; import java.awt.Graphics2D; -import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,13 +33,13 @@ import org.apache.fop.afp.fonts.AFPPageFonts; import org.apache.fop.afp.modca.GraphicsObject; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; -import org.apache.fop.svg.FOPTextHandler; +import org.apache.fop.svg.FOPTextHandlerAdapter; /** * Specialized TextHandler implementation that the AFPGraphics2D class delegates to to paint text * using AFP GOCA text operations. */ -public class AFPTextHandler implements FOPTextHandler { +public class AFPTextHandler extends FOPTextHandlerAdapter { /** logging instance */ private static Log log = LogFactory.getLog(AFPTextHandler.class); @@ -73,7 +72,6 @@ public class AFPTextHandler implements FOPTextHandler { * Registers a page font * * @param internalFontName the internal font name - * @param internalFontName the internal font name * @param fontSize the font size * @return a font reference */ @@ -88,19 +86,13 @@ public class AFPTextHandler implements FOPTextHandler { return afpFontAttributes.getFontReference(); } - /** {@inheritDoc} */ - public void drawString(String text, float x, float y) throws IOException { - // TODO Remove me after removing the deprecated method in TextHandler. - throw new UnsupportedOperationException("Deprecated method!"); - } - /** * Add a text string to the current data object of the AFP datastream. * The text is painted using text operations. * * {@inheritDoc} */ - public void drawString(Graphics2D g, String str, float x, float y) throws IOException { + public void drawString(Graphics2D g, String str, float x, float y) { if (log.isDebugEnabled()) { log.debug("drawString() str=" + str + ", x=" + x + ", y=" + y); } diff --git a/src/java/org/apache/fop/afp/svg/AFPTextPainter.java b/src/java/org/apache/fop/afp/svg/AFPTextPainter.java index 3bf4983bb..3815c9eae 100644 --- a/src/java/org/apache/fop/afp/svg/AFPTextPainter.java +++ b/src/java/org/apache/fop/afp/svg/AFPTextPainter.java @@ -26,7 +26,7 @@ import org.apache.fop.svg.AbstractFOPTextPainter; import org.apache.fop.svg.FOPTextHandler; /** - * Renders the attributed character iterator of a {@link TextNode}. + * Renders the attributed character iterator of some text. * This class draws the text directly into the AFPGraphics2D so that * the text is not drawn using shapes. * If the text is simple enough to draw then it sets the font and calls diff --git a/src/java/org/apache/fop/afp/util/BinaryUtils.java b/src/java/org/apache/fop/afp/util/BinaryUtils.java index 2b2649415..2b4197b36 100644 --- a/src/java/org/apache/fop/afp/util/BinaryUtils.java +++ b/src/java/org/apache/fop/afp/util/BinaryUtils.java @@ -27,6 +27,9 @@ import java.io.ByteArrayOutputStream; */ public final class BinaryUtils { + private BinaryUtils() { + } + /** * Convert an int into the corresponding byte array by encoding each * two hexadecimal digits as a char. This will return a byte array diff --git a/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java b/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java index d3ed41c76..e5980c3dd 100644 --- a/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java +++ b/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java @@ -29,7 +29,10 @@ import java.awt.geom.Point2D.Double; * The various techniques are described here: * http://www.timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm */ -public class CubicBezierApproximator { +public final class CubicBezierApproximator { + + private CubicBezierApproximator() { + } /** * This method will take in an array containing the x and y coordinates of the four control diff --git a/src/java/org/apache/fop/afp/util/DTDEntityResolver.java b/src/java/org/apache/fop/afp/util/DTDEntityResolver.java index dcf5ad7d9..b4eb7fc23 100644 --- a/src/java/org/apache/fop/afp/util/DTDEntityResolver.java +++ b/src/java/org/apache/fop/afp/util/DTDEntityResolver.java @@ -98,7 +98,7 @@ public class DTDEntityResolver implements EntityResolver { /** * Returns the URL of a resource on the classpath - * @param resourceName the path to the resource relative to the root of the + * @param resourcePath the path to the resource relative to the root of the * classpath. * @return the URL of the required resource * @throws FontRuntimeException if the resource could not be found. diff --git a/src/java/org/apache/fop/afp/util/StringUtils.java b/src/java/org/apache/fop/afp/util/StringUtils.java index ce68d27be..5014089da 100644 --- a/src/java/org/apache/fop/afp/util/StringUtils.java +++ b/src/java/org/apache/fop/afp/util/StringUtils.java @@ -23,7 +23,10 @@ package org.apache.fop.afp.util; * Library of utility methods useful in dealing with strings. * */ -public class StringUtils { +public final class StringUtils { + + private StringUtils() { + } /** * Padds the string to the left with the given character for diff --git a/src/java/org/apache/fop/apps/FopFactoryConfigurator.java b/src/java/org/apache/fop/apps/FopFactoryConfigurator.java index 736ae05d8..e46530177 100644 --- a/src/java/org/apache/fop/apps/FopFactoryConfigurator.java +++ b/src/java/org/apache/fop/apps/FopFactoryConfigurator.java @@ -34,7 +34,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry; import org.apache.xmlgraphics.image.loader.util.Penalty; -import org.apache.fop.fonts.FontManager; import org.apache.fop.fonts.FontManagerConfigurator; import org.apache.fop.util.LogUtil; @@ -198,9 +197,7 @@ public class FopFactoryConfigurator { } // configure font manager - FontManager fontManager = factory.getFontManager(); - FontManagerConfigurator fontManagerConfigurator = new FontManagerConfigurator(cfg); - fontManagerConfigurator.configure(fontManager, strict); + new FontManagerConfigurator(cfg).configure(factory.getFontManager(), strict); // configure image loader framework configureImageLoading(cfg.getChild("image-loading", false), strict); diff --git a/src/java/org/apache/fop/area/AreaEventProducer.java b/src/java/org/apache/fop/area/AreaEventProducer.java index 325367199..c4f5a7a35 100644 --- a/src/java/org/apache/fop/area/AreaEventProducer.java +++ b/src/java/org/apache/fop/area/AreaEventProducer.java @@ -30,7 +30,10 @@ public interface AreaEventProducer extends EventProducer { /** * Provider class for the event producer. */ - class Provider { + static final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java index e41f5e873..31c0e04fc 100644 --- a/src/java/org/apache/fop/area/AreaTreeParser.java +++ b/src/java/org/apache/fop/area/AreaTreeParser.java @@ -228,8 +228,13 @@ public class AreaTreeParser { if (areaStack.size() > 0) { int pos = areaStack.size() - 1; Object obj = null; - while (pos >= 0 && !(clazz.isInstance(obj = areaStack.get(pos)))) { - pos--; + while ( pos >= 0 ) { + obj = areaStack.get(pos); + if ( clazz.isInstance ( obj ) ) { + break; + } else { + pos--; + } } if (pos >= 0) { return (Area)obj; diff --git a/src/java/org/apache/fop/area/Block.java b/src/java/org/apache/fop/area/Block.java index 5faec9f7a..ecb9c4990 100644 --- a/src/java/org/apache/fop/area/Block.java +++ b/src/java/org/apache/fop/area/Block.java @@ -58,6 +58,7 @@ public class Block extends BlockParent { private int stacking = TB; private int positioning = STACK; + /** if true, allow BPD update */ protected transient boolean allowBPDUpdate = true; // a block with may contain the dominant styling info in diff --git a/src/java/org/apache/fop/area/DestinationData.java b/src/java/org/apache/fop/area/DestinationData.java index cb2d6eccb..75b981fb7 100644 --- a/src/java/org/apache/fop/area/DestinationData.java +++ b/src/java/org/apache/fop/area/DestinationData.java @@ -98,7 +98,7 @@ public class DestinationData extends AbstractOffDocumentItem implements Resolvab * object that corresponds to the IDRef * * {@inheritDoc} List) - * @todo check to make sure it works if multiple bookmark-items + * @asf.todo check to make sure it works if multiple bookmark-items * have the same idref */ public void resolveIDRef(String id, List pages) { diff --git a/src/java/org/apache/fop/area/IDTracker.java b/src/java/org/apache/fop/area/IDTracker.java index b55ed7983..829c8c58d 100644 --- a/src/java/org/apache/fop/area/IDTracker.java +++ b/src/java/org/apache/fop/area/IDTracker.java @@ -34,7 +34,7 @@ import org.apache.commons.logging.LogFactory; */ public class IDTracker { - private static final Log log = LogFactory.getLog(IDTracker.class); + private static final Log LOG = LogFactory.getLog(IDTracker.class); // HashMap of ID's whose area is located on one or more consecutive // PageViewports. Each ID has an arraylist of PageViewports that @@ -58,8 +58,8 @@ public class IDTracker { * @param pv a page viewport that contains the area with this ID */ public void associateIDWithPageViewport(String id, PageViewport pv) { - if (log.isDebugEnabled()) { - log.debug("associateIDWithPageViewport(" + id + ", " + pv + ")"); + if (LOG.isDebugEnabled()) { + LOG.debug("associateIDWithPageViewport(" + id + ", " + pv + ")"); } List pvList = (List) idLocations.get(id); if (pvList == null) { // first time ID located @@ -92,8 +92,8 @@ public class IDTracker { * @param id the id of the object being processed */ public void signalPendingID(String id) { - if (log.isDebugEnabled()) { - log.debug("signalPendingID(" + id + ")"); + if (LOG.isDebugEnabled()) { + LOG.debug("signalPendingID(" + id + ")"); } unfinishedIDs.add(id); } @@ -106,8 +106,8 @@ public class IDTracker { * @param id the id of the formatting object which was just finished */ public void signalIDProcessed(String id) { - if (log.isDebugEnabled()) { - log.debug("signalIDProcessed(" + id + ")"); + if (LOG.isDebugEnabled()) { + LOG.debug("signalIDProcessed(" + id + ")"); } alreadyResolvedIDs.add(id); diff --git a/src/java/org/apache/fop/area/LineArea.java b/src/java/org/apache/fop/area/LineArea.java index bbf947499..0e6e6ac30 100644 --- a/src/java/org/apache/fop/area/LineArea.java +++ b/src/java/org/apache/fop/area/LineArea.java @@ -37,7 +37,7 @@ public class LineArea extends Area { * that can be used in order to re-compute adjustement and / or indents when a * page-number or a page-number-citation is resolved */ - private class LineAdjustingInfo implements Serializable { + private final class LineAdjustingInfo implements Serializable { private int lineAlignment; private int difference; private int availableStretch; diff --git a/src/java/org/apache/fop/area/Trait.java b/src/java/org/apache/fop/area/Trait.java index 27ce39252..42c5462e4 100644 --- a/src/java/org/apache/fop/area/Trait.java +++ b/src/java/org/apache/fop/area/Trait.java @@ -34,7 +34,10 @@ import org.apache.fop.util.ColorUtil; * Area traits used for rendering. * This class represents an area trait that specifies a value for rendering. */ -public class Trait implements Serializable { +public final class Trait implements Serializable { + + private Trait() { + } /** * Id reference line, not resolved. diff --git a/src/java/org/apache/fop/area/inline/AbstractTextArea.java b/src/java/org/apache/fop/area/inline/AbstractTextArea.java index e73a8355c..b50f53a24 100644 --- a/src/java/org/apache/fop/area/inline/AbstractTextArea.java +++ b/src/java/org/apache/fop/area/inline/AbstractTextArea.java @@ -140,12 +140,14 @@ public abstract class AbstractTextArea extends InlineParent { if (textWordSpaceAdjust < 0) { // from a negative adjustment to a positive one balancingFactor - = ((double) textAdjustingInfo.availableStretch / textAdjustingInfo.availableShrink) + = ((double) textAdjustingInfo.availableStretch + / textAdjustingInfo.availableShrink) * ((double) lineShrink / lineStretch); } else { // from a positive adjustment to a negative one balancingFactor - = ((double) textAdjustingInfo.availableShrink / textAdjustingInfo.availableStretch) + = ((double) textAdjustingInfo.availableShrink + / textAdjustingInfo.availableStretch) * ((double) lineStretch / lineShrink); } } diff --git a/src/java/org/apache/fop/area/inline/InlineArea.java b/src/java/org/apache/fop/area/inline/InlineArea.java index 5106fd5bc..30afc149b 100644 --- a/src/java/org/apache/fop/area/inline/InlineArea.java +++ b/src/java/org/apache/fop/area/inline/InlineArea.java @@ -218,6 +218,10 @@ public class InlineArea extends Area { return false; } + /** + * Apply IPD variation. + * @param ipdVariation the variation + */ public void handleIPDVariation(int ipdVariation) { increaseIPD(ipdVariation); notifyIPDVariation(ipdVariation); diff --git a/src/java/org/apache/fop/area/inline/SpaceArea.java b/src/java/org/apache/fop/area/inline/SpaceArea.java index 287f09dfc..202408deb 100644 --- a/src/java/org/apache/fop/area/inline/SpaceArea.java +++ b/src/java/org/apache/fop/area/inline/SpaceArea.java @@ -16,6 +16,7 @@ */ /* $Id$ */ + package org.apache.fop.area.inline; /** diff --git a/src/java/org/apache/fop/area/inline/WordArea.java b/src/java/org/apache/fop/area/inline/WordArea.java index 70d10ef9b..4737d81d3 100644 --- a/src/java/org/apache/fop/area/inline/WordArea.java +++ b/src/java/org/apache/fop/area/inline/WordArea.java @@ -16,6 +16,7 @@ */ /* $Id$ */ + package org.apache.fop.area.inline; /** diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java index 011e84008..6b4ec1a1d 100644 --- a/src/java/org/apache/fop/cli/CommandLineOptions.java +++ b/src/java/org/apache/fop/cli/CommandLineOptions.java @@ -41,6 +41,7 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.fonts.FontManager; import org.apache.fop.pdf.PDFAMode; import org.apache.fop.pdf.PDFEncryptionManager; import org.apache.fop.pdf.PDFEncryptionParams; @@ -50,7 +51,7 @@ import org.apache.fop.render.awt.AWTRenderer; import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFSerializer; -import org.apache.fop.render.pdf.PDFRenderer; +import org.apache.fop.render.pdf.PDFConfigurationConstants; import org.apache.fop.render.print.PagesMode; import org.apache.fop.render.print.PrintRenderer; import org.apache.fop.render.xml.XMLRenderer; @@ -109,7 +110,7 @@ public class CommandLineOptions { 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 */ + /* 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(); @@ -129,6 +130,8 @@ public class CommandLineOptions { private String mimicRenderer = null; + private boolean flushCache = false; + /** * Construct a command line option object. */ @@ -166,7 +169,9 @@ public class CommandLineOptions { } checkSettings(); setUserConfig(); - + if (flushCache) { + flushCache(); + } //Factory config is set up, now we can create the user agent foUserAgent = factory.newFOUserAgent(); foUserAgent.getRendererOptions().putAll(renderingOptions); @@ -284,6 +289,10 @@ public class CommandLineOptions { factory.setStrictValidation(false); } else if (args[i].equals("-conserve")) { conserveMemoryPolicy = true; + } else if (args[i].equals("-flush")) { + flushCache = true; + } else if (args[i].equals("-cache")) { + parseCacheOption(args, i); } else if (args[i].equals("-dpi")) { i = i + parseResolution(args, i); } else if (args[i].equals("-q") || args[i].equals("--quiet")) { @@ -385,6 +394,17 @@ public class CommandLineOptions { return true; } // end parseOptions + private int parseCacheOption(String[] args, int i) throws FOPException { + if ((i + 1 == args.length) + || (isOption(args[i + 1]))) { + throw new FOPException("if you use '-cache', you must specify " + + "the name of the font cache file"); + } else { + factory.getFontManager().setCacheFile(new File(args[i + 1])); + return 1; + } + } + private int parseConfigurationOption(String[] args, int i) throws FOPException { if ((i + 1 == args.length) || (isOption(args[i + 1]))) { @@ -785,14 +805,14 @@ public class CommandLineOptions { private PDFEncryptionParams getPDFEncryptionParams() throws FOPException { PDFEncryptionParams params = (PDFEncryptionParams)renderingOptions.get( - PDFRenderer.ENCRYPTION_PARAMS); + PDFConfigurationConstants.ENCRYPTION_PARAMS); if (params == null) { if (!PDFEncryptionManager.checkAvailableAlgorithms()) { throw new FOPException("PDF encryption requested but it is not available." + " Please make sure MD5 and RC4 algorithms are available."); } params = new PDFEncryptionParams(); - renderingOptions.put(PDFRenderer.ENCRYPTION_PARAMS, params); + renderingOptions.put(PDFConfigurationConstants.ENCRYPTION_PARAMS, params); } return params; } @@ -961,10 +981,12 @@ public class CommandLineOptions { "FO output mode is only available if you use -xml and -xsl"); } else if (outputmode.equals(MimeConstants.MIME_FOP_AREA_TREE)) { throw new FOPException( - "Area Tree Output is not available if Intermediate Format is used as input!"); + "Area Tree Output is not available if Intermediate Format" + + " is used as input!"); } else if (outputmode.equals(MimeConstants.MIME_FOP_IF)) { throw new FOPException( - "Intermediate Output is not available if Intermediate Format is used as input!"); + "Intermediate Output is not available if Intermediate Format" + + " is used as input!"); } if (iffile != null && !iffile.exists()) { throw new FileNotFoundException("Error: intermediate format file " @@ -1151,7 +1173,8 @@ public class CommandLineOptions { + " -r relaxed/less strict validation (where available)\n" + " -dpi xxx target resolution in dots per inch (dpi) where xxx is a number\n" + " -s for area tree XML, down to block areas only\n" - + " -v run in verbose mode (currently simply print FOP version and continue)\n\n" + + " -v run in verbose mode (currently simply print FOP version" + + " and continue)\n\n" + " -o [password] PDF file will be encrypted with option owner password\n" + " -u [password] PDF file will be encrypted with option user password\n" + " -noprint PDF file will be encrypted without printing permission\n" @@ -1161,8 +1184,15 @@ public class CommandLineOptions { + " -a enables accessibility features (Tagged PDF etc., default off)\n" + " -pdfprofile prof PDF file will be generated with the specified profile\n" + " (Examples for prof: PDF/A-1b or PDF/X-3:2003)\n\n" - + " -conserve Enable memory-conservation policy (trades memory-consumption for disk I/O)\n" - + " (Note: currently only influences whether the area tree is serialized.)\n\n" + + " -conserve enable memory-conservation policy (trades memory-consumption" + + " for disk I/O)\n" + + " (Note: currently only influences whether the area tree is" + + " serialized.)\n\n" + + + " -cache specifies a file/directory path location" + + " for the font cache file\n" + + " -flush flushes the current font cache file\n\n" + + " [INPUT] \n" + " infile xsl:fo input file (the same as the next) \n" + " (use '-' for infile to pipe input from stdin)\n" @@ -1192,14 +1222,16 @@ public class CommandLineOptions { + " -at [mime] out representation of area tree as XML (outfile req'd) \n" + " specify optional mime output to allow the AT to be converted\n" + " to final format later\n" - + " -if [mime] out representation of document in intermediate format XML (outfile req'd)\n" + + " -if [mime] out representation of document in intermediate format XML" + + " (outfile req'd)\n" + " specify optional mime output to allow the IF to be converted\n" + " to final format later\n" + " -print input file will be rendered and sent to the printer \n" + " see options with \"-print help\" \n" + " -out mime outfile input will be rendered using the given MIME type\n" + " (outfile req'd) Example: \"-out application/pdf D:\\out.pdf\"\n" - + " (Tip: \"-out list\" prints the list of supported MIME types)\n" + + " (Tip: \"-out list\" prints the list of supported MIME types" + + " and exits)\n" //+ " -mif outfile input will be rendered as MIF (FrameMaker) (outfile req'd)\n" //+ " Experimental feature - requires additional fop-sandbox.jar.\n" + " -svg outfile input will be rendered as an SVG slides file (outfile req'd) \n" @@ -1333,5 +1365,14 @@ public class CommandLineOptions { } } + private void flushCache() throws FOPException { + FontManager fontManager = factory.getFontManager(); + File cacheFile = fontManager.getCacheFile(); + if (!fontManager.deleteCache()) { + System.err.println("Failed to flush the font cache file '" + + cacheFile + "'."); + System.exit(1); + } + } } diff --git a/src/java/org/apache/fop/cli/InputHandler.java b/src/java/org/apache/fop/cli/InputHandler.java index e7109fcfa..f6389a25f 100644 --- a/src/java/org/apache/fop/cli/InputHandler.java +++ b/src/java/org/apache/fop/cli/InputHandler.java @@ -196,13 +196,14 @@ public class InputHandler implements ErrorListener, Renderable { * 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. + * @param userAgent the user agent instance */ public void createCatalogResolver(FOUserAgent userAgent) { String[] classNames = new String[] { "org.apache.xml.resolver.tools.CatalogResolver", "com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver"}; - ResourceEventProducer eventProducer = - ResourceEventProducer.Provider.get(userAgent.getEventBroadcaster()); + ResourceEventProducer eventProducer + = ResourceEventProducer.Provider.get(userAgent.getEventBroadcaster()); Class resolverClass = null; for (int i = 0; i < classNames.length && resolverClass == null; ++i) { try { diff --git a/src/java/org/apache/fop/cli/Main.java b/src/java/org/apache/fop/cli/Main.java index c4393bb03..6ae81ea21 100644 --- a/src/java/org/apache/fop/cli/Main.java +++ b/src/java/org/apache/fop/cli/Main.java @@ -35,7 +35,10 @@ import org.apache.fop.apps.MimeConstants; /** * Main command-line class for Apache FOP. */ -public class Main { +public final class Main { + + private Main() { + } /** * @return the list of URLs to all libraries. diff --git a/src/java/org/apache/fop/datatypes/FODimension.java b/src/java/org/apache/fop/datatypes/FODimension.java index cf8acdbb5..e1a94d087 100644 --- a/src/java/org/apache/fop/datatypes/FODimension.java +++ b/src/java/org/apache/fop/datatypes/FODimension.java @@ -27,9 +27,9 @@ package org.apache.fop.datatypes; public class FODimension { /** distance (in millipoints) on the inline-progression-direction */ - public int ipd; + public int ipd; // CSOK: VisibilityModifier /** distance (in millipoints) on the block-progression-direction */ - public int bpd; + public int bpd; // CSOK: VisibilityModifier /** * Constructor @@ -41,6 +41,17 @@ public class FODimension { this.bpd = bpd; } + /** @return ipd */ + public int getIPD() { + return ipd; + } + + /** @return bpd */ + public int getBPD() { + return bpd; + } + + /** {@inheritDoc} */ public String toString() { StringBuffer sb = new StringBuffer(super.toString()); sb.append(" {ipd=").append(Integer.toString(ipd)); diff --git a/src/java/org/apache/fop/datatypes/Numeric.java b/src/java/org/apache/fop/datatypes/Numeric.java index 32ae78921..c26cacd7c 100644 --- a/src/java/org/apache/fop/datatypes/Numeric.java +++ b/src/java/org/apache/fop/datatypes/Numeric.java @@ -37,7 +37,7 @@ public interface Numeric { /** * Return the value of this Numeric * @return the computed value. - * @throws PropertyException + * @throws PropertyException if a propert exception occurs */ double getNumericValue() throws PropertyException; @@ -45,7 +45,7 @@ public interface Numeric { * Return the value of this Numeric * @param context The context for the length calculation (for percentage based lengths) * @return the computed value. - * @throws PropertyException + * @throws PropertyException if a propert exception occurs */ double getNumericValue(PercentBaseContext context) throws PropertyException; @@ -68,14 +68,14 @@ public interface Numeric { * Returns the value of this numeric as an int. * @return the value as an integer. */ - public int getValue(); + int getValue(); /** * Returns the value of this numeric as an int. * @param context the context for the length calculation (for percentage based lengths) * @return the value as an integer. */ - public int getValue(PercentBaseContext context); + int getValue(PercentBaseContext context); /** * Return the resolved value. This method will becalled during evaluation @@ -89,6 +89,7 @@ public interface Numeric { /** * Return the enum value that is stored in this numeric. + * @return the enum value */ - public int getEnum(); + int getEnum(); } diff --git a/src/java/org/apache/fop/datatypes/PercentBaseContext.java b/src/java/org/apache/fop/datatypes/PercentBaseContext.java index 9744f417e..b04f774cf 100644 --- a/src/java/org/apache/fop/datatypes/PercentBaseContext.java +++ b/src/java/org/apache/fop/datatypes/PercentBaseContext.java @@ -36,6 +36,6 @@ public interface PercentBaseContext { * @param fobj The FO object against which the percentage should be evaluated * @return The base length value of the given kind */ - public int getBaseLength(int lengthBase, FObj fobj); + int getBaseLength(int lengthBase, FObj fobj); } diff --git a/src/java/org/apache/fop/datatypes/URISpecification.java b/src/java/org/apache/fop/datatypes/URISpecification.java index 9311851ea..b1a1d84d4 100644 --- a/src/java/org/apache/fop/datatypes/URISpecification.java +++ b/src/java/org/apache/fop/datatypes/URISpecification.java @@ -25,7 +25,10 @@ import java.io.UnsupportedEncodingException; /** * This class contains method to deal with the <uri-specification> datatype from XSL-FO. */ -public class URISpecification { +public final class URISpecification { + + private URISpecification() { + } /** * Get the URL string from a wrapped URL. @@ -94,7 +97,7 @@ public class URISpecification { return false; } - private final static char[] HEX_DIGITS = { + private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; diff --git a/src/java/org/apache/fop/events/EventExceptionManager.java b/src/java/org/apache/fop/events/EventExceptionManager.java index 1072600c9..f7d679282 100644 --- a/src/java/org/apache/fop/events/EventExceptionManager.java +++ b/src/java/org/apache/fop/events/EventExceptionManager.java @@ -27,7 +27,10 @@ import org.apache.xmlgraphics.util.Service; /** * This class is responsible for converting events into exceptions. */ -public class EventExceptionManager { +public final class EventExceptionManager { + + private EventExceptionManager() { + } private static final Map EXCEPTION_FACTORIES = new java.util.HashMap(); diff --git a/src/java/org/apache/fop/events/LoggingEventListener.java b/src/java/org/apache/fop/events/LoggingEventListener.java index 03467303e..58fbb7f97 100644 --- a/src/java/org/apache/fop/events/LoggingEventListener.java +++ b/src/java/org/apache/fop/events/LoggingEventListener.java @@ -79,10 +79,18 @@ public class LoggingEventListener implements EventListener { } else if (severity == EventSeverity.WARN) { log.warn(msg); } else if (severity == EventSeverity.ERROR) { - log.error(msg); + if (event.getParam("e") != null) { + log.error(msg, (Throwable)event.getParam("e")); + } else { + log.error(msg); + } } else if (severity == EventSeverity.FATAL) { if (!skipFatal) { - log.fatal(msg); + if (event.getParam("e") != null) { + log.fatal(msg, (Throwable)event.getParam("e")); + } else { + log.fatal(msg); + } } } else { assert false; diff --git a/src/java/org/apache/fop/events/model/EventModelParser.java b/src/java/org/apache/fop/events/model/EventModelParser.java index ddb1bf663..5441d1c4f 100644 --- a/src/java/org/apache/fop/events/model/EventModelParser.java +++ b/src/java/org/apache/fop/events/model/EventModelParser.java @@ -40,10 +40,13 @@ import org.apache.fop.util.DefaultErrorListener; /** * This is a parser for the event model XML. */ -public class EventModelParser { +public final class EventModelParser { + + private EventModelParser() { + } /** Logger instance */ - protected static Log log = LogFactory.getLog(EventModelParser.class); + private static final Log LOG = LogFactory.getLog(EventModelParser.class); private static SAXTransformerFactory tFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); @@ -57,7 +60,7 @@ public class EventModelParser { public static EventModel parse(Source src) throws TransformerException { Transformer transformer = tFactory.newTransformer(); - transformer.setErrorListener(new DefaultErrorListener(log)); + transformer.setErrorListener(new DefaultErrorListener(LOG)); EventModel model = new EventModel(); SAXResult res = new SAXResult(getContentHandler(model)); diff --git a/src/java/org/apache/fop/fo/FOEventHandler.java b/src/java/org/apache/fop/fo/FOEventHandler.java index 238a4ced6..e280af2d7 100644 --- a/src/java/org/apache/fop/fo/FOEventHandler.java +++ b/src/java/org/apache/fop/fo/FOEventHandler.java @@ -40,11 +40,10 @@ import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.fo.flow.PageNumberCitationLast; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; -import org.apache.fop.fo.flow.table.TableFooter; -import org.apache.fop.fo.flow.table.TableHeader; -import org.apache.fop.fo.flow.table.TablePart; import org.apache.fop.fo.flow.table.TableCell; import org.apache.fop.fo.flow.table.TableColumn; +import org.apache.fop.fo.flow.table.TableFooter; +import org.apache.fop.fo.flow.table.TableHeader; import org.apache.fop.fo.flow.table.TableRow; import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index bbe3ce3a3..a6be832f0 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -633,8 +633,9 @@ public abstract class FONode implements Cloneable { * this method only in exceptional conditions because this method may perform quite extensive * information gathering inside the FO tree. * @return a String containing context information - * @deprecated Not localized! Should rename getContextInfoAlt() to getContextInfo() when done! */ + // [GA] remove deprecation - no alternative specified + // @deprecated Not localized! Should rename getContextInfoAlt() to getContextInfo() when done! public String getContextInfo() { StringBuffer sb = new StringBuffer(); if (getLocalName() != null) { @@ -797,8 +798,9 @@ public abstract class FONode implements Cloneable { /** * This method is overridden by extension elements and allows the extension element to return - * a {@link ContentHandlerFactory}. This factory can create ContentHandler implementations that handle - * foreign XML content by either building up a specific DOM, a Java object or something else. + * a {@link ContentHandlerFactory}. This factory can create ContentHandler implementations that + * handle foreign XML content by either building up a specific DOM, a Java object or something + * else. * * @return the <code>ContentHandlerFactory</code> or <code>null</code> if not applicable */ diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java index 07fb20fd8..8293180cf 100644 --- a/src/java/org/apache/fop/fo/FOPropertyMapping.java +++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java @@ -72,16 +72,20 @@ import org.apache.fop.fo.properties.XMLLangShorthandParser; * This class creates and returns an array of Property.Maker instances * indexed by the PR_* propId from Constants.java. * - * @todo Check multi-threading safety of the statics below + * @asf.todo Check multi-threading safety of the statics below */ public final class FOPropertyMapping implements Constants { - private static Map s_htPropNames = new HashMap(); - private static Map s_htSubPropNames = new HashMap(); - private static Map s_htPropIds = new HashMap(); - private static PropertyMaker[] s_generics = null; + private FOPropertyMapping() { + } + + private static Map propNames = new HashMap(); // CSOK: VisibilityModifier + private static Map subPropNames = new HashMap(); // CSOK: VisibilityModifier + private static Map propIds = new HashMap(); // CSOK: VisibilityModifier + + private static PropertyMaker[] generics = null; // CSOK: VisibilityModifier - // The rest is only used during the building of the s_generics array. + // The rest is only used during the building of the generics array. private Property[] enums = null; private PropertyMaker genericColor = null; @@ -154,7 +158,7 @@ public final class FOPropertyMapping implements Constants { genericPadding.setInherited(false); genericPadding.setDefault("0pt"); genericPadding.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); - genericPadding.addShorthand(s_generics[PR_PADDING]); + genericPadding.addShorthand(generics[PR_PADDING]); // GenericCondBorderWidth genericCondBorderWidth = new CondLengthProperty.Maker(0); @@ -235,15 +239,15 @@ public final class FOPropertyMapping implements Constants { /** * Add a property maker to the generics array. - * Also creates the name <-> id mapping in s_htPropNames and s_htPropIds. + * Also creates the name <-> id mapping in propNames and propIds. * * @param name the name of the property maker. * @param maker the maker. */ private static void addPropertyMaker(String name, PropertyMaker maker) { - s_generics[maker.getPropId()] = maker; - s_htPropNames.put(name, new Integer(maker.getPropId())); - s_htPropIds.put(new Integer(maker.getPropId()), name); + generics[maker.getPropId()] = maker; + propNames.put(name, new Integer(maker.getPropId())); + propIds.put(new Integer(maker.getPropId()), name); } /** @@ -252,8 +256,8 @@ public final class FOPropertyMapping implements Constants { * @param id Id for the subproperty from CP_* in Constants.java. */ private static void addSubpropMakerName(String name, int id) { - s_htSubPropNames.put(name, new Integer(id)); - s_htPropIds.put(new Integer(id), name); + subPropNames.put(name, new Integer(id)); + propIds.put(new Integer(id), name); } /** @@ -278,9 +282,9 @@ public final class FOPropertyMapping implements Constants { */ public static PropertyMaker[] getGenericMappings() { - if (s_generics == null) { + if (generics == null) { /* this method was never called before */ - s_generics = new PropertyMaker[PROPERTY_COUNT + 1]; + generics = new PropertyMaker[PROPERTY_COUNT + 1]; FOPropertyMapping gp = new FOPropertyMapping(); /* Create the shorthand first. They are @@ -328,7 +332,7 @@ public final class FOPropertyMapping implements Constants { addSubpropMakerName("precedence", CP_PRECEDENCE); } - return s_generics; + return generics; } /** @@ -338,7 +342,7 @@ public final class FOPropertyMapping implements Constants { */ public static int getPropertyId(String name) { if (name != null) { - Integer i = (Integer) s_htPropNames.get(name); + Integer i = (Integer) propNames.get(name); if (i != null) { return i.intValue(); } @@ -353,7 +357,7 @@ public final class FOPropertyMapping implements Constants { */ public static int getSubPropertyId(String name) { if (name != null) { - Integer i = (Integer) s_htSubPropNames.get(name); + Integer i = (Integer) subPropNames.get(name); if (i != null) { return i.intValue(); } @@ -369,10 +373,10 @@ public final class FOPropertyMapping implements Constants { public static String getPropertyName(int id) { if (((id & Constants.COMPOUND_MASK) == 0) || ((id & Constants.PROPERTY_MASK) == 0)) { - return (String) s_htPropIds.get(new Integer(id)); + return (String) propIds.get(new Integer(id)); } else { - return s_htPropIds.get(new Integer(id & Constants.PROPERTY_MASK)) - + "." + s_htPropIds.get(new Integer(id & Constants.COMPOUND_MASK)); + return propIds.get(new Integer(id & Constants.PROPERTY_MASK)) + + "." + propIds.get(new Integer(id & Constants.COMPOUND_MASK)); } } @@ -403,7 +407,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("fixed", getEnumProperty(EN_FIXED, "FIXED")); m.addEnum("absolute", getEnumProperty(EN_ABSOLUTE, "ABSOLUTE")); m.setDefault("auto"); - m.addShorthand(s_generics[PR_POSITION]); + m.addShorthand(generics[PR_POSITION]); addPropertyMaker("absolute-position", m); // top @@ -551,7 +555,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("volume", m); } - private void createBorderPaddingBackgroundProperties() { + private void createBorderPaddingBackgroundProperties() { // CSOK: MethodLength PropertyMaker m; BorderWidthPropertyMaker bwm; CorrespondingPropertyMaker corr; @@ -606,7 +610,7 @@ public final class FOPropertyMapping implements Constants { m.addKeyword("center", "50%"); m.addKeyword("right", "100%"); m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL); - m.addShorthand(s_generics[PR_BACKGROUND_POSITION]); + m.addShorthand(generics[PR_BACKGROUND_POSITION]); addPropertyMaker("background-position-horizontal", m); // background-position-vertical @@ -617,7 +621,7 @@ public final class FOPropertyMapping implements Constants { m.addKeyword("center", "50%"); m.addKeyword("bottom", "100%"); m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL); - m.addShorthand(s_generics[PR_BACKGROUND_POSITION]); + m.addShorthand(generics[PR_BACKGROUND_POSITION]); addPropertyMaker("background-position-vertical", m); // border-before-color @@ -745,9 +749,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_TOP]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_TOP]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_BEFORE_COLOR, PR_BORDER_BEFORE_COLOR, PR_BORDER_START_COLOR); @@ -756,9 +760,9 @@ public final class FOPropertyMapping implements Constants { // border-top-style m = new EnumProperty.Maker(PR_BORDER_TOP_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_TOP]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_TOP]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_BEFORE_STYLE, PR_BORDER_BEFORE_STYLE, PR_BORDER_START_STYLE); @@ -768,9 +772,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_TOP_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_TOP_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_TOP]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_TOP]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_BEFORE_WIDTH, PR_BORDER_BEFORE_WIDTH, PR_BORDER_START_WIDTH); @@ -781,9 +785,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_BOTTOM]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_BOTTOM]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_AFTER_COLOR, PR_BORDER_AFTER_COLOR, PR_BORDER_END_COLOR); @@ -792,9 +796,9 @@ public final class FOPropertyMapping implements Constants { // border-bottom-style m = new EnumProperty.Maker(PR_BORDER_BOTTOM_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_BOTTOM]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_BOTTOM]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_AFTER_STYLE, PR_BORDER_AFTER_STYLE, PR_BORDER_END_STYLE); @@ -804,9 +808,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_BOTTOM_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_BOTTOM_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_BOTTOM]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_BOTTOM]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_AFTER_WIDTH, PR_BORDER_AFTER_WIDTH, PR_BORDER_END_WIDTH); @@ -817,9 +821,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_LEFT]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_LEFT]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_START_COLOR, PR_BORDER_END_COLOR, PR_BORDER_AFTER_COLOR); @@ -828,9 +832,9 @@ public final class FOPropertyMapping implements Constants { // border-left-style m = new EnumProperty.Maker(PR_BORDER_LEFT_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_LEFT]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_LEFT]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_START_STYLE, PR_BORDER_END_STYLE, PR_BORDER_AFTER_STYLE); @@ -840,9 +844,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_LEFT_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_LEFT_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_LEFT]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_LEFT]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_START_WIDTH, PR_BORDER_END_WIDTH, PR_BORDER_AFTER_WIDTH); @@ -853,9 +857,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_RIGHT]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_RIGHT]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_END_COLOR, PR_BORDER_START_COLOR, PR_BORDER_BEFORE_COLOR); @@ -864,9 +868,9 @@ public final class FOPropertyMapping implements Constants { // border-right-style m = new EnumProperty.Maker(PR_BORDER_RIGHT_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_RIGHT]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_RIGHT]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_END_STYLE, PR_BORDER_START_STYLE, PR_BORDER_BEFORE_STYLE); @@ -876,9 +880,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_RIGHT_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_RIGHT_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_RIGHT]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_RIGHT]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_END_WIDTH, PR_BORDER_START_WIDTH, PR_BORDER_BEFORE_WIDTH); @@ -964,7 +968,7 @@ public final class FOPropertyMapping implements Constants { m = new FontFamilyProperty.Maker(PR_FONT_FAMILY); m.setInherited(true); m.setDefault("sans-serif,Symbol,ZapfDingbats"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-family", m); // font-selection-strategy @@ -990,7 +994,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("larger", getEnumProperty(EN_LARGER, "LARGER")); m.addEnum("smaller", getEnumProperty(EN_SMALLER, "SMALLER")); m.setPercentBase(LengthBase.INH_FONTSIZE); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-size", m); // font-stretch @@ -1024,7 +1028,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("oblique", getEnumProperty(EN_OBLIQUE, "OBLIQUE")); m.addEnum("backslant", getEnumProperty(EN_BACKSLANT, "BACKSLANT")); m.setDefault("normal"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-style", m); // font-variant @@ -1033,7 +1037,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("normal", getEnumProperty(EN_NORMAL, "NORMAL")); m.addEnum("small-caps", getEnumProperty(EN_SMALL_CAPS, "SMALL_CAPS")); m.setDefault("normal"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-variant", m); // font-weight @@ -1053,7 +1057,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("800", getEnumProperty(EN_800, "800")); m.addEnum("900", getEnumProperty(EN_900, "900")); m.setDefault("400"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-weight", m); } @@ -1064,14 +1068,14 @@ public final class FOPropertyMapping implements Constants { m = new StringProperty.Maker(PR_COUNTRY); m.setInherited(true); m.setDefault("none"); - m.addShorthand(s_generics[PR_XML_LANG]); + m.addShorthand(generics[PR_XML_LANG]); addPropertyMaker("country", m); // language m = new StringProperty.Maker(PR_LANGUAGE); m.setInherited(true); m.setDefault("none"); - m.addShorthand(s_generics[PR_XML_LANG]); + m.addShorthand(generics[PR_XML_LANG]); addPropertyMaker("language", m); // script @@ -1114,7 +1118,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_TOP); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-top", m); @@ -1122,7 +1126,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_BOTTOM); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-bottom", m); @@ -1130,7 +1134,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_LEFT); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-left", m); @@ -1138,7 +1142,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_RIGHT); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-right", m); @@ -1218,7 +1222,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("static", getEnumProperty(EN_STATIC, "STATIC")); m.addEnum("relative", getEnumProperty(EN_RELATIVE, "RELATIVE")); m.setDefault("static"); - m.addShorthand(s_generics[PR_POSITION]); + m.addShorthand(generics[PR_POSITION]); addPropertyMaker("relative-position", m); } @@ -1242,7 +1246,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("mathematical", getEnumProperty(EN_MATHEMATICAL, "MATHEMATICAL")); m.setDefault("auto"); m.setPercentBase(LengthBase.ALIGNMENT_ADJUST); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); addPropertyMaker("alignment-adjust", m); // alignment-baseline @@ -1261,7 +1265,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("hanging", getEnumProperty(EN_HANGING, "HANGING")); m.addEnum("mathematical", getEnumProperty(EN_MATHEMATICAL, "MATHEMATICAL")); m.setDefault("auto"); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); addPropertyMaker("alignment-baseline", m); // baseline-shift @@ -1271,7 +1275,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("sub", getEnumProperty(EN_SUB, "SUB")); m.addEnum("super", getEnumProperty(EN_SUPER, "SUPER")); m.setDefault("baseline"); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); m.setPercentBase(LengthBase.CUSTOM_BASE); addPropertyMaker("baseline-shift", m); @@ -1303,7 +1307,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("text-after-edge", getEnumProperty(EN_TEXT_AFTER_EDGE, "TEXT_AFTER_EDGE")); m.addEnum("text-before-edge", getEnumProperty(EN_TEXT_BEFORE_EDGE, "TEXT_BEFORE_EDGE")); m.setDefault("auto"); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); addPropertyMaker("dominant-baseline", m); // relative-align @@ -1315,7 +1319,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("relative-align", m); } - private void createAreaDimensionProperties() { + private void createAreaDimensionProperties() { // CSOK: MethodLength PropertyMaker m; LengthProperty.Maker l; DimensionPropertyMaker pdim; @@ -1464,8 +1468,10 @@ public final class FOPropertyMapping implements Constants { m = new EnumProperty.Maker(PR_SCALING_METHOD); m.setInherited(false); m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO")); - m.addEnum("integer-pixels", getEnumProperty(EN_INTEGER_PIXELS, "INTEGER_PIXELS")); - m.addEnum("resample-any-method", getEnumProperty(EN_RESAMPLE_ANY_METHOD, "RESAMPLE_ANY_METHOD")); + m.addEnum("integer-pixels", + getEnumProperty(EN_INTEGER_PIXELS, "INTEGER_PIXELS")); + m.addEnum("resample-any-method", + getEnumProperty(EN_RESAMPLE_ANY_METHOD, "RESAMPLE_ANY_METHOD")); m.setDefault("auto"); addPropertyMaker("scaling-method", m); @@ -1484,7 +1490,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("fox:block-progression-unit", l); } - private void createBlockAndLineProperties() { + private void createBlockAndLineProperties() { // CSOK: MethodLength PropertyMaker m; // hyphenation-keep @@ -1517,7 +1523,7 @@ public final class FOPropertyMapping implements Constants { m.addKeyword("normal", "1.2"); m.setPercentBase(LengthBase.FONTSIZE); m.setDefault("normal", true); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("line-height", m); // line-height-shift-adjustment @@ -1543,9 +1549,11 @@ public final class FOPropertyMapping implements Constants { m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE")); m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE")); m.addEnum("treat-as-space", getEnumProperty(EN_TREAT_AS_SPACE, "TREAT_AS_SPACE")); - m.addEnum("treat-as-zero-width-space", getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE, "TREAT_AS_ZERO_WIDTH_SPACE")); + m.addEnum("treat-as-zero-width-space", + getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE, + "TREAT_AS_ZERO_WIDTH_SPACE")); m.setDefault("treat-as-space"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("linefeed-treatment", m); // white-space-treatment @@ -1553,11 +1561,17 @@ public final class FOPropertyMapping implements Constants { m.setInherited(true); m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE")); m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE")); - m.addEnum("ignore-if-before-linefeed", getEnumProperty(EN_IGNORE_IF_BEFORE_LINEFEED, "IGNORE_IF_BEFORE_LINEFEED")); - m.addEnum("ignore-if-after-linefeed", getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED, "IGNORE_IF_AFTER_LINEFEED")); - m.addEnum("ignore-if-surrounding-linefeed", getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED, "IGNORE_IF_SURROUNDING_LINEFEED")); + m.addEnum("ignore-if-before-linefeed", + getEnumProperty(EN_IGNORE_IF_BEFORE_LINEFEED, + "IGNORE_IF_BEFORE_LINEFEED")); + m.addEnum("ignore-if-after-linefeed", + getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED, + "IGNORE_IF_AFTER_LINEFEED")); + m.addEnum("ignore-if-surrounding-linefeed", + getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED, + "IGNORE_IF_SURROUNDING_LINEFEED")); m.setDefault("ignore-if-surrounding-linefeed"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("white-space-treatment", m); // text-align TODO: make it a StringProperty with enums. @@ -1637,7 +1651,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericBoolean); m.setInherited(true); m.setDefault("true"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("white-space-collapse", m); // wrap-option @@ -1646,7 +1660,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("wrap", getEnumProperty(EN_WRAP, "WRAP")); m.addEnum("no-wrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP")); m.setDefault("wrap"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("wrap-option", m); } @@ -1750,9 +1764,11 @@ public final class FOPropertyMapping implements Constants { m.setInherited(false); m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO")); m.addEnum("perceptual", getEnumProperty(EN_PERCEPTUAL, "PERCEPTUAL")); - m.addEnum("relative-colorimetric", getEnumProperty(EN_RELATIVE_COLOMETRIC, "RELATIVE_COLOMETRIC")); + m.addEnum("relative-colorimetric", getEnumProperty(EN_RELATIVE_COLOMETRIC, + "RELATIVE_COLOMETRIC")); m.addEnum("saturation", getEnumProperty(EN_SATURATION, "SATURATION")); - m.addEnum("absolute-colorimetric", getEnumProperty(EN_ABSOLUTE_COLORMETRIC, "ABSOLUTE_COLORMETRIC")); + m.addEnum("absolute-colorimetric", getEnumProperty(EN_ABSOLUTE_COLORMETRIC, + "ABSOLUTE_COLORMETRIC")); m.setDefault("auto"); addPropertyMaker("rendering-intent", m); } @@ -1804,13 +1820,13 @@ public final class FOPropertyMapping implements Constants { // break-after m = new EnumProperty.Maker(PR_BREAK_AFTER); m.useGeneric(genericBreak); - m.addShorthand(s_generics[PR_PAGE_BREAK_AFTER]); + m.addShorthand(generics[PR_PAGE_BREAK_AFTER]); addPropertyMaker("break-after", m); // break-before m = new EnumProperty.Maker(PR_BREAK_BEFORE); m.useGeneric(genericBreak); - m.addShorthand(s_generics[PR_PAGE_BREAK_BEFORE]); + m.addShorthand(generics[PR_PAGE_BREAK_BEFORE]); addPropertyMaker("break-before", m); // keep-together @@ -1818,7 +1834,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericKeep); m.setInherited(true); m.setDefault("auto"); - m.addShorthand(s_generics[PR_PAGE_BREAK_INSIDE]); + m.addShorthand(generics[PR_PAGE_BREAK_INSIDE]); addPropertyMaker("keep-together", m); // keep-with-next @@ -1826,7 +1842,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericKeep); m.setInherited(false); m.setDefault("auto"); - m.addShorthand(s_generics[PR_PAGE_BREAK_AFTER]); + m.addShorthand(generics[PR_PAGE_BREAK_AFTER]); addPropertyMaker("keep-with-next", m); // keep-with-previous @@ -1834,7 +1850,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericKeep); m.setInherited(false); m.setDefault("auto"); - m.addShorthand(s_generics[PR_PAGE_BREAK_BEFORE]); + m.addShorthand(generics[PR_PAGE_BREAK_BEFORE]); addPropertyMaker("keep-with-previous", m); // orphans @@ -2240,7 +2256,8 @@ public final class FOPropertyMapping implements Constants { m.setInherited(false); m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO")); m.addEnum("paginate", getEnumProperty(EN_PAGINATE, "PAGINATE")); - m.addEnum("bounded-in-one-dimension", getEnumProperty(EN_BOUNDED_IN_ONE_DIMENSION, "BOUNDED_IN_ONE_DIMENSION")); + m.addEnum("bounded-in-one-dimension", getEnumProperty(EN_BOUNDED_IN_ONE_DIMENSION, + "BOUNDED_IN_ONE_DIMENSION")); m.addEnum("unbounded", getEnumProperty(EN_UNBOUNDED, "UNBOUNDED")); m.setDefault("auto"); addPropertyMaker("media-usage", m); @@ -2330,7 +2347,7 @@ public final class FOPropertyMapping implements Constants { // border-separation m = new LengthPairProperty.Maker(PR_BORDER_SEPARATION); m.setInherited(true); - m.addShorthand(s_generics[PR_BORDER_SPACING]); + m.addShorthand(generics[PR_BORDER_SPACING]); sub = new LengthProperty.Maker(CP_BLOCK_PROGRESSION_DIRECTION); sub.setDefault("0pt"); @@ -2577,7 +2594,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("z-index", m); } - private void createShorthandProperties() { + private void createShorthandProperties() { // CSOK: MethodLength PropertyMaker m; // background diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index 08ffa40a3..5db11f731 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -489,10 +489,10 @@ public class FOText extends FONode implements CharSequence { private class TextCharIterator extends CharIterator { - int currentPosition = 0; + private int currentPosition = 0; - boolean canRemove = false; - boolean canReplace = false; + private boolean canRemove = false; + private boolean canReplace = false; /** {@inheritDoc} */ public boolean hasNext() { diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 133d932bc..cb265b008 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -44,7 +44,7 @@ import org.apache.fop.fo.properties.PropertyMaker; public abstract class FObj extends FONode implements Constants { /** the list of property makers */ - private static final PropertyMaker[] propertyListTable + private static final PropertyMaker[] PROPERTY_LIST_TABLE = FOPropertyMapping.getGenericMappings(); /** @@ -108,7 +108,7 @@ public abstract class FObj extends FONode implements Constants { * @return the requested Property Maker */ public static PropertyMaker getPropertyMakerFor(int propId) { - return propertyListTable[propId]; + return PROPERTY_LIST_TABLE[propId]; } /** {@inheritDoc} */ @@ -255,7 +255,7 @@ public abstract class FObj extends FONode implements Constants { /** * Check if this formatting object generates reference areas. * @return true if generates reference areas - * @todo see if needed + * @asf.todo see if needed */ public boolean generatesReferenceAreas() { return false; @@ -610,7 +610,7 @@ public abstract class FObj extends FONode implements Constants { return (super.toString() + "[@id=" + this.id + "]"); } - /** Basic {@link FONodeIterator} implementation */ + /** Basic {@link FONode.FONodeIterator} implementation */ public class FObjIterator implements FONodeIterator { private static final int F_NONE_ALLOWED = 0; diff --git a/src/java/org/apache/fop/fo/NullCharIterator.java b/src/java/org/apache/fop/fo/NullCharIterator.java index 2b2a2a9a0..db872caec 100644 --- a/src/java/org/apache/fop/fo/NullCharIterator.java +++ b/src/java/org/apache/fop/fo/NullCharIterator.java @@ -28,6 +28,10 @@ public class NullCharIterator extends CharIterator { private static CharIterator instance; + /** + * Obtain the singleton instance of the null character iterator. + * @return the char iterator + */ public static CharIterator getInstance() { if (instance == null) { instance = new NullCharIterator(); diff --git a/src/java/org/apache/fop/fo/PropertyListMaker.java b/src/java/org/apache/fop/fo/PropertyListMaker.java index e48541af5..ef8978b0c 100644 --- a/src/java/org/apache/fop/fo/PropertyListMaker.java +++ b/src/java/org/apache/fop/fo/PropertyListMaker.java @@ -23,6 +23,13 @@ package org.apache.fop.fo; * A PropertyListMaker is a factory that creates PropertyLists. */ public interface PropertyListMaker { + + /** + * Make a property list. + * @param fobj the FO from which the new property list is associated + * @param parentPropertyList the parent property list + * @return the new property list + */ PropertyList make(FObj fobj, PropertyList parentPropertyList); } diff --git a/src/java/org/apache/fop/fo/StaticPropertyList.java b/src/java/org/apache/fop/fo/StaticPropertyList.java index 5e6559e84..c3ab95b91 100644 --- a/src/java/org/apache/fop/fo/StaticPropertyList.java +++ b/src/java/org/apache/fop/fo/StaticPropertyList.java @@ -14,6 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* $Id$ */ + package org.apache.fop.fo; import org.apache.fop.fo.expr.PropertyException; @@ -62,14 +65,14 @@ public class StaticPropertyList extends PropertyList { /** * Override PropertyList.get() and provides fast caching of previously * retrieved property values. - * @param propId The property ID + * {@inheritDoc} */ public Property get(int propId, boolean bTryInherit, boolean bTryDefault) - throws PropertyException - { + throws PropertyException { Property p = values[propId]; if (p == null) { - p = values[propId] = super.get(propId, bTryInherit, bTryDefault); + p = super.get(propId, bTryInherit, bTryDefault); + values[propId] = p; } return p; } diff --git a/src/java/org/apache/fop/fo/ValidationException.java b/src/java/org/apache/fop/fo/ValidationException.java index 103c5fcc8..2285fbd19 100644 --- a/src/java/org/apache/fop/fo/ValidationException.java +++ b/src/java/org/apache/fop/fo/ValidationException.java @@ -26,10 +26,20 @@ import org.xml.sax.Locator; * Exception thrown during FO tree validation. */ public class ValidationException extends FOPException { + + /** + * Construct a validation exception instance. + * @param message a message + */ public ValidationException(String message) { super(message); } + /** + * Construct a validation exception instance. + * @param message a message + * @param locator a locator + */ public ValidationException(String message, Locator locator) { super(message, locator); } diff --git a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java index eb68b2a23..5307e75b0 100644 --- a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java +++ b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java @@ -47,8 +47,9 @@ public class BodyStartFunction extends FunctionBase { */ public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException { - Numeric distance = - pInfo.getPropertyList().get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric(); + Numeric distance + = pInfo.getPropertyList() + .get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric(); PropertyList pList = pInfo.getPropertyList(); while (pList != null && !(pList.getFObj() instanceof ListItem)) { diff --git a/src/java/org/apache/fop/fo/expr/NumericOp.java b/src/java/org/apache/fop/fo/expr/NumericOp.java index 9fe35d96d..d1f91d509 100644 --- a/src/java/org/apache/fop/fo/expr/NumericOp.java +++ b/src/java/org/apache/fop/fo/expr/NumericOp.java @@ -30,7 +30,11 @@ import org.apache.fop.datatypes.Numeric; * The evaluation of the operation can then occur when getNumericValue() is * called. */ -public class NumericOp { +public final class NumericOp { + + private NumericOp() { + } + /** * Add the two operands and return a new Numeric representing the result. * @param op1 The first operand. @@ -39,7 +43,8 @@ public class NumericOp { * @throws PropertyException If the dimension of the operand is different * from the dimension of this Numeric. */ - public static Numeric addition(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric addition(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return addition2(op1, op2, null); } else { @@ -47,11 +52,23 @@ public class NumericOp { } } - public static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Add the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Can't subtract Numerics of different dimensions"); } - return numeric(op1.getNumericValue(context) + op2.getNumericValue(context), op1.getDimension()); + return numeric(op1.getNumericValue(context) + + op2.getNumericValue(context), op1.getDimension()); } /** @@ -63,7 +80,8 @@ public class NumericOp { * @throws PropertyException If the dimension of the operand is different * from the dimension of this Numeric. */ - public static Numeric subtraction(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric subtraction(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return subtraction2(op1, op2, null); } else { @@ -71,11 +89,23 @@ public class NumericOp { } } - public static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Subtract the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Can't subtract Numerics of different dimensions"); } - return numeric(op1.getNumericValue(context) - op2.getNumericValue(context), op1.getDimension()); + return numeric(op1.getNumericValue(context) + - op2.getNumericValue(context), op1.getDimension()); } /** @@ -87,7 +117,8 @@ public class NumericOp { * @throws PropertyException If the dimension of the operand is different * from the dimension of this Numeric. */ - public static Numeric multiply(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric multiply(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return multiply2(op1, op2, null); } else { @@ -95,7 +126,18 @@ public class NumericOp { } } - public static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Multiply the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { return numeric(op1.getNumericValue(context) * op2.getNumericValue(context), op1.getDimension() + op2.getDimension()); } @@ -118,7 +160,18 @@ public class NumericOp { } } - public static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Divide the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { return numeric(op1.getNumericValue(context) / op2.getNumericValue(context), op1.getDimension() - op2.getDimension()); } @@ -128,8 +181,10 @@ public class NumericOp { * @param op1 The first operand. * @param op2 The second operand. * @return A new Numeric object representing the absolute value. + * @throws PropertyException if a property exception occurs */ - public static Numeric modulo(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric modulo(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return modulo2(op1, op2, null); } else { @@ -137,16 +192,29 @@ public class NumericOp { } } - public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { - return numeric(op1.getNumericValue(context) % op2.getNumericValue(context), op1.getDimension()); + /** + * Return the remainder of a division of the two operand Numeric. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { + return numeric(op1.getNumericValue(context) + % op2.getNumericValue(context), op1.getDimension()); } /** * Return the absolute value of a Numeric. * @param op the operand. * @return a new Numeric object representing the absolute value of the operand. + * @throws PropertyException if a property exception occurs */ - public static Numeric abs(Numeric op) throws PropertyException { + public static Numeric abs(Numeric op) + throws PropertyException { if (op.isAbsolute()) { return abs2(op, null); } else { @@ -154,7 +222,16 @@ public class NumericOp { } } - public static Numeric abs2(Numeric op, PercentBaseContext context) throws PropertyException { + /** + * Return the absolute value of a Numeric. + * @param op the operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric abs2(Numeric op, PercentBaseContext context) + throws PropertyException { return numeric(Math.abs(op.getNumericValue(context)), op.getDimension()); } @@ -162,8 +239,10 @@ public class NumericOp { * Return the negation of a Numeric. * @param op the operand. * @return a new Numeric object representing the negation of the operand. + * @throws PropertyException if a property exception occurs */ - public static Numeric negate(Numeric op) throws PropertyException { + public static Numeric negate(Numeric op) + throws PropertyException { if (op.isAbsolute()) { return negate2(op, null); } else { @@ -171,8 +250,18 @@ public class NumericOp { } } - public static Numeric negate2(Numeric op, PercentBaseContext context) throws PropertyException { - return numeric(- op.getNumericValue(context), op.getDimension()); + + /** + * Return the negation of a Numeric. + * @param op the operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric negate2(Numeric op, PercentBaseContext context) + throws PropertyException { + return numeric(-op.getNumericValue(context), op.getDimension()); } /** @@ -182,7 +271,8 @@ public class NumericOp { * @return a Numeric which is the maximum of the two operands. * @throws PropertyException if the dimensions or value types of the operands are different. */ - public static Numeric max(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric max(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return max2(op1, op2, null); } else { @@ -190,7 +280,17 @@ public class NumericOp { } } - public static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Return the larger of the two Numerics. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Arguments to max() must have same dimensions"); } @@ -204,7 +304,8 @@ public class NumericOp { * @return a Numeric which is the minimum of the two operands. * @throws PropertyException if the dimensions or value types of the operands are different. */ - public static Numeric min(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric min(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return min2(op1, op2, null); } else { @@ -212,7 +313,17 @@ public class NumericOp { } } - public static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Return the smaller of the two Numerics. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Arguments to min() must have same dimensions"); } @@ -221,8 +332,8 @@ public class NumericOp { /** * Create a new absolute numeric with the specified value and dimension. - * @param value - * @param dimension + * @param value of numeric + * @param dimension of numeric * @return a new absolute numeric. */ private static Numeric numeric(double value, int dimension) { diff --git a/src/java/org/apache/fop/fo/expr/PropertyInfo.java b/src/java/org/apache/fop/fo/expr/PropertyInfo.java index 2bce0793f..0463e2e1d 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyInfo.java +++ b/src/java/org/apache/fop/fo/expr/PropertyInfo.java @@ -58,6 +58,7 @@ public class PropertyInfo { * a percent specification. * Propagates to the Maker. * @return The PercentBase object or null if percentLengthOK()=false. + * @throws PropertyException if a property exception occurs */ public PercentBase getPercentBase() throws PropertyException { PercentBase pcbase = getFunctionPercentBase(); @@ -66,6 +67,7 @@ public class PropertyInfo { /** * @return the current font-size value as base units (milli-points). + * @throws PropertyException if a property exception occurs */ public Length currentFontSize() throws PropertyException { return plist.get(Constants.PR_FONT_SIZE).getLength(); diff --git a/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java b/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java index 5baa0c4d8..3008dbebe 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java +++ b/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java @@ -83,7 +83,7 @@ class PropertyTokenizer { boolean currentMaybeOperator = recognizeOperator; boolean bSawDecimal; recognizeOperator = true; - for (; ;) { + while ( true ) { if (exprIndex >= exprLength) { currentToken = TOK_EOF; return; @@ -273,8 +273,11 @@ class PropertyTokenizer { } private void scanRestOfName() { - while (++exprIndex < exprLength - && isNameChar(expr.charAt(exprIndex))) { } + while ( ++exprIndex < exprLength ) { + if ( !isNameChar ( expr.charAt ( exprIndex ) ) ) { + break; + } + } } /** @@ -320,8 +323,8 @@ class PropertyTokenizer { } - private static final String NAME_START_CHARS = - "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + private static final String NAME_START_CHARS + = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String NAME_CHARS = ".-0123456789"; private static final String DIGITS = "0123456789"; private static final String HEX_CHARS = DIGITS + "abcdefABCDEF"; @@ -331,7 +334,7 @@ class PropertyTokenizer { * decimal digit (0-9). * @param c The character to check */ - private static final boolean isDigit(char c) { + private static boolean isDigit(char c) { return DIGITS.indexOf(c) >= 0; } @@ -340,7 +343,7 @@ class PropertyTokenizer { * hexadecimal digit (0-9, A-F, a-f). * @param c The character to check */ - private static final boolean isHexDigit(char c) { + private static boolean isHexDigit(char c) { return HEX_CHARS.indexOf(c) >= 0; } @@ -349,15 +352,16 @@ class PropertyTokenizer { * as defined by XSL (space, newline, CR, tab). * @param c The character to check */ - private static final boolean isSpace(char c) { + private static boolean isSpace(char c) { switch (c) { case ' ': case '\r': case '\n': case '\t': return true; + default: + return false; } - return false; } /** @@ -365,7 +369,7 @@ class PropertyTokenizer { * start character, ie. can start a NAME as defined by XSL. * @param c The character to check */ - private static final boolean isNameStartChar(char c) { + private static boolean isNameStartChar(char c) { return NAME_START_CHARS.indexOf(c) >= 0 || c >= 0x80; } @@ -374,7 +378,7 @@ class PropertyTokenizer { * character, ie. can occur in a NAME as defined by XSL. * @param c The character to check */ - private static final boolean isNameChar(char c) { + private static boolean isNameChar(char c) { return NAME_START_CHARS.indexOf(c) >= 0 || NAME_CHARS.indexOf(c) >= 0 || c >= 0x80; } diff --git a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java b/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java index a4e257546..883070056 100644 --- a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java +++ b/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java @@ -33,14 +33,23 @@ import org.apache.fop.fo.properties.TableColLength; * or getValue() is called. */ public class RelativeNumericProperty extends Property implements Length { + /** ADDITION */ public static final int ADDITION = 1; + /** SUBTRACTION */ public static final int SUBTRACTION = 2; + /** MULTIPLY */ public static final int MULTIPLY = 3; + /** DIVIDE */ public static final int DIVIDE = 4; + /** MODULO */ public static final int MODULO = 5; + /** NEGATE */ public static final int NEGATE = 6; + /** ABS */ public static final int ABS = 7; + /** MAX */ public static final int MAX = 8; + /** MIN */ public static final int MIN = 9; // Used in the toString() method, indexed by operation id. @@ -145,6 +154,7 @@ public class RelativeNumericProperty extends Property implements Length { /** * Return the dimension of the expression + * @return numeric value as dimension */ public int getDimension() { return dimension; @@ -153,6 +163,7 @@ public class RelativeNumericProperty extends Property implements Length { /** * Return false since an expression is only created when there is relative * numerics involved. + * @return true if expression is absolute */ public boolean isAbsolute() { return false; @@ -160,6 +171,7 @@ public class RelativeNumericProperty extends Property implements Length { /** * Cast this numeric as a Length. + * @return numeric value as length */ public Length getLength() { if (dimension == 1) { @@ -169,6 +181,7 @@ public class RelativeNumericProperty extends Property implements Length { return null; } + /** @return numeric value */ public Numeric getNumeric() { return this; } @@ -272,7 +285,8 @@ public class RelativeNumericProperty extends Property implements Length { return "min(" + op1 + ", " + op2 + ")"; case ABS: return "abs(" + op1 + ")"; + default: + return "unknown operation " + operation; } - return "unknown operation " + operation; } } diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java index f9a556167..a12bed0fa 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java @@ -37,17 +37,18 @@ public class ExtensionElementMapping extends ElementMapping { /** The FOP extension namespace URI */ public static final String URI = "http://xmlgraphics.apache.org/fop/extensions"; - private static final Set propertyAttributes = new java.util.HashSet(); + private static final Set PROPERTY_ATTRIBUTES + = new java.util.HashSet(); static { //These are FOP's standard extension properties (fox:*) - propertyAttributes.add("block-progression-unit"); - propertyAttributes.add("widow-content-limit"); - propertyAttributes.add("orphan-content-limit"); - propertyAttributes.add("internal-destination"); - propertyAttributes.add("disable-column-balancing"); + PROPERTY_ATTRIBUTES.add("block-progression-unit"); + PROPERTY_ATTRIBUTES.add("widow-content-limit"); + PROPERTY_ATTRIBUTES.add("orphan-content-limit"); + PROPERTY_ATTRIBUTES.add("internal-destination"); + PROPERTY_ATTRIBUTES.add("disable-column-balancing"); //These are FOP's extension properties for accessibility - propertyAttributes.add("alt-text"); + PROPERTY_ATTRIBUTES.add("alt-text"); } /** @@ -92,7 +93,7 @@ public class ExtensionElementMapping extends ElementMapping { if (!URI.equals(attributeName.getNamespaceURI())) { throw new IllegalArgumentException("The namespace URIs don't match"); } - return propertyAttributes.contains(attributeName.getLocalName()); + return PROPERTY_ATTRIBUTES.contains(attributeName.getLocalName()); } } diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionObj.java b/src/java/org/apache/fop/fo/extensions/ExtensionObj.java index da732f421..4329f1a7e 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionObj.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionObj.java @@ -47,13 +47,15 @@ public abstract class ExtensionObj extends FObj { */ public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) - throws FOPException - { - // Empty + throws FOPException { } /** * Create a default property list for this element. + * @param parent the parent property list + * @param foEventHandler an event handler + * @return property list + * @throws FOPException in case of exception */ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException { diff --git a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java b/src/java/org/apache/fop/fo/extensions/ExternalDocument.java index 233714bd7..a6f5e7680 100644 --- a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java +++ b/src/java/org/apache/fop/fo/extensions/ExternalDocument.java @@ -82,13 +82,18 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr } } + /** + * @throws FOPException in case of processing exception + * @see org.apache.fop.fo.FONode#startOfNode() + */ protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startExternalDocument(this); } /** - * @see org.apache.fop.fo.FONode#endOfNode + * @throws FOPException in case of processing exception + * @see org.apache.fop.fo.FONode#endOfNode() */ protected void endOfNode() throws FOPException { getFOEventHandler().endExternalDocument(this); @@ -96,8 +101,11 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr } /** + * @param loc a locator + * @param nsURI a namespace uri or null + * @param localName a local name + * @throws ValidationException if invalid child * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - XSL/FOP: empty */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { @@ -162,17 +170,26 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr return textAlign; } - /** @see org.apache.fop.fo.FONode#getNamespaceURI() */ + /** + * @return namespace uri + * @see org.apache.fop.fo.FONode#getNamespaceURI() + */ public String getNamespaceURI() { return ExtensionElementMapping.URI; } - /** @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() */ + /** + * @return namespace prefix + * @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() + */ public String getNormalNamespacePrefix() { return "fox"; } - /** @see org.apache.fop.fo.FONode#getLocalName() */ + /** + * @return local name + * @see org.apache.fop.fo.FONode#getLocalName() + */ public String getLocalName() { return "external-document"; } diff --git a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java index 2cc451b64..449258525 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java @@ -53,7 +53,7 @@ public class BatikExtensionElementMapping extends ElementMapping { * Batik classes that apparently need it (error messages, perhaps) * @return an XML parser classname */ - private final String getAParserClassName() { + private String getAParserClassName() { try { //TODO Remove when Batik uses JAXP instead of SAX directly. SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -63,6 +63,7 @@ public class BatikExtensionElementMapping extends ElementMapping { } } + /** initialize mapping */ protected void initialize() { if (foObjs == null && batikAvail) { // this sets the parser that will be used diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java b/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java index 6556c7251..67f6567c9 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java +++ b/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java @@ -105,7 +105,7 @@ public class SVGDOMContentHandlerFactory implements ContentHandlerFactory { Class clazz = Class.forName( "org.apache.batik.dom.svg12.SVG12DOMImplementation"); return (DOMImplementation)clazz.getMethod( - "getDOMImplementation", null).invoke(null, null); + "getDOMImplementation", (Class[])null).invoke(null, (Object[])null); } catch (Exception e) { return SVGDOMImplementation.getDOMImplementation(); } diff --git a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java index 0f4575c5b..7bc0ff00c 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java @@ -109,7 +109,9 @@ public abstract class AbstractPageNumberCitation extends FObj } /** {@inheritDoc} */ - public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + public void processNode + (String elementName, Locator locator, Attributes attlist, PropertyList pList) + throws FOPException { super.processNode(elementName, locator, attlist, pList); if (!inMarker() && (refId == null || "".equals(refId))) { missingPropertyError("ref-id"); diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index e3176464d..66e06db83 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -330,7 +330,8 @@ public class Block extends FObjMixed implements BreakPropertySet, StructurePoint /** * @return the "fox:disable-column-balancing" property, one of - * {@link Constants#EN_TRUE}, {@link Constants#EN_FALSE} + * {@link org.apache.fop.fo.Constants#EN_TRUE}, + * {@link org.apache.fop.fo.Constants#EN_FALSE} */ public int getDisableColumnBalancing() { return disableColumnBalancing; diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index 2a8d73002..57cb6e5c6 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -219,7 +219,8 @@ public class BlockContainer extends FObj implements BreakPropertySet { /** * @return the "fox:disable-column-balancing" property, one of - * {@link Constants#EN_TRUE}, {@link Constants#EN_FALSE} + * {@link org.apache.fop.fo.Constants#EN_TRUE}, + * {@link org.apache.fop.fo.Constants#EN_FALSE} */ public int getDisableColumnBalancing() { return disableColumnBalancing; diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/java/org/apache/fop/fo/flow/Float.java index 815b30393..5d8fcdc2c 100644 --- a/src/java/org/apache/fop/fo/flow/Float.java +++ b/src/java/org/apache/fop/fo/flow/Float.java @@ -38,7 +38,7 @@ public class Float extends FObj { // private int clear; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index e73701c3b..9967a54d8 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -76,9 +76,9 @@ public class Footnote extends FObj { /** * {@inheritDoc} * <br>XSL Content Model: (inline,footnote-body) - * @todo implement additional constraint: A fo:footnote is not permitted + * @asf.todo implement additional constraint: A fo:footnote is not permitted * to have a fo:float, fo:footnote, or fo:marker as a descendant. - * @todo implement additional constraint: A fo:footnote is not + * @asf.todo implement additional constraint: A fo:footnote is not * permitted to have as a descendant a fo:block-container that * generates an absolutely positioned area. */ diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index e6e8e9c01..d9ae63ec8 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -120,7 +120,8 @@ public class Inline extends InlineLevel implements StructurePointerPropertySet { } else if (!isBlockOrInlineItem(nsURI, localName)) { invalidChildError(loc, nsURI, localName); } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) { - invalidChildError(loc, getParent().getName(), nsURI, getName(), "rule.inlineContent"); + invalidChildError(loc, getParent().getName(), nsURI, getName(), + "rule.inlineContent"); } else { blockOrInlineItemFound = true; } diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index c25fc8cab..1b32e3f1e 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -30,7 +30,7 @@ import org.apache.fop.fo.properties.LengthRangeProperty; * <code>fo:leader</code></a> object. * The main property of <code>fo:leader</code> is leader-pattern. * The following patterns are treated: rule, space, dots and use-content. - * @todo implement validateChildNode() + * @asf.todo implement validateChildNode() */ public class Leader extends InlineLevel { // The value of properties relevant for fo:leader. diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index f748bc15a..3f714dbd8 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -119,7 +119,7 @@ public class ListItem extends FObj implements BreakPropertySet { /** * {@inheritDoc} - * @todo see if can/should rely on base class for this + * @asf.todo see if can/should rely on base class for this * (i.e., add to childNodes instead) */ public void addChildNode(FONode child) { diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java index 01863c0c7..d8f69af28 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.flow; -import java.util.Collections; import java.util.Map; import org.xml.sax.Attributes; @@ -111,7 +110,7 @@ public class Marker extends FObjMixed { * <br><i>Additionally: "An fo:marker may contain any formatting objects that * are permitted as a replacement of any fo:retrieve-marker that retrieves * the fo:marker's children."</i> - * @todo implement "additional" constraint, possibly within fo:retrieve-marker + * @asf.todo implement "additional" constraint, possibly within fo:retrieve-marker */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { @@ -199,17 +198,25 @@ public class Marker extends FObjMixed { name = attributes.getLocalName(i); value = attributes.getValue(i); - this.attribs[i] = - MarkerAttribute.getInstance(namespace, qname, name, value); + this.attribs[i] + = MarkerAttribute.getInstance(namespace, qname, name, value); } } - /** Null implementation; not used by this type of {@link PropertyList} */ + /** + * Null implementation; not used by this type of {@link PropertyList}. + * @param propId the propert id + * @param value the property value + */ public void putExplicit(int propId, Property value) { //nop } - /** Null implementation; not used by this type of {@link PropertyList} */ + /** + * Null implementation; not used by this type of {@link PropertyList}. + * @param propId the propert id + * @return the property id + */ public Property getExplicit(int propId) { return null; } @@ -259,7 +266,11 @@ public class Marker extends FObjMixed { } } - /** Default implementation; not used */ + /** + * Default implementation; not used. + * @param index a type index + * @return type string + */ public String getType(int index) { return "CDATA"; } @@ -305,12 +316,21 @@ public class Marker extends FObjMixed { return index; } - /** Default implementation; not used */ + /** + * Default implementation; not used + * @param name a type name + * @param namespace a type namespace + * @return type string + */ public String getType(String name, String namespace) { return "CDATA"; } - /** Default implementation; not used */ + /** + * Default implementation; not used + * @param qname a type name + * @return type string + */ public String getType(String qname) { return "CDATA"; } @@ -337,12 +357,16 @@ public class Marker extends FObjMixed { /** Convenience inner class */ public static final class MarkerAttribute { - private static PropertyCache attributeCache = - new PropertyCache(MarkerAttribute.class); + private static PropertyCache attributeCache + = new PropertyCache(MarkerAttribute.class); + /** namespace */ protected String namespace; + /** qualfied name */ protected String qname; + /** local name */ protected String name; + /** value */ protected String value; /** diff --git a/src/java/org/apache/fop/fo/flow/MultiCase.java b/src/java/org/apache/fop/fo/flow/MultiCase.java index b2d630ba7..76bded0be 100644 --- a/src/java/org/apache/fop/fo/flow/MultiCase.java +++ b/src/java/org/apache/fop/fo/flow/MultiCase.java @@ -27,7 +27,7 @@ import org.apache.fop.fo.PropertyList; /** * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_multi-case"> * <code>fo:multi-case</code></a> object. - * @todo implement validateChildNode() + * @asf.todo implement validateChildNode() */ public class MultiCase extends FObj { // The value of properties relevant for fo:multi-case. @@ -38,7 +38,7 @@ public class MultiCase extends FObj { // private CommonAccessibility commonAccessibility; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/java/org/apache/fop/fo/flow/MultiProperties.java index 091934203..3e2e57d97 100644 --- a/src/java/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/java/org/apache/fop/fo/flow/MultiProperties.java @@ -37,11 +37,11 @@ public class MultiProperties extends FObj { // private CommonAccessibility commonAccessibility; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; // used for input FO validation - boolean hasMultiPropertySet = false; - boolean hasWrapper = false; + private boolean hasMultiPropertySet = false; + private boolean hasWrapper = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java index 96e73ec97..6e7c6a3e0 100644 --- a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java +++ b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java @@ -37,7 +37,7 @@ public class MultiPropertySet extends FObj { // private ToBeImplementedProperty activeState; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java index 1db72159e..aa18d6cdf 100644 --- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java @@ -39,7 +39,7 @@ public class MultiSwitch extends FObj { // private CommonAccessibility commonAccessibility; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiToggle.java b/src/java/org/apache/fop/fo/flow/MultiToggle.java index aacfda8eb..10766680e 100644 --- a/src/java/org/apache/fop/fo/flow/MultiToggle.java +++ b/src/java/org/apache/fop/fo/flow/MultiToggle.java @@ -39,7 +39,7 @@ public class MultiToggle extends FObj { // public ToBeImplementedProperty prSwitchTo; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java index c58ecc628..3fe977b21 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java @@ -16,6 +16,7 @@ */ /* $Id$ */ + package org.apache.fop.fo.flow; import org.apache.fop.fo.FONode; @@ -50,7 +51,9 @@ public class RetrieveTableMarker extends AbstractRetrieveMarker { * <i>NOTE: An <code>fo:retrieve-table-marker</code> is only permitted as a descendant * of an <code>fo:table-header</code> or an <code>fo:table-footer</code>.</i> */ - public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + public void processNode + (String elementName, Locator locator, Attributes attlist, PropertyList pList) + throws FOPException { if (findAncestor(FO_TABLE_HEADER) < 0 && findAncestor(FO_TABLE_FOOTER) < 0) { invalidChildError(locator, getParent().getName(), FO_URI, getName(), diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java index 74072da87..7fb412521 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/java/org/apache/fop/fo/flow/Wrapper.java @@ -76,7 +76,8 @@ public class Wrapper extends FObjMixed { try { FONode.validateChildNode(this.parent, loc, nsURI, localName); } catch (ValidationException vex) { - invalidChildError(loc, getName(), FO_URI, localName, "rule.wrapperInvalidChildForParent"); + invalidChildError(loc, getName(), FO_URI, localName, + "rule.wrapperInvalidChildForParent"); } blockOrInlineItemFound = true; } else { diff --git a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java b/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java index 1f73f5f10..9f3ed195d 100644 --- a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java +++ b/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java @@ -77,8 +77,7 @@ public class ColumnNumberManager { for (int i = 0; i < pendingSpans.size(); i++) { pSpan = (PendingSpan) pendingSpans.get(i); if (pSpan != null) { - pSpan.rowsLeft--; - if (pSpan.rowsLeft == 0) { + if ( pSpan.decrRowsLeft() == 0 ) { pendingSpans.set(i, null); } else { usedColumnIndices.set(i); diff --git a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java b/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java index 5ff01b7fa..b5cd56d47 100644 --- a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java +++ b/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java @@ -36,20 +36,23 @@ import org.apache.fop.layoutmgr.table.CollapsingBorderModel; */ public class ConditionalBorder { + /** normal border */ public static final int NORMAL = 0; + /** leading and trailing border */ public static final int LEADING_TRAILING = 1; + /** all the rest */ public static final int REST = 2; /** Normal case, no break. */ - BorderSpecification normal; + BorderSpecification normal; // CSOK: VisibilityModifier /** Special case: the cell is at the top or the bottom of the page. */ - BorderSpecification leadingTrailing; + BorderSpecification leadingTrailing; // CSOK: VisibilityModifier /** Special case: break inside the cell. */ - BorderSpecification rest; + BorderSpecification rest; // CSOK: VisibilityModifier /** The model used to resolve borders. */ private CollapsingBorderModel collapsingBorderModel; diff --git a/src/java/org/apache/fop/fo/flow/table/GridUnit.java b/src/java/org/apache/fop/fo/flow/table/GridUnit.java index 229a7177f..37f3df37c 100644 --- a/src/java/org/apache/fop/fo/flow/table/GridUnit.java +++ b/src/java/org/apache/fop/fo/flow/table/GridUnit.java @@ -65,13 +65,13 @@ public class GridUnit { private byte flags = 0; /** the border-before specification */ - ConditionalBorder borderBefore; + ConditionalBorder borderBefore; // CSOK: VisibilityModifier /** the border-after specification */ - ConditionalBorder borderAfter; + ConditionalBorder borderAfter; // CSOK: VisibilityModifier /** the border-start specification */ - BorderSpecification borderStart; + BorderSpecification borderStart; // CSOK: VisibilityModifier /** the border-end specification */ - BorderSpecification borderEnd; + BorderSpecification borderEnd; // CSOK: VisibilityModifier /** The border model helper associated with the table */ protected CollapsingBorderModel collapsingBorderModel; diff --git a/src/java/org/apache/fop/fo/flow/table/PendingSpan.java b/src/java/org/apache/fop/fo/flow/table/PendingSpan.java index 321684fae..0a5a2b41a 100644 --- a/src/java/org/apache/fop/fo/flow/table/PendingSpan.java +++ b/src/java/org/apache/fop/fo/flow/table/PendingSpan.java @@ -27,7 +27,7 @@ class PendingSpan { /** * member variable holding the number of rows left */ - int rowsLeft; + private int rowsLeft; /** * Constructor @@ -37,4 +37,22 @@ class PendingSpan { public PendingSpan(int rows) { rowsLeft = rows; } + + /** @return number of rows spanned */ + public int getRowsLeft() { + return rowsLeft; + } + + /** + * Decrement rows spanned. + * @return number of rows spanned after decrementing + */ + public int decrRowsLeft() { + if ( rowsLeft > 0 ) { + return --rowsLeft; + } else { + return 0; + } + } + }
\ No newline at end of file diff --git a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java index 9326d6cd4..529a6acc2 100644 --- a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java +++ b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java @@ -85,6 +85,10 @@ public class PrimaryGridUnit extends GridUnit { return (TablePart) node; } + /** + * Get cell's layout manager. + * @return the cell's layout manager + */ public TableCellLayoutManager getCellLM() { assert cellLM != null; return cellLM; @@ -109,6 +113,10 @@ public class PrimaryGridUnit extends GridUnit { this.elements = elements; } + /** + * Obtain the Knuth elements. + * @return a list of Knuth elements + */ public List getElements() { return this.elements; } @@ -247,6 +255,10 @@ public class PrimaryGridUnit extends GridUnit { return this.rows; } + /** + * Add a row. + * @param row the row to be added + */ public void addRow(GridUnit[] row) { if (rows == null) { rows = new java.util.ArrayList(); diff --git a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java index 919e73bfb..5ee5e78ad 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java @@ -30,7 +30,7 @@ import org.apache.fop.fo.ValidationException; /** * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-and-caption"> * <code>fo:table-and-caption</code></a> property. - * @todo needs implementation + * @asf.todo needs implementation */ public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { // The value of properties relevant for fo:table-and-caption. @@ -50,7 +50,7 @@ public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { // private int textAlign; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** used for FO validation */ private boolean tableCaptionFound = false; diff --git a/src/java/org/apache/fop/fo/flow/table/TableCaption.java b/src/java/org/apache/fop/fo/flow/table/TableCaption.java index bbc9b52bc..fc5d3d5b7 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCaption.java @@ -49,7 +49,7 @@ public class TableCaption extends FObj { /** used for FO validation */ private boolean blockItemFound = false; - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Create a TableCaption instance with the given {@link FONode} diff --git a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java index 9b4fe755f..41eab578f 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java @@ -30,14 +30,26 @@ import org.apache.fop.fo.FONode; */ public abstract class TableCellContainer extends TableFObj implements ColumnNumberManagerHolder { + /** list of pending spans */ protected List pendingSpans; + /** column number manager */ protected ColumnNumberManager columnNumberManager; + /** + * Construct table cell container. + * @param parent the parent node of the cell container + */ public TableCellContainer(FONode parent) { super(parent); } + /** + * Add cell to current row. + * @param cell a table cell to add + * @param firstRow true is first row + * @throws FOPException if exception occurs + */ protected void addTableCellChild(TableCell cell, boolean firstRow) throws FOPException { int colNumber = cell.getColumnNumber(); int colSpan = cell.getNumberColumnsSpanned(); diff --git a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java index d6abf609e..792151360 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java +++ b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java @@ -32,7 +32,10 @@ import org.apache.fop.fo.expr.PropertyException; public interface TableEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + static final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/fo/flow/table/TableFObj.java b/src/java/org/apache/fop/fo/flow/table/TableFObj.java index ab8676cb3..6ba763933 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFObj.java +++ b/src/java/org/apache/fop/fo/flow/table/TableFObj.java @@ -50,12 +50,12 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty private Numeric borderStartPrecedence; private String ptr; - ConditionalBorder borderBefore; - ConditionalBorder borderAfter; - BorderSpecification borderStart; - BorderSpecification borderEnd; + ConditionalBorder borderBefore; // CSOK: VisibilityModifier + ConditionalBorder borderAfter; // CSOK: VisibilityModifier + BorderSpecification borderStart; // CSOK: VisibilityModifier + BorderSpecification borderEnd; // CSOK: VisibilityModifier - CollapsingBorderModel collapsingBorderModel; + CollapsingBorderModel collapsingBorderModel; // CSOK: VisibilityModifier /** * Create a TableFObj instance that is a child @@ -205,9 +205,10 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty int foId = propertyList.getFObj().getNameId(); if (i <= 0) { if (foId == FO_TABLE_CELL || foId == FO_TABLE_COLUMN) { - ColumnNumberManagerHolder parent = - (ColumnNumberManagerHolder) propertyList.getParentFObj(); - ColumnNumberManager columnIndexManager = parent.getColumnNumberManager(); + ColumnNumberManagerHolder parent + = (ColumnNumberManagerHolder) propertyList.getParentFObj(); + ColumnNumberManager columnIndexManager + = parent.getColumnNumberManager(); i = columnIndexManager.getCurrentColumnNumber(); } else { /* very exceptional case: @@ -216,10 +217,11 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty */ i = 1; } - TableEventProducer eventProducer = - TableEventProducer.Provider.get(fo.getUserAgent().getEventBroadcaster()); - eventProducer.forceNextColumnNumber(this, propertyList.getFObj().getName(), - val, i, propertyList.getFObj().getLocator()); + TableEventProducer eventProducer + = TableEventProducer.Provider.get(fo.getUserAgent().getEventBroadcaster()); + eventProducer.forceNextColumnNumber + (this, propertyList.getFObj().getName(), + val, i, propertyList.getFObj().getLocator()); } return NumberProperty.getInstance(i); } @@ -229,7 +231,9 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty } /** {@inheritDoc} */ - public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + public void processNode + (String elementName, Locator locator, Attributes attlist, PropertyList pList) + throws FOPException { super.processNode(elementName, locator, attlist, pList); Table table = getTable(); if (!inMarker() && !table.isSeparateBorderModel()) { diff --git a/src/java/org/apache/fop/fo/flow/table/TablePart.java b/src/java/org/apache/fop/fo/flow/table/TablePart.java index 5b04cddc7..3ab92cc94 100644 --- a/src/java/org/apache/fop/fo/flow/table/TablePart.java +++ b/src/java/org/apache/fop/fo/flow/table/TablePart.java @@ -46,10 +46,9 @@ public abstract class TablePart extends TableCellContainer { // private int visibility; // End of property values - /** - * used for validation - */ + /** table rows found */ protected boolean tableRowsFound = false; + /** table cells found */ protected boolean tableCellsFound = false; private boolean firstRow = true; @@ -124,6 +123,10 @@ public abstract class TablePart extends TableCellContainer { return this; } + /** + * Finish last row group. + * @throws ValidationException if content validation exception + */ protected void finishLastRowGroup() throws ValidationException { if (!inMarker()) { RowGroupBuilder rowGroupBuilder = getTable().getRowGroupBuilder(); @@ -214,6 +217,7 @@ public abstract class TablePart extends TableCellContainer { rowGroups.add(rowGroup); } + /** @return list of row groups */ public List getRowGroups() { return rowGroups; } diff --git a/src/java/org/apache/fop/fo/flow/table/TableRow.java b/src/java/org/apache/fop/fo/flow/table/TableRow.java index 2feb45d86..dd9f7c6d4 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/table/TableRow.java @@ -144,7 +144,6 @@ public class TableRow extends TableCellContainer implements BreakPropertySet { return (TablePart) parent; } - /** {@inheritDoc} */ boolean isTableRow() { return true; } diff --git a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java index dce36f95c..51b24b314 100644 --- a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java @@ -34,7 +34,9 @@ import org.apache.fop.fo.PropertyList; public abstract class AbstractPageSequence extends FObj { // The value of properties relevant for fo:page-sequence. + /** initial page number */ protected Numeric initialPageNumber; + /** forced page count */ protected int forcePageCount; private String format; private int letterValue; @@ -45,6 +47,7 @@ public abstract class AbstractPageSequence extends FObj { private PageNumberGenerator pageNumberGenerator; + /** starting page number */ protected int startingPageNumber = 0; /** diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 26812166d..01ca5863e 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -151,7 +151,7 @@ public class PageSequence extends AbstractPageSequence { /** * {@inheritDoc} - * @todo see if addChildNode() should also be called for fo's other than + * @asf.todo see if addChildNode() should also be called for fo's other than * fo:flow. */ public void addChildNode(FONode child) throws FOPException { @@ -254,10 +254,9 @@ public class PageSequence extends AbstractPageSequence { * @return the SimplePageMaster to use for this page * @throws PageProductionException if there's a problem determining the page master */ - public SimplePageMaster getNextSimplePageMaster(int page, - boolean isFirstPage, - boolean isLastPage, - boolean isBlank) throws PageProductionException { + public SimplePageMaster getNextSimplePageMaster + (int page, boolean isFirstPage, boolean isLastPage, boolean isBlank) + throws PageProductionException { if (pageSequenceMaster == null) { return simplePageMaster; diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 6f94418be..ea449cdff 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -31,7 +31,6 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; -import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; /** diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index 165bb4734..cb265706d 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java @@ -106,8 +106,10 @@ public class RegionBody extends Region { * Also the values are resolved relative to the page size * and reference orientation. */ - PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CONTAINING_BLOCK_WIDTH); - PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CONTAINING_BLOCK_WIDTH); + PercentBaseContext pageWidthContext + = getPageWidthContext(LengthBase.CONTAINING_BLOCK_WIDTH); + PercentBaseContext pageHeightContext + = getPageHeightContext(LengthBase.CONTAINING_BLOCK_WIDTH); int start; int end; diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index fcbb54abd..2a634c24a 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -144,7 +144,11 @@ public class Root extends FObj { } - /** @inheritDoc */ + /** + * @param loc location in the source file + * @param child the {@link FONode} to validate against + * @throws ValidationException if the incoming node is not a valid child for the given FO + */ protected void validateChildNode(Locator loc, FONode child) throws ValidationException { if (child instanceof AbstractPageSequence) { pageSequenceFound = true; @@ -207,7 +211,8 @@ public class Root extends FObj { * @param additionalPages the total pages generated by the sequence (for statistics) * @throws IllegalArgumentException for negative additional page counts */ - public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) { + public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) + throws IllegalArgumentException { if (additionalPages >= 0) { totalPagesGenerated += additionalPages; diff --git a/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java b/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java index 709fdf7f2..58f1ac210 100644 --- a/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java +++ b/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java @@ -57,7 +57,8 @@ public class BackgroundPositionShorthand extends ListProperty { * specified, <code>background-position-vertical</code> is set * to "50%". */ - public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException { + public Property make(PropertyList propertyList, String value, FObj fo) + throws PropertyException { Property p = super.make(propertyList, value, fo); if (p.getList().size() == 1) { /* only background-position-horizontal specified diff --git a/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java b/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java index 37cb2119c..7822db3f8 100644 --- a/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java @@ -29,6 +29,7 @@ import org.apache.fop.fo.expr.PropertyException; */ public class BorderSpacingShorthandParser extends GenericShorthandParser { + /** {@inheritDoc} */ protected Property convertValueForProperty(int propId, Property property, PropertyMaker maker, PropertyList propertyList) throws PropertyException { diff --git a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java b/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java index 7c2854759..467682878 100644 --- a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java @@ -28,7 +28,8 @@ import org.apache.fop.fo.expr.PropertyException; * border width described in 7.7.20. */ public class BorderWidthPropertyMaker extends LengthProperty.Maker { - int borderStyleId = 0; + + private int borderStyleId = 0; /** * Create a length property which check the value of the border-*-style @@ -41,7 +42,7 @@ public class BorderWidthPropertyMaker extends LengthProperty.Maker { /** * Set the propId of the style property for the same side. - * @param borderStyleId + * @param borderStyleId the border style id */ public void setBorderStyleId(int borderStyleId) { this.borderStyleId = borderStyleId; @@ -55,8 +56,7 @@ public class BorderWidthPropertyMaker extends LengthProperty.Maker { public Property get(int subpropId, PropertyList propertyList, boolean bTryInherit, boolean bTryDefault) - throws PropertyException - { + throws PropertyException { Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault); diff --git a/src/java/org/apache/fop/fo/properties/CharacterProperty.java b/src/java/org/apache/fop/fo/properties/CharacterProperty.java index c078da0c7..5fef57a8b 100644 --- a/src/java/org/apache/fop/fo/properties/CharacterProperty.java +++ b/src/java/org/apache/fop/fo/properties/CharacterProperty.java @@ -24,6 +24,8 @@ import org.apache.fop.fo.PropertyList; /** * Superclass for properties that wrap a character value + * @asf.todo convert character value to int in order to denote unicode scalar value + * instead of a single UTF-16 code element */ public final class CharacterProperty extends Property { @@ -39,6 +41,7 @@ public final class CharacterProperty extends Property { super(propId); } + /** {@inheritDoc} */ public Property make(PropertyList propertyList, String value, FObj fo) { char c = value.charAt(0); @@ -48,7 +51,8 @@ public final class CharacterProperty extends Property { } /** cache containing all canonical CharacterProperty instances */ - private static final PropertyCache cache = new PropertyCache(CharacterProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(CharacterProperty.class); private final char character; @@ -59,8 +63,13 @@ public final class CharacterProperty extends Property { this.character = character; } + /** + * Get character property instance for character. + * @param character the character + * @return the character property instance + */ public static CharacterProperty getInstance(char character) { - return (CharacterProperty) cache.fetch( + return (CharacterProperty) CACHE.fetch( new CharacterProperty(character)); } diff --git a/src/java/org/apache/fop/fo/properties/ColorProperty.java b/src/java/org/apache/fop/fo/properties/ColorProperty.java index 925d275af..e7b8d5931 100644 --- a/src/java/org/apache/fop/fo/properties/ColorProperty.java +++ b/src/java/org/apache/fop/fo/properties/ColorProperty.java @@ -33,7 +33,8 @@ import org.apache.fop.util.ColorUtil; public final class ColorProperty extends Property { /** cache holding canonical ColorProperty instances */ - private static final PropertyCache cache = new PropertyCache(ColorProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(ColorProperty.class); /** * The color represented by this property. @@ -97,11 +98,12 @@ public final class ColorProperty extends Property { * @throws PropertyException if the value can't be parsed * @see ColorUtil#parseColorString(FOUserAgent, String) */ - public static ColorProperty getInstance(FOUserAgent foUserAgent, String value) throws PropertyException { + public static ColorProperty getInstance(FOUserAgent foUserAgent, String value) + throws PropertyException { ColorProperty instance = new ColorProperty( ColorUtil.parseColorString( foUserAgent, value)); - return (ColorProperty)cache.fetch(instance); + return (ColorProperty)CACHE.fetch(instance); } /** diff --git a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java b/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java index e32e9dbd9..f803439b9 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java +++ b/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java @@ -33,31 +33,32 @@ public class CommonAbsolutePosition { /** * The "absolute-position" property. */ - public int absolutePosition; + public int absolutePosition; // CSOK: VisibilityModifier /** * The "top" property. */ - public Length top; + public Length top; // CSOK: VisibilityModifier /** * The "right" property. */ - public Length right; + public Length right; // CSOK: VisibilityModifier /** * The "bottom" property. */ - public Length bottom; + public Length bottom; // CSOK: VisibilityModifier /** * The "left" property. */ - public Length left; + public Length left; // CSOK: VisibilityModifier /** * Create a CommonAbsolutePosition object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception is raised */ public CommonAbsolutePosition(PropertyList pList) throws PropertyException { absolutePosition = pList.get(Constants.PR_ABSOLUTE_POSITION).getEnum(); @@ -67,6 +68,7 @@ public class CommonAbsolutePosition { right = pList.get(Constants.PR_RIGHT).getLength(); } + /** {@inheritDoc} */ public String toString() { StringBuffer sb = new StringBuffer("CommonAbsolutePosition{"); sb.append(" absPos="); diff --git a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java b/src/java/org/apache/fop/fo/properties/CommonAccessibility.java index 74edf046b..dc17228d2 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java +++ b/src/java/org/apache/fop/fo/properties/CommonAccessibility.java @@ -32,16 +32,17 @@ public class CommonAccessibility { /** * The "source-doc" property. */ - public String sourceDoc = null; + public String sourceDoc = null; // CSOK: VisibilityModifier /** * The "role" property. */ - public String role = null; + public String role = null; // CSOK: VisibilityModifier /** * Create a <code>CommonAccessibility</code> object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception is raised */ public CommonAccessibility(PropertyList pList) throws PropertyException { sourceDoc = pList.get(Constants.PR_SOURCE_DOCUMENT).getString(); diff --git a/src/java/org/apache/fop/fo/properties/CommonAural.java b/src/java/org/apache/fop/fo/properties/CommonAural.java index a47f183f1..c805ab4fe 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAural.java +++ b/src/java/org/apache/fop/fo/properties/CommonAural.java @@ -30,92 +30,92 @@ public class CommonAural { /** * The "azimuth" property. */ - public int azimuth; + public int azimuth; // CSOK: VisibilityModifier /** * The "cueAfter" property. */ - public String cueAfter; + public String cueAfter; // CSOK: VisibilityModifier /** * The "cueBefore" property. */ - public String cueBefore; + public String cueBefore; // CSOK: VisibilityModifier /** * The "elevation" property. */ - public int elevation; + public int elevation; // CSOK: VisibilityModifier /** * The "pauseAfter" property. */ - public int pauseAfter; + public int pauseAfter; // CSOK: VisibilityModifier /** * The "pauseBefore" property. */ - public int pauseBefore; + public int pauseBefore; // CSOK: VisibilityModifier /** * The "pitch" property. */ - public int pitch; + public int pitch; // CSOK: VisibilityModifier /** * The "pitch-range" property. */ - public int pitchRange; + public int pitchRange; // CSOK: VisibilityModifier /** * The "playDuring" property. */ - public int playDuring; + public int playDuring; // CSOK: VisibilityModifier /** * The "richness" property. */ - public int richness; + public int richness; // CSOK: VisibilityModifier /** * The "speak" property. */ - public int speak; + public int speak; // CSOK: VisibilityModifier /** * The "speak-header" property. */ - public int speakHeader; + public int speakHeader; // CSOK: VisibilityModifier /** * The "speak-numeral" property. */ - public int speakNumeral; + public int speakNumeral; // CSOK: VisibilityModifier /** * The "speak-punctuation" property. */ - public int speakPunctuation; + public int speakPunctuation; // CSOK: VisibilityModifier /** * The "speech-rate" property. */ - public int speechRate; + public int speechRate; // CSOK: VisibilityModifier /** * The "stress" property. */ - public int stress; + public int stress; // CSOK: VisibilityModifier /** * The "voice-family" property. */ - public int voiceFamily; + public int voiceFamily; // CSOK: VisibilityModifier /** * The "volume" property. */ - public int volume; + public int volume; // CSOK: VisibilityModifier /** * Create a CommonAbsolutePosition object. diff --git a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java index 7e68bbcea..d39dc24f0 100644 --- a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java +++ b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java @@ -42,45 +42,46 @@ import org.apache.fop.fo.expr.PropertyException; * Stores all common border and padding properties. * See Sec. 7.7 of the XSL-FO Standard. */ -public class CommonBorderPaddingBackground { +public class CommonBorderPaddingBackground { // CSOK: FinalClassCheck /** * cache holding all canonical instances * (w/ absolute background-position-* and padding-*) */ - private static final PropertyCache cache = new PropertyCache(CommonBorderPaddingBackground.class); + private static final PropertyCache CACHE + = new PropertyCache(CommonBorderPaddingBackground.class); private int hash = -1; /** * The "background-attachment" property. */ - public final int backgroundAttachment; + public final int backgroundAttachment; // CSOK: VisibilityModifier /** * The "background-color" property. */ - public final Color backgroundColor; + public final Color backgroundColor; // CSOK: VisibilityModifier /** * The "background-image" property. */ - public final String backgroundImage; + public final String backgroundImage; // CSOK: VisibilityModifier /** * The "background-repeat" property. */ - public final int backgroundRepeat; + public final int backgroundRepeat; // CSOK: VisibilityModifier /** * The "background-position-horizontal" property. */ - public final Length backgroundPositionHorizontal; + public final Length backgroundPositionHorizontal; // CSOK: VisibilityModifier /** * The "background-position-vertical" property. */ - public final Length backgroundPositionVertical; + public final Length backgroundPositionVertical; // CSOK: VisibilityModifier private ImageInfo backgroundImageInfo; @@ -96,12 +97,13 @@ public class CommonBorderPaddingBackground { public static final int END = 3; /** - * + * Utility class to express border info. */ - public static class BorderInfo { + public static final class BorderInfo { /** cache holding all canonical instances */ - private static final PropertyCache cache = new PropertyCache(BorderInfo.class); + private static final PropertyCache CACHE + = new PropertyCache(BorderInfo.class); private int mStyle; // Enum for border style private Color mColor; // Border color @@ -127,7 +129,7 @@ public class CommonBorderPaddingBackground { * @return a cached BorderInfo instance */ public static BorderInfo getInstance(int style, CondLengthProperty width, Color color) { - return cache.fetch(new BorderInfo(style, width, color)); + return CACHE.fetch(new BorderInfo(style, width, color)); } /** @@ -212,7 +214,7 @@ public class CommonBorderPaddingBackground { * A border info with style "none". Used as a singleton, in the collapsing-border model, * for elements which don't specify any border on some of their sides. */ - private static final BorderInfo defaultBorderInfo + private static final BorderInfo DEFAULT_BORDER_INFO = BorderInfo.getInstance(Constants.EN_NONE, new ConditionalNullLength(), null); /** @@ -274,7 +276,7 @@ public class CommonBorderPaddingBackground { * @return a BorderInfo instance with style set to {@link Constants#EN_NONE} */ public static BorderInfo getDefaultBorderInfo() { - return defaultBorderInfo; + return DEFAULT_BORDER_INFO; } private BorderInfo[] borderInfo = new BorderInfo[4]; @@ -352,13 +354,19 @@ public class CommonBorderPaddingBackground { CommonBorderPaddingBackground cachedInstance = null; /* if padding-* and background-position-* resolve to absolute lengths * the whole instance can be cached */ - if ((newInstance.padding[BEFORE] == null || newInstance.padding[BEFORE].getLength().isAbsolute()) - && (newInstance.padding[AFTER] == null || newInstance.padding[AFTER].getLength().isAbsolute()) - && (newInstance.padding[START] == null || newInstance.padding[START].getLength().isAbsolute()) - && (newInstance.padding[END] == null || newInstance.padding[END].getLength().isAbsolute()) - && (newInstance.backgroundPositionHorizontal == null || newInstance.backgroundPositionHorizontal.isAbsolute()) - && (newInstance.backgroundPositionVertical == null || newInstance.backgroundPositionVertical.isAbsolute())) { - cachedInstance = cache.fetch(newInstance); + if ((newInstance.padding[BEFORE] == null + || newInstance.padding[BEFORE].getLength().isAbsolute()) + && (newInstance.padding[AFTER] == null + || newInstance.padding[AFTER].getLength().isAbsolute()) + && (newInstance.padding[START] == null + || newInstance.padding[START].getLength().isAbsolute()) + && (newInstance.padding[END] == null + || newInstance.padding[END].getLength().isAbsolute()) + && (newInstance.backgroundPositionHorizontal == null + || newInstance.backgroundPositionHorizontal.isAbsolute()) + && (newInstance.backgroundPositionVertical == null + || newInstance.backgroundPositionVertical.isAbsolute())) { + cachedInstance = CACHE.fetch(newInstance); } /* for non-cached, or not-yet-cached instances, preload the image */ @@ -515,6 +523,7 @@ public class CommonBorderPaddingBackground { } /** + * @param side the side to retrieve * @param discard indicates whether the .conditionality component should be * considered (end of a reference-area) * @return the width of the start-border, taking into account the specified conditionality @@ -755,8 +764,12 @@ public class CommonBorderPaddingBackground { hash = 37 * hash + backgroundAttachment; hash = 37 * hash + (backgroundColor == null ? 0 : backgroundColor.hashCode()); hash = 37 * hash + (backgroundImage == null ? 0 : backgroundImage.hashCode()); - hash = 37 * hash + (backgroundPositionHorizontal == null ? 0 : backgroundPositionHorizontal.hashCode()); - hash = 37 * hash + (backgroundPositionVertical == null ? 0 : backgroundPositionVertical.hashCode()); + hash = 37 * hash + + (backgroundPositionHorizontal == null + ? 0 : backgroundPositionHorizontal.hashCode()); + hash = 37 * hash + + (backgroundPositionVertical == null + ? 0 : backgroundPositionVertical.hashCode()); hash = 37 * hash + backgroundRepeat; hash = 37 * hash + (borderInfo[BEFORE] == null ? 0 : borderInfo[BEFORE].hashCode()); hash = 37 * hash + (borderInfo[AFTER] == null ? 0 : borderInfo[AFTER].hashCode()); diff --git a/src/java/org/apache/fop/fo/properties/CommonFont.java b/src/java/org/apache/fop/fo/properties/CommonFont.java index 55a2393fa..b12f84ad2 100644 --- a/src/java/org/apache/fop/fo/properties/CommonFont.java +++ b/src/java/org/apache/fop/fo/properties/CommonFont.java @@ -37,7 +37,8 @@ public final class CommonFont { /** cache holding canonical CommonFont instances (only those with * absolute font-size and font-size-adjust) */ - private static final PropertyCache cache = new PropertyCache(CommonFont.class); + private static final PropertyCache CACHE + = new PropertyCache(CommonFont.class); /** hashcode of this instance */ private int hash = 0; @@ -61,10 +62,10 @@ public final class CommonFont { private final EnumProperty fontWeight; /** The "font-size" property. */ - public final Length fontSize; + public final Length fontSize; // CSOK: VisibilityModifier /** The "font-size-adjust" property. */ - public final Numeric fontSizeAdjust; + public final Numeric fontSizeAdjust; // CSOK: VisibilityModifier /** @@ -79,7 +80,7 @@ public final class CommonFont { * @param fontSize the font-size (possibly non-cached) * @param fontSizeAdjust the font-size-adjust (possibly non-cached) */ - private CommonFont(FontFamilyProperty fontFamily, + private CommonFont(FontFamilyProperty fontFamily, // CSOK: ParameterNumber EnumProperty fontSelectionStrategy, EnumProperty fontStretch, EnumProperty fontStyle, @@ -110,7 +111,8 @@ public final class CommonFont { */ public static CommonFont getInstance(PropertyList pList) throws PropertyException { FontFamilyProperty fontFamily = (FontFamilyProperty) pList.get(Constants.PR_FONT_FAMILY); - EnumProperty fontSelectionStrategy = (EnumProperty) pList.get(Constants.PR_FONT_SELECTION_STRATEGY); + EnumProperty fontSelectionStrategy + = (EnumProperty) pList.get(Constants.PR_FONT_SELECTION_STRATEGY); EnumProperty fontStretch = (EnumProperty) pList.get(Constants.PR_FONT_STRETCH); EnumProperty fontStyle = (EnumProperty) pList.get(Constants.PR_FONT_STYLE); EnumProperty fontVariant = (EnumProperty) pList.get(Constants.PR_FONT_VARIANT); @@ -127,7 +129,7 @@ public final class CommonFont { fontSize, fontSizeAdjust); - return cache.fetch(commonFont); + return CACHE.fetch(commonFont); } /** @return an array with the font-family names */ @@ -183,23 +185,22 @@ public final class CommonFont { /** * Create and return an array of <code>FontTriplets</code> based on * the properties stored in the instance variables. - * - * @param fontInfo - * @return a Font object. + * @param fontInfo a font info object + * @return a font triplet */ public FontTriplet[] getFontState(FontInfo fontInfo) { - int font_weight; + int fw; switch (fontWeight.getEnum()) { - case Constants.EN_100: font_weight = 100; break; - case Constants.EN_200: font_weight = 200; break; - case Constants.EN_300: font_weight = 300; break; - case Constants.EN_400: font_weight = 400; break; - case Constants.EN_500: font_weight = 500; break; - case Constants.EN_600: font_weight = 600; break; - case Constants.EN_700: font_weight = 700; break; - case Constants.EN_800: font_weight = 800; break; - case Constants.EN_900: font_weight = 900; break; - default: font_weight = 400; + case Constants.EN_100: fw = 100; break; + case Constants.EN_200: fw = 200; break; + case Constants.EN_300: fw = 300; break; + case Constants.EN_400: fw = 400; break; + case Constants.EN_500: fw = 500; break; + case Constants.EN_600: fw = 600; break; + case Constants.EN_700: fw = 700; break; + case Constants.EN_800: fw = 800; break; + case Constants.EN_900: fw = 900; break; + default: fw = 400; } String style; @@ -221,7 +222,7 @@ public final class CommonFont { //int fontVariant = propertyList.get("font-variant").getEnum(); FontTriplet[] triplets = fontInfo.fontLookup( getFontFamily(), - style, font_weight); + style, fw); return triplets; } @@ -259,7 +260,8 @@ public final class CommonFont { hash = 37 * hash + (fontSize == null ? 0 : fontSize.hashCode()); hash = 37 * hash + (fontSizeAdjust == null ? 0 : fontSizeAdjust.hashCode()); hash = 37 * hash + (fontFamily == null ? 0 : fontFamily.hashCode()); - hash = 37 * hash + (fontSelectionStrategy == null ? 0 : fontSelectionStrategy.hashCode()); + hash = 37 * hash + (fontSelectionStrategy == null + ? 0 : fontSelectionStrategy.hashCode()); hash = 37 * hash + (fontStretch == null ? 0 : fontStretch.hashCode()); hash = 37 * hash + (fontStyle == null ? 0 : fontStyle.hashCode()); hash = 37 * hash + (fontVariant == null ? 0 : fontVariant.hashCode()); diff --git a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java index 0e32f250a..65b2cebbd 100644 --- a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java +++ b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java @@ -36,32 +36,32 @@ import org.apache.fop.fonts.Typeface; public final class CommonHyphenation { /** Logger */ - protected static Log log = LogFactory.getLog(CommonHyphenation.class); + private static final Log LOG = LogFactory.getLog(CommonHyphenation.class); - private static final PropertyCache cache = new PropertyCache(CommonHyphenation.class); + private static final PropertyCache CACHE = new PropertyCache(CommonHyphenation.class); private int hash = 0; /** The "language" property */ - public final StringProperty language; + public final StringProperty language; // CSOK: VisibilityModifier /** The "country" property */ - public final StringProperty country; + public final StringProperty country; // CSOK: VisibilityModifier /** The "script" property */ - public final StringProperty script; + public final StringProperty script; // CSOK: VisibilityModifier /** The "hyphenate" property */ - public final EnumProperty hyphenate; + public final EnumProperty hyphenate; // CSOK: VisibilityModifier /** The "hyphenation-character" property */ - public final CharacterProperty hyphenationCharacter; + public final CharacterProperty hyphenationCharacter; // CSOK: VisibilityModifier /** The "hyphenation-push-character-count" property */ - public final NumberProperty hyphenationPushCharacterCount; + public final NumberProperty hyphenationPushCharacterCount; // CSOK: VisibilityModifier /** The "hyphenation-remain-character-count" property*/ - public final NumberProperty hyphenationRemainCharacterCount; + public final NumberProperty hyphenationRemainCharacterCount; // CSOK: VisibilityModifier /** * Construct a CommonHyphenation object holding the given properties @@ -87,24 +87,26 @@ public final class CommonHyphenation { * Gets the canonical <code>CommonHyphenation</code> instance corresponding * to the values of the related properties present on the given * <code>PropertyList</code> - * * @param propertyList the <code>PropertyList</code> + * @return a common hyphenation instance + * @throws PropertyException if a a property exception occurs */ - public static CommonHyphenation getInstance(PropertyList propertyList) throws PropertyException { - StringProperty language = - (StringProperty) propertyList.get(Constants.PR_LANGUAGE); - StringProperty country = - (StringProperty) propertyList.get(Constants.PR_COUNTRY); - StringProperty script = - (StringProperty) propertyList.get(Constants.PR_SCRIPT); - EnumProperty hyphenate = - (EnumProperty) propertyList.get(Constants.PR_HYPHENATE); - CharacterProperty hyphenationCharacter = - (CharacterProperty) propertyList.get(Constants.PR_HYPHENATION_CHARACTER); - NumberProperty hyphenationPushCharacterCount = - (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_PUSH_CHARACTER_COUNT); - NumberProperty hyphenationRemainCharacterCount = - (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_REMAIN_CHARACTER_COUNT); + public static CommonHyphenation getInstance(PropertyList propertyList) + throws PropertyException { + StringProperty language + = (StringProperty) propertyList.get(Constants.PR_LANGUAGE); + StringProperty country + = (StringProperty) propertyList.get(Constants.PR_COUNTRY); + StringProperty script + = (StringProperty) propertyList.get(Constants.PR_SCRIPT); + EnumProperty hyphenate + = (EnumProperty) propertyList.get(Constants.PR_HYPHENATE); + CharacterProperty hyphenationCharacter + = (CharacterProperty) propertyList.get(Constants.PR_HYPHENATION_CHARACTER); + NumberProperty hyphenationPushCharacterCount + = (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_PUSH_CHARACTER_COUNT); + NumberProperty hyphenationRemainCharacterCount + = (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_REMAIN_CHARACTER_COUNT); CommonHyphenation instance = new CommonHyphenation( language, @@ -115,7 +117,7 @@ public final class CommonHyphenation { hyphenationPushCharacterCount, hyphenationRemainCharacterCount); - return cache.fetch(instance); + return CACHE.fetch(instance); } @@ -164,7 +166,7 @@ public final class CommonHyphenation { } } if (warn) { - log.warn("Substituted specified hyphenation character (0x" + LOG.warn("Substituted specified hyphenation character (0x" + Integer.toHexString(hyphChar) + ") with 0x" + Integer.toHexString(effHyphChar) + " because the font doesn't have the specified hyphenation character: " @@ -209,12 +211,15 @@ public final class CommonHyphenation { hash = 37 * hash + (script == null ? 0 : script.hashCode()); hash = 37 * hash + (country == null ? 0 : country.hashCode()); hash = 37 * hash + (hyphenate == null ? 0 : hyphenate.hashCode()); - hash = 37 * hash + - (hyphenationCharacter == null ? 0 : hyphenationCharacter.hashCode()); - hash = 37 * hash + - (hyphenationPushCharacterCount == null ? 0 : hyphenationPushCharacterCount.hashCode()); - hash = 37 * hash + - (hyphenationRemainCharacterCount == null ? 0 : hyphenationRemainCharacterCount.hashCode()); + hash = 37 * hash + + (hyphenationCharacter == null + ? 0 : hyphenationCharacter.hashCode()); + hash = 37 * hash + + (hyphenationPushCharacterCount == null + ? 0 : hyphenationPushCharacterCount.hashCode()); + hash = 37 * hash + + (hyphenationRemainCharacterCount == null + ? 0 : hyphenationRemainCharacterCount.hashCode()); this.hash = hash; } return this.hash; diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java b/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java index 8d63b3d22..a45c09672 100644 --- a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java +++ b/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java @@ -33,46 +33,47 @@ public class CommonMarginBlock { /** * The "margin-top" property. */ - public Length marginTop; + public Length marginTop; // CSOK: VisibilityModifier /** * The "margin-bottom" property. */ - public Length marginBottom; + public Length marginBottom; // CSOK: VisibilityModifier /** * The "margin-left" property. */ - public Length marginLeft; + public Length marginLeft; // CSOK: VisibilityModifier /** * The "margin-right" property. */ - public Length marginRight; + public Length marginRight; // CSOK: VisibilityModifier /** * The "space-before" property. */ - public SpaceProperty spaceBefore; + public SpaceProperty spaceBefore; // CSOK: VisibilityModifier /** * The "space-after" property. */ - public SpaceProperty spaceAfter; + public SpaceProperty spaceAfter; // CSOK: VisibilityModifier /** * The "start-indent" property. */ - public Length startIndent; + public Length startIndent; // CSOK: VisibilityModifier /** * The "end-indent" property. */ - public Length endIndent; + public Length endIndent; // CSOK: VisibilityModifier /** * Create a CommonMarginBlock object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception occurs */ public CommonMarginBlock(PropertyList pList) throws PropertyException { marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength(); diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java b/src/java/org/apache/fop/fo/properties/CommonMarginInline.java index c578e58b8..3b1d886ea 100644 --- a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java +++ b/src/java/org/apache/fop/fo/properties/CommonMarginInline.java @@ -34,36 +34,37 @@ public class CommonMarginInline { /** * The "margin-top" property. */ - public Length marginTop; + public Length marginTop; // CSOK: VisibilityModifier /** * The "margin-bottom" property. */ - public Length marginBottom; + public Length marginBottom; // CSOK: VisibilityModifier /** * The "margin-left" property. */ - public Length marginLeft; + public Length marginLeft; // CSOK: VisibilityModifier /** * The "margin-right" property. */ - public Length marginRight; + public Length marginRight; // CSOK: VisibilityModifier /** * The "space-start" property. */ - public SpaceProperty spaceStart; + public SpaceProperty spaceStart; // CSOK: VisibilityModifier /** * The "space-end" property. */ - public SpaceProperty spaceEnd; + public SpaceProperty spaceEnd; // CSOK: VisibilityModifier /** * Create a CommonMarginInline object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception occurs */ public CommonMarginInline(PropertyList pList) throws PropertyException { marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength(); diff --git a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java b/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java index f28a3edb3..32d21133b 100644 --- a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java +++ b/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java @@ -33,31 +33,32 @@ public class CommonRelativePosition { /** * The "relative-position" property. */ - public int relativePosition; + public int relativePosition; // CSOK: VisibilityModifier /** * The "top" property. */ - public Length top; + public Length top; // CSOK: VisibilityModifier /** * The "right" property. */ - public Length right; + public Length right; // CSOK: VisibilityModifier /** * The "bottom" property. */ - public Length bottom; + public Length bottom; // CSOK: VisibilityModifier /** * The "left" property. */ - public Length left; + public Length left; // CSOK: VisibilityModifier /** * Create a CommonRelativePosition object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception occurs */ public CommonRelativePosition(PropertyList pList) throws PropertyException { relativePosition = pList.get(Constants.PR_RELATIVE_POSITION).getEnum(); diff --git a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java index 45f6b2e9f..3edb84009 100644 --- a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java @@ -32,8 +32,8 @@ public class CompoundPropertyMaker extends PropertyMaker { /** * The list of subproperty makers supported by this compound maker. */ - private PropertyMaker[] subproperties = - new PropertyMaker[Constants.COMPOUND_COUNT]; + private PropertyMaker[] subproperties + = new PropertyMaker[Constants.COMPOUND_COUNT]; /** * The first subproperty maker which has a setByShorthand of true. @@ -66,7 +66,7 @@ public class CompoundPropertyMaker extends PropertyMaker { /** * Add a subproperty to this maker. - * @param subproperty + * @param subproperty the sub property */ public void addSubpropMaker(PropertyMaker subproperty) { // Place the base propId in the propId of the subproperty. @@ -101,12 +101,11 @@ public class CompoundPropertyMaker extends PropertyMaker { * Calculate the real value of a subproperty by unmasking and shifting * the value into the range [0 - (COMPOUND_COUNT-1)]. * The value is used as index into the subproperties array. - * @param propId the property id of the sub property. + * @param subpropertyId the property id of the sub property. * @return the array index. */ private int getSubpropIndex(int subpropertyId) { - return ((subpropertyId & Constants.COMPOUND_MASK) >> - Constants.COMPOUND_SHIFT)-1; + return ((subpropertyId & Constants.COMPOUND_MASK) >> Constants.COMPOUND_SHIFT) - 1; } /** @@ -137,11 +136,12 @@ public class CompoundPropertyMaker extends PropertyMaker { * @param propertyList The PropertyList object being built for this FO. * @param tryInherit true if inherited properties should be examined. * @param tryDefault true if the default value should be returned. + * @return the property + * @throws PropertyException if a property exception occurs */ public Property get(int subpropertyId, PropertyList propertyList, boolean tryInherit, boolean tryDefault) - throws PropertyException - { + throws PropertyException { Property p = super.get(subpropertyId, propertyList, tryInherit, tryDefault); if (subpropertyId != 0 && p != null) { p = getSubprop(p, subpropertyId); @@ -261,7 +261,8 @@ public class CompoundPropertyMaker extends PropertyMaker { PropertyMaker subpropertyMaker = subproperties[i]; if (subpropertyMaker != null) { Property subproperty = subpropertyMaker.make(propertyList); - data.setComponent(subpropertyMaker.getPropId() & Constants.COMPOUND_MASK, subproperty, true); + data.setComponent(subpropertyMaker.getPropId() + & Constants.COMPOUND_MASK, subproperty, true); } } return p; diff --git a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java index aa913d969..1ab7ec3ad 100644 --- a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java +++ b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java @@ -33,7 +33,8 @@ import org.apache.fop.fo.expr.PropertyException; public class CondLengthProperty extends Property implements CompoundDatatype { /** cache holding canonical instances (for absolute conditional lengths) */ - private static final PropertyCache cache = new PropertyCache(CondLengthProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(CondLengthProperty.class); /** components */ private Property length; @@ -158,7 +159,7 @@ public class CondLengthProperty extends Property implements CompoundDatatype { */ public CondLengthProperty getCondLength() { if (this.length.getLength().isAbsolute()) { - CondLengthProperty clp = (CondLengthProperty) cache.fetch(this); + CondLengthProperty clp = (CondLengthProperty) CACHE.fetch(this); if (clp == this) { isCached = true; } diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java index 60237c53a..6183b9e56 100644 --- a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java @@ -19,31 +19,46 @@ package org.apache.fop.fo.properties; -import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; /** + * Maker class for handling corresponding properties. */ public class CorrespondingPropertyMaker { + /** base property maker */ protected PropertyMaker baseMaker; - protected int lr_tb; - protected int rl_tb; - protected int tb_rl; + /** corresponding property for lr-tb writing mode */ + protected int lrtb; + /** corresponding property for rl-tb writing mode */ + protected int rltb; + /** corresponding property for tb-rl writing mode */ + protected int tbrl; + /** user parent property list */ protected boolean useParent; private boolean relative; + /** + * Construct a corresponding property maker. + * @param baseMaker the base property maker + */ public CorrespondingPropertyMaker(PropertyMaker baseMaker) { this.baseMaker = baseMaker; baseMaker.setCorresponding(this); } - public void setCorresponding(int lr_tb, int rl_tb, int tb_rl) { - this.lr_tb = lr_tb; - this.rl_tb = rl_tb; - this.tb_rl = tb_rl; + /** + * Set corresponding property identifiers. + * @param lrtb the property that corresponds with lr-tb writing mode + * @param rltb the property that corresponds with rl-tb writing mode + * @param tbrl the property that corresponds with tb-lr writing mode + */ + public void setCorresponding(int lrtb, int rltb, int tbrl) { + this.lrtb = lrtb; + this.rltb = rltb; + this.tbrl = tbrl; } /** @@ -55,6 +70,10 @@ public class CorrespondingPropertyMaker { this.useParent = useParent; } + /** + * Set relative flag. + * @param relative true if relative direction + */ public void setRelative(boolean relative) { this.relative = relative; } @@ -83,7 +102,7 @@ public class CorrespondingPropertyMaker { PropertyList pList = getWMPropertyList(propertyList); if (pList != null) { - int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int correspondingId = pList.getWritingMode(lrtb, rltb, tbrl); if (pList.getExplicit(correspondingId) != null) { return true; @@ -100,14 +119,14 @@ public class CorrespondingPropertyMaker { * @param propertyList The PropertyList for the FO. * @return Property A computed Property value or null if no rules * are specified (in foproperties.xml) to compute the value. - * @throws FOPException for invalid or inconsistent FO input + * @throws PropertyException if a property exception occurs */ public Property compute(PropertyList propertyList) throws PropertyException { PropertyList pList = getWMPropertyList(propertyList); if (pList == null) { return null; } - int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int correspondingId = pList.getWritingMode(lrtb, rltb, tbrl); Property p = propertyList.getExplicitOrShorthand(correspondingId); if (p != null) { @@ -120,6 +139,8 @@ public class CorrespondingPropertyMaker { /** * Return the property list to use for fetching writing mode depending property * ids. + * @param pList a property list + * @return the property list to use */ protected PropertyList getWMPropertyList(PropertyList pList) { if (useParent) { diff --git a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java index 29715fe66..df8583089 100644 --- a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java @@ -30,27 +30,44 @@ import org.apache.fop.fo.expr.PropertyException; * Window - Preferences - Java - Code Generation - Code and Comments */ public class DimensionPropertyMaker extends CorrespondingPropertyMaker { - int[][] extraCorresponding = null; + + private int[][] extraCorresponding = null; + /** + * Construct a dimension property maker. + * @param baseMaker the base property maker + */ public DimensionPropertyMaker(PropertyMaker baseMaker) { super(baseMaker); } + /** + * Set extra correspondences. + * @param extraCorresponding the extra correspondences + */ public void setExtraCorresponding(int[][] extraCorresponding) { this.extraCorresponding = extraCorresponding; } + /** + * Determine if corresponding property is forced. + * @param propertyList the property list to use + * @return true if it is forced + */ public boolean isCorrespondingForced(PropertyList propertyList) { - if (super.isCorrespondingForced(propertyList)) + if (super.isCorrespondingForced(propertyList)) { return true; + } for (int i = 0; i < extraCorresponding.length; i++) { int wmcorr = extraCorresponding[i][0]; //propertyList.getWritingMode()]; - if (propertyList.getExplicit(wmcorr) != null) + if (propertyList.getExplicit(wmcorr) != null) { return true; + } } return false; } + /** {@inheritDoc} */ public Property compute(PropertyList propertyList) throws PropertyException { // Based on [width|height] Property p = super.compute(propertyList); diff --git a/src/java/org/apache/fop/fo/properties/EnumLength.java b/src/java/org/apache/fop/fo/properties/EnumLength.java index 76fd0e5b7..d2480beb2 100644 --- a/src/java/org/apache/fop/fo/properties/EnumLength.java +++ b/src/java/org/apache/fop/fo/properties/EnumLength.java @@ -27,6 +27,10 @@ import org.apache.fop.datatypes.PercentBaseContext; public class EnumLength extends LengthProperty { private Property enumProperty; + /** + * Construct an enumerated length from an enum property. + * @param enumProperty the enumeration property + */ public EnumLength(Property enumProperty) { this.enumProperty = enumProperty; } @@ -38,6 +42,7 @@ public class EnumLength extends LengthProperty { return enumProperty.getEnum(); } + /** @return true if absolute */ public boolean isAbsolute() { return false; } diff --git a/src/java/org/apache/fop/fo/properties/EnumNumber.java b/src/java/org/apache/fop/fo/properties/EnumNumber.java index fdc359a06..153a716df 100644 --- a/src/java/org/apache/fop/fo/properties/EnumNumber.java +++ b/src/java/org/apache/fop/fo/properties/EnumNumber.java @@ -29,7 +29,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class EnumNumber extends Property implements Numeric { /** cache holding all canonical EnumNumber instances */ - private static final PropertyCache cache = new PropertyCache(EnumNumber.class); + private static final PropertyCache CACHE + = new PropertyCache(EnumNumber.class); private final EnumProperty enumProperty; @@ -49,7 +50,7 @@ public final class EnumNumber extends Property implements Numeric { * @return the canonical instance */ public static EnumNumber getInstance(Property enumProperty) { - return (EnumNumber)cache.fetch( + return (EnumNumber)CACHE.fetch( new EnumNumber((EnumProperty) enumProperty)); } diff --git a/src/java/org/apache/fop/fo/properties/EnumProperty.java b/src/java/org/apache/fop/fo/properties/EnumProperty.java index 07cfaadcc..ae704f1c9 100644 --- a/src/java/org/apache/fop/fo/properties/EnumProperty.java +++ b/src/java/org/apache/fop/fo/properties/EnumProperty.java @@ -29,7 +29,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class EnumProperty extends Property { /** cache holding all canonical EnumProperty instances */ - private static final PropertyCache cache = new PropertyCache(EnumProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(EnumProperty.class); /** * Inner class for creating EnumProperty instances @@ -54,6 +55,14 @@ public final class EnumProperty extends Property { return super.checkEnumValues(value); } + /** + * Convert a property. + * @param p the property to convert + * @param propertyList the property list to use in conversion + * @param fo the FO to use in conversion + * @return the converted property + * @throws PropertyException if a property conversion exception occurs + */ public Property convertProperty(Property p, PropertyList propertyList, FObj fo) throws PropertyException { @@ -77,8 +86,14 @@ public final class EnumProperty extends Property { this.text = text; } + /** + * Construct an enumeration property. + * @param explicitValue the value + * @param text the text + * @return an enumeration property + */ public static EnumProperty getInstance(int explicitValue, String text) { - return (EnumProperty) cache.fetch( + return (EnumProperty) CACHE.fetch( new EnumProperty(explicitValue, text)); } diff --git a/src/java/org/apache/fop/fo/properties/FixedLength.java b/src/java/org/apache/fop/fo/properties/FixedLength.java index 84d159edf..c35c6f6c9 100644 --- a/src/java/org/apache/fop/fo/properties/FixedLength.java +++ b/src/java/org/apache/fop/fo/properties/FixedLength.java @@ -45,7 +45,8 @@ public final class FixedLength extends LengthProperty { public static final String MPT = "mpt"; /** cache holding all canonical FixedLength instances */ - private static final PropertyCache cache = new PropertyCache(FixedLength.class); + private static final PropertyCache CACHE + = new PropertyCache(FixedLength.class); /** canonical zero-length instance */ public static final FixedLength ZERO_FIXED_LENGTH = new FixedLength(0, FixedLength.MPT, 1.0f); @@ -81,7 +82,7 @@ public final class FixedLength extends LengthProperty { if (numUnits == 0.0) { return ZERO_FIXED_LENGTH; } else { - return (FixedLength)cache.fetch( + return (FixedLength)CACHE.fetch( new FixedLength(numUnits, units, sourceResolution)); } diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java index 34a6b58d8..330101ee7 100644 --- a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java +++ b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java @@ -31,7 +31,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class FontFamilyProperty extends ListProperty { /** cache holding all canonical FontFamilyProperty instances */ - private static final PropertyCache cache = new PropertyCache(FontFamilyProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(FontFamilyProperty.class); private int hash = 0; @@ -50,7 +51,8 @@ public final class FontFamilyProperty extends ListProperty { /** * {@inheritDoc} */ - public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException { + public Property make(PropertyList propertyList, String value, FObj fo) + throws PropertyException { if ("inherit".equals(value)) { return super.make(propertyList, value, fo); } else { @@ -93,7 +95,7 @@ public final class FontFamilyProperty extends ListProperty { prop.addProperty(StringProperty.getInstance(tmpVal)); } } - return cache.fetch(prop); + return CACHE.fetch(prop); } } diff --git a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java b/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java index 5096d6160..60ef955ba 100644 --- a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java @@ -50,7 +50,8 @@ public class FontSizePropertyMaker * here already: if the property evaluates to a {@link PercentLength}, * it is immediately replaced by the resolved {@link FixedLength}. */ - public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException { + public Property make(PropertyList propertyList, String value, FObj fo) + throws PropertyException { Property p = super.make(propertyList, value, fo); if (p instanceof PercentLength) { Property pp = propertyList.getFromParent(this.propId); diff --git a/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java b/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java index 278fec862..6397813e6 100644 --- a/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java @@ -13,7 +13,8 @@ * 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.fo.properties; @@ -25,6 +26,9 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.PropertyInfo; import org.apache.fop.fo.expr.PropertyParser; +/** + * Font weight property maker. + */ public class FontWeightPropertyMaker extends EnumProperty.Maker { /** @@ -45,10 +49,8 @@ public class FontWeightPropertyMaker extends EnumProperty.Maker { } else { String pValue = checkValueKeywords(value); Property newProp = checkEnumValues(pValue); - int enumValue = -1; - if (newProp != null - && ((enumValue = newProp.getEnum()) == Constants.EN_BOLDER - || enumValue == Constants.EN_LIGHTER)) { + int enumValue = ( newProp != null ) ? newProp.getEnum() : -1; + if (enumValue == Constants.EN_BOLDER || enumValue == Constants.EN_LIGHTER) { /* check for relative enum values, compute in relation to parent */ Property parentProp = pList.getInherited(Constants.PR_FONT_WEIGHT); if (enumValue == Constants.EN_BOLDER) { diff --git a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java index d976fc6ea..19c4675ed 100644 --- a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java @@ -68,6 +68,9 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { /** * Calculate the corresponding value for start-indent and end-indent. + * @param propertyList the property list to use in the computation + * @return the computed indent property + * @throws PropertyException if a property exception occurs * @see CorrespondingPropertyMaker#compute(PropertyList) */ public Property compute(PropertyList propertyList) throws PropertyException { @@ -81,6 +84,9 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { /** * Calculate the corresponding value for start-indent and end-indent. + * @param propertyList the property list to use in the computation + * @return the computed indent property + * @throws PropertyException if a property exception occurs * @see CorrespondingPropertyMaker#compute(PropertyList) */ public Property computeConforming(PropertyList propertyList) throws PropertyException { @@ -93,7 +99,7 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { Numeric padding = getCorresponding(paddingCorresponding, propertyList).getNumeric(); Numeric border = getCorresponding(borderWidthCorresponding, propertyList).getNumeric(); - int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int marginProp = pList.getWritingMode(lrtb, rltb, tbrl); // Calculate the absolute margin. if (propertyList.getExplicitOrShorthand(marginProp) == null) { Property indent = propertyList.getExplicit(baseMaker.propId); @@ -136,6 +142,9 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { * This method calculates indent following an alternative rule set that * tries to mimic many commercial solutions that chose to violate the * XSL specification. + * @param propertyList the property list to use in the computation + * @return the computed indent property + * @throws PropertyException if a property exception occurs * @see CorrespondingPropertyMaker#compute(PropertyList) */ public Property computeAlternativeRuleset(PropertyList propertyList) throws PropertyException { @@ -149,7 +158,7 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { Numeric padding = getCorresponding(paddingCorresponding, propertyList).getNumeric(); Numeric border = getCorresponding(borderWidthCorresponding, propertyList).getNumeric(); - int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int marginProp = pList.getWritingMode(lrtb, rltb, tbrl); //Determine whether the nearest anscestor indent was specified through //start-indent|end-indent or through a margin property. diff --git a/src/java/org/apache/fop/fo/properties/KeepProperty.java b/src/java/org/apache/fop/fo/properties/KeepProperty.java index d2e2c70a7..0bc44e459 100644 --- a/src/java/org/apache/fop/fo/properties/KeepProperty.java +++ b/src/java/org/apache/fop/fo/properties/KeepProperty.java @@ -30,7 +30,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class KeepProperty extends Property implements CompoundDatatype { /** class holding all canonical KeepProperty instances*/ - private static final PropertyCache cache = new PropertyCache(KeepProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(KeepProperty.class); private boolean isCachedValue = false; private Property withinLine; @@ -61,8 +62,7 @@ public final class KeepProperty extends Property implements CompoundDatatype { * {@inheritDoc} */ public Property convertProperty(Property p, PropertyList propertyList, FObj fo) - throws PropertyException - { + throws PropertyException { if (p instanceof KeepProperty) { return p; } @@ -154,10 +154,10 @@ public final class KeepProperty extends Property implements CompoundDatatype { * @return String representation */ public String toString() { - return "Keep[" + - "withinLine:" + getWithinLine().getObject() + - ", withinColumn:" + getWithinColumn().getObject() + - ", withinPage:" + getWithinPage().getObject() + "]"; + return "Keep[" + + "withinLine:" + getWithinLine().getObject() + + ", withinColumn:" + getWithinColumn().getObject() + + ", withinPage:" + getWithinPage().getObject() + "]"; } /** @@ -165,7 +165,7 @@ public final class KeepProperty extends Property implements CompoundDatatype { * this property */ public KeepProperty getKeep() { - KeepProperty keep = (KeepProperty) cache.fetch(this); + KeepProperty keep = (KeepProperty) CACHE.fetch(this); /* make sure setComponent() can never alter cached values */ keep.isCachedValue = true; return keep; diff --git a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java b/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java index 4b408e83b..1d79bb7af 100644 --- a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java @@ -64,6 +64,7 @@ public class LineHeightPropertyMaker extends SpaceProperty.Maker { /** * Recalculate the line-height value based on the nearest specified * value. + * {@inheritDoc} */ protected Property compute(PropertyList propertyList) throws PropertyException { // recalculate based on last specified value diff --git a/src/java/org/apache/fop/fo/properties/NumberProperty.java b/src/java/org/apache/fop/fo/properties/NumberProperty.java index 4d7c3b97b..97844d723 100644 --- a/src/java/org/apache/fop/fo/properties/NumberProperty.java +++ b/src/java/org/apache/fop/fo/properties/NumberProperty.java @@ -68,6 +68,9 @@ public final class NumberProperty extends Property implements Numeric { } + /** + * A positive integer property maker. + */ public static class PositiveIntegerMaker extends PropertyMaker { /** @@ -103,7 +106,8 @@ public final class NumberProperty extends Property implements Numeric { } /** cache holding all canonical NumberProperty instances */ - private static final PropertyCache cache = new PropertyCache(NumberProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(NumberProperty.class); private final Number number; @@ -140,7 +144,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(Double num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num.doubleValue())); } @@ -151,7 +155,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(Integer num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num.intValue())); } @@ -162,7 +166,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(double num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num)); } @@ -173,7 +177,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(int num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num)); } diff --git a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java b/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java index 53a9c1286..919dd84d0 100644 --- a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java +++ b/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java @@ -43,7 +43,13 @@ public class PageDimensionMaker extends LengthProperty.Maker { * Check the value of the page-width / page-height property. * Return the default or user-defined fallback in case the value * was specified as "auto" - * + * @param subpropId The subproperty id of the property being retrieved. + * Is 0 when retriving a base property. + * @param propertyList The PropertyList object being built for this FO. + * @param tryInherit true if inherited properties should be examined. + * @param tryDefault true if the default value should be returned. + * @return the property + * @throws PropertyException if a property exception occurs * @see PropertyMaker#get(int, PropertyList, boolean, boolean) */ public Property get(int subpropId, PropertyList propertyList, diff --git a/src/java/org/apache/fop/fo/properties/PercentLength.java b/src/java/org/apache/fop/fo/properties/PercentLength.java index f89007f34..66f1f175c 100644 --- a/src/java/org/apache/fop/fo/properties/PercentLength.java +++ b/src/java/org/apache/fop/fo/properties/PercentLength.java @@ -118,8 +118,7 @@ public class PercentLength extends LengthProperty { * @return the String equivalent of this */ public String toString() { - StringBuffer sb = - new StringBuffer(PercentLength.class.getName()) + StringBuffer sb = new StringBuffer(PercentLength.class.getName()) .append("[factor=").append(factor) .append(",lbase=").append(lbase).append("]"); return sb.toString(); diff --git a/src/java/org/apache/fop/fo/properties/PropertyCache.java b/src/java/org/apache/fop/fo/properties/PropertyCache.java index dc9abb023..920125796 100644 --- a/src/java/org/apache/fop/fo/properties/PropertyCache.java +++ b/src/java/org/apache/fop/fo/properties/PropertyCache.java @@ -98,8 +98,13 @@ public final class PropertyCache { } /* Wrapper objects to synchronize on */ - private static class CacheSegment { + private static final class CacheSegment { + CacheSegment() { + } private int count = 0; + int getCount() { + return count; + } } private void cleanSegment(int segmentIndex) { @@ -209,10 +214,11 @@ public final class PropertyCache { /* try non-synched first */ for (CacheEntry e = entry; e != null; e = e.nextEntry) { - if (e.hash == hash - && (q = e.get()) != null - && eq(q, o)) { - return q; + if ( e.hash == hash ) { + q = e.get(); + if ( ( q != null ) && eq ( q, o ) ) { + return q; + } } } @@ -223,10 +229,11 @@ public final class PropertyCache { synchronized (segment) { entry = table[index]; for (CacheEntry e = entry; e != null; e = e.nextEntry) { - if (e.hash == hash - && (q = e.get()) != null - && eq(q, o)) { - return q; + if ( e.hash == hash ) { + q = e.get(); + if ( ( q != null ) && eq ( q, o ) ) { + return q; + } } } } @@ -261,7 +268,8 @@ public final class PropertyCache { newLength--; for (int i = table.length; --i >= 0;) { for (CacheEntry c = table[i]; c != null; c = c.nextEntry) { - if ((o = c.get()) != null) { + o = c.get(); + if (o != null) { hash = c.hash; idx = hash & newLength; newTable[idx] = new CacheEntry(o, newTable[idx]); @@ -384,7 +392,7 @@ public final class PropertyCache { } /** - * Checks if the given {@link Marker.MarkerAttribute} is present + * Checks if the given {@link org.apache.fop.fo.flow.Marker.MarkerAttribute} is present * in the cache - if so, returns a reference to the cached instance. * Otherwise the given object is added to the cache and returned. * diff --git a/src/java/org/apache/fop/fo/properties/ShorthandParser.java b/src/java/org/apache/fop/fo/properties/ShorthandParser.java index f0ec0e6e9..f03c377fd 100644 --- a/src/java/org/apache/fop/fo/properties/ShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/ShorthandParser.java @@ -30,9 +30,11 @@ public interface ShorthandParser { /** * @param propId the property ID in the Constants interface + * @param property from which value is obtained * @param maker Maker object for the Property * @param propertyList list of properties * @return Property object corresponding to propName + * @throws PropertyException in case a property exception occurs */ Property getValueForProperty(int propId, Property property, diff --git a/src/java/org/apache/fop/fo/properties/SpaceProperty.java b/src/java/org/apache/fop/fo/properties/SpaceProperty.java index 49f76f874..641ec3baf 100644 --- a/src/java/org/apache/fop/fo/properties/SpaceProperty.java +++ b/src/java/org/apache/fop/fo/properties/SpaceProperty.java @@ -136,13 +136,14 @@ public class SpaceProperty extends LengthRangeProperty { return this.conditionality.getEnum() == Constants.EN_DISCARD; } + /** {@inheritDoc} */ public String toString() { - return "Space[" + - "min:" + getMinimum(null).getObject() + - ", max:" + getMaximum(null).getObject() + - ", opt:" + getOptimum(null).getObject() + - ", precedence:" + precedence.getObject() + - ", conditionality:" + conditionality.getObject() + "]"; + return "Space[" + + "min:" + getMinimum(null).getObject() + + ", max:" + getMaximum(null).getObject() + + ", opt:" + getOptimum(null).getObject() + + ", precedence:" + precedence.getObject() + + ", conditionality:" + conditionality.getObject() + "]"; } /** diff --git a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java index 19fa7baa7..3c51dd44a 100644 --- a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java @@ -41,6 +41,11 @@ public class SpacingPropertyMaker extends SpaceProperty.Maker { /** * Support for the 'normal' value. + * @param p the property to convert + * @param propertyList the property list to use in conversion + * @param fo the FO to use in conversion + * @return the converted property + * @throws PropertyException if a property conversion exception occurs */ public Property convertProperty(Property p, PropertyList propertyList, diff --git a/src/java/org/apache/fop/fo/properties/StringProperty.java b/src/java/org/apache/fop/fo/properties/StringProperty.java index ec7e1f841..9bbe33070 100644 --- a/src/java/org/apache/fop/fo/properties/StringProperty.java +++ b/src/java/org/apache/fop/fo/properties/StringProperty.java @@ -21,11 +21,6 @@ package org.apache.fop.fo.properties; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; -import org.apache.fop.fo.FOValidationEventProducer; -import org.apache.fop.fo.ValidationException; -import org.apache.fop.fo.expr.PropertyException; - -import java.util.Set; /** * Exists primarily as a container for its Maker inner class, which is @@ -83,7 +78,8 @@ public final class StringProperty extends Property { } /** cache containing all canonical StringProperty instances */ - private static final PropertyCache cache = new PropertyCache(StringProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(StringProperty.class); /** canonical instance for empty strings */ public static final StringProperty EMPTY_STRING_PROPERTY = new StringProperty(""); @@ -108,7 +104,7 @@ public final class StringProperty extends Property { if ("".equals(str) || str == null) { return EMPTY_STRING_PROPERTY; } else { - return (StringProperty)cache.fetch( + return (StringProperty)CACHE.fetch( new StringProperty(str)); } } diff --git a/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java b/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java index 4a2fc92f4..b01ee22a0 100644 --- a/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java +++ b/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java @@ -24,7 +24,11 @@ import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; -public class TableBorderPrecedence extends NumberProperty.Maker{ +/** + * A table border preference property maker. + */ +public class TableBorderPrecedence extends NumberProperty.Maker { + private static Property num0 = NumberProperty.getInstance(0); private static Property num1 = NumberProperty.getInstance(1); private static Property num2 = NumberProperty.getInstance(2); @@ -33,6 +37,10 @@ public class TableBorderPrecedence extends NumberProperty.Maker{ private static Property num5 = NumberProperty.getInstance(5); private static Property num6 = NumberProperty.getInstance(6); + /** + * Construct a table border preference property maker. + * @param propId the border's property id + */ public TableBorderPrecedence(int propId) { super(propId); } @@ -59,7 +67,8 @@ public class TableBorderPrecedence extends NumberProperty.Maker{ return num1; case Constants.FO_TABLE_FOOTER: return num0; + default: + return null; } - return null; } } diff --git a/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java b/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java index 3cbe56f00..bcd41fb20 100644 --- a/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java +++ b/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java @@ -14,6 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* $Id$ */ + package org.apache.fop.fo.properties; import java.util.Iterator; @@ -72,11 +75,11 @@ public class TextDecorationProperty extends ListProperty { if (prop instanceof EnumProperty) { //skip } else if (prop instanceof NCnameProperty) { - Property prop_enum = checkEnumValues(((NCnameProperty)prop).getString()); - if (prop_enum == null) { + Property propEnum = checkEnumValues(((NCnameProperty)prop).getString()); + if (propEnum == null) { throw new PropertyException("Illegal enum value: " + prop.getString()); } - l.set(i, prop_enum); + l.set(i, propEnum); } else { throw new PropertyException("Invalid content for text-decoration " + "property: " + prop); @@ -113,7 +116,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_UNDERLINE: case Constants.EN_NO_UNDERLINE: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (under) { throw new PropertyException("Invalid combination of values"); @@ -123,7 +127,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_OVERLINE: case Constants.EN_NO_OVERLINE: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (over) { throw new PropertyException("Invalid combination of values"); @@ -133,7 +138,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_LINE_THROUGH: case Constants.EN_NO_LINE_THROUGH: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (through) { throw new PropertyException("Invalid combination of values"); @@ -143,7 +149,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_BLINK: case Constants.EN_NO_BLINK: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (blink) { throw new PropertyException("Invalid combination of values"); diff --git a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java b/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java index c04b1a892..387355623 100644 --- a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java +++ b/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java @@ -22,22 +22,33 @@ package org.apache.fop.fo.properties; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; +/** + * A special property for representing an as yet implemented implemented property. + */ public class ToBeImplementedProperty extends Property { + /** + * A to be implemented property maker instance. + */ public static class Maker extends PropertyMaker { + /** + * Instantiate a to be implemented property maker instance. + * @param propId a property id + */ public Maker(int propId) { super(propId); } + /** {@inheritDoc} */ public Property convertProperty(Property p, PropertyList propertyList, FObj fo) { if (p instanceof ToBeImplementedProperty) { return p; } - ToBeImplementedProperty val = - new ToBeImplementedProperty(getPropId()); + ToBeImplementedProperty val + = new ToBeImplementedProperty(getPropId()); return val; } } diff --git a/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java b/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java index c0950a794..8c0cec744 100644 --- a/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java @@ -18,6 +18,7 @@ /* $Id$ */ package org.apache.fop.fo.properties; + import org.apache.fop.fo.Constants; import org.apache.fop.fo.PropertyList; @@ -47,6 +48,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_TOP: switch (propId) { @@ -58,6 +61,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_TEXT_TOP: switch (propId) { @@ -69,6 +74,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_MIDDLE: switch (propId) { @@ -80,6 +87,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_BOTTOM: switch (propId) { @@ -91,6 +100,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_TEXT_BOTTOM: switch (propId) { @@ -102,6 +113,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_SUB: switch (propId) { @@ -113,6 +126,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_SUB, "SUB")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_SUPER: switch (propId) { @@ -124,6 +139,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_SUPER, "SUPER")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } default: switch (propId) { @@ -135,6 +152,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } } return null; diff --git a/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java b/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java index efadd8957..d8b8dac27 100644 --- a/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java @@ -13,7 +13,8 @@ * 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.fo.properties; @@ -22,6 +23,9 @@ import org.apache.fop.fo.Constants; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; +/** + * A parser for the xml:lang property. + */ public class XMLLangShorthandParser extends GenericShorthandParser { private static final char HYPHEN_MINUS = '-'; diff --git a/src/java/org/apache/fop/fonts/CIDFontType.java b/src/java/org/apache/fop/fonts/CIDFontType.java index f553377b3..20a94b9dd 100644 --- a/src/java/org/apache/fop/fonts/CIDFontType.java +++ b/src/java/org/apache/fop/fonts/CIDFontType.java @@ -38,6 +38,9 @@ public class CIDFontType extends ValuedEnum { /** + * Construct a CID font type. + * @param name a type name + * @param value a type value * @see org.apache.avalon.framework.Enum#Enum(String) */ protected CIDFontType(String name, int value) { diff --git a/src/java/org/apache/fop/fonts/CIDSubset.java b/src/java/org/apache/fop/fonts/CIDSubset.java index 6be4007ea..778521517 100644 --- a/src/java/org/apache/fop/fonts/CIDSubset.java +++ b/src/java/org/apache/fop/fonts/CIDSubset.java @@ -55,6 +55,9 @@ public class CIDSubset { */ private Map/*<Integer, Character>*/ usedCharsIndex = new java.util.HashMap(); + /** + * Default constructor. + */ public CIDSubset() { } diff --git a/src/java/org/apache/fop/fonts/FontCache.java b/src/java/org/apache/fop/fonts/FontCache.java index 9d5eff010..29470a2a9 100644 --- a/src/java/org/apache/fop/fonts/FontCache.java +++ b/src/java/org/apache/fop/fonts/FontCache.java @@ -19,7 +19,9 @@ package org.apache.fop.fonts; +import java.io.BufferedInputStream; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; @@ -45,8 +47,8 @@ import org.apache.fop.util.LogUtil; public final class FontCache implements Serializable { /** - * Serialization Version UID. Change this value if you want to make sure the user's cache - * file is purged after an update. + * Serialization Version UID. Change this value if you want to make sure the + * user's cache file is purged after an update. */ private static final long serialVersionUID = 605232520271754719L; @@ -59,19 +61,23 @@ public final class FontCache implements Serializable { /** font cache file path */ private static final String DEFAULT_CACHE_FILENAME = "fop-fonts.cache"; - /** has this cache been changed since it was last read? */ private transient boolean changed = false; /** change lock */ private final boolean[] changeLock = new boolean[1]; - /** master mapping of font url -> font info. This needs to be - * a list, since a TTC file may contain more than 1 font. */ - private Map/*<String, CachedFontFile>*/ fontfileMap = null; + /** + * master mapping of font url -> font info. This needs to be a list, since a + * TTC file may contain more than 1 font. + */ + private Map/* <String, CachedFontFile> */fontfileMap = null; - /** mapping of font url -> file modified date (for all fonts that have failed to load) */ - private Map failedFontMap/*<String, Long>*/ = null; + /** + * mapping of font url -> file modified date (for all fonts that have failed + * to load) + */ + private Map failedFontMap/* <String, Long>*/ = null; /** * Default constructor @@ -100,7 +106,9 @@ public final class FontCache implements Serializable { /** * Returns the default font cache file. - * @param forWriting true if the user directory should be created + * + * @param forWriting + * true if the user directory should be created * @return the default font cache file */ public static File getDefaultCacheFile(boolean forWriting) { @@ -125,8 +133,9 @@ public final class FontCache implements Serializable { /** * Reads the default font cache file and returns its contents. - * @return the font cache deserialized from the file (or null if no cache file exists or if - * it could not be read) + * + * @return the font cache deserialized from the file (or null if no cache + * file exists or if it could not be read) */ public static FontCache load() { return loadFrom(getDefaultCacheFile(false)); @@ -134,36 +143,41 @@ public final class FontCache implements Serializable { /** * Reads a font cache file and returns its contents. - * @param cacheFile the cache file - * @return the font cache deserialized from the file (or null if no cache file exists or if - * it could not be read) + * + * @param cacheFile + * the cache file + * @return the font cache deserialized from the file (or null if no cache + * file exists or if it could not be read) */ public static FontCache loadFrom(File cacheFile) { if (cacheFile.exists()) { try { if (log.isTraceEnabled()) { - log.trace("Loading font cache from " + cacheFile.getCanonicalPath()); + log.trace("Loading font cache from " + + cacheFile.getCanonicalPath()); } - InputStream in = new java.io.FileInputStream(cacheFile); - in = new java.io.BufferedInputStream(in); + InputStream in = new BufferedInputStream(new FileInputStream(cacheFile)); ObjectInputStream oin = new ObjectInputStream(in); try { - return (FontCache)oin.readObject(); + return (FontCache) oin.readObject(); } finally { IOUtils.closeQuietly(oin); } } catch (ClassNotFoundException e) { - //We don't really care about the exception since it's just a cache file + // We don't really care about the exception since it's just a + // cache file log.warn("Could not read font cache. Discarding font cache file. Reason: " + e.getMessage()); } catch (IOException ioe) { - //We don't really care about the exception since it's just a cache file - log.warn("I/O exception while reading font cache (" + ioe.getMessage() - + "). Discarding font cache file."); + // We don't really care about the exception since it's just a + // cache file + log.warn("I/O exception while reading font cache (" + + ioe.getMessage() + "). Discarding font cache file."); try { cacheFile.delete(); } catch (SecurityException ex) { - log.warn("Failed to delete font cache file: " + cacheFile.getAbsolutePath()); + log.warn("Failed to delete font cache file: " + + cacheFile.getAbsolutePath()); } } } @@ -172,7 +186,9 @@ public final class FontCache implements Serializable { /** * Writes the font cache to disk. - * @throws FOPException fop exception + * + * @throws FOPException + * fop exception */ public void save() throws FOPException { saveTo(getDefaultCacheFile(true)); @@ -180,16 +196,17 @@ public final class FontCache implements Serializable { /** * Writes the font cache to disk. - * @param cacheFile the file to write to - * @throws FOPException fop exception + * + * @param cacheFile + * the file to write to + * @throws FOPException + * fop exception */ public void saveTo(File cacheFile) throws FOPException { synchronized (changeLock) { if (changed) { try { - if (log.isTraceEnabled()) { - log.trace("Writing font cache to " + cacheFile.getCanonicalPath()); - } + log.trace("Writing font cache to " + cacheFile.getCanonicalPath()); OutputStream out = new java.io.FileOutputStream(cacheFile); out = new java.io.BufferedOutputStream(out); ObjectOutputStream oout = new ObjectOutputStream(out); @@ -209,7 +226,9 @@ public final class FontCache implements Serializable { /** * creates a key given a font info for the font mapping - * @param fontInfo font info + * + * @param fontInfo + * font info * @return font cache key */ protected static String getCacheKey(EmbedFontInfo fontInfo) { @@ -223,6 +242,7 @@ public final class FontCache implements Serializable { /** * cache has been updated since it was read + * * @return if this cache has changed */ public boolean hasChanged() { @@ -231,28 +251,33 @@ public final class FontCache implements Serializable { /** * is this font in the cache? - * @param embedUrl font info + * + * @param embedUrl + * font info * @return boolean */ public boolean containsFont(String embedUrl) { - return (embedUrl != null - && getFontFileMap().containsKey(embedUrl)); + return (embedUrl != null && getFontFileMap().containsKey(embedUrl)); } /** * is this font info in the cache? - * @param fontInfo font info + * + * @param fontInfo + * font info * @return font */ public boolean containsFont(EmbedFontInfo fontInfo) { - return (fontInfo != null - && getFontFileMap().containsKey(getCacheKey(fontInfo))); + return (fontInfo != null && getFontFileMap().containsKey( + getCacheKey(fontInfo))); } /** - * Tries to identify a File instance from an array of URLs. If there's no file URL in the - * array, the method returns null. - * @param urls array of possible font urls + * Tries to identify a File instance from an array of URLs. If there's no + * file URL in the array, the method returns null. + * + * @param urls + * array of possible font urls * @return file font file */ public static File getFileFromUrls(String[] urls) { @@ -279,31 +304,35 @@ public final class FontCache implements Serializable { return null; } - private Map/*<String, CachedFontFile>*/ getFontFileMap() { + private Map/* <String, CachedFontFile> */getFontFileMap() { if (fontfileMap == null) { - fontfileMap = new java.util.HashMap/*<String, CachedFontFile>*/(); + fontfileMap = new java.util.HashMap/* <String, CachedFontFile> */(); } return fontfileMap; } /** * Adds a font info to cache - * @param fontInfo font info + * + * @param fontInfo + * font info */ public void addFont(EmbedFontInfo fontInfo) { String cacheKey = getCacheKey(fontInfo); synchronized (changeLock) { CachedFontFile cachedFontFile; if (containsFont(cacheKey)) { - cachedFontFile = (CachedFontFile)getFontFileMap().get(cacheKey); + cachedFontFile = (CachedFontFile) getFontFileMap() + .get(cacheKey); if (!cachedFontFile.containsFont(fontInfo)) { cachedFontFile.put(fontInfo); } } else { // try and determine modified date - File fontFile = getFileFromUrls(new String[] - {fontInfo.getEmbedFile(), fontInfo.getMetricsFile()}); - long lastModified = (fontFile != null ? fontFile.lastModified() : -1); + File fontFile = getFileFromUrls(new String[] { + fontInfo.getEmbedFile(), fontInfo.getMetricsFile() }); + long lastModified = (fontFile != null ? fontFile.lastModified() + : -1); cachedFontFile = new CachedFontFile(lastModified); if (log.isTraceEnabled()) { log.trace("Font added to cache: " + cacheKey); @@ -317,19 +346,27 @@ public final class FontCache implements Serializable { /** * Returns a font from the cache. - * @param embedUrl font info + * + * @param embedUrl + * font info * @return CachedFontFile object */ public CachedFontFile getFontFile(String embedUrl) { - return containsFont(embedUrl) ? (CachedFontFile) getFontFileMap().get(embedUrl) : null; + return containsFont(embedUrl) ? (CachedFontFile) getFontFileMap().get( + embedUrl) : null; } /** - * Returns the EmbedFontInfo instances belonging to a font file. If the font file was - * modified since it was cached the entry is removed and null is returned. - * @param embedUrl the font URL - * @param lastModified the last modified date/time of the font file - * @return the EmbedFontInfo instances or null if there's no cached entry or if it is outdated + * Returns the EmbedFontInfo instances belonging to a font file. If the font + * file was modified since it was cached the entry is removed and null is + * returned. + * + * @param embedUrl + * the font URL + * @param lastModified + * the last modified date/time of the font file + * @return the EmbedFontInfo instances or null if there's no cached entry or + * if it is outdated */ public EmbedFontInfo[] getFontInfos(String embedUrl, long lastModified) { CachedFontFile cff = getFontFile(embedUrl); @@ -343,7 +380,9 @@ public final class FontCache implements Serializable { /** * removes font from cache - * @param embedUrl embed url + * + * @param embedUrl + * embed url */ public void removeFont(String embedUrl) { synchronized (changeLock) { @@ -359,14 +398,18 @@ public final class FontCache implements Serializable { /** * has this font previously failed to load? - * @param embedUrl embed url - * @param lastModified last modified + * + * @param embedUrl + * embed url + * @param lastModified + * last modified * @return whether this is a failed font */ public boolean isFailedFont(String embedUrl, long lastModified) { synchronized (changeLock) { if (getFailedFontMap().containsKey(embedUrl)) { - long failedLastModified = ((Long)getFailedFontMap().get(embedUrl)).longValue(); + long failedLastModified = ((Long) getFailedFontMap().get( + embedUrl)).longValue(); if (lastModified != failedLastModified) { // this font has been changed so lets remove it // from failed font map for now @@ -382,8 +425,11 @@ public final class FontCache implements Serializable { /** * Registers a failed font with the cache - * @param embedUrl embed url - * @param lastModified time last modified + * + * @param embedUrl + * embed url + * @param lastModified + * time last modified */ public void registerFailedFont(String embedUrl, long lastModified) { synchronized (changeLock) { @@ -394,9 +440,9 @@ public final class FontCache implements Serializable { } } - private Map/*<String, Long>*/ getFailedFontMap() { + private Map/* <String, Long> */getFailedFontMap() { if (failedFontMap == null) { - failedFontMap = new java.util.HashMap/*<String, Long>*/(); + failedFontMap = new java.util.HashMap/* <String, Long> */(); } return failedFontMap; } @@ -417,7 +463,9 @@ public final class FontCache implements Serializable { /** * Retrieve the last modified date/time of a URL. - * @param url the URL + * + * @param url + * the URL * @return the last modified date/time */ public static long getLastModified(URL url) { @@ -426,7 +474,8 @@ public final class FontCache implements Serializable { try { return conn.getLastModified(); } finally { - //An InputStream is created even if it's not accessed, but we need to close it. + // An InputStream is created even if it's not accessed, but we + // need to close it. IOUtils.closeQuietly(conn.getInputStream()); } } catch (IOException e) { @@ -442,15 +491,15 @@ public final class FontCache implements Serializable { /** file modify date (if available) */ private long lastModified = -1; - private Map/*<String, EmbedFontInfo>*/ filefontsMap = null; + private Map/* <String, EmbedFontInfo> */filefontsMap = null; public CachedFontFile(long lastModified) { setLastModified(lastModified); } - private Map/*<String, EmbedFontInfo>*/ getFileFontsMap() { + private Map/* <String, EmbedFontInfo> */getFileFontsMap() { if (filefontsMap == null) { - filefontsMap = new java.util.HashMap/*<String, EmbedFontInfo>*/(); + filefontsMap = new java.util.HashMap/* <String, EmbedFontInfo> */(); } return filefontsMap; } @@ -465,12 +514,13 @@ public final class FontCache implements Serializable { } public EmbedFontInfo[] getEmbedFontInfos() { - return (EmbedFontInfo[])getFileFontsMap().values().toArray( + return (EmbedFontInfo[]) getFileFontsMap().values().toArray( new EmbedFontInfo[getFileFontsMap().size()]); } /** * Gets the modified timestamp for font file (not always available) + * * @return modified timestamp */ public long lastModified() { @@ -478,17 +528,18 @@ public final class FontCache implements Serializable { } /** - * Gets the modified timestamp for font file - * (used for the purposes of font info caching) - * @param lastModified modified font file timestamp + * Gets the modified timestamp for font file (used for the purposes of + * font info caching) + * + * @param lastModified + * modified font file timestamp */ public void setLastModified(long lastModified) { this.lastModified = lastModified; } /** - * @return string representation of this object - * {@inheritDoc} + * @return string representation of this object {@inheritDoc} */ public String toString() { return super.toString() + ", lastModified=" + lastModified; diff --git a/src/java/org/apache/fop/fonts/FontInfoConfigurator.java b/src/java/org/apache/fop/fonts/FontInfoConfigurator.java index e0d52ad43..f8399b110 100644 --- a/src/java/org/apache/fop/fonts/FontInfoConfigurator.java +++ b/src/java/org/apache/fop/fonts/FontInfoConfigurator.java @@ -75,8 +75,8 @@ public class FontInfoConfigurator { * @throws FOPException if an exception occurs while processing the configuration */ public void configure(List/*<EmbedFontInfo>*/ fontInfoList) throws FOPException { - Configuration fonts = cfg.getChild("fonts", false); - if (fonts != null) { + Configuration fontsCfg = cfg.getChild("fonts", false); + if (fontsCfg != null) { long start = 0; if (log.isDebugEnabled()) { log.debug("Starting font configuration..."); @@ -86,24 +86,23 @@ public class FontInfoConfigurator { FontAdder fontAdder = new FontAdder(fontManager, fontResolver, listener); // native o/s search (autodetect) configuration - boolean autodetectFonts = (fonts.getChild("auto-detect", false) != null); + boolean autodetectFonts = (fontsCfg.getChild("auto-detect", false) != null); if (autodetectFonts) { FontDetector fontDetector = new FontDetector(fontManager, fontAdder, strict); fontDetector.detect(fontInfoList); } - // Add configured directories to FontInfo - addDirectories(fonts, fontAdder, fontInfoList); + // Add configured directories to FontInfo list + addDirectories(fontsCfg, fontAdder, fontInfoList); - // Add configured fonts to FontInfo - FontCache fontCache = fontManager.getFontCache(); - addFonts(fonts, fontCache, fontInfoList); + // Add fonts from configuration to FontInfo list + addFonts(fontsCfg, fontManager.getFontCache(), fontInfoList); // Update referenced fonts (fonts which are not to be embedded) fontManager.updateReferencedFonts(fontInfoList); // Renderer-specific referenced fonts - Configuration referencedFontsCfg = fonts.getChild("referenced-fonts", false); + Configuration referencedFontsCfg = fontsCfg.getChild("referenced-fonts", false); if (referencedFontsCfg != null) { FontTriplet.Matcher matcher = FontManagerConfigurator.createFontsMatcher( referencedFontsCfg, strict); @@ -111,9 +110,7 @@ public class FontInfoConfigurator { } // Update font cache if it has changed - if (fontCache != null && fontCache.hasChanged()) { - fontCache.save(); - } + fontManager.saveCache(); if (log.isDebugEnabled()) { log.debug("Finished font configuration in " diff --git a/src/java/org/apache/fop/fonts/FontManager.java b/src/java/org/apache/fop/fonts/FontManager.java index cfce0fd69..519dab6d5 100644 --- a/src/java/org/apache/fop/fonts/FontManager.java +++ b/src/java/org/apache/fop/fonts/FontManager.java @@ -19,6 +19,7 @@ package org.apache.fop.fonts; +import java.io.File; import java.net.MalformedURLException; import java.util.Iterator; import java.util.List; @@ -26,12 +27,12 @@ import java.util.List; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; +import org.apache.fop.apps.FOPException; import org.apache.fop.fonts.FontTriplet.Matcher; import org.apache.fop.fonts.substitute.FontSubstitutions; // TODO: Refactor fonts package so major font activities (autodetection etc) -// are all centrally managed and delegated from this class, also remove dependency on FopFactory -// and start using POJO config/properties type classes +// are all centrally managed and delegated from this class /** * The manager of fonts. The class holds a reference to the font cache and information about @@ -56,11 +57,16 @@ public class FontManager { /** FontTriplet matcher for fonts that shall be referenced rather than embedded. */ private FontTriplet.Matcher referencedFontsMatcher; + /** Enables/disables the use of font caching */ + private boolean useCache = DEFAULT_USE_CACHE; + + /** Provides a font cache file path **/ + private File cacheFile; + /** * Main constructor */ public FontManager() { - setUseCache(DEFAULT_USE_CACHE); } /** @@ -113,16 +119,31 @@ public class FontManager { } /** + * Sets the font cache file + * @param cacheFile the font cache file + */ + public void setCacheFile(File cacheFile) { + this.cacheFile = cacheFile; + } + + /** + * Returns the font cache file + * @return the font cache file + */ + public File getCacheFile() { + if (cacheFile != null) { + return this.cacheFile; + } + return FontCache.getDefaultCacheFile(false); + } + + /** * Whether or not to cache results of font triplet detection/auto-config * @param useCache use cache or not */ public void setUseCache(boolean useCache) { - if (useCache) { - this.fontCache = FontCache.load(); - if (this.fontCache == null) { - this.fontCache = new FontCache(); - } - } else { + this.useCache = useCache; + if (!useCache) { this.fontCache = null; } } @@ -132,7 +153,7 @@ public class FontManager { * @return true if this font manager uses the cache */ public boolean useCache() { - return (this.fontCache != null); + return useCache; } /** @@ -140,7 +161,52 @@ public class FontManager { * @return the font cache */ public FontCache getFontCache() { - return this.fontCache; + if (fontCache == null) { + if (useCache) { + if (cacheFile != null) { + fontCache = FontCache.loadFrom(cacheFile); + } else { + fontCache = FontCache.load(); + } + if (fontCache == null) { + fontCache = new FontCache(); + } + } + } + return fontCache; + } + + /** + * Saves the FontCache as necessary + * + * @throws FOPException fop exception + */ + public void saveCache() throws FOPException { + if (useCache) { + if (fontCache != null && fontCache.hasChanged()) { + if (cacheFile != null) { + fontCache.saveTo(cacheFile); + } else { + fontCache.save(); + } + } + } + } + + /** + * Deletes the current FontCache file + * @return Returns true if the font cache file was successfully deleted. + */ + public boolean deleteCache() { + boolean deleted = false; + if (useCache) { + if (cacheFile != null) { + deleted = cacheFile.delete(); + } else { + deleted = FontCache.getDefaultCacheFile(true).delete(); + } + } + return deleted; } /** diff --git a/src/java/org/apache/fop/fonts/FontManagerConfigurator.java b/src/java/org/apache/fop/fonts/FontManagerConfigurator.java index 68dd869f5..7792b118d 100644 --- a/src/java/org/apache/fop/fonts/FontManagerConfigurator.java +++ b/src/java/org/apache/fop/fonts/FontManagerConfigurator.java @@ -19,6 +19,7 @@ package org.apache.fop.fonts; +import java.io.File; import java.net.MalformedURLException; import java.util.List; import java.util.regex.Pattern; @@ -58,20 +59,24 @@ public class FontManagerConfigurator { * @throws FOPException if an exception occurs while processing the configuration */ public void configure(FontManager fontManager, boolean strict) throws FOPException { - // caching (fonts) if (cfg.getChild("use-cache", false) != null) { try { - fontManager.setUseCache( - cfg.getChild("use-cache").getValueAsBoolean()); - } catch (ConfigurationException mfue) { - LogUtil.handleException(log, mfue, true); + fontManager.setUseCache(cfg.getChild("use-cache").getValueAsBoolean()); + } catch (ConfigurationException e) { + LogUtil.handleException(log, e, true); + } + } + if (cfg.getChild("cache-file", false) != null) { + try { + fontManager.setCacheFile(new File(cfg.getChild("cache-file").getValue())); + } catch (ConfigurationException e) { + LogUtil.handleException(log, e, true); } } if (cfg.getChild("font-base", false) != null) { try { - fontManager.setFontBaseURL( - cfg.getChild("font-base").getValue(null)); + fontManager.setFontBaseURL(cfg.getChild("font-base").getValue(null)); } catch (MalformedURLException mfue) { LogUtil.handleException(log, mfue, true); } @@ -80,13 +85,12 @@ public class FontManagerConfigurator { // global font configuration Configuration fontsCfg = cfg.getChild("fonts", false); if (fontsCfg != null) { + // font substitution Configuration substitutionsCfg = fontsCfg.getChild("substitutions", false); if (substitutionsCfg != null) { - FontSubstitutionsConfigurator fontSubstitutionsConfigurator - = new FontSubstitutionsConfigurator(substitutionsCfg); FontSubstitutions substitutions = new FontSubstitutions(); - fontSubstitutionsConfigurator.configure(substitutions); + new FontSubstitutionsConfigurator(substitutionsCfg).configure(substitutions); fontManager.setFontSubstitutions(substitutions); } diff --git a/src/java/org/apache/fop/fonts/FontSetup.java b/src/java/org/apache/fop/fonts/FontSetup.java index f7ad6fc65..1f49f7bb5 100644 --- a/src/java/org/apache/fop/fonts/FontSetup.java +++ b/src/java/org/apache/fop/fonts/FontSetup.java @@ -25,8 +25,6 @@ import java.util.List; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.fop.fonts.base14.Courier; import org.apache.fop.fonts.base14.CourierBold; import org.apache.fop.fonts.base14.CourierBoldOblique; @@ -51,12 +49,10 @@ import org.apache.fop.fonts.base14.ZapfDingbats; * Assigns the font (with metrics) to internal names like "F1" and * assigns family-style-weight triplets to the fonts */ -public class FontSetup { +public final class FontSetup { - /** - * logging instance - */ - protected static Log log = LogFactory.getLog(FontSetup.class); + private FontSetup() { + } /** * Sets up a font info diff --git a/src/java/org/apache/fop/fonts/FontType.java b/src/java/org/apache/fop/fonts/FontType.java index e19901d1e..06bbf1bc1 100644 --- a/src/java/org/apache/fop/fonts/FontType.java +++ b/src/java/org/apache/fop/fonts/FontType.java @@ -54,6 +54,9 @@ public class FontType { /** + * Construct a font type. + * @param name a font type name + * @param value a font type value * @see org.apache.avalon.framework.Enum#Enum(String) */ protected FontType(String name, int value) { diff --git a/src/java/org/apache/fop/fonts/FontUtil.java b/src/java/org/apache/fop/fonts/FontUtil.java index 49f23c12f..b97e3a407 100644 --- a/src/java/org/apache/fop/fonts/FontUtil.java +++ b/src/java/org/apache/fop/fonts/FontUtil.java @@ -23,7 +23,10 @@ package org.apache.fop.fonts; /** * Font utilities. */ -public class FontUtil { +public final class FontUtil { + + private FontUtil() { + } /** * Parses an CSS2 (SVG and XSL-FO) font weight (normal, bold, 100-900) to diff --git a/src/java/org/apache/fop/fonts/Glyphs.java b/src/java/org/apache/fop/fonts/Glyphs.java index 4da95d575..dfc44675b 100644 --- a/src/java/org/apache/fop/fonts/Glyphs.java +++ b/src/java/org/apache/fop/fonts/Glyphs.java @@ -23,7 +23,10 @@ package org.apache.fop.fonts; * This class provides a number of constants for glyph management. * @deprecated Use the Glyphs class from XML Graphics Commons instead! */ -public class Glyphs { +public final class Glyphs { + + private Glyphs() { + } /** * Glyph name for the "notdef" glyph @@ -33,7 +36,7 @@ public class Glyphs { /** * Glyph names for Mac encoding */ - public static final String MAC_GLYPH_NAMES[] = { + public static final String[] MAC_GLYPH_NAMES = { /* 0x00 */ NOTDEF, ".null", "CR", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", @@ -1273,7 +1276,7 @@ public class Glyphs { * @param ch glyph to evaluate * @return the name of the glyph */ - public static final String charToGlyphName(char ch) { + public static String charToGlyphName(char ch) { return stringToGlyph(new Character(ch).toString()); } @@ -1286,7 +1289,7 @@ public class Glyphs { * TODO: javadocs for glyphToString and stringToGlyph are confused * TODO: Improve method names */ - public static final String glyphToString(String name) { + public static String glyphToString(String name) { for (int i = 0; i < UNICODE_GLYPHS.length; i += 2) { if (UNICODE_GLYPHS[i + 1].equals(name)) { return UNICODE_GLYPHS[i]; diff --git a/src/java/org/apache/fop/fonts/MultiByteFont.java b/src/java/org/apache/fop/fonts/MultiByteFont.java index 1e6bd4f84..b3b5d8639 100644 --- a/src/java/org/apache/fop/fonts/MultiByteFont.java +++ b/src/java/org/apache/fop/fonts/MultiByteFont.java @@ -241,7 +241,7 @@ public class MultiByteFont extends CIDFont { return subset.getSubsetGlyphs(); } - /** {@inheritDoc} */ + /** @return an array of the chars used */ public char[] getCharsUsed() { if (!isEmbeddable()) { return null; diff --git a/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java b/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java index e2858e2f7..9f0fa9fd6 100644 --- a/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java +++ b/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java @@ -70,7 +70,7 @@ public class FontInfoFinder { * It seems to be fairly accurate but will probably require some tweaking over time * * @param customFont CustomFont - * @param triplet Collection that will take the generated triplets + * @param triplets Collection that will take the generated triplets */ private void generateTripletsFromFont(CustomFont customFont, Collection triplets) { if (log.isTraceEnabled()) { @@ -138,7 +138,7 @@ public class FontInfoFinder { * @param fontUrl the font URL * @param customFont the custom font * @param fontCache font cache (may be null) - * @return + * @return FontInfo from the given custom font */ private EmbedFontInfo getFontInfoFromCustomFont( URL fontUrl, CustomFont customFont, FontCache fontCache) { diff --git a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java index d12b19654..a6db7b6d0 100644 --- a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java +++ b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java @@ -317,6 +317,7 @@ public class FontFileReader { * Read an ISO-8859-1 string of len bytes. * * @param len The length of the string to read + * @param encodingID the string encoding id (presently ignored; always uses UTF-16BE) * @return A String * @throws IOException If EOF is reached */ diff --git a/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java b/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java index 171f71a76..897d5e2de 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java @@ -44,6 +44,17 @@ public class TTFCmapEntry { /** * {@inheritDoc} */ + public int hashCode() { + int hc = super.hashCode(); + hc ^= ( hc * 11 ) + unicodeStart; + hc ^= ( hc * 19 ) + unicodeEnd; + hc ^= ( hc * 23 ) + glyphStartIndex; + return hc; + } + + /** + * {@inheritDoc} + */ public boolean equals(Object o) { if (o instanceof TTFCmapEntry) { TTFCmapEntry ce = (TTFCmapEntry)o; diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/java/org/apache/fop/fonts/truetype/TTFFile.java index a1b6319ed..7ad51c676 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFFile.java @@ -245,7 +245,8 @@ public class TTFFile { } } - private boolean readUnicodeCmap(FontFileReader in, long cmapUniOffset, int encodingID) + private boolean readUnicodeCmap // CSOK: MethodLength + (FontFileReader in, long cmapUniOffset, int encodingID) throws IOException { //Read CMAP table and correct mtxTab.index int mtxPtr = 0; @@ -961,7 +962,7 @@ public class TTFFile { * Read the "post" table * containing the PostScript names of the glyphs. */ - private final void readPostScript(FontFileReader in) throws IOException { + private void readPostScript(FontFileReader in) throws IOException { seekTab(in, "post", 0); postFormat = in.readTTFLong(); italicAngle = in.readTTFULong(); @@ -1133,7 +1134,7 @@ public class TTFFile { * @param in FontFileReader to read from * @throws IOException In case of a I/O problem */ - private final void readGlyf(FontFileReader in) throws IOException { + private void readGlyf(FontFileReader in) throws IOException { TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("glyf"); if (dirTab == null) { throw new IOException("glyf table not found, cannot continue"); @@ -1188,7 +1189,7 @@ public class TTFFile { * @param in FontFileReader to read from * @throws IOException In case of a I/O problem */ - private final void readName(FontFileReader in) throws IOException { + private void readName(FontFileReader in) throws IOException { seekTab(in, "name", 2); int i = in.getCurrentPos(); int n = in.readTTFUShort(); @@ -1259,7 +1260,7 @@ public class TTFFile { * @param in FontFileReader to read from * @throws IOException In case of a I/O problem */ - private final boolean readPCLT(FontFileReader in) throws IOException { + private boolean readPCLT(FontFileReader in) throws IOException { TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("PCLT"); if (dirTab != null) { in.seekSet(dirTab.getOffset() + 4 + 4 + 2); @@ -1403,7 +1404,7 @@ public class TTFFile { * @param in FontFileReader to read from * @throws IOException In case of a I/O problem */ - private final void readKerning(FontFileReader in) throws IOException { + private void readKerning(FontFileReader in) throws IOException { // Read kerning kerningTab = new java.util.HashMap(); ansiKerningTab = new java.util.HashMap(); diff --git a/src/java/org/apache/fop/fonts/type1/PFBParser.java b/src/java/org/apache/fop/fonts/type1/PFBParser.java index bd12c2c77..8cb90b146 100644 --- a/src/java/org/apache/fop/fonts/type1/PFBParser.java +++ b/src/java/org/apache/fop/fonts/type1/PFBParser.java @@ -161,7 +161,7 @@ public class PFBParser { } - private static final boolean byteCmp(byte[] src, int srcOffset, byte[] cmp) { + private static boolean byteCmp(byte[] src, int srcOffset, byte[] cmp) { for (int i = 0; i < cmp.length; i++) { // System.out.println("Compare: " + src[srcOffset + i] + " " + cmp[i]); if (src[srcOffset + i] != cmp[i]) { diff --git a/src/java/org/apache/fop/hyphenation/ByteVector.java b/src/java/org/apache/fop/hyphenation/ByteVector.java index 5a81a51ec..920089684 100644 --- a/src/java/org/apache/fop/hyphenation/ByteVector.java +++ b/src/java/org/apache/fop/hyphenation/ByteVector.java @@ -45,10 +45,17 @@ public class ByteVector implements Serializable { */ private int n; + /** + * Construct byte vector instance with default block size. + */ public ByteVector() { this(DEFAULT_BLOCK_SIZE); } + /** + * Construct byte vector instance. + * @param capacity initial block size + */ public ByteVector(int capacity) { if (capacity > 0) { blockSize = capacity; @@ -59,12 +66,25 @@ public class ByteVector implements Serializable { n = 0; } + /** + * Construct byte vector instance. + * @param a byte array to use + * @asf.todo should n should be initialized to a.length to be consistent with + * CharVector behavior? [GA] + */ public ByteVector(byte[] a) { blockSize = DEFAULT_BLOCK_SIZE; array = a; n = 0; } + /** + * Construct byte vector instance. + * @param a byte array to use + * @param capacity initial block size + * @asf.todo should n should be initialized to a.length to be consistent with + * CharVector behavior? [GA] + */ public ByteVector(byte[] a, int capacity) { if (capacity > 0) { blockSize = capacity; @@ -75,34 +95,52 @@ public class ByteVector implements Serializable { n = 0; } + /** + * Obtain byte vector array. + * @return byte array + */ public byte[] getArray() { return array; } /** - * return number of items in array + * Obtain number of items in array. + * @return number of items */ public int length() { return n; } /** - * returns current capacity of array + * Obtain capacity of array. + * @return current capacity of array */ public int capacity() { return array.length; } + /** + * Pet byte at index. + * @param index the index + * @param val a byte + */ public void put(int index, byte val) { array[index] = val; } + /** + * Get byte at index. + * @param index the index + * @return a byte + */ public byte get(int index) { return array[index]; } /** * This is to implement memory allocation in the array. Like malloc(). + * @param size to allocate + * @return previous length */ public int alloc(int size) { int index = n; @@ -116,6 +154,9 @@ public class ByteVector implements Serializable { return index; } + /** + * Trim byte vector to current length. + */ public void trimToSize() { if (n < array.length) { byte[] aux = new byte[n]; diff --git a/src/java/org/apache/fop/hyphenation/CharVector.java b/src/java/org/apache/fop/hyphenation/CharVector.java index ad8280f12..0ba42362b 100644 --- a/src/java/org/apache/fop/hyphenation/CharVector.java +++ b/src/java/org/apache/fop/hyphenation/CharVector.java @@ -45,10 +45,17 @@ public class CharVector implements Cloneable, Serializable { */ private int n; + /** + * Construct char vector instance with default block size. + */ public CharVector() { this(DEFAULT_BLOCK_SIZE); } + /** + * Construct char vector instance. + * @param capacity initial block size + */ public CharVector(int capacity) { if (capacity > 0) { blockSize = capacity; @@ -59,12 +66,21 @@ public class CharVector implements Cloneable, Serializable { n = 0; } + /** + * Construct char vector instance. + * @param a char array to use + */ public CharVector(char[] a) { blockSize = DEFAULT_BLOCK_SIZE; array = a; n = a.length; } + /** + * Construct char vector instance. + * @param a char array to use + * @param capacity initial block size + */ public CharVector(char[] a, int capacity) { if (capacity > 0) { blockSize = capacity; @@ -76,44 +92,66 @@ public class CharVector implements Cloneable, Serializable { } /** - * Reset Vector but don't resize or clear elements + * Reset length of vector, but don't clear contents. */ public void clear() { n = 0; } + /** {@inheritDoc} */ public Object clone() { CharVector cv = new CharVector((char[])array.clone(), blockSize); cv.n = this.n; return cv; } + /** + * Obtain char vector array. + * @return char array + */ public char[] getArray() { return array; } /** - * return number of items in array + * Obtain number of items in array. + * @return number of items */ public int length() { return n; } /** - * returns current capacity of array + * Obtain capacity of array. + * @return current capacity of array */ public int capacity() { return array.length; } + /** + * Pet char at index. + * @param index the index + * @param val a char + */ public void put(int index, char val) { array[index] = val; } + /** + * Get char at index. + * @param index the index + * @return a char + */ public char get(int index) { return array[index]; } + /** + * This is to implement memory allocation in the array. Like malloc(). + * @param size to allocate + * @return previous length + */ public int alloc(int size) { int index = n; int len = array.length; @@ -126,6 +164,9 @@ public class CharVector implements Cloneable, Serializable { return index; } + /** + * Trim char vector to current length. + */ public void trimToSize() { if (n < array.length) { char[] aux = new char[n]; diff --git a/src/java/org/apache/fop/hyphenation/Hyphen.java b/src/java/org/apache/fop/hyphenation/Hyphen.java index 268e3861d..ca876e1ec 100644 --- a/src/java/org/apache/fop/hyphenation/Hyphen.java +++ b/src/java/org/apache/fop/hyphenation/Hyphen.java @@ -34,23 +34,43 @@ import java.io.Serializable; * @author Carlos Villegas <cav@uniscope.co.jp> */ +/** + * Represents a hyphen. + */ public class Hyphen implements Serializable { - public String preBreak; - public String noBreak; - public String postBreak; + /** pre break string */ + public String preBreak; // CSOK: VisibilityModifier + + /** no break string */ + public String noBreak; // CSOK: VisibilityModifier + + /** post break string */ + public String postBreak; // CSOK: VisibilityModifier + + /** + * Construct a hyphen. + * @param pre break string + * @param no break string + * @param post break string + */ Hyphen(String pre, String no, String post) { preBreak = pre; noBreak = no; postBreak = post; } + /** + * Construct a hyphen. + * @param pre break string + */ Hyphen(String pre) { preBreak = pre; noBreak = null; postBreak = null; } + /** {@inheritDoc} */ public String toString() { if (noBreak == null && postBreak == null diff --git a/src/java/org/apache/fop/hyphenation/Hyphenation.java b/src/java/org/apache/fop/hyphenation/Hyphenation.java index fe4d6ba0c..b1e2f1cde 100644 --- a/src/java/org/apache/fop/hyphenation/Hyphenation.java +++ b/src/java/org/apache/fop/hyphenation/Hyphenation.java @@ -52,6 +52,7 @@ public class Hyphenation { } /** + * @param index an index position * @return the pre-break text, not including the hyphen character */ public String getPreHyphenText(int index) { @@ -59,6 +60,7 @@ public class Hyphenation { } /** + * @param index an index position * @return the post-break text */ public String getPostHyphenText(int index) { @@ -72,6 +74,7 @@ public class Hyphenation { return hyphenPoints; } + /** {@inheritDoc} */ public String toString() { StringBuffer str = new StringBuffer(); int start = 0; diff --git a/src/java/org/apache/fop/hyphenation/HyphenationException.java b/src/java/org/apache/fop/hyphenation/HyphenationException.java index 0a4e737c6..e109cadf9 100644 --- a/src/java/org/apache/fop/hyphenation/HyphenationException.java +++ b/src/java/org/apache/fop/hyphenation/HyphenationException.java @@ -20,12 +20,15 @@ package org.apache.fop.hyphenation; /** + * An hyphenation exception. * @author Carlos Villegas <cav@uniscope.co.jp> - * (todo) Derive from FOPException + * @asf.todo Derive from FOPException */ public class HyphenationException extends Exception { /** + * Construct a hyphenation exception. + * @param msg a message string * @see java.lang.Throwable#Throwable(String) */ public HyphenationException(String msg) { diff --git a/src/java/org/apache/fop/hyphenation/HyphenationTree.java b/src/java/org/apache/fop/hyphenation/HyphenationTree.java index 41d4cc63c..fa7d218d9 100644 --- a/src/java/org/apache/fop/hyphenation/HyphenationTree.java +++ b/src/java/org/apache/fop/hyphenation/HyphenationTree.java @@ -66,6 +66,7 @@ public class HyphenationTree extends TernaryTree */ private transient TernaryTree ivalues; + /** Default constructor. */ public HyphenationTree() { stoplist = new HashMap(23); // usually a small table classmap = new TernaryTree(); @@ -100,6 +101,11 @@ public class HyphenationTree extends TernaryTree return offset; } + /** + * Unpack values. + * @param k an integer + * @return a string + */ protected String unpackValues(int k) { StringBuffer buf = new StringBuffer(); byte v = vspace.get(k++); @@ -154,6 +160,11 @@ public class HyphenationTree extends TernaryTree ivalues = null; } + /** + * Find pattern. + * @param pat a pattern + * @return a string + */ public String findPattern(String pat) { int k = super.find(pat); if (k >= 0) { @@ -164,7 +175,12 @@ public class HyphenationTree extends TernaryTree /** * String compare, returns 0 if equal or - * t is a substring of s + * t is a substring of s. + * @param s first character array + * @param si starting index into first array + * @param t second character array + * @param ti starting index into second array + * @return an integer */ protected int hstrcmp(char[] s, int si, char[] t, int ti) { for (; s[si] == t[ti]; si++, ti++) { @@ -178,6 +194,11 @@ public class HyphenationTree extends TernaryTree return s[si] - t[ti]; } + /** + * Get values. + * @param k an integer + * @return a byte array + */ protected byte[] getValues(int k) { StringBuffer buf = new StringBuffer(); byte v = vspace.get(k++); @@ -352,12 +373,12 @@ public class HyphenationTree extends TernaryTree if (nc < 0) { // found a non-letter character ... if (i == (1 + iIgnoreAtBeginning)) { // ... before any letter character - iIgnoreAtBeginning ++; + iIgnoreAtBeginning++; } else { // ... after a letter character bEndOfLetters = true; } - iLength --; + iLength--; } else { if (!bEndOfLetters) { word[i - iIgnoreAtBeginning] = (char)nc; @@ -435,6 +456,7 @@ public class HyphenationTree extends TernaryTree * files use only lower case characters, in this case a class * for letter 'a', for example, should be defined as "aA", the first * character being the normalization char. + * @param chargroup a character class (group) */ public void addClass(String chargroup) { if (chargroup.length() > 0) { @@ -479,6 +501,9 @@ public class HyphenationTree extends TernaryTree insert(pattern, (char)k); } + /** + * Print statistics. + */ public void printStats() { System.out.println("Value space size = " + Integer.toString(vspace.length())); @@ -486,11 +511,16 @@ public class HyphenationTree extends TernaryTree } + /** + * Main entry point for this hyphenation utility application. + * @param argv array of command linee arguments + * @throws Exception in case an exception is raised but not caught + */ public static void main(String[] argv) throws Exception { HyphenationTree ht = null; int minCharCount = 2; - BufferedReader in = - new BufferedReader(new java.io.InputStreamReader(System.in)); + BufferedReader in + = new BufferedReader(new java.io.InputStreamReader(System.in)); while (true) { System.out.print("l:\tload patterns from XML\n" + "L:\tload patterns from serialized object\n" @@ -572,8 +602,8 @@ public class HyphenationTree extends TernaryTree long starttime = 0; int counter = 0; try { - BufferedReader reader = - new BufferedReader(new FileReader(token)); + BufferedReader reader + = new BufferedReader(new FileReader(token)); String line; starttime = System.currentTimeMillis(); diff --git a/src/java/org/apache/fop/hyphenation/Hyphenator.java b/src/java/org/apache/fop/hyphenation/Hyphenator.java index 401cc6e3b..230f2ae20 100644 --- a/src/java/org/apache/fop/hyphenation/Hyphenator.java +++ b/src/java/org/apache/fop/hyphenation/Hyphenator.java @@ -259,7 +259,8 @@ public class Hyphenator { if (source.getSystemId() != null) { in = new java.net.URL(source.getSystemId()).openStream(); } else { - throw new UnsupportedOperationException("Cannot load hyphenation pattern file" + throw new UnsupportedOperationException + ("Cannot load hyphenation pattern file" + " with the supplied Source object: " + source); } } @@ -377,7 +378,8 @@ public class Hyphenator { * @param rightMin the minimum number of characters after the hyphenation point * @return the hyphenation result */ - public static Hyphenation hyphenate(String lang, String country, + public static Hyphenation hyphenate(String lang, // CSOK: ParameterNumber + String country, HyphenationTreeResolver resolver, char[] word, int offset, int len, int leftMin, int rightMin) { diff --git a/src/java/org/apache/fop/hyphenation/PatternConsumer.java b/src/java/org/apache/fop/hyphenation/PatternConsumer.java index 6263b5534..5fb80dcaa 100644 --- a/src/java/org/apache/fop/hyphenation/PatternConsumer.java +++ b/src/java/org/apache/fop/hyphenation/PatternConsumer.java @@ -44,6 +44,8 @@ public interface PatternConsumer { * fails or the user wants to provide his own hyphenation. * A hyphenatedword is a vector of alternating String's and * {@link Hyphen Hyphen} instances + * @param word word to add as an exception + * @param hyphenatedword pre-hyphenated word */ void addException(String word, ArrayList hyphenatedword); diff --git a/src/java/org/apache/fop/hyphenation/PatternParser.java b/src/java/org/apache/fop/hyphenation/PatternParser.java index b34ab7ec8..4c4edd78e 100644 --- a/src/java/org/apache/fop/hyphenation/PatternParser.java +++ b/src/java/org/apache/fop/hyphenation/PatternParser.java @@ -61,6 +61,10 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { static final int ELEM_PATTERNS = 3; static final int ELEM_HYPHEN = 4; + /** + * Construct a pattern parser. + * @throws HyphenationException if a hyphenation exception is raised + */ public PatternParser() throws HyphenationException { this.consumer = this; token = new StringBuffer(); @@ -70,6 +74,11 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { hyphenChar = '-'; // default } + /** + * Construct a pattern parser. + * @param consumer a pattern consumer + * @throws HyphenationException if a hyphenation exception is raised + */ public PatternParser(PatternConsumer consumer) throws HyphenationException { this(); this.consumer = consumer; @@ -130,7 +139,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { } } - protected String readToken(StringBuffer chars) { + private String readToken(StringBuffer chars) { String word; boolean space = false; int i; @@ -175,7 +184,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { return null; } - protected static String getPattern(String word) { + private static String getPattern(String word) { StringBuffer pat = new StringBuffer(); int len = word.length(); for (int i = 0; i < len; i++) { @@ -186,7 +195,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { return pat.toString(); } - protected ArrayList normalizeException(ArrayList ex) { + private ArrayList normalizeException(ArrayList ex) { ArrayList res = new ArrayList(); for (int i = 0; i < ex.size(); i++) { Object item = ex.get(i); @@ -217,7 +226,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { return res; } - protected String getExceptionWord(ArrayList ex) { + private String getExceptionWord(ArrayList ex) { StringBuffer res = new StringBuffer(); for (int i = 0; i < ex.size(); i++) { Object item = ex.get(i); @@ -232,7 +241,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { return res.toString(); } - protected static String getInterletterValues(String pat) { + private static String getInterletterValues(String pat) { StringBuffer il = new StringBuffer(); String word = pat + "a"; // add dummy letter to serve as sentinel int len = word.length(); @@ -248,6 +257,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { return il.toString(); } + /** @throws SAXException if not caught */ protected void getExternalClasses() throws SAXException { XMLReader mainParser = parser; parser = createParser(); @@ -328,6 +338,8 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { case ELEM_HYPHEN: // nothing to do break; + default: + break; } if (currElement != ELEM_HYPHEN) { token.setLength(0); @@ -347,7 +359,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { /** * {@inheritDoc} */ - public void characters(char ch[], int start, int length) { + public void characters(char[] ch, int start, int length) { StringBuffer chars = new StringBuffer(length); chars.append(ch, start, length); String word = readToken(chars); @@ -368,6 +380,8 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { consumer.addPattern(getPattern(word), getInterletterValues(word)); break; + default: + break; } word = readToken(chars); } @@ -426,15 +440,26 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { } // getLocationString(SAXParseException):String - // PatternConsumer implementation for testing purposes + /** + * For testing purposes only. + * {@inheritDoc} + */ public void addClass(String c) { testOut.println("class: " + c); } + /** + * For testing purposes only. + * {@inheritDoc} + */ public void addException(String w, ArrayList e) { testOut.println("exception: " + w + " : " + e.toString()); } + /** + * For testing purposes only. + * {@inheritDoc} + */ public void addPattern(String p, String v) { testOut.println("pattern: " + p + " : " + v); } @@ -442,17 +467,26 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { private PrintStream testOut = System.out; /** + * Set test out stream. * @param testOut the testOut to set */ public void setTestOut(PrintStream testOut) { this.testOut = testOut; } + /** + * Close test out file. + */ public void closeTestOut() { testOut.flush(); testOut.close(); } + /** + * Main entry point when used as an application. + * @param args array of command line arguments + * @throws Exception in case of uncaught exception + */ public static void main(String[] args) throws Exception { if (args.length > 0) { PatternParser pp = new PatternParser(); diff --git a/src/java/org/apache/fop/hyphenation/TernaryTree.java b/src/java/org/apache/fop/hyphenation/TernaryTree.java index 0824632a3..a3a823324 100644 --- a/src/java/org/apache/fop/hyphenation/TernaryTree.java +++ b/src/java/org/apache/fop/hyphenation/TernaryTree.java @@ -107,16 +107,22 @@ public class TernaryTree implements Cloneable, Serializable { */ protected CharVector kv; + /** root */ protected char root; + /** free node */ protected char freenode; - protected int length; // number of items in tree + /** number of items in tree */ + protected int length; - protected static final int BLOCK_SIZE = 2048; // allocation size for arrays + /** allocation size for arrays */ + protected static final int BLOCK_SIZE = 2048; + /** default constructor */ TernaryTree() { init(); } + /** initialize */ protected void init() { root = 0; freenode = 1; @@ -135,6 +141,8 @@ public class TernaryTree implements Cloneable, Serializable { * another key with same prefix * is inserted. This saves a lot of space, * specially for long keys. + * @param key the key + * @param val a value */ public void insert(String key, char val) { // make sure we have enough room in the arrays @@ -143,12 +151,18 @@ public class TernaryTree implements Cloneable, Serializable { if (freenode + len > eq.length) { redimNodeArrays(eq.length + BLOCK_SIZE); } - char strkey[] = new char[len--]; + char[] strkey = new char[len--]; key.getChars(0, len, strkey, 0); strkey[len] = 0; root = insert(root, strkey, 0, val); } + /** + * Insert key. + * @param key the key + * @param start offset into key array + * @param val a value + */ public void insert(char[] key, int start, char val) { int len = strlen(key) + 1; if (freenode + len > eq.length) { @@ -232,6 +246,11 @@ public class TernaryTree implements Cloneable, Serializable { /** * Compares 2 null terminated char arrays + * @param a a character array + * @param startA an index into character array + * @param b a character array + * @param startB an index into character array + * @return an integer */ public static int strcmp(char[] a, int startA, char[] b, int startB) { for (; a[startA] == b[startB]; startA++, startB++) { @@ -244,6 +263,10 @@ public class TernaryTree implements Cloneable, Serializable { /** * Compares a string with null terminated char array + * @param str a string + * @param a a character array + * @param start an index into character array + * @return an integer */ public static int strcmp(String str, char[] a, int start) { int i, d, len = str.length(); @@ -263,6 +286,12 @@ public class TernaryTree implements Cloneable, Serializable { } + /** + * @param dst a character array + * @param di an index into character array + * @param src a character array + * @param si an index into character array + */ public static void strcpy(char[] dst, int di, char[] src, int si) { while (src[si] != 0) { dst[di++] = src[si++]; @@ -270,6 +299,11 @@ public class TernaryTree implements Cloneable, Serializable { dst[di] = 0; } + /** + * @param a a character array + * @param start an index into character array + * @return an integer + */ public static int strlen(char[] a, int start) { int len = 0; for (int i = start; i < a.length && a[i] != 0; i++) { @@ -278,19 +312,34 @@ public class TernaryTree implements Cloneable, Serializable { return len; } + /** + * @param a a character array + * @return an integer + */ public static int strlen(char[] a) { return strlen(a, 0); } + /** + * Find key. + * @param key the key + * @return result + */ public int find(String key) { int len = key.length(); - char strkey[] = new char[len + 1]; + char[] strkey = new char[len + 1]; key.getChars(0, len, strkey, 0); strkey[len] = 0; return find(strkey, 0); } + /** + * Find key. + * @param key the key + * @param start offset into key array + * @return result + */ public int find(char[] key, int start) { int d; char p = root; @@ -322,6 +371,10 @@ public class TernaryTree implements Cloneable, Serializable { return -1; } + /** + * @param key a key + * @return trye if key present + */ public boolean knows(String key) { return (find(key) >= 0); } @@ -343,10 +396,12 @@ public class TernaryTree implements Cloneable, Serializable { sc = na; } + /** @return length */ public int size() { return length; } + /** {@inheritDoc} */ public Object clone() { TernaryTree t = new TernaryTree(); t.lo = (char[])this.lo.clone(); @@ -366,6 +421,10 @@ public class TernaryTree implements Cloneable, Serializable { * lower and upper halves, and so on in order to get a balanced * tree. The array of keys is assumed to be sorted in ascending * order. + * @param k array of keys + * @param v array of values + * @param offset where to insert + * @param n count to insert */ protected void insertBalanced(String[] k, char[] v, int offset, int n) { int m; @@ -453,37 +512,47 @@ public class TernaryTree implements Cloneable, Serializable { } } - + /** @return the keys */ public Enumeration keys() { return new Iterator(); } + /** an iterator */ public class Iterator implements Enumeration { /** * current node index */ - int cur; + int cur; // CSOK: VisibilityModifier /** * current key */ - String curkey; + String curkey; // CSOK: VisibilityModifier private class Item implements Cloneable { - char parent; - char child; + /** parent */ + char parent; // CSOK: VisibilityModifier + /** child */ + char child; // CSOK: VisibilityModifier + /** default constructor */ public Item() { parent = 0; child = 0; } + /** + * Construct item. + * @param p a char + * @param c a char + */ public Item(char p, char c) { parent = p; child = c; } + /** {@inheritDoc} */ public Object clone() { return new Item(parent, child); } @@ -493,13 +562,14 @@ public class TernaryTree implements Cloneable, Serializable { /** * Node stack */ - Stack ns; + Stack ns; // CSOK: VisibilityModifier /** * key stack implemented with a StringBuffer */ - StringBuffer ks; + StringBuffer ks; // CSOK: VisibilityModifier + /** default constructor */ public Iterator() { cur = -1; ns = new Stack(); @@ -507,6 +577,7 @@ public class TernaryTree implements Cloneable, Serializable { rewind(); } + /** rewind iterator */ public void rewind() { ns.removeAllElements(); ks.setLength(0); @@ -514,6 +585,7 @@ public class TernaryTree implements Cloneable, Serializable { run(); } + /** @return next element */ public Object nextElement() { String res = new String(curkey); cur = up(); @@ -521,6 +593,7 @@ public class TernaryTree implements Cloneable, Serializable { return res; } + /** @return value */ public char getValue() { if (cur >= 0) { return eq[cur]; @@ -528,6 +601,7 @@ public class TernaryTree implements Cloneable, Serializable { return 0; } + /** @return true if more elements */ public boolean hasMoreElements() { return (cur != -1); } @@ -633,6 +707,9 @@ public class TernaryTree implements Cloneable, Serializable { } + /** + * Print stats (for testing). + */ public void printStats() { System.out.println("Number of keys = " + Integer.toString(length)); System.out.println("Node count = " + Integer.toString(freenode)); @@ -653,6 +730,11 @@ public class TernaryTree implements Cloneable, Serializable { } + /** + * Main entry point for testing. + * @param args not used + * @throws Exception if not caught + */ public static void main(String[] args) throws Exception { TernaryTree tt = new TernaryTree(); tt.insert("Carlos", 'C'); diff --git a/src/java/org/apache/fop/image/loader/batik/BatikUtil.java b/src/java/org/apache/fop/image/loader/batik/BatikUtil.java index 20a7bf767..c5b6264b4 100644 --- a/src/java/org/apache/fop/image/loader/batik/BatikUtil.java +++ b/src/java/org/apache/fop/image/loader/batik/BatikUtil.java @@ -27,7 +27,10 @@ import org.apache.batik.dom.util.DOMUtilities; /** * Helper utilities for Apache Batik. */ -public class BatikUtil { +public final class BatikUtil { + + private BatikUtil() { + } /** * Checks whether Apache Batik is available in the classpath. diff --git a/src/java/org/apache/fop/image/loader/batik/GenericFOPBridgeContext.java b/src/java/org/apache/fop/image/loader/batik/GenericFOPBridgeContext.java new file mode 100644 index 000000000..b1808a7b9 --- /dev/null +++ b/src/java/org/apache/fop/image/loader/batik/GenericFOPBridgeContext.java @@ -0,0 +1,111 @@ +/* + * 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.image.loader.batik; + +import java.awt.geom.AffineTransform; + +import org.apache.batik.bridge.BridgeContext; +import org.apache.batik.bridge.DocumentLoader; +import org.apache.batik.bridge.UserAgent; +import org.apache.batik.dom.svg.SVGOMDocument; + +import org.apache.xmlgraphics.image.loader.ImageManager; +import org.apache.xmlgraphics.image.loader.ImageSessionContext; + +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.svg.AbstractFOPBridgeContext; +import org.apache.fop.svg.SVGUserAgent; + +/** + * BridgeContext which registers the custom bridges for Java2D output. + */ +class GenericFOPBridgeContext extends AbstractFOPBridgeContext { + + /** + * Constructs a new bridge context. + * @param userAgent the user agent + * @param documentLoader the Document Loader to use for referenced documents. + * @param fontInfo the font list for the text painter, may be null + * in which case text is painted as shapes + * @param imageManager an image manager + * @param imageSessionContext an image session context + * @param linkTransform AffineTransform to properly place links, + * may be null + */ + public GenericFOPBridgeContext(UserAgent userAgent, DocumentLoader documentLoader, + FontInfo fontInfo, ImageManager imageManager, + ImageSessionContext imageSessionContext, + AffineTransform linkTransform) { + super(userAgent, documentLoader, fontInfo, + imageManager, imageSessionContext, linkTransform); + } + + /** + * Constructs a new bridge context. + * @param userAgent the user agent + * @param fontInfo the font list for the text painter, may be null + * in which case text is painted as shapes + * @param imageManager an image manager + * @param imageSessionContext an image session context + */ + public GenericFOPBridgeContext(UserAgent userAgent, FontInfo fontInfo, + ImageManager imageManager, ImageSessionContext imageSessionContext) { + super(userAgent, fontInfo, imageManager, imageSessionContext); + } + + /** + * Constructs a new bridge context. + * @param userAgent the user agent + * @param fontInfo the font list for the text painter, may be null + * in which case text is painted as shapes + * @param imageManager an image manager + * @param imageSessionContext an image session context + * @param linkTransform AffineTransform to properly place links, + * may be null + */ + public GenericFOPBridgeContext(SVGUserAgent userAgent, FontInfo fontInfo, + ImageManager imageManager, ImageSessionContext imageSessionContext, + AffineTransform linkTransform) { + super(userAgent, fontInfo, imageManager, imageSessionContext, linkTransform); + } + + /** {@inheritDoc} */ + public void registerSVGBridges() { + super.registerSVGBridges(); + + //This makes Batik load images via FOP and the XGC image loading framework + putBridge(new GenericFOPImageElementBridge()); + } + + /** {@inheritDoc} */ + public BridgeContext createBridgeContext(SVGOMDocument doc) { + return createBridgeContext(); + } + + /** {@inheritDoc} */ + public BridgeContext createBridgeContext() { + return new GenericFOPBridgeContext(getUserAgent(), getDocumentLoader(), + fontInfo, + getImageManager(), + getImageSessionContext(), + linkTransform); + } + +} diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerRegistry.java b/src/java/org/apache/fop/image/loader/batik/GenericFOPImageElementBridge.java index 59ca6cf38..7a14025c8 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerRegistry.java +++ b/src/java/org/apache/fop/image/loader/batik/GenericFOPImageElementBridge.java @@ -17,26 +17,30 @@ /* $Id$ */ -package org.apache.fop.render.afp; +package org.apache.fop.image.loader.batik; -import org.apache.fop.render.AbstractImageHandlerRegistry; +import org.apache.xmlgraphics.image.loader.ImageFlavor; + +import org.apache.fop.svg.AbstractFOPImageElementBridge; /** - * This class holds references to various image handlers used by the AFP renderer. It also - * supports automatic discovery of additional handlers available through - * the class path. + * Image Element Bridge class for the SVG to Java2D converter, used to make Batik load images + * through FOP and XGC's image loading framework. */ -public class AFPImageHandlerRegistry extends AbstractImageHandlerRegistry { +class GenericFOPImageElementBridge extends AbstractFOPImageElementBridge { /** - * Main constructor + * Constructs a new bridge for the <image> element. */ - public AFPImageHandlerRegistry() { - } + public GenericFOPImageElementBridge() { } + + private final ImageFlavor[] supportedFlavors = new ImageFlavor[] + {ImageFlavor.GRAPHICS2D, + BatikImageFlavors.SVG_DOM}; /** {@inheritDoc} */ - public Class getHandlerClass() { - return AFPImageHandler.class; + protected ImageFlavor[] getSupportedFlavours() { + return supportedFlavors; } } diff --git a/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java b/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java index 2bb521dc9..9efc2aaf0 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java +++ b/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java @@ -37,7 +37,9 @@ import org.apache.xmlgraphics.image.loader.Image; import org.apache.xmlgraphics.image.loader.ImageException; import org.apache.xmlgraphics.image.loader.ImageFlavor; import org.apache.xmlgraphics.image.loader.ImageInfo; +import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.ImageProcessingHints; +import org.apache.xmlgraphics.image.loader.ImageSessionContext; import org.apache.xmlgraphics.image.loader.XMLNamespaceEnabledImageFlavor; import org.apache.xmlgraphics.image.loader.impl.AbstractImageConverter; import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D; @@ -77,7 +79,16 @@ public class ImageConverterSVG2G2D extends AbstractImageConverter { } UserAgent ua = createBatikUserAgent(pxToMillimeter); GVTBuilder builder = new GVTBuilder(); - final BridgeContext ctx = new BridgeContext(ua); + + final ImageManager imageManager = (ImageManager)hints.get( + ImageProcessingHints.IMAGE_MANAGER); + final ImageSessionContext sessionContext = (ImageSessionContext)hints.get( + ImageProcessingHints.IMAGE_SESSION_CONTEXT); + + boolean useEnhancedBridgeContext = (imageManager != null && sessionContext != null); + final BridgeContext ctx = (useEnhancedBridgeContext + ? new GenericFOPBridgeContext(ua, null, imageManager, sessionContext) + : new BridgeContext(ua)); Document doc = svg.getDocument(); //Cloning SVG DOM as Batik attaches non-thread-safe facilities (like the CSS engine) @@ -117,9 +128,20 @@ public class ImageConverterSVG2G2D extends AbstractImageConverter { /** {@inheritDoc} */ public void displayMessage(String message) { //TODO Refine and pipe through to caller - log.debug(message); + log.info(message); + } + + /** {@inheritDoc} */ + public void displayError(Exception e) { + log.error("Error converting SVG to a Java2D graphic", e); } + /** {@inheritDoc} */ + public void displayError(String message) { + log.error(message); + } + + }; } diff --git a/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java b/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java index 5e4e37345..c675e3cfc 100644 --- a/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java +++ b/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java @@ -102,7 +102,11 @@ public class PreloaderSVG extends AbstractImagePreloader { * attempt to load Batik related classes when constructing the SVGPreloader * class. */ - class Loader { + private final class Loader { + + private Loader() { + } + private ImageInfo getImage(String uri, Source src, ImageContext context) { // parse document and get the size attributes of the svg element diff --git a/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java b/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java index 4e78f8193..8bda04903 100644 --- a/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java +++ b/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java @@ -78,7 +78,11 @@ public class PreloaderWMF extends AbstractImagePreloader { * attempt to load Batik related classes when constructing the WMFPreloader * class. */ - class Loader { + private final class Loader { + + private Loader() { + } + private ImageInfo getImage(String uri, Source src, ImageContext context) { // parse document and get the size attributes of the svg element diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java index 07c2a3d36..cc18c5b36 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java @@ -42,15 +42,19 @@ public abstract class AbstractBreaker { /** logging instance */ protected static Log log = LogFactory.getLog(AbstractBreaker.class); + /** + * A page break position. + */ public static class PageBreakPosition extends LeafPosition { - double bpdAdjust; // Percentage to adjust (stretch or shrink) - int difference; - int footnoteFirstListIndex; - int footnoteFirstElementIndex; - int footnoteLastListIndex; - int footnoteLastElementIndex; - - PageBreakPosition(LayoutManager lm, int breakIndex, + // Percentage to adjust (stretch or shrink) + double bpdAdjust; // CSOK: VisibilityModifier + int difference; // CSOK: VisibilityModifier + int footnoteFirstListIndex; // CSOK: VisibilityModifier + int footnoteFirstElementIndex; // CSOK: VisibilityModifier + int footnoteLastListIndex; // CSOK: VisibilityModifier + int footnoteLastElementIndex; // CSOK: VisibilityModifier + + PageBreakPosition(LayoutManager lm, int breakIndex, // CSOK: ParameterNumber int ffli, int ffei, int flli, int flei, double bpdA, int diff) { super(lm, breakIndex); @@ -90,9 +94,9 @@ public abstract class AbstractBreaker { public class BlockSequence extends BlockKnuthSequence { /** Number of elements to ignore at the beginning of the list. */ - public int ignoreAtStart = 0; + int ignoreAtStart = 0; // CSOK: VisibilityModifier /** Number of elements to ignore at the end of the list. */ - public int ignoreAtEnd = 0; + int ignoreAtEnd = 0; // CSOK: VisibilityModifier /** * startOn represents where on the page/which page layout @@ -198,15 +202,34 @@ public abstract class AbstractBreaker { private List blockLists = null; + /** desired text alignment */ protected int alignment; + private int alignmentLast; + /** footnote separator length */ protected MinOptMax footnoteSeparatorLength = MinOptMax.ZERO; + /** @return current display alignment */ protected abstract int getCurrentDisplayAlign(); + + /** @return true if content not exhausted */ protected abstract boolean hasMoreContent(); + + /** + * Tell the layout manager to add all the child areas implied + * by Position objects which will be returned by the + * Iterator. + * + * @param posIter the position iterator + * @param context the context + */ protected abstract void addAreas(PositionIterator posIter, LayoutContext context); + + /** @return top level layout manager */ protected abstract LayoutManager getTopLevelLM(); + + /** @return current child layout manager */ protected abstract LayoutManager getCurrentChildLM(); /** @@ -244,13 +267,27 @@ public abstract class AbstractBreaker { return null; } - /* - * This method is to contain the logic to determine the LM's - * getNextKnuthElements() implementation(s) that are to be called. - * @return LinkedList of Knuth elements. + /** + * Get a sequence of KnuthElements representing the content + * of the node assigned to the LM + * + * @param context the LayoutContext used to store layout information + * @param alignment the desired text alignment + * @return the list of KnuthElements */ protected abstract List getNextKnuthElements(LayoutContext context, int alignment); + /** + * Get a sequence of KnuthElements representing the content + * of the node assigned to the LM + * + * @param context the LayoutContext used to store layout information + * @param alignment the desired text alignment + * @param positionAtIPDChange last element on the part before an IPD change + * @param restartAtLM the layout manager from which to restart, if IPD + * change occurs between two LMs + * @return the list of KnuthElements + */ protected List getNextKnuthElements(LayoutContext context, int alignment, Position positionAtIPDChange, LayoutManager restartAtLM) { throw new UnsupportedOperationException("TODO: implement acceptable fallback"); @@ -261,6 +298,11 @@ public abstract class AbstractBreaker { return (this.blockLists.isEmpty()); } + /** + * Start part. + * @param list a block sequence + * @param breakClass a break class + */ protected void startPart(BlockSequence list, int breakClass) { //nop } @@ -272,6 +314,11 @@ public abstract class AbstractBreaker { //nop } + /** + * Finish part. + * @param alg a page breaking algorithm + * @param pbp a page break posittion + */ protected abstract void finishPart(PageBreakingAlgorithm alg, PageBreakPosition pbp); /** @@ -809,8 +856,8 @@ public abstract class AbstractBreaker { * @param availableBPD the available BPD * @return the effective list */ - private BlockSequence justifyBoxes(BlockSequence blockList, PageBreakingAlgorithm alg, - int availableBPD) { + private BlockSequence justifyBoxes // CSOK: MethodLength + (BlockSequence blockList, PageBreakingAlgorithm alg, int availableBPD) { int iOptPageNumber; alg.setConstantLineWidth(availableBPD); iOptPageNumber = alg.findBreakingPoints(blockList, /*availableBPD,*/ @@ -843,15 +890,18 @@ public abstract class AbstractBreaker { // inside the // while loop must be a box KnuthElement firstElement; - while (!(firstElement = (KnuthElement) sequenceIterator - .next()).isBox()) { - // - log.debug("PLM> ignoring glue or penalty element " - + "at the beginning of the sequence"); - if (firstElement.isGlue()) { - ((BlockLevelLayoutManager) firstElement - .getLayoutManager()) + while ( sequenceIterator.hasNext() ) { + firstElement = (KnuthElement) sequenceIterator.next(); + if ( !firstElement.isBox() ) { + log.debug("PLM> ignoring glue or penalty element " + + "at the beginning of the sequence"); + if (firstElement.isGlue()) { + ((BlockLevelLayoutManager) firstElement + .getLayoutManager()) .discardSpace((KnuthGlue) firstElement); + } + } else { + break; } } firstElementIndex = sequenceIterator.previousIndex(); @@ -904,8 +954,10 @@ public abstract class AbstractBreaker { // blockSpaceList KnuthGlue blockSpace = (KnuthGlue) unconfirmedList .removeFirst(); - spaceMaxAdjustment = spaceMaxAdjustment.plusMax(blockSpace.getStretch()); - spaceMaxAdjustment = spaceMaxAdjustment.minusMin(blockSpace.getShrink()); + spaceMaxAdjustment + = spaceMaxAdjustment.plusMax(blockSpace.getStretch()); + spaceMaxAdjustment + = spaceMaxAdjustment.minusMin(blockSpace.getShrink()); blockSpacesList.add(blockSpace); } } @@ -995,7 +1047,9 @@ public abstract class AbstractBreaker { + (((int)((float) partial * difference / total)) - adjustedDiff) + " / " + difference); } - int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace); + int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager()) + .negotiateBPDAdjustment + (((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace); adjustedDiff += newAdjust; } return adjustedDiff; @@ -1003,7 +1057,13 @@ public abstract class AbstractBreaker { private int adjustLineNumbers(LinkedList lineList, int difference, int total) { if (log.isDebugEnabled()) { - log.debug("AdjustLineNumbers: difference " + difference + " / " + total + " on " + lineList.size() + " elements"); + log.debug("AdjustLineNumbers: difference " + + difference + + " / " + + total + + " on " + + lineList.size() + + " elements"); } ListIterator lineListIterator = lineList.listIterator(); @@ -1012,7 +1072,9 @@ public abstract class AbstractBreaker { while (lineListIterator.hasNext()) { KnuthGlue line = (KnuthGlue)lineListIterator.next(); partial += (difference > 0 ? line.getStretch() : line.getShrink()); - int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, line); + int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()) + .negotiateBPDAdjustment + (((int) ((float) partial * difference / total)) - adjustedDiff, line); adjustedDiff += newAdjust; } return adjustedDiff; diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java index 1f91cef1a..ae230e261 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -123,6 +123,10 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager return null; } + /** + * Set currently active child layout manager. + * @param childLM the child layout manager + */ protected void setCurrentChildLM(LayoutManager childLM) { curChildLM = childLM; childLMiter = new LMiter(this); diff --git a/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java index 0fa046aee..f5c9d0779 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java @@ -275,8 +275,8 @@ public abstract class AbstractPageSequenceLayoutManager extends AbstractLayoutMa /** * Makes a new page * - * @param bIsBlank whether this page is blank or not - * @param bIsLast whether this page is the last page or not + * @param isBlank whether this page is blank or not + * @param isLast whether this page is the last page or not * @return a new page */ protected Page makeNewPage(boolean isBlank, boolean isLast) { diff --git a/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java b/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java index 14183c52e..755be91d1 100644 --- a/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java +++ b/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java @@ -27,7 +27,10 @@ import org.apache.fop.layoutmgr.SpaceResolver.SpaceHandlingBreakPosition; /** * Utility class which provides common code for the addAreas stage. */ -public class AreaAdditionUtil { +public final class AreaAdditionUtil { + + private AreaAdditionUtil() { + } private static class StackingIter extends PositionIterator { StackingIter(Iterator parentIter) { diff --git a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java index 2bb499a36..b8bbc0c6c 100644 --- a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java @@ -21,6 +21,8 @@ package org.apache.fop.layoutmgr; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + +import org.apache.fop.fo.Constants; import org.apache.fop.traits.MinOptMax; /** @@ -29,13 +31,32 @@ import org.apache.fop.traits.MinOptMax; */ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { - private Log log = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class); + private static final Log LOG = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class); private int columnCount; private int fullLen; private int idealPartLen; - public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, + /** + * Construct a balancing column breaking algorithm. + * @param topLevelLM the top level layout manager + * @param pageProvider the page provider + * @param layoutListener the layout listener + * @param alignment alignment of the paragraph/page. One of {@link Constants#EN_START}, + * {@link Constants#EN_JUSTIFY}, {@link Constants#EN_CENTER}, + * {@link Constants#EN_END}. + * For pages, {@link Constants#EN_BEFORE} and {@link Constants#EN_AFTER} + * are mapped to the corresponding inline properties, + * {@link Constants#EN_START} and {@link Constants#EN_END}. + * @param alignmentLast alignment of the paragraph's last line + * @param footnoteSeparatorLength length of footnote separator + * @param partOverflowRecovery {@code true} if too long elements should be moved to + * the next line/part + * @param columnCount number of columns + * @see PageBreakingAlgorithm + */ + public BalancingColumnBreakingAlgorithm // CSOK: ParameterNumber + (LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, @@ -53,8 +74,8 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { protected double computeDemerits(KnuthNode activeNode, KnuthElement element, int fitnessClass, double r) { double dem = super.computeDemerits(activeNode, element, fitnessClass, r); - if (log.isTraceEnabled()) { - log.trace("original demerit=" + dem + " " + totalWidth + if (LOG.isTraceEnabled()) { + LOG.trace("original demerit=" + dem + " " + totalWidth + " line=" + activeNode.line + "/" + columnCount + " pos=" + activeNode.position + "/" + (par.size() - 1)); } @@ -70,13 +91,13 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { if (remParts > 0) { avgRestLen = restLen / remParts; } - if (log.isTraceEnabled()) { - log.trace("remaining parts: " + remParts + " rest len: " + restLen + if (LOG.isTraceEnabled()) { + LOG.trace("remaining parts: " + remParts + " rest len: " + restLen + " avg=" + avgRestLen); } double balance = (idealPartLen - partLen) / 1000f; - if (log.isTraceEnabled()) { - log.trace("balance=" + balance); + if (LOG.isTraceEnabled()) { + LOG.trace("balance=" + balance); } double absBalance = Math.abs(balance); dem = absBalance; @@ -99,8 +120,8 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { //We don't want more columns than available dem = Double.MAX_VALUE; } - if (log.isTraceEnabled()) { - log.trace("effective dem=" + dem + " " + totalWidth); + if (LOG.isTraceEnabled()) { + LOG.trace("effective dem=" + dem + " " + totalWidth); } return dem; } diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 5ca2b567f..ee010efe5 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -187,7 +187,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements // CSOK: MethodLength + (LayoutContext context, int alignment) { resetSpaces(); if (isAbsoluteOrFixed()) { return getNextKnuthElementsAbsolute(context, alignment); @@ -404,8 +405,9 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, - Position restartPosition, LayoutManager restartAtLM) { + public List getNextKnuthElements // CSOK: MethodLength + (LayoutContext context, int alignment, Stack lmStack, + Position restartPosition, LayoutManager restartAtLM) { resetSpaces(); if (isAbsoluteOrFixed()) { return getNextKnuthElementsAbsolute(context, alignment); @@ -990,8 +992,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager } /** {@inheritDoc} */ - public void addAreas(PositionIterator parentIter, - LayoutContext layoutContext) { + public void addAreas // CSOK: MethodLength + (PositionIterator parentIter, LayoutContext layoutContext) { getParentArea(null); // if this will create the first block area in a page diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 69e07a404..62e89bdb0 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -234,8 +234,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager } /** {@inheritDoc} */ - public void addAreas(PositionIterator parentIter, - LayoutContext layoutContext) { + public void addAreas // CSOK: MethodLength + (PositionIterator parentIter, LayoutContext layoutContext) { getParentArea(null); // if this will create the first block area in a page diff --git a/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java index a1d43dd6f..8f2a4b214 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java @@ -26,8 +26,18 @@ import org.apache.fop.fo.properties.KeepProperty; */ public interface BlockLevelLayoutManager extends LayoutManager { + /** + * Negotiate BPD adjustment. + * @param adj amount to adjust + * @param lastElement the last knuth element + * @return the resulting adjusted BPD + */ int negotiateBPDAdjustment(int adj, KnuthElement lastElement); + /** + * Discard space. + * @param spaceGlue the space + */ void discardSpace(KnuthGlue spaceGlue); /** diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 4636cb15a..fd9f2a822 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -55,6 +55,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager */ private static Log log = LogFactory.getLog(BlockStackingLayoutManager.class); + /** parent area */ protected BlockParent parentArea; /** Value of the block-progression-unit (non-standard property) */ @@ -360,7 +361,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, + public List getNextKnuthElements // CSOK: MethodLength + (LayoutContext context, int alignment, Stack lmStack, Position restartPosition, LayoutManager restartAtLM) { referenceIPD = context.getRefIPD(); updateContentAreaIPDwithOverconstrainedAdjust(); @@ -582,8 +584,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager /** * Adds a break element to the content list between individual child elements. - * @param contentList - * @param parentLC + * @param contentList the content list + * @param parentLC the parent layout context * @param childLC the currently active child layout context */ protected void addInBetweenBreak(List contentList, LayoutContext parentLC, @@ -758,7 +760,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager /** * {@inheritDoc} */ - public List getChangedKnuthElements(List oldList, int alignment) { + public List getChangedKnuthElements(List oldList, int alignment) { // CSOK: MethodLength /*LF*/ //log.debug(""); /*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = " // + oldList.size()); @@ -1377,7 +1379,12 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager }*/ } - protected List createUnitElements(List oldList) { + /** + * Create unit elements. + * @param oldList the old list + * @return the new list + */ + protected List createUnitElements(List oldList) { // CSOK: MethodLength //log.debug("Start conversion: " + oldList.size() // + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min // + " space-after.min=" + layoutProps.spaceAfter.getSpace().min); @@ -1640,7 +1647,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager // insert the correct elements newList.addFirst(new KnuthBox(wrongBox.getWidth() - decreasedLength, wrongBox.getPosition(), false)); - newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, Adjustment.SPACE_BEFORE_ADJUSTMENT, + newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, + Adjustment.SPACE_BEFORE_ADJUSTMENT, wrongBox.getPosition(), false)); //log.debug(" rimosso box " + neededUnits(wrongBox.getWidth())); //log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0"); @@ -1692,34 +1700,58 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager return newList; } + /** A stack iterator. */ protected static class StackingIter extends PositionIterator { + + /** + * Construct a stacking iterator. + * @param parentIter the parent iterator + */ StackingIter(Iterator parentIter) { super(parentIter); } + /** + * @param nextObj the next position + * @return the layout manager of the next position + */ protected LayoutManager getLM(Object nextObj) { return ((Position) nextObj).getLM(); } + /** + * @param nextObj the next position + * @return the next position + */ protected Position getPos(Object nextObj) { return ((Position) nextObj); } } + /** A mapping position. */ protected static class MappingPosition extends Position { + private int iFirstIndex; private int iLastIndex; + /** + * Construct mapping position. + * @param lm layout manager + * @param first position + * @param last position + */ public MappingPosition(LayoutManager lm, int first, int last) { super(lm); iFirstIndex = first; iLastIndex = last; } + /** @return first index */ public int getFirstIndex() { return iFirstIndex; } + /** @return last index */ public int getLastIndex() { return iLastIndex; } diff --git a/src/java/org/apache/fop/layoutmgr/BreakElement.java b/src/java/org/apache/fop/layoutmgr/BreakElement.java index 3eb96e9cd..7208a585f 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakElement.java +++ b/src/java/org/apache/fop/layoutmgr/BreakElement.java @@ -55,7 +55,8 @@ public class BreakElement extends UnresolvedListElement { * @param breakClass the break class * @param context the {@link LayoutContext} */ - public BreakElement(Position position, int penaltyValue, int breakClass, LayoutContext context) { + public BreakElement(Position position, int penaltyValue, int breakClass, + LayoutContext context) { this(position, 0, penaltyValue, breakClass, context); } diff --git a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java index 4516c8d97..f8d78d477 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java @@ -59,12 +59,18 @@ public abstract class BreakingAlgorithm { /** Holder for symbolic literals for the fitness classes */ static final class FitnessClasses { + + private FitnessClasses() { + } + static final int VERY_TIGHT = 0; static final int TIGHT = 1; static final int LOOSE = 2; static final int VERY_LOOSE = 3; - static final String[] NAMES = { "VERY TIGHT", "TIGHT", "LOOSE", "VERY LOOSE" }; + static final String[] NAMES = { + "VERY TIGHT", "TIGHT", "LOOSE", "VERY LOOSE" + }; /** * Figure out the fitness class of this line (tight, loose, @@ -178,6 +184,9 @@ public abstract class BreakingAlgorithm { */ protected int totalShrink = 0; + /** + * Best records. + */ protected BestRecords best; private boolean partOverflowRecoveryActivated = true; @@ -217,51 +226,67 @@ public abstract class BreakingAlgorithm { */ public class KnuthNode { /** index of the breakpoint represented by this node */ - public final int position; + public final int position; // CSOK: VisibilityModifier /** number of the line ending at this breakpoint */ - public final int line; + public final int line; // CSOK: VisibilityModifier /** fitness class of the line ending at this breakpoint. One of 0, 1, 2, 3. */ - public final int fitness; + public final int fitness; // CSOK: VisibilityModifier /** accumulated width of the KnuthElements up to after this breakpoint. */ - public final int totalWidth; + public final int totalWidth; // CSOK: VisibilityModifier /** accumulated stretchability of the KnuthElements up to after this breakpoint. */ - public final int totalStretch; + public final int totalStretch; // CSOK: VisibilityModifier /** accumulated shrinkability of the KnuthElements up to after this breakpoint. */ - public final int totalShrink; + public final int totalShrink; // CSOK: VisibilityModifier /** adjustment ratio if the line ends at this breakpoint */ - public final double adjustRatio; + public final double adjustRatio; // CSOK: VisibilityModifier /** available stretch of the line ending at this breakpoint */ - public final int availableShrink; + public final int availableShrink; // CSOK: VisibilityModifier /** available shrink of the line ending at this breakpoint */ - public final int availableStretch; + public final int availableStretch; // CSOK: VisibilityModifier /** difference between target and actual line width */ - public final int difference; + public final int difference; // CSOK: VisibilityModifier /** minimum total demerits up to this breakpoint */ - public double totalDemerits; + public double totalDemerits; // CSOK: VisibilityModifier /** best node for the preceding breakpoint */ - public KnuthNode previous; + public KnuthNode previous; // CSOK: VisibilityModifier /** next possible node in the same line */ - public KnuthNode next; + public KnuthNode next; // CSOK: VisibilityModifier /** * Holds the number of subsequent recovery attempty that are made to get content fit * into a line. */ - public int fitRecoveryCounter = 0; + public int fitRecoveryCounter = 0; // CSOK: VisibilityModifier - public KnuthNode(int position, int line, int fitness, + /** + * Construct node. + * @param position an integer + * @param line an integer + * @param fitness an integer + * @param totalWidth an integer + * @param totalStretch an integer + * @param totalShrink an integer + * @param adjustRatio a real number + * @param availableShrink an integer + * @param availableStretch an integer + * @param difference an integer + * @param totalDemerits a real number + * @param previous a node + */ + public KnuthNode // CSOK: ParameterNumber + (int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink, double adjustRatio, int availableShrink, int availableStretch, int difference, double totalDemerits, KnuthNode previous) { @@ -279,6 +304,7 @@ public abstract class BreakingAlgorithm { this.previous = previous; } + /** {@inheritDoc} */ public String toString() { return "<KnuthNode at " + position + " " + totalWidth + "+" + totalStretch + "-" + totalShrink @@ -303,6 +329,7 @@ public abstract class BreakingAlgorithm { /** Points to the fitness class which currently leads to the best demerits. */ private int bestIndex = -1; + /** default constructor */ public BestRecords() { reset(); } @@ -334,6 +361,7 @@ public abstract class BreakingAlgorithm { } } + /** @return true if has records (best index not -1) */ public boolean hasRecords() { return (bestIndex != -1); } @@ -347,30 +375,55 @@ public abstract class BreakingAlgorithm { return (bestDemerits[fitness] != INFINITE_DEMERITS); } + /** + * @param fitness to use + * @return best demerits + */ public double getDemerits(int fitness) { return bestDemerits[fitness]; } + /** + * @param fitness to use + * @return best node + */ public KnuthNode getNode(int fitness) { return bestNode[fitness]; } + /** + * @param fitness to use + * @return adjustment + */ public double getAdjust(int fitness) { return bestAdjust[fitness]; } + /** + * @param fitness to use + * @return available shrink + */ public int getAvailableShrink(int fitness) { return bestAvailableShrink[fitness]; } + /** + * @param fitness to use + * @return available stretch + */ public int getAvailableStretch(int fitness) { return bestAvailableStretch[fitness]; } + /** + * @param fitness to use + * @return difference + */ public int getDifference(int fitness) { return bestDifference[fitness]; } + /** @return minimum demerits */ public double getMinDemerits() { if (bestIndex != -1) { return getDemerits(bestIndex); @@ -427,11 +480,22 @@ public abstract class BreakingAlgorithm { KnuthSequence sequence, int total); + /** @param lineWidth the line width */ public void setConstantLineWidth(int lineWidth) { this.lineWidth = lineWidth; } - /** @see #findBreakingPoints(KnuthSequence, int, double, boolean, int) */ + /** + * @param par the paragraph to break + * @param threshold upper bound of the adjustment ratio + * @param force {@code true} if a set of breakpoints must be found, even + * if there are no feasible ones + * @param allowedBreaks the type(s) of breaks allowed. One of {@link #ONLY_FORCED_BREAKS}, + * {@link #NO_FLAGGED_PENALTIES} or {@link #ALL_BREAKS}. + * + * @return the number of effective breaks + * @see #findBreakingPoints(KnuthSequence, int, double, boolean, int) + */ public int findBreakingPoints(KnuthSequence par, double threshold, boolean force, @@ -538,10 +602,18 @@ public abstract class BreakingAlgorithm { return line; } + /** + * obtain ipd difference + * @return an integer + */ protected int getIPDdifference() { return 0; } + /** + * handle ipd change + * @return an integer + */ protected int handleIpdChange() { throw new IllegalStateException(); } @@ -572,8 +644,10 @@ public abstract class BreakingAlgorithm { this.totalWidth = 0; this.totalStretch = 0; this.totalShrink = 0; - this.lastTooShort = this.lastTooLong = null; - this.startLine = this.endLine = 0; + this.lastTooShort = null; + this.lastTooLong = null; + this.startLine = 0; + this.endLine = 0; this.activeLines = new KnuthNode[20]; } @@ -597,7 +671,8 @@ public abstract class BreakingAlgorithm { * @param previous active node for the preceding breakpoint * @return a new node */ - protected KnuthNode createNode(int position, int line, int fitness, + protected KnuthNode createNode // CSOK: ParameterNumber + (int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink, double adjustRatio, int availableShrink, int availableStretch, int difference, double totalDemerits, KnuthNode previous) { @@ -609,7 +684,17 @@ public abstract class BreakingAlgorithm { /** Creates a new active node for a break from the best active node of the given * fitness class to the element at the given position. - * @see #createNode(int, int, int, int, int, int, double, int, int, int, double, org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode) + * @param position index of the element in the Knuth sequence + * @param line number of the line ending at the breakpoint + * @param fitness fitness class of the line ending at the breakpoint. One of 0, 1, 2, 3. + * @param totalWidth accumulated width of the KnuthElements up to after the breakpoint + * @param totalStretch accumulated stretchability of the KnuthElements up to after the + * breakpoint + * @param totalShrink accumulated shrinkability of the KnuthElements up to after the + * breakpoint + * @return a new node + * @see #createNode(int, int, int, int, int, int, double, int, int, int, double, + * org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode) * @see BreakingAlgorithm.BestRecords */ protected KnuthNode createNode(int position, int line, int fitness, @@ -655,7 +740,7 @@ public abstract class BreakingAlgorithm { handleBox((KnuthBox) element); } else if (element.isGlue()) { handleGlueAt((KnuthGlue) element, position, previousIsBox, allowedBreaks); - } else if (element.isPenalty()){ + } else if (element.isPenalty()) { handlePenaltyAt((KnuthPenalty) element, position, allowedBreaks); } else { throw new IllegalArgumentException( @@ -875,7 +960,7 @@ public abstract class BreakingAlgorithm { * number. * @param element the element * @param line the line number - * @param difference + * @param difference an integer * @return {@code true} if the element can end the line */ protected boolean elementCanEndLine(KnuthElement element, int line, int difference) { @@ -896,7 +981,7 @@ public abstract class BreakingAlgorithm { * @param availableShrink the available amount of shrink * @param availableStretch tha available amount of stretch */ - protected void forceNode(KnuthNode node, + protected void forceNode(KnuthNode node, // CSOK: ParameterNumber int line, int elementIdx, int difference, @@ -1320,6 +1405,10 @@ public abstract class BreakingAlgorithm { return sb.toString(); } + /** + * Filter active nodes. + * @return an integer + */ protected abstract int filterActiveNodes(); /** diff --git a/src/java/org/apache/fop/layoutmgr/ElementListObserver.java b/src/java/org/apache/fop/layoutmgr/ElementListObserver.java index 73a6d5be4..d5c6f5527 100644 --- a/src/java/org/apache/fop/layoutmgr/ElementListObserver.java +++ b/src/java/org/apache/fop/layoutmgr/ElementListObserver.java @@ -27,7 +27,10 @@ import java.util.List; * is mainly used for the purpose of automated testing. This implementation here does nothing. * Please see the subclass within the test code. */ -public class ElementListObserver { +public final class ElementListObserver { + + private ElementListObserver() { + } private static List activeObservers = null; diff --git a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java index 67b9b4254..2e6f6926a 100644 --- a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java @@ -36,7 +36,7 @@ import org.apache.fop.fo.pagination.Flow; * Its parent LM is the PageSequenceLayoutManager. * This LM is responsible for getting columns of the appropriate size * and filling them with block-level areas generated by its children. - * @todo Reintroduce emergency counter (generate error to avoid endless loop) + * @asf.todo Reintroduce emergency counter (generate error to avoid endless loop) */ public class FlowLayoutManager extends BlockStackingLayoutManager implements BlockLevelLayoutManager { @@ -79,7 +79,16 @@ public class FlowLayoutManager extends BlockStackingLayoutManager return elements; } - /** {@inheritDoc} */ + /** + * Get a sequence of KnuthElements representing the content + * of the node assigned to the LM. + * @param context the LayoutContext used to store layout information + * @param alignment the desired text alignment + * @param positionAtIPDChange position at ipd change + * @param restartAtLM restart at this layout manager + * @return the list of KnuthElements + * @see LayoutManager#getNextKnuthElements(LayoutContext,int) + */ public List getNextKnuthElements(LayoutContext context, int alignment, Position positionAtIPDChange, LayoutManager restartAtLM) { diff --git a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java index 0d00b710a..63a2f7c5e 100644 --- a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java +++ b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java @@ -95,6 +95,9 @@ public class InlineKnuthSequence extends KnuthSequence { return this; } + /** + * Add letter space. + */ public void addALetterSpace() { KnuthBox prevBox = (KnuthBox) getLast(); if (prevBox.isAuxiliary() diff --git a/src/java/org/apache/fop/layoutmgr/Keep.java b/src/java/org/apache/fop/layoutmgr/Keep.java index 444448ae4..c53c5e41a 100644 --- a/src/java/org/apache/fop/layoutmgr/Keep.java +++ b/src/java/org/apache/fop/layoutmgr/Keep.java @@ -1,16 +1,18 @@ /* - * 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 + * 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 + * 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. + * 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$ */ @@ -25,7 +27,7 @@ import org.apache.fop.fo.properties.Property; * Object representing a keep constraint, corresponding * to the XSL-FO <a href="http://www.w3.org/TR/xsl/#d0e26492">keep properties</a>. */ -public class Keep { +public final class Keep { /** The integer value for "auto" keep strength. */ private static final int STRENGTH_AUTO = Integer.MIN_VALUE; @@ -33,8 +35,10 @@ public class Keep { /** The integer value for "always" keep strength. */ private static final int STRENGTH_ALWAYS = Integer.MAX_VALUE; + /** keep auto */ public static final Keep KEEP_AUTO = new Keep(STRENGTH_AUTO, Constants.EN_AUTO); + /** keep always */ public static final Keep KEEP_ALWAYS = new Keep(STRENGTH_ALWAYS, Constants.EN_LINE); private int strength; diff --git a/src/java/org/apache/fop/layoutmgr/KnuthGlue.java b/src/java/org/apache/fop/layoutmgr/KnuthGlue.java index 2efea0e61..2b89c10d4 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthGlue.java +++ b/src/java/org/apache/fop/layoutmgr/KnuthGlue.java @@ -87,6 +87,16 @@ public class KnuthGlue extends KnuthElement { this.adjustmentClass = Adjustment.NO_ADJUSTMENT; } + /** + * Creates a new <code>KnuthGlue</code>. + * + * @param width the width of this glue + * @param stretch the stretchability of this glue + * @param shrink the shrinkability of this glue + * @param adjustmentClass the adjsutment class + * @param pos the Position stored in this glue + * @param auxiliary is this glue auxiliary? + */ public KnuthGlue(int width, int stretch, int shrink, Adjustment adjustmentClass, Position pos, boolean auxiliary) { super(width, pos, auxiliary); diff --git a/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java b/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java index e7397babb..e69b991b3 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java +++ b/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java @@ -21,6 +21,9 @@ package org.apache.fop.layoutmgr; import java.util.List; +/** + * A Knuth element position iterator. + */ public class KnuthPossPosIter extends PositionIterator { private int iterCount; @@ -46,9 +49,7 @@ public class KnuthPossPosIter extends PositionIterator { // Check position < endPos - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ protected boolean checkNext() { if (iterCount > 0) { return super.checkNext(); @@ -58,22 +59,26 @@ public class KnuthPossPosIter extends PositionIterator { } } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public Object next() { --iterCount; return super.next(); } + /** + * Peek at next, returning as ListElement. + * @return peek at next as ListElement + */ public ListElement getKE() { return (ListElement) peekNext(); } + /** {@inheritDoc} */ protected LayoutManager getLM(Object nextObj) { return ((ListElement) nextObj).getLayoutManager(); } + /** {@inheritDoc} */ protected Position getPos(Object nextObj) { return ((ListElement) nextObj).getPosition(); } diff --git a/src/java/org/apache/fop/layoutmgr/KnuthSequence.java b/src/java/org/apache/fop/layoutmgr/KnuthSequence.java index 7c712040a..1a9bb6534 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthSequence.java +++ b/src/java/org/apache/fop/layoutmgr/KnuthSequence.java @@ -182,13 +182,20 @@ public abstract class KnuthSequence extends ArrayList { ListElement element = null; int posIndex = startIndex; int lastIndex = size(); - while (posIndex < lastIndex - && !(element = getElement(posIndex)).isBox()) { - posIndex++; + while ( posIndex < lastIndex ) { + element = getElement(posIndex); + if ( !element.isBox() ) { + posIndex++; + } else { + break; + } } - if (posIndex != startIndex - && element.isBox()) { - return posIndex - 1; + if ( posIndex != startIndex ) { + if ( ( element != null ) && element.isBox() ) { + return posIndex - 1; + } else { + return startIndex; + } } else { return startIndex; } diff --git a/src/java/org/apache/fop/layoutmgr/LMiter.java b/src/java/org/apache/fop/layoutmgr/LMiter.java index 4fa5590dc..9f437df6a 100644 --- a/src/java/org/apache/fop/layoutmgr/LMiter.java +++ b/src/java/org/apache/fop/layoutmgr/LMiter.java @@ -23,27 +23,36 @@ import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; +/** An iterator for layout managers. */ public class LMiter implements ListIterator { - + /** list of layout managers */ protected List listLMs; + /** current position in iteration */ protected int curPos = 0; /** The LayoutManager to which this LMiter is attached **/ private LayoutManager lp; + /** + * Construct a layout manager iterator. + * @param lp the associated layout manager (parent) + */ public LMiter(LayoutManager lp) { this.lp = lp; listLMs = lp.getChildLMs(); } + /** {@inheritDoc} */ public boolean hasNext() { return (curPos < listLMs.size()) ? true : lp.createNextChildLMs(curPos); } + /** {@inheritDoc} */ public boolean hasPrevious() { return (curPos > 0); } + /** {@inheritDoc} */ public Object previous() throws NoSuchElementException { if (curPos > 0) { return listLMs.get(--curPos); @@ -52,6 +61,7 @@ public class LMiter implements ListIterator { } } + /** {@inheritDoc} */ public Object next() throws NoSuchElementException { if (curPos < listLMs.size()) { return listLMs.get(curPos++); @@ -60,7 +70,8 @@ public class LMiter implements ListIterator { } } - public void remove() throws NoSuchElementException { + /** {@inheritDoc} */ + public void remove() throws NoSuchElementException { if (curPos > 0) { listLMs.remove(--curPos); // Note: doesn't actually remove it from the base! @@ -70,18 +81,22 @@ public class LMiter implements ListIterator { } - public void add(Object o) throws UnsupportedOperationException { + /** {@inheritDoc} */ + public void add(Object o) throws UnsupportedOperationException { throw new UnsupportedOperationException("LMiter doesn't support add"); } + /** {@inheritDoc} */ public void set(Object o) throws UnsupportedOperationException { throw new UnsupportedOperationException("LMiter doesn't support set"); } + /** {@inheritDoc} */ public int nextIndex() { return curPos; } + /** {@inheritDoc} */ public int previousIndex() { return curPos - 1; } diff --git a/src/java/org/apache/fop/layoutmgr/LayoutContext.java b/src/java/org/apache/fop/layoutmgr/LayoutContext.java index 752ffd628..18059c5ca 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutContext.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutContext.java @@ -33,12 +33,12 @@ import org.apache.fop.traits.MinOptMax; * method. It is set up by higher level LM and used by lower level LM. */ public class LayoutContext { - /** - * Values for flags. - */ + + /** linebreak at line feed only flag */ public static final int LINEBREAK_AT_LF_ONLY = 0x01; /** Generated break possibility is first in a new area */ public static final int NEW_AREA = 0x02; + /** ipd unknown flag */ public static final int IPD_UNKNOWN = 0x04; /** Signal to a Line LM that a higher level LM may provoke a change * in the reference area, thus ref area IPD. The LineLM should return @@ -51,10 +51,13 @@ public class LayoutContext { * not cause a mandatory break as this break was already handled by a parent layout manager. */ public static final int SUPPRESS_BREAK_BEFORE = 0x10; + /** first area flag */ public static final int FIRST_AREA = 0x20; + /** try hypenate flag */ public static final int TRY_HYPHENATE = 0x40; + /** last area flag */ public static final int LAST_AREA = 0x80; - + /** resolve leading space flag */ public static final int RESOLVE_LEADING_SPACE = 0x100; /** @@ -178,6 +181,7 @@ public class LayoutContext { trailingSpace = null; } + /** @param source from which pending marks are copied */ public void copyPendingMarksFrom(LayoutContext source) { if (source.pendingAfterMarks != null) { this.pendingAfterMarks = new java.util.ArrayList(source.pendingAfterMarks); @@ -187,10 +191,15 @@ public class LayoutContext { } } + /** @param flags to set */ public void setFlags(int flags) { setFlags(flags, true); } + /** + * @param flags to set or clear + * @param bSet true to set, false to clear + */ public void setFlags(int flags, boolean bSet) { if (bSet) { this.flags |= flags; @@ -199,26 +208,32 @@ public class LayoutContext { } } + /** @param flags to clear */ public void unsetFlags(int flags) { setFlags(flags, false); } + /** @return true if new area is set */ public boolean isStart() { return ((this.flags & NEW_AREA) != 0); } + /** @return true if new area is set and leading space is non-null */ public boolean startsNewArea() { return ((this.flags & NEW_AREA) != 0 && leadingSpace != null); } + /** @return true if first area is set */ public boolean isFirstArea() { return ((this.flags & FIRST_AREA) != 0); } + /** @return true if last area is set */ public boolean isLastArea() { return ((this.flags & LAST_AREA) != 0); } + /** @return true if suppress break before is set */ public boolean suppressBreakBefore() { return ((this.flags & SUPPRESS_BREAK_BEFORE) != 0); } @@ -293,22 +308,27 @@ public class LayoutContext { return !getKeepWithPreviousPending().isAuto(); } + /** @param space leading space */ public void setLeadingSpace(SpaceSpecifier space) { leadingSpace = space; } + /** @return leading space */ public SpaceSpecifier getLeadingSpace() { return leadingSpace; } + /** @return true if resolve leading space is set */ public boolean resolveLeadingSpace() { return ((this.flags & RESOLVE_LEADING_SPACE) != 0); } + /** @param space trailing space */ public void setTrailingSpace(SpaceSpecifier space) { trailingSpace = space; } + /** @return trailing space */ public SpaceSpecifier getTrailingSpace() { return trailingSpace; } @@ -389,6 +409,7 @@ public class LayoutContext { /** * Sets the inline-progression-dimension of the nearest ancestor reference area. + * @param ipd of nearest ancestor reference area */ public void setRefIPD(int ipd) { refIPD = ipd; @@ -403,14 +424,17 @@ public class LayoutContext { return refIPD; } + /** @param hyph a hyphenation context */ public void setHyphContext(HyphContext hyph) { hyphContext = hyph; } + /** @return hyphenation context */ public HyphContext getHyphContext() { return hyphContext; } + /** @return true if try hyphenate is set */ public boolean tryHyphenate() { return ((this.flags & TRY_HYPHENATE) != 0); } @@ -428,30 +452,39 @@ public class LayoutContext { return this.bpAlignment; } + /** @param adjust space adjustment */ public void setSpaceAdjust(double adjust) { dSpaceAdjust = adjust; } + /** @return space adjustment */ public double getSpaceAdjust() { return dSpaceAdjust; } + /** @param ipdA ipd adjustment */ public void setIPDAdjust(double ipdA) { ipdAdjust = ipdA; } + /** @return ipd adjustment */ public double getIPDAdjust() { return ipdAdjust; } + /** @param alignmentContext alignment context */ public void setAlignmentContext(AlignmentContext alignmentContext) { this.alignmentContext = alignmentContext; } + /** @return alignment context */ public AlignmentContext getAlignmentContext() { return this.alignmentContext; } + /** + * Reset alignment context. + */ public void resetAlignmentContext() { if (this.alignmentContext != null) { this.alignmentContext = this.alignmentContext.getParentAlignmentContext(); diff --git a/src/java/org/apache/fop/layoutmgr/LayoutException.java b/src/java/org/apache/fop/layoutmgr/LayoutException.java index 822607020..280266003 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutException.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutException.java @@ -29,7 +29,7 @@ import org.apache.fop.events.EventExceptionManager.ExceptionFactory; * Exception thrown by FOP if an unrecoverable layout error occurs. An example: An area overflows * a viewport that has overflow="error-if-overflow". * - * @todo Discuss if this should become a checked exception. + * @asf.todo Discuss if this should become a checked exception. */ public class LayoutException extends RuntimeException { diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManager.java b/src/java/org/apache/fop/layoutmgr/LayoutManager.java index 454b8b366..985131bf1 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManager.java @@ -132,7 +132,7 @@ public interface LayoutManager extends PercentBaseContext { /** * Get a sequence of KnuthElements representing the content - * of the node assigned to the LM + * of the node assigned to the LM. * * @param context the LayoutContext used to store layout information * @param alignment the desired text alignment diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java index 8efe5ce65..e9e3fb6a7 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java @@ -16,6 +16,7 @@ */ /* $Id$ */ + package org.apache.fop.layoutmgr; import java.util.List; @@ -40,7 +41,7 @@ public interface LayoutManagerMaker { * @param node the FO node for which the LayoutManagers are made * @param lms the list to which the LayoutManagers are added */ - public void makeLayoutManagers(FONode node, List lms); + void makeLayoutManagers(FONode node, List lms); /** * Make a specific LayoutManager for the node. @@ -48,10 +49,8 @@ public interface LayoutManagerMaker { * an IllegalStateException is thrown. * @param node the FO node for which the LayoutManagers are made * @return The created LayoutManager - * @throws IllegalStateException if not exactly one - * LayoutManager is available for the requested node */ - public LayoutManager makeLayoutManager(FONode node); + LayoutManager makeLayoutManager(FONode node); /** * Make a PageSequenceLayoutManager object. @@ -59,7 +58,7 @@ public interface LayoutManagerMaker { * @param ps the fo:page-sequence object this PSLM will process * @return The created PageSequenceLayoutManager object */ - public PageSequenceLayoutManager makePageSequenceLayoutManager( + PageSequenceLayoutManager makePageSequenceLayoutManager( AreaTreeHandler ath, PageSequence ps); /** @@ -68,7 +67,7 @@ public interface LayoutManagerMaker { * @param ed the fox:external-document object to be processed * @return The created ExternalDocumentLayoutManager object */ - public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager( + ExternalDocumentLayoutManager makeExternalDocumentLayoutManager( AreaTreeHandler ath, ExternalDocument ed); /** @@ -77,7 +76,7 @@ public interface LayoutManagerMaker { * @param flow the fo:flow object this FLM will process * @return The created FlowLayoutManager object */ - public FlowLayoutManager makeFlowLayoutManager( + FlowLayoutManager makeFlowLayoutManager( PageSequenceLayoutManager pslm, Flow flow); /** @@ -86,7 +85,7 @@ public interface LayoutManagerMaker { * @param title the fo:title object this CLM will process * @return The created ContentLayoutManager object */ - public ContentLayoutManager makeContentLayoutManager( + ContentLayoutManager makeContentLayoutManager( PageSequenceLayoutManager pslm, Title title); /** @@ -97,7 +96,7 @@ public interface LayoutManagerMaker { * needs to be processed. * @return The created StaticContentLayoutManager object */ - public StaticContentLayoutManager makeStaticContentLayoutManager( + StaticContentLayoutManager makeStaticContentLayoutManager( PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg); /** @@ -107,7 +106,7 @@ public interface LayoutManagerMaker { * @param block the Block area this SCLM must add its areas to * @return The created StaticContentLayoutManager object */ - public StaticContentLayoutManager makeStaticContentLayoutManager( + StaticContentLayoutManager makeStaticContentLayoutManager( PageSequenceLayoutManager pslm, StaticContent sc, Block block); } diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java index cab2dd0ba..2acf67c1f 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java @@ -67,14 +67,12 @@ import org.apache.fop.fo.pagination.SideRegion; import org.apache.fop.fo.pagination.StaticContent; import org.apache.fop.fo.pagination.Title; import org.apache.fop.layoutmgr.inline.BasicLinkLayoutManager; -import org.apache.fop.layoutmgr.inline.BidiLayoutManager; import org.apache.fop.layoutmgr.inline.CharacterLayoutManager; import org.apache.fop.layoutmgr.inline.ContentLayoutManager; import org.apache.fop.layoutmgr.inline.ExternalGraphicLayoutManager; import org.apache.fop.layoutmgr.inline.FootnoteLayoutManager; import org.apache.fop.layoutmgr.inline.ICLayoutManager; import org.apache.fop.layoutmgr.inline.InlineLayoutManager; -import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager; import org.apache.fop.layoutmgr.inline.InstreamForeignObjectLM; import org.apache.fop.layoutmgr.inline.LeaderLayoutManager; import org.apache.fop.layoutmgr.inline.PageNumberCitationLastLayoutManager; @@ -93,11 +91,12 @@ import org.apache.fop.util.CharUtilities; public class LayoutManagerMapping implements LayoutManagerMaker { /** logging instance */ - protected static Log log = LogFactory.getLog(LayoutManagerMapping.class); + private static final Log LOG = LogFactory.getLog(LayoutManagerMapping.class); /** The map of LayoutManagerMakers */ private Map makers = new HashMap(); + /** default constructor */ public LayoutManagerMapping() { initialize(); } @@ -152,17 +151,15 @@ public class LayoutManagerMapping implements LayoutManagerMaker { makers.put(clazz, maker); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public void makeLayoutManagers(FONode node, List lms) { Maker maker = (Maker) makers.get(node.getClass()); if (maker == null) { if (FOElementMapping.URI.equals(node.getNamespaceURI())) { - log.error("No LayoutManager maker for class " + node.getClass()); + LOG.error("No LayoutManager maker for class " + node.getClass()); } else { - if (log.isDebugEnabled()) { - log.debug("Skipping the creation of a layout manager for " + node.getClass()); + if (LOG.isDebugEnabled()) { + LOG.debug("Skipping the creation of a layout manager for " + node.getClass()); } } } else { @@ -170,9 +167,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public LayoutManager makeLayoutManager(FONode node) { List lms = new ArrayList(); makeLayoutManagers(node, lms); @@ -188,30 +183,31 @@ public class LayoutManagerMapping implements LayoutManagerMaker { return (LayoutManager) lms.get(0); } + /** {@inheritDoc} */ public PageSequenceLayoutManager makePageSequenceLayoutManager( AreaTreeHandler ath, PageSequence ps) { return new PageSequenceLayoutManager(ath, ps); } - /* - * {@inheritDoc} - */ + /** {@inheritDoc} */ + public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager( + AreaTreeHandler ath, ExternalDocument ed) { + return new ExternalDocumentLayoutManager(ath, ed); + } + + /** {@inheritDoc} */ public FlowLayoutManager makeFlowLayoutManager( PageSequenceLayoutManager pslm, Flow flow) { return new FlowLayoutManager(pslm, flow); } - /* - * {@inheritDoc} - */ + /** {@inheritDoc} */ public ContentLayoutManager makeContentLayoutManager(PageSequenceLayoutManager pslm, Title title) { return new ContentLayoutManager(pslm, title); } - /* - * {@inheritDoc} - */ + /** {@inheritDoc} */ public StaticContentLayoutManager makeStaticContentLayoutManager( PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg) { return new StaticContentLayoutManager(pslm, sc, reg); @@ -223,13 +219,21 @@ public class LayoutManagerMapping implements LayoutManagerMaker { return new StaticContentLayoutManager(pslm, sc, block); } + /** a layout manager maker base class */ public static class Maker { + /** + * Create a layout manager. + * @param node the associated FO node + * @param lms a list of layout managers to which new manager is to be added + */ public void make(FONode node, List lms) { // no layout manager } } + /** a layout manager maker */ public static class FOTextLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { FOText foText = (FOText) node; if (foText.length() > 0) { @@ -238,9 +242,11 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } + /** a layout manager maker */ public static class BidiOverrideLayoutManagerMaker extends Maker { - // public static class BidiOverrideLayoutManagerMaker extends FObjMixedLayoutManagerMaker { - public void make(BidiOverride node, List lms) { + /** {@inheritDoc} */ + public void make(FONode node, List lms) { + /* [GA] remove broken code if (false) { // this is broken; it does nothing // it should make something like an InlineStackingLM @@ -254,29 +260,36 @@ public class LayoutManagerMapping implements LayoutManagerMaker { LayoutManager lm = (LayoutManager) childList.get(count); if (lm instanceof InlineLevelLayoutManager) { LayoutManager blm = new BidiLayoutManager - (node, (InlineLayoutManager) lm); + ((BidiOverride) node, (InlineLayoutManager) lm); lms.add(blm); } else { lms.add(lm); } } } + */ } } + /** a layout manager maker */ public static class InlineLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new InlineLayoutManager((InlineLevel) node)); } } + /** a layout manager maker */ public static class FootnodeLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new FootnoteLayoutManager((Footnote) node)); } } + /** a layout manager maker */ public static class InlineContainerLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { ArrayList childList = new ArrayList(); super.make(node, childList); @@ -284,25 +297,33 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } + /** a layout manager maker */ public static class BasicLinkLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new BasicLinkLayoutManager((BasicLink) node)); } } + /** a layout manager maker */ public static class BlockLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new BlockLayoutManager((Block) node)); } } + /** a layout manager maker */ public static class LeaderLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new LeaderLayoutManager((Leader) node)); } } + /** a layout manager maker */ public static class CharacterLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { Character foCharacter = (Character) node; if (foCharacter.getCharacter() != CharUtilities.CODE_EOT) { @@ -311,7 +332,9 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } + /** a layout manager maker */ public static class ExternalGraphicLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { ExternalGraphic eg = (ExternalGraphic) node; if (!eg.getSrc().equals("")) { @@ -320,49 +343,65 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } + /** a layout manager maker */ public static class BlockContainerLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new BlockContainerLayoutManager((BlockContainer) node)); } } + /** a layout manager maker */ public static class ListItemLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new ListItemLayoutManager((ListItem) node)); } } + /** a layout manager maker */ public static class ListBlockLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new ListBlockLayoutManager((ListBlock) node)); } } + /** a layout manager maker */ public static class InstreamForeignObjectLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new InstreamForeignObjectLM((InstreamForeignObject) node)); } } + /** a layout manager maker */ public static class PageNumberLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new PageNumberLayoutManager((PageNumber) node)); } } + /** a layout manager maker */ public static class PageNumberCitationLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new PageNumberCitationLayoutManager((PageNumberCitation) node)); } } + /** a layout manager maker */ public static class PageNumberCitationLastLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { lms.add(new PageNumberCitationLastLayoutManager((PageNumberCitationLast) node)); } } + /** a layout manager maker */ public static class TableLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { Table table = (Table) node; TableLayoutManager tlm = new TableLayoutManager(table); @@ -370,7 +409,9 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } + /** a layout manager maker */ public class RetrieveMarkerLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { Iterator baseIter; baseIter = node.getChildNodes(); @@ -384,7 +425,9 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } + /** a layout manager maker */ public class WrapperLayoutManagerMaker extends Maker { + /** {@inheritDoc} */ public void make(FONode node, List lms) { //We insert the wrapper LM before it's children so an ID //on the node can be registered on a page. @@ -401,9 +444,4 @@ public class LayoutManagerMapping implements LayoutManagerMaker { } } - public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager( - AreaTreeHandler ath, ExternalDocument ed) { - return new ExternalDocumentLayoutManager(ath, ed); - } - } diff --git a/src/java/org/apache/fop/layoutmgr/LeafPosition.java b/src/java/org/apache/fop/layoutmgr/LeafPosition.java index e1d5b2aaa..61ebfc5e7 100644 --- a/src/java/org/apache/fop/layoutmgr/LeafPosition.java +++ b/src/java/org/apache/fop/layoutmgr/LeafPosition.java @@ -19,24 +19,38 @@ package org.apache.fop.layoutmgr; +/** A leaf position. */ public class LeafPosition extends Position { private int leafPos; + /** + * Construct a leaf position. + * @param layoutManager the associated layout manager + * @param pos the leaf position + */ public LeafPosition(LayoutManager layoutManager, int pos) { super(layoutManager); leafPos = pos; } + /** + * Construct a leaf position. + * @param layoutManager the associated layout manager + * @param pos the leaf position + * @param index the index + */ public LeafPosition(LayoutManager layoutManager, int pos, int index) { super(layoutManager, index); leafPos = pos; } + /** @return leaf position */ public int getLeafPos() { return leafPos; } + /** {@inheritDoc} */ public boolean generatesAreas() { return getLM() != null; } diff --git a/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java b/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java index 7089dabda..42908262f 100644 --- a/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java +++ b/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java @@ -19,19 +19,27 @@ package org.apache.fop.layoutmgr; +/** A non-leaf position. */ public class NonLeafPosition extends Position { private Position subPos; + /** + * Construct a leaf position. + * @param lm the associated layout manager + * @param sub the position + */ public NonLeafPosition(LayoutManager lm, Position sub) { super(lm); subPos = sub; } + /** @return the sub position */ public Position getPosition() { return subPos; } + /** {@inheritDoc} */ public boolean generatesAreas() { return (subPos != null ? subPos.generatesAreas() : false); } diff --git a/src/java/org/apache/fop/layoutmgr/PageBreaker.java b/src/java/org/apache/fop/layoutmgr/PageBreaker.java index 25ecd5a75..171b3fd4f 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreaker.java @@ -54,6 +54,10 @@ public class PageBreaker extends AbstractBreaker { private StaticContentLayoutManager footnoteSeparatorLM = null; + /** + * Construct page breaker. + * @param pslm the page sequence layout manager + */ public PageBreaker(PageSequenceLayoutManager pslm) { this.pslm = pslm; this.pageProvider = pslm.getPageProvider(); @@ -382,7 +386,8 @@ public class PageBreaker extends AbstractBreaker { + " pageBreaks.size()= " + algRestart.getPageBreaks().size()); boolean fitsOnePage - = optimalPageCount <= pslm.getCurrentPV().getBodyRegion().getMainReference().getCurrentSpan().getColumnCount(); + = optimalPageCount <= pslm.getCurrentPV() + .getBodyRegion().getMainReference().getCurrentSpan().getColumnCount(); if (needColumnBalancing) { if (!fitsOnePage) { @@ -411,6 +416,7 @@ public class PageBreaker extends AbstractBreaker { addAreas(algRestart, optimalPageCount, originalList, effectiveList); } + /** {@inheritDoc} */ protected void startPart(BlockSequence list, int breakClass) { AbstractBreaker.log.debug("startPart() breakClass=" + getBreakClassName(breakClass)); if (pslm.getCurrentPage() == null) { @@ -442,6 +448,7 @@ public class PageBreaker extends AbstractBreaker { pslm.getCurrentPV().getPage().fakeNonEmpty(); } + /** {@inheritDoc} */ protected void finishPart(PageBreakingAlgorithm alg, PageBreakPosition pbp) { // add footnote areas if (pbp.footnoteFirstListIndex < pbp.footnoteLastListIndex @@ -473,7 +480,7 @@ public class PageBreaker extends AbstractBreaker { pslm.getCurrentPV().getCurrentSpan().notifyFlowsFinished(); } - /** @return the current child flow layout manager */ + /** {@inheritDoc} */ protected LayoutManager getCurrentChildLM() { return childFLM; } @@ -546,7 +553,8 @@ public class PageBreaker extends AbstractBreaker { * @param breakVal - value of break-before or break-after trait. */ private boolean needBlankPageBeforeNew(int breakVal) { - if (breakVal == Constants.EN_PAGE || (pslm.getCurrentPage().getPageViewport().getPage().isEmpty())) { + if (breakVal == Constants.EN_PAGE + || (pslm.getCurrentPage().getPageViewport().getPage().isEmpty())) { // any page is OK or we already have an empty page return false; } else { diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java index 8f60e51b7..e0b0cae11 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java @@ -103,8 +103,26 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { private int currentKeepContext = Constants.EN_AUTO; private KnuthNode lastBeforeKeepContextSwitch; - - public PageBreakingAlgorithm(LayoutManager topLevelLM, + /** + * Construct a page breaking algorithm. + * @param topLevelLM the top level layout manager + * @param pageProvider the page provider + * @param layoutListener the layout listener + * @param alignment alignment of the paragraph/page. One of {@link Constants#EN_START}, + * {@link Constants#EN_JUSTIFY}, {@link Constants#EN_CENTER}, + * {@link Constants#EN_END}. + * For pages, {@link Constants#EN_BEFORE} and {@link Constants#EN_AFTER} + * are mapped to the corresponding inline properties, + * {@link Constants#EN_START} and {@link Constants#EN_END}. + * @param alignmentLast alignment of the paragraph's last line + * @param footnoteSeparatorLength length of footnote separator + * @param partOverflowRecovery {@code true} if too long elements should be moved to + * the next line/part + * @param autoHeight true if auto height + * @param favorSinglePart true if favoring single part + * @see BreakingAlgorithm + */ + public PageBreakingAlgorithm(LayoutManager topLevelLM, // CSOK: ParameterNumber PageProvider pageProvider, PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, @@ -128,15 +146,16 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { protected class KnuthPageNode extends KnuthNode { /** Additional length due to footnotes. */ - public int totalFootnotes; + public int totalFootnotes; // CSOK: VisibilityModifier /** Index of the last inserted footnote. */ - public int footnoteListIndex; + public int footnoteListIndex; // CSOK: VisibilityModifier /** Index of the last inserted element of the last inserted footnote. */ - public int footnoteElementIndex; + public int footnoteElementIndex; // CSOK: VisibilityModifier - public KnuthPageNode(int position, int line, int fitness, + public KnuthPageNode(int position, // CSOK: ParameterNumber + int line, int fitness, int totalWidth, int totalStretch, int totalShrink, int totalFootnotes, int footnoteListIndex, int footnoteElementIndex, double adjustRatio, int availableShrink, int availableStretch, @@ -206,7 +225,8 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { log.debug("Recovering from too long: " + lastTooLong); log.debug("\tlastTooShort = " + getLastTooShort()); log.debug("\tlastBeforeKeepContextSwitch = " + lastBeforeKeepContextSwitch); - log.debug("\tcurrentKeepContext = " + AbstractBreaker.getBreakClassName(currentKeepContext)); + log.debug("\tcurrentKeepContext = " + + AbstractBreaker.getBreakClassName(currentKeepContext)); } if (lastBeforeKeepContextSwitch == null @@ -261,7 +281,8 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { } /** {@inheritDoc} */ - protected KnuthNode createNode(int position, int line, int fitness, + protected KnuthNode createNode(int position, // CSOK: ParameterNumber + int line, int fitness, int totalWidth, int totalStretch, int totalShrink, double adjustRatio, int availableShrink, int availableStretch, int difference, double totalDemerits, KnuthNode previous) { @@ -473,7 +494,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { KnuthPageNode pageNode = (KnuthPageNode) activeNode; int actualWidth = totalWidth - pageNode.totalWidth; int footnoteSplit = 0; - boolean canDeferOldFootnotes; + boolean canDeferOldFN; if (element.isPenalty()) { actualWidth += element.getWidth(); } @@ -492,11 +513,12 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { footnoteListIndex = footnotesList.size() - 1; footnoteElementIndex = getFootnoteList(footnoteListIndex).size() - 1; - } else if (((canDeferOldFootnotes - = checkCanDeferOldFootnotes(pageNode, elementIndex)) + } else if (((canDeferOldFN = canDeferOldFootnotes // CSOK: InnerAssignment + (pageNode, elementIndex)) || newFootnotes) - && (footnoteSplit = getFootnoteSplit(pageNode, - getLineWidth(activeNode.line) - actualWidth, canDeferOldFootnotes)) > 0) { + && (footnoteSplit = getFootnoteSplit // CSOK: InnerAssignment + (pageNode, getLineWidth(activeNode.line) - actualWidth, + canDeferOldFN)) > 0) { // it is allowed to break or even defer footnotes if either: // - there are new footnotes in the last piece of content, and // there is space to add at least a piece of the first one @@ -541,7 +563,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { * @param contentElementIndex index of the Knuth element considered for the * current page break */ - private boolean checkCanDeferOldFootnotes(KnuthPageNode node, int contentElementIndex) { + private boolean canDeferOldFootnotes(KnuthPageNode node, int contentElementIndex) { return (noBreakBetween(node.position, contentElementIndex) && deferredFootnotes(node.footnoteListIndex, node.footnoteElementIndex, node.totalFootnotes)); @@ -584,7 +606,8 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { index++) { if (par.getElement(index).isGlue() && par.getElement(index - 1).isBox() || par.getElement(index).isPenalty() - && ((KnuthElement) par.getElement(index)).getPenalty() < KnuthElement.INFINITE) { + && ((KnuthElement) par + .getElement(index)).getPenalty() < KnuthElement.INFINITE) { // break found break; } @@ -865,8 +888,9 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { insertedFootnotesLength = tmpLength; footnoteElementIndex = getFootnoteList(footnoteListIndex).size() - 1; - } else if ((split = getFootnoteSplit(footnoteListIndex, footnoteElementIndex, - insertedFootnotesLength, availableBPD, true)) > 0) { + } else if ((split = getFootnoteSplit // CSOK: InnerAssignment + (footnoteListIndex, footnoteElementIndex, + insertedFootnotesLength, availableBPD, true)) > 0) { // add a piece of a footnote availableBPD -= split; insertedFootnotesLength += split; @@ -1101,7 +1125,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { */ protected void addNode(int line, KnuthNode node) { if (node.position < par.size() - 1 && line > 0 - && (ipdDifference = compareIPDs(line - 1)) != 0) { + && (ipdDifference = compareIPDs(line - 1)) != 0) { // CSOK: InnerAssignment log.trace("IPD changes at page " + line); if (bestNodeForIPDChange == null || node.totalDemerits < bestNodeForIPDChange.totalDemerits) { diff --git a/src/java/org/apache/fop/layoutmgr/Position.java b/src/java/org/apache/fop/layoutmgr/Position.java index 10ad5878e..5cf6a893f 100644 --- a/src/java/org/apache/fop/layoutmgr/Position.java +++ b/src/java/org/apache/fop/layoutmgr/Position.java @@ -19,20 +19,30 @@ package org.apache.fop.layoutmgr; +/** A position. */ public class Position { private LayoutManager layoutManager; private int index = -1; + /** + * Construct a position. + * @param lm the associated layout manager + */ public Position(LayoutManager lm) { layoutManager = lm; } + /** + * Construct a position. + * @param lm the associated layout manager + * @param index the index + */ public Position(LayoutManager lm, int index) { this(lm); setIndex(index); } - + /** @return associated layout manager */ public LayoutManager getLM() { return layoutManager; } @@ -40,11 +50,13 @@ public class Position { /** * Overridden by NonLeafPosition to return the Position of its * child LM. + * @return a position or null */ public Position getPosition() { return null; } + /** @return true if generates areas */ public boolean generatesAreas() { return false; } @@ -67,12 +79,13 @@ public class Position { return this.index; } - public String getShortLMName() { + /** @return short name of associated layout manager */ + protected String getShortLMName() { if (getLM() != null) { String lm = getLM().toString(); int idx = lm.lastIndexOf('.'); if (idx >= 0 && lm.indexOf('@') > 0) { - return(lm.substring(idx + 1)); + return lm.substring(idx + 1); } else { return lm; } diff --git a/src/java/org/apache/fop/layoutmgr/PositionIterator.java b/src/java/org/apache/fop/layoutmgr/PositionIterator.java index b50035313..63ff8461a 100644 --- a/src/java/org/apache/fop/layoutmgr/PositionIterator.java +++ b/src/java/org/apache/fop/layoutmgr/PositionIterator.java @@ -22,6 +22,7 @@ package org.apache.fop.layoutmgr; import java.util.Iterator; import java.util.NoSuchElementException; +/** A position iterator. */ public abstract class PositionIterator implements Iterator { private Iterator parentIter; @@ -29,12 +30,17 @@ public abstract class PositionIterator implements Iterator { private LayoutManager childLM; private boolean bHasNext; + /** + * Construct position iterator. + * @param pIter an iterator to use as parent + */ protected PositionIterator(Iterator pIter) { parentIter = pIter; lookAhead(); //checkNext(); } + /** @return layout manager of next child layout manager or null */ public LayoutManager getNextChildLM() { // Move to next "segment" of iterator, ie: new childLM if (childLM == null && nextObj != null) { @@ -44,8 +50,16 @@ public abstract class PositionIterator implements Iterator { return childLM; } + /** + * @param nextObj next object from which to obtain position + * @return layout manager + */ protected abstract LayoutManager getLM(Object nextObj); + /** + * @param nextObj next object from which to obtain position + * @return position of next object + */ protected abstract Position getPos(Object nextObj); private void lookAhead() { @@ -57,6 +71,7 @@ public abstract class PositionIterator implements Iterator { } } + /** @return true if not at end of sub-sequence with same child layout manager */ protected boolean checkNext() { LayoutManager lm = getLM(nextObj); if (childLM == null) { @@ -70,17 +85,20 @@ public abstract class PositionIterator implements Iterator { return true; } + /** end (reset) iterator */ protected void endIter() { bHasNext = false; nextObj = null; childLM = null; } + /** {@inheritDoc} */ public boolean hasNext() { return (bHasNext && checkNext()); } + /** {@inheritDoc} */ public Object next() throws NoSuchElementException { if (bHasNext) { Object retObj = getPos(nextObj); @@ -91,10 +109,12 @@ public abstract class PositionIterator implements Iterator { } } + /** @return peek at next object */ public Object peekNext() { return nextObj; } + /** {@inheritDoc} */ public void remove() throws UnsupportedOperationException { throw new UnsupportedOperationException("PositionIterator doesn't support remove"); } diff --git a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java b/src/java/org/apache/fop/layoutmgr/SpaceResolver.java index 6dbf107f3..6890d4ebc 100644 --- a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java +++ b/src/java/org/apache/fop/layoutmgr/SpaceResolver.java @@ -32,10 +32,10 @@ import org.apache.fop.traits.MinOptMax; * UnresolvedListElements descendants by the right combination of KnuthElements on an element * list. */ -public class SpaceResolver { +public final class SpaceResolver { /** Logger instance */ - protected static Log log = LogFactory.getLog(SpaceResolver.class); + private static final Log LOG = LogFactory.getLog(SpaceResolver.class); private UnresolvedListElementWithLength[] firstPart; private BreakElement breakPoss; @@ -93,25 +93,25 @@ public class SpaceResolver { //Add pending elements from higher level FOs if (breakPoss != null) { if (breakPoss.getPendingAfterMarks() != null) { - if (log.isTraceEnabled()) { - log.trace(" adding pending before break: " + if (LOG.isTraceEnabled()) { + LOG.trace(" adding pending before break: " + breakPoss.getPendingAfterMarks()); } first.addAll(0, breakPoss.getPendingAfterMarks()); } if (breakPoss.getPendingBeforeMarks() != null) { - if (log.isTraceEnabled()) { - log.trace(" adding pending after break: " + if (LOG.isTraceEnabled()) { + LOG.trace(" adding pending after break: " + breakPoss.getPendingBeforeMarks()); } second.addAll(0, breakPoss.getPendingBeforeMarks()); } } - if (log.isTraceEnabled()) { - log.trace("before: " + first); - log.trace(" break: " + breakPoss); - log.trace("after: " + second); - log.trace("NO-BREAK: " + toString(noBreak, noBreakLengths)); + if (LOG.isTraceEnabled()) { + LOG.trace("before: " + first); + LOG.trace(" break: " + breakPoss); + LOG.trace("after: " + second); + LOG.trace("NO-BREAK: " + toString(noBreak, noBreakLengths)); } if (first != null) { @@ -163,15 +163,15 @@ public class SpaceResolver { if (elems[effIndex] instanceof BorderOrPaddingElement) { BorderOrPaddingElement bop = (BorderOrPaddingElement)elems[effIndex]; if (bop.isConditional() && !(bop.isFirst() || bop.isLast())) { - if (log.isDebugEnabled()) { - log.debug("Nulling conditional element: " + bop); + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling conditional element: " + bop); } lengths[effIndex] = null; } } } - if (log.isTraceEnabled() && elems.length > 0) { - log.trace("-->Resulting list: " + toString(elems, lengths)); + if (LOG.isTraceEnabled() && elems.length > 0) { + LOG.trace("-->Resulting list: " + toString(elems, lengths)); } } @@ -193,20 +193,20 @@ public class SpaceResolver { } else if (!elems[effIndex].isConditional()) { break; } - if (log.isDebugEnabled()) { - log.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]); + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]); } lengths[effIndex] = null; } - if (log.isTraceEnabled() && elems.length > 0) { - log.trace("-->Resulting list: " + toString(elems, lengths)); + if (LOG.isTraceEnabled() && elems.length > 0) { + LOG.trace("-->Resulting list: " + toString(elems, lengths)); } } private void performSpaceResolutionRules2to3(UnresolvedListElement[] elems, MinOptMax[] lengths, int start, int end) { - if (log.isTraceEnabled()) { - log.trace("rule 2-3: " + start + "-" + end); + if (LOG.isTraceEnabled()) { + LOG.trace("rule 2-3: " + start + "-" + end); } SpaceElement space; int remaining; @@ -235,8 +235,8 @@ public class SpaceResolver { } space = (SpaceElement)elems[i]; if (!space.isForcing()) { - if (log.isDebugEnabled()) { - log.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: " + elems[i]); } lengths[i] = null; @@ -255,8 +255,8 @@ public class SpaceResolver { space = (SpaceElement)elems[i]; highestPrecedence = Math.max(highestPrecedence, space.getPrecedence()); } - if (highestPrecedence != 0 && log.isDebugEnabled()) { - log.debug("Highest precedence is " + highestPrecedence); + if (highestPrecedence != 0 && LOG.isDebugEnabled()) { + LOG.debug("Highest precedence is " + highestPrecedence); } //Suppress space-specifiers with lower precedence remaining = 0; @@ -267,8 +267,8 @@ public class SpaceResolver { } space = (SpaceElement)elems[i]; if (space.getPrecedence() != highestPrecedence) { - if (log.isDebugEnabled()) { - log.debug("Nulling space-specifier with precedence " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling space-specifier with precedence " + space.getPrecedence() + " using 4.3.1, rule 3: " + elems[i]); } @@ -278,8 +278,8 @@ public class SpaceResolver { remaining++; } } - if (log.isDebugEnabled()) { - log.debug("Greatest optimum: " + greatestOptimum); + if (LOG.isDebugEnabled()) { + LOG.debug("Greatest optimum: " + greatestOptimum); } if (remaining <= 1) { return; @@ -292,8 +292,8 @@ public class SpaceResolver { } space = (SpaceElement)elems[i]; if (space.getLength().getOpt() < greatestOptimum) { - if (log.isDebugEnabled()) { - log.debug("Nulling space-specifier with smaller optimum length " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling space-specifier with smaller optimum length " + "using 4.3.1, rule 3: " + elems[i]); } @@ -316,8 +316,8 @@ public class SpaceResolver { min = Math.max(min, space.getLength().getMin()); max = Math.min(max, space.getLength().getMax()); if (remaining > 1) { - if (log.isDebugEnabled()) { - log.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: " + if (LOG.isDebugEnabled()) { + LOG.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: " + elems[i]); } lengths[i] = null; @@ -327,9 +327,9 @@ public class SpaceResolver { } } - if (log.isTraceEnabled() && elems.length > 0) { - log.trace("Remaining spaces: " + remaining); - log.trace("-->Resulting list: " + toString(elems, lengths)); + if (LOG.isTraceEnabled() && elems.length > 0) { + LOG.trace("Remaining spaces: " + remaining); + LOG.trace("-->Resulting list: " + toString(elems, lengths)); } } @@ -389,7 +389,7 @@ public class SpaceResolver { if (hasFirstPart()) { //Now that we've handled isFirst/isLast conditions, we need to look at the //active part in its normal order so swap it back. - log.trace("Swapping first and second parts."); + LOG.trace("Swapping first and second parts."); UnresolvedListElementWithLength[] tempList; MinOptMax[] tempLengths; tempList = secondPart; @@ -439,7 +439,8 @@ public class SpaceResolver { } // No break - // TODO: We can't use a MinOptMax for glue2, because min <= opt <= max is not always true - why? + // TODO: We can't use a MinOptMax for glue2, + // because min <= opt <= max is not always true - why? MinOptMax noBreakLength = sum(noBreakLengths); MinOptMax spaceSum = spaceBeforeBreak.plus(spaceAfterBreak); int glue2width = noBreakLength.getOpt() - spaceSum.getOpt(); @@ -543,6 +544,7 @@ public class SpaceResolver { return this.originalPosition; } + /** {@inheritDoc} */ public Position getPosition() { return originalPosition; } @@ -595,8 +597,8 @@ public class SpaceResolver { * @param elems the element list */ public static void resolveElementList(List elems) { - if (log.isTraceEnabled()) { - log.trace(elems); + if (LOG.isTraceEnabled()) { + LOG.trace(elems); } boolean first = true; boolean last = false; @@ -608,8 +610,8 @@ public class SpaceResolver { while (iter.hasNext()) { ListElement el = (ListElement)iter.next(); if (el.isUnresolvedElement()) { - if (log.isTraceEnabled()) { - log.trace("unresolved found: " + el + " " + first + "/" + last); + if (LOG.isTraceEnabled()) { + LOG.trace("unresolved found: " + el + " " + first + "/" + last); } BreakElement breakPoss = null; //Clear temp lists @@ -646,7 +648,7 @@ public class SpaceResolver { } //last = !iter.hasNext(); if (breakPoss == null && unresolvedSecond.size() == 0 && !last) { - log.trace("Swap first and second parts in no-break condition," + LOG.trace("Swap first and second parts in no-break condition," + " second part is empty."); //The first list is reversed, so swap if this shouldn't happen List swapList = unresolvedSecond; @@ -654,7 +656,7 @@ public class SpaceResolver { unresolvedFirst = swapList; } - log.debug("----start space resolution (first=" + first + ", last=" + last + ")..."); + LOG.debug("----start space resolution (first=" + first + ", last=" + last + ")..."); SpaceResolver resolver = new SpaceResolver( unresolvedFirst, breakPoss, unresolvedSecond, first, last); if (!last) { @@ -664,7 +666,7 @@ public class SpaceResolver { if (!last && skipNextElement) { iter.next(); } - log.debug("----end space resolution."); + LOG.debug("----end space resolution."); } first = false; } diff --git a/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java b/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java index 140d90bb8..83a67b101 100644 --- a/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java +++ b/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java @@ -155,6 +155,7 @@ public class SpaceSpecifier implements Cloneable { return resolvedSpace; } + /** {@inheritDoc} */ public String toString() { return "Space Specifier (resolved at begin/end of ref. area:):\n" + resolve(false) + "\n" + resolve(true); diff --git a/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java b/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java index 72fddf199..2091484a4 100644 --- a/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java @@ -33,18 +33,18 @@ public interface TopLevelLayoutManager { * page sequence will be created and sent to the AreaTreeModel * for rendering. */ - public void activateLayout(); + void activateLayout(); /** * Act upon the force-page-count trait, * in relation to the initial-page-number trait of the following page-sequence. * @param nextPageSeqInitialPageNumber initial-page-number trait of next page-sequence */ - public void doForcePageCount(Numeric nextPageSeqInitialPageNumber); + void doForcePageCount(Numeric nextPageSeqInitialPageNumber); /** * Finished the page-sequence and notifies everyone about it. */ - public void finishPageSequence(); + void finishPageSequence(); }
\ No newline at end of file diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java index 911b6dcc6..6039ad941 100644 --- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java +++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java @@ -39,10 +39,13 @@ import org.apache.fop.traits.MinOptMax; /** * This is a helper class used for setting common traits on areas. */ -public class TraitSetter { +public final class TraitSetter { + + private TraitSetter() { + } /** logger */ - protected static Log log = LogFactory.getLog(TraitSetter.class); + private static final Log LOG = LogFactory.getLog(TraitSetter.class); /** * Sets border and padding traits on areas. @@ -339,7 +342,7 @@ public class TraitSetter { + backProps.backgroundPositionHorizontal.getValue(refContext)); } else { // TODO Area IPD has to be set for this to work - log.warn("Horizontal background image positioning ignored" + LOG.warn("Horizontal background image positioning ignored" + " because the IPD was not set on the area." + " (Yes, it's a bug in FOP)"); } @@ -356,7 +359,7 @@ public class TraitSetter { + backProps.backgroundPositionVertical.getValue(refContext)); } else { // TODO Area BPD has to be set for this to work - log.warn("Vertical background image positioning ignored" + LOG.warn("Vertical background image positioning ignored" + " because the BPD was not set on the area." + " (Yes, it's a bug in FOP)"); } @@ -407,7 +410,7 @@ public class TraitSetter { back.setHoriz(horizontal); } else { //TODO Area IPD has to be set for this to work - log.warn("Horizontal background image positioning ignored" + LOG.warn("Horizontal background image positioning ignored" + " because the IPD was not set on the area." + " (Yes, it's a bug in FOP)"); } @@ -431,7 +434,7 @@ public class TraitSetter { back.setVertical(vertical); } else { //TODO Area BPD has to be set for this to work - log.warn("Vertical background image positioning ignored" + LOG.warn("Vertical background image positioning ignored" + " because the BPD was not set on the area." + " (Yes, it's a bug in FOP)"); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java index a74fac743..e090fbae6 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java @@ -30,7 +30,6 @@ import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; import org.apache.fop.layoutmgr.LayoutContext; -import org.apache.fop.layoutmgr.LayoutManager; import org.apache.fop.layoutmgr.PositionIterator; import org.apache.fop.layoutmgr.TraitSetter; @@ -99,10 +98,9 @@ public abstract class AbstractPageNumberCitationLayoutManager extends LeafNodeLa } /** - * If id can be resolved then simply return a word, otherwise + * If id can be resolved then simply return a text area, otherwise * return a resolvable area * - * @param parentLM the parent LayoutManager * @return a corresponding InlineArea */ private InlineArea getPageNumberCitationInlineArea() { diff --git a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java b/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java index 4eb0abd64..07d153eed 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java +++ b/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java @@ -237,6 +237,8 @@ public class AlignmentContext implements Constants { case EN_MATHEMATICAL: this.alignmentBaselineIdentifier = alignmentBaseline; break; + default: + break; } } @@ -307,7 +309,6 @@ public class AlignmentContext implements Constants { * Calculates the baseline shift value based on the baseline-shift * property value. * @param baselineShift the baseline shift property value - * @return the computed baseline shift value */ private void setBaselineShift(Length baselineShift) { baselineShiftValue = 0; @@ -331,6 +332,9 @@ public class AlignmentContext implements Constants { , LengthBase.CUSTOM_BASE , parentAlignmentContext.getLineHeight())); break; + default: + break; + } } @@ -354,10 +358,12 @@ public class AlignmentContext implements Constants { return parentAlignmentContext.getScaledBaselineTable() .getBaseline(alignmentBaselineIdentifier) - scaledBaselineTable - .deriveScaledBaselineTable(parentAlignmentContext.getDominantBaselineIdentifier()) + .deriveScaledBaselineTable(parentAlignmentContext + .getDominantBaselineIdentifier()) .getBaseline(alignmentBaselineIdentifier) - scaledBaselineTable - .getBaseline(parentAlignmentContext.getDominantBaselineIdentifier()) + .getBaseline(parentAlignmentContext + .getDominantBaselineIdentifier()) + baselineShiftValue; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java b/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java index 73f414bf7..467f2e154 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java +++ b/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java @@ -21,9 +21,7 @@ package org.apache.fop.layoutmgr.inline; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.datatypes.Length; -import org.apache.fop.datatypes.LengthBase; -import org.apache.fop.datatypes.SimplePercentBaseContext; + import org.apache.fop.fo.Constants; @@ -96,39 +94,44 @@ public class BasicScaledBaselineTable implements ScaledBaselineTable, Constants * @return the baseline offset */ public int getBaseline(int baselineIdentifier) { - int offset = 0; + int offset; if (!isHorizontalWritingMode()) { switch (baselineIdentifier) { + default: case EN_TOP: case EN_TEXT_TOP: case EN_TEXT_BOTTOM: case EN_BOTTOM: log.warn("The given baseline is only supported for horizontal" + " writing modes"); - return 0; + offset = 0; + } + } else { + switch (baselineIdentifier) { + case EN_TOP: // fall through + case EN_BEFORE_EDGE: + offset = beforeEdgeOffset; + break; + case EN_TEXT_TOP: + case EN_TEXT_BEFORE_EDGE: + case EN_HANGING: + case EN_CENTRAL: + case EN_MIDDLE: + case EN_MATHEMATICAL: + case EN_ALPHABETIC: + case EN_IDEOGRAPHIC: + case EN_TEXT_BOTTOM: + case EN_TEXT_AFTER_EDGE: + offset = getBaselineDefaultOffset(baselineIdentifier) - dominantBaselineOffset; + break; + case EN_BOTTOM: // fall through + case EN_AFTER_EDGE: + offset = afterEdgeOffset; + break; + default: + offset = 0; + break; } - } - switch (baselineIdentifier) { - case EN_TOP: // fall through - case EN_BEFORE_EDGE: - offset = beforeEdgeOffset; - break; - case EN_TEXT_TOP: - case EN_TEXT_BEFORE_EDGE: - case EN_HANGING: - case EN_CENTRAL: - case EN_MIDDLE: - case EN_MATHEMATICAL: - case EN_ALPHABETIC: - case EN_IDEOGRAPHIC: - case EN_TEXT_BOTTOM: - case EN_TEXT_AFTER_EDGE: - offset = getBaselineDefaultOffset(baselineIdentifier) - dominantBaselineOffset; - break; - case EN_BOTTOM: // fall through - case EN_AFTER_EDGE: - offset = afterEdgeOffset; - break; } return offset; } @@ -168,6 +171,8 @@ public class BasicScaledBaselineTable implements ScaledBaselineTable, Constants case EN_TEXT_AFTER_EDGE: offset = depth; break; + default: + break; } return offset; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java index d5b2e5803..f342399fc 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java @@ -35,6 +35,11 @@ public class BidiLayoutManager extends LeafNodeLayoutManager { private List children; + /** + * Construct bidi layout manager. + * @param node bidi override FO + * @param cLM parent layout manager + */ public BidiLayoutManager(BidiOverride node, InlineLayoutManager cLM) { super(node); setParent(cLM); @@ -53,10 +58,15 @@ public class BidiLayoutManager extends LeafNodeLayoutManager { */ } + /** @return number of children */ public int size() { return children.size(); } + /** + * @param index of child inline area + * @return a child inline area + */ public InlineArea get(int index) { return (InlineArea) children.get(index); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java index a19680f51..ed22886a4 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java @@ -207,7 +207,8 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { new LeafPosition(this, -1), true)); returnList.add(new KnuthGlue(letterSpaceIPD.mult(areaInfo.iLScount), new LeafPosition(this, -1), true)); - returnList.add(new KnuthInlineBox(0, null, notifyPos(new LeafPosition(this, -1)), true)); + returnList.add + (new KnuthInlineBox(0, null, notifyPos(new LeafPosition(this, -1)), true)); if (areaInfo.bHyphenated) { returnList.add(new KnuthPenalty(hyphIPD, KnuthPenalty.FLAGGED_PENALTY, true, new LeafPosition(this, -1), false)); diff --git a/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java index d0dcc2bb8..598a641d5 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java @@ -67,6 +67,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager * Constructs a new ContentLayoutManager * * @param area The parent area + * @param parentLM the parent layout manager */ public ContentLayoutManager(Area area, LayoutManager parentLM) { holder = area; @@ -100,11 +101,12 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager } } + /** {@inheritDoc} */ public void initialize() { // Empty } - public void fillArea(LayoutManager curLM) { + private void fillArea(LayoutManager curLM) { int ipd = 1000000; @@ -150,6 +152,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager curLM.addAreas(contentPosIter, lc); } + /** {@inheritDoc} */ public void addAreas(PositionIterator posIter, LayoutContext context) { // add the content areas // the area width has already been adjusted, and it must remain unchanged @@ -163,6 +166,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager ((InlineArea)holder).setIPD(savedIPD); } + /** @return stack size */ public int getStackingSize() { return stackSize; } @@ -248,6 +252,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager } } + /** {@inheritDoc} */ public List getNextKnuthElements(LayoutContext context, int alignment) { List contentList = new LinkedList(); List returnedList; @@ -264,7 +269,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager Object obj = returnedList.remove(0); if (obj instanceof KnuthSequence) { KnuthSequence ks = (KnuthSequence)obj; - for (Iterator it = ks.iterator(); it.hasNext(); ) { + for (Iterator it = ks.iterator(); it.hasNext();) { contentElement = (KnuthElement)it.next(); stackSize += contentElement.getWidth(); contentList.add(contentElement); @@ -282,6 +287,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager return contentList; } + /** {@inheritDoc} */ public List addALetterSpaceTo(List oldList) { return oldList; } @@ -296,23 +302,28 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager log.warn(this.getClass().getName() + " should not receive a call to removeWordSpace(list)"); } + /** {@inheritDoc} */ public String getWordChars(Position pos) { return ""; } + /** {@inheritDoc} */ public void hyphenate(Position pos, HyphContext hc) { } + /** {@inheritDoc} */ public boolean applyChanges(List oldList) { return false; } + /** {@inheritDoc} */ public List getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/ int alignment) { return null; } + /** {@inheritDoc} */ public PageSequenceLayoutManager getPSLM() { return parentLM.getPSLM(); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java b/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java index 881608e08..ffc57fa16 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java +++ b/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java @@ -32,10 +32,14 @@ public class HyphContext { private int currentOffset = 0; private int currentIndex = 0; + /** + * @param hyphPoints number of hyphenation points + */ public HyphContext(int[] hyphPoints) { this.hyphPoints = hyphPoints; } + /** @return next hyphenation point */ public int getNextHyphPoint() { for (; currentIndex < hyphPoints.length; currentIndex++) { if (hyphPoints[currentIndex] > currentOffset) { @@ -45,6 +49,7 @@ public class HyphContext { return -1; // AT END! } + /** @return true if more hyphenation points */ public boolean hasMoreHyphPoints() { for (; currentIndex < hyphPoints.length; currentIndex++) { if (hyphPoints[currentIndex] > currentOffset) { @@ -54,6 +59,7 @@ public class HyphContext { return false; } + /** @param iCharsProcessed amount to extend offset */ public void updateOffset(int iCharsProcessed) { currentOffset += iCharsProcessed; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java index c47a7e682..7fe90f63c 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java @@ -33,11 +33,20 @@ import org.apache.fop.fo.flow.InlineContainer; public class ICLayoutManager extends LeafNodeLayoutManager { private List childrenLM; + /** + * Construct inline container layout manager. + * @param node inline container FO node + * @param childLM child layout manager + */ public ICLayoutManager(InlineContainer node, List childLM) { super(node); childrenLM = childLM; } + /** + * @param index an integer + * @return an inline area or null + */ public InlineArea get(int index) { return null; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java index 26f8e3b97..82285d106 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java @@ -239,7 +239,8 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements // CSOK: MethodLength + (LayoutContext context, int alignment) { LayoutManager curLM; // the list returned by child LM @@ -434,7 +435,7 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { // layout context given to the other LMs. List positionList = new LinkedList(); NonLeafPosition pos; - LayoutManager lastLM = null;// last child LM in this iterator + LayoutManager lastLM = null; // last child LM in this iterator Position lastPos = null; while (parentIter.hasNext()) { pos = (NonLeafPosition) parentIter.next(); @@ -553,13 +554,13 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { if (returnList instanceof BlockKnuthSequence) { return; } - CommonBorderPaddingBackground borderAndPadding = - ((InlineLevel)fobj).getCommonBorderPaddingBackground(); + CommonBorderPaddingBackground borderAndPadding + = ((InlineLevel)fobj).getCommonBorderPaddingBackground(); if (borderAndPadding != null) { int ipStart = borderAndPadding.getBorderStartWidth(false) + borderAndPadding.getPaddingStart(false, this); if (ipStart > 0) { - returnList.add(0,new KnuthBox(ipStart, getAuxiliaryPosition(), true)); + returnList.add(0, new KnuthBox(ipStart, getAuxiliaryPosition(), true)); } } } @@ -578,8 +579,8 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { if (returnList instanceof BlockKnuthSequence) { return; } - CommonBorderPaddingBackground borderAndPadding = - ((InlineLevel)fobj).getCommonBorderPaddingBackground(); + CommonBorderPaddingBackground borderAndPadding + = ((InlineLevel)fobj).getCommonBorderPaddingBackground(); if (borderAndPadding != null) { int ipEnd = borderAndPadding.getBorderEndWidth(false) + borderAndPadding.getPaddingEnd(false, this); diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java index c9c65e769..f286fbf6c 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java @@ -32,7 +32,10 @@ public interface InlineLevelEventProducer extends EventProducer { /** * Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java index 525f0407d..11f2ea000 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java @@ -51,6 +51,7 @@ public interface InlineLevelLayoutManager extends LayoutManager { * Get the word chars corresponding to the given position. * * @param pos the position referring to the needed word chars. + * @return the word chars */ String getWordChars(Position pos); diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java index 375afb82f..4a6a59615 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java @@ -46,16 +46,27 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager implements InlineLevelLayoutManager { + /** + * A stacking iterator. + */ protected static class StackingIter extends PositionIterator { StackingIter(Iterator parentIter) { super(parentIter); } + /** + * @param nextObj the next object + * @return layout manager of next object + */ protected LayoutManager getLM(Object nextObj) { return ((Position) nextObj).getLM(); } + /** + * @param nextObj the next object + * @return position of next object + */ protected Position getPos(Object nextObj) { return ((Position) nextObj); } @@ -218,10 +229,10 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager // The last element may not have a layout manager (its position == null); // this may happen if it is a padding box; see bug 39571. - InlineLevelLayoutManager LM = - (InlineLevelLayoutManager) element.getLayoutManager(); - if (LM != null) { - oldList = LM.addALetterSpaceTo(oldList); + InlineLevelLayoutManager lm + = (InlineLevelLayoutManager) element.getLayoutManager(); + if (lm != null) { + oldList = lm.addALetterSpaceTo(oldList); } // "wrap" again the Position stored in each element of oldList oldListIterator = oldList.listIterator(); diff --git a/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java b/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java index 7b08a67db..312a58fc0 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java +++ b/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java @@ -23,6 +23,9 @@ import org.apache.fop.layoutmgr.FootnoteBodyLayoutManager; import org.apache.fop.layoutmgr.KnuthBox; import org.apache.fop.layoutmgr.Position; +/** + * A knuth inline box. + */ public class KnuthInlineBox extends KnuthBox { private FootnoteBodyLayoutManager footnoteBodyLM = null; @@ -36,7 +39,8 @@ public class KnuthInlineBox extends KnuthBox { * @param pos the Position stored in this box * @param auxiliary is this box auxiliary? */ - public KnuthInlineBox(int width, AlignmentContext alignmentContext, Position pos, boolean auxiliary) { + public KnuthInlineBox + (int width, AlignmentContext alignmentContext, Position pos, boolean auxiliary) { super(width, pos, auxiliary); this.alignmentContext = alignmentContext; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java index c5f38134b..2a58b2018 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java @@ -344,4 +344,10 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { this.contentAreaIPD = contentAreaIPD; } + /** {@inheritDoc} */ + public void reset() { + childLMs.clear(); + super.reset(); + } + } diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java index e74b51d96..f5a0a51f8 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java @@ -48,6 +48,7 @@ import org.apache.fop.traits.MinOptMax; * an exception to this rule.) * This class can be extended to handle the creation and adding of the * inline area. + * @asf.todo [GA] replace use of hungarian notation with normalized java naming */ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager implements InlineLevelLayoutManager { @@ -75,11 +76,22 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager * Store information about the inline area */ protected class AreaInfo { + /** letter space count */ protected short iLScount; + /** ipd of area */ protected MinOptMax ipdArea; + /** true if hyphenated */ protected boolean bHyphenated; + /** alignment context */ protected AlignmentContext alignmentContext; + /** + * Construct an area information item. + * @param iLS letter space count + * @param ipd inline progression dimension + * @param bHyph true if hyphenated + * @param alignmentContext an alignment context + */ public AreaInfo(short iLS, MinOptMax ipd, boolean bHyph, AlignmentContext alignmentContext) { iLScount = iLS; diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index 0ece70cac..7e87de241 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -132,10 +132,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager private int spaceAfter; private int baseline; - LineBreakPosition(LayoutManager lm, int index, int startIndex, int breakIndex, - int shrink, int stretch, int diff, - double ipdA, double adjust, int ind, - int lh, int lw, int sb, int sa, int bl) { + LineBreakPosition // CSOK: ParameterNumber + (LayoutManager lm, int index, int startIndex, int breakIndex, + int shrink, int stretch, int diff, double ipdA, double adjust, int ind, + int lh, int lw, int sb, int sa, int bl) { super(lm, breakIndex); availableShrink = shrink; availableStretch = stretch; @@ -174,7 +174,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager private List knuthParagraphs; private LineLayoutPossibilities lineLayouts; - private List lineLayoutsList; + private LineLayoutPossibilities[] lineLayoutsList; private int ipd = 0; /** * When layout must be re-started due to a change of IPD, there is no need @@ -198,11 +198,17 @@ public class LineLayoutManager extends InlineStackingLayoutManager */ private class Update { private InlineLevelLayoutManager inlineLM; - private int iFirstIndex; + private int firstIndex; public Update(InlineLevelLayoutManager lm, int index) { inlineLM = lm; - iFirstIndex = index; + firstIndex = index; + } + InlineLevelLayoutManager getInlineLM() { + return inlineLM; + } + int getFirstIndex() { + return firstIndex; } } @@ -325,11 +331,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager private int follow; private static final double MAX_DEMERITS = 10e6; - public LineBreakingAlgorithm (int pageAlign, - int textAlign, int textAlignLast, - int indent, int fillerWidth, - int lh, int ld, int fl, boolean first, - int maxFlagCount, LineLayoutManager llm) { + public LineBreakingAlgorithm // CSOK: ParameterNumber + (int pageAlign, int textAlign, int textAlignLast, int indent, int fillerWidth, + int lh, int ld, int fl, boolean first, int maxFlagCount, LineLayoutManager llm) { super(textAlign, textAlignLast, first, false, maxFlagCount); pageAlignment = pageAlign; textIndent = indent; @@ -357,7 +361,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager int textAlign = (bestActiveNode.line < total) ? alignment : alignmentLast; indent += (textAlign == Constants.EN_CENTER) ? difference / 2 : (textAlign == Constants.EN_END) ? difference : 0; - indent += (bestActiveNode.line == 1 && indentFirstPart && isFirstInBlock) ? textIndent : 0; + indent += (bestActiveNode.line == 1 && indentFirstPart && isFirstInBlock) + ? textIndent : 0; double ratio = (textAlign == Constants.EN_JUSTIFY || difference < 0 && -difference <= bestActiveNode.availableShrink) ? bestActiveNode.adjustRatio : 0; @@ -405,14 +410,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager activePossibility = -1; } - private LineBreakPosition makeLineBreakPosition(KnuthSequence par, - int firstElementIndex, - int lastElementIndex, - int availableShrink, - int availableStretch, - int difference, - double ratio, - int indent) { + private LineBreakPosition makeLineBreakPosition // CSOK: ParameterNumber + (KnuthSequence par, int firstElementIndex, int lastElementIndex, int availableShrink, + int availableStretch, int difference, double ratio, int indent) { // line height calculation - spaceBefore may differ from spaceAfter // by 1mpt due to rounding int spaceBefore = (lineHeight - lead - follow) / 2; @@ -501,7 +501,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager //log.debug("LBA.filterActiveNodes> " + activeNodeCount + " layouts"); for (int i = startLine; i < endLine; i++) { for (KnuthNode node = getNode(i); node != null; node = node.next) { - //log.debug(" + lines = " + node.line + " demerits = " + node.totalDemerits); + //log.debug(" + lines = " + //+ node.line + " demerits = " + node.totalDemerits); bestActiveNode = compareNodes(bestActiveNode, node); } } @@ -514,10 +515,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager //if (false) { if (node.line != bestActiveNode.line && node.totalDemerits > MAX_DEMERITS) { - //log.debug(" XXX lines = " + node.line + " demerits = " + node.totalDemerits); + //log.debug(" XXX lines = " + //+ node.line + " demerits = " + node.totalDemerits); removeNode(i, node); } else { - //log.debug(" ok lines = " + node.line + " demerits = " + node.totalDemerits); + //log.debug(" ok lines = " + //+ node.line + " demerits = " + node.totalDemerits); } } } @@ -592,6 +595,15 @@ public class LineLayoutManager extends InlineStackingLayoutManager return createLineBreaks(context.getBPAlignment(), context); } + /** + * Get a sequence of KnuthElements representing the content + * of the node assigned to the LM. + * @param context the LayoutContext used to store layout information + * @param alignment the desired text alignment + * @param restartPosition position at restart + * @return the list of KnuthElements + * @see LayoutManager#getNextKnuthElements(LayoutContext,int) + */ public List getNextKnuthElements(LayoutContext context, int alignment, LeafPosition restartPosition) { log.trace("Restarting line breaking from index " + restartPosition.getIndex()); @@ -705,7 +717,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager // finish last paragraph if it was closed with a linefeed if (lastElement.isPenalty() - && ((KnuthPenalty) lastElement).getPenalty() == -KnuthPenalty.INFINITE) { + && ((KnuthPenalty) lastElement).getPenalty() == -KnuthPenalty.INFINITE) { // a penalty item whose value is -inf // represents a preserved linefeed, // which forces a line break @@ -750,11 +762,11 @@ public class LineLayoutManager extends InlineStackingLayoutManager */ private List createLineBreaks(int alignment, LayoutContext context) { // find the optimal line breaking points for each paragraph - ListIterator paragraphsIterator = knuthParagraphs.listIterator(knuthParagraphs.size()); - lineLayoutsList = new ArrayList(knuthParagraphs.size()); + Iterator paragraphsIterator = knuthParagraphs.iterator(); + lineLayoutsList = new LineLayoutPossibilities[knuthParagraphs.size()]; LineLayoutPossibilities llPoss; - while (paragraphsIterator.hasPrevious()) { - KnuthSequence seq = (KnuthSequence) paragraphsIterator.previous(); + for (int i = 0; paragraphsIterator.hasNext(); i++) { + KnuthSequence seq = (KnuthSequence) paragraphsIterator.next(); if (!seq.isInlineSequence()) { // This set of line layout possibilities does not matter; // we only need an entry in lineLayoutsList. @@ -762,7 +774,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager } else { llPoss = findOptimalBreakingPoints(alignment, (Paragraph) seq); } - lineLayoutsList.add(0, llPoss); + lineLayoutsList[i] = llPoss; } setFinished(true); @@ -818,7 +830,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager } // now try something different - log.debug("Hyphenation possible? " + (hyphenationProperties.hyphenate.getEnum() == EN_TRUE)); + log.debug("Hyphenation possible? " + + (hyphenationProperties.hyphenate.getEnum() == EN_TRUE)); if (hyphenationProperties.hyphenate.getEnum() == EN_TRUE && !(allowedBreaks == BreakingAlgorithm.ONLY_FORCED_BREAKS)) { // consider every hyphenation point as a legal break @@ -828,9 +841,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager maxAdjustment = 5; } - if ((iBPcount - = alg.findBreakingPoints(currPar, - maxAdjustment, false, allowedBreaks)) == 0) { + iBPcount = alg.findBreakingPoints(currPar, maxAdjustment, false, allowedBreaks); + if (iBPcount == 0) { // the second try failed too, try with a huge threshold // and force the algorithm to find // a set of breaking points @@ -853,9 +865,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager is justify and the paragraph has only one layout, try using shorter or longer lines */ //TODO This code snippet is disabled. Reenable? + /* [GA] remove dead code if (false && alignment == EN_JUSTIFY && textAlignment == EN_JUSTIFY) { - //log.debug("LLM.getNextKnuthElements> layouts with more lines? " + lineLayouts.canUseMoreLines()); - //log.debug(" layouts with fewer lines? " + lineLayouts.canUseLessLines()); + //log.debug("LLM.getNextKnuthElements> layouts with more lines? " + //+ lineLayouts.canUseMoreLines()); + //log.debug(" layouts with fewer lines? " + //+ lineLayouts.canUseLessLines()); if (!lineLayouts.canUseMoreLines()) { alg.resetAlgorithm(); lineLayouts.savePossibilities(true); @@ -881,9 +896,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager lineLayouts.restorePossibilities(); ipd = savedLineWidth; } - //log.debug("LLM.getNextKnuthElements> now, layouts with more lines? " + lineLayouts.canUseMoreLines()); - //log.debug(" now, layouts with fewer lines? " + lineLayouts.canUseLessLines()); + //log.debug("LLM.getNextKnuthElements> now, layouts with more lines? " + //+ lineLayouts.canUseMoreLines()); + //log.debug(" now, layouts with fewer lines? " + //+ lineLayouts.canUseLessLines()); } + */ } return lineLayouts; } @@ -910,8 +928,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager context)); } - LineLayoutPossibilities llPoss; - llPoss = (LineLayoutPossibilities) lineLayoutsList.get(p); + LineLayoutPossibilities llPoss = lineLayoutsList[p]; KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p); if (!seq.isInlineSequence()) { @@ -987,137 +1004,136 @@ public class LineLayoutManager extends InlineStackingLayoutManager return returnList; } - private void createElements(List list, LineLayoutPossibilities llPoss, Position elementPosition) { /* number of normal, inner lines */ - int nInnerLines = 0; + int innerLines = 0; /* number of lines that can be used in order to fill more space */ - int nOptionalLines = 0; + int optionalLines = 0; /* number of lines that can be used in order to fill more space only if the paragraph is not parted */ - int nConditionalOptionalLines = 0; + int conditionalOptionalLines = 0; /* number of lines that can be omitted in order to fill less space */ - int nEliminableLines = 0; + int eliminableLines = 0; /* number of lines that can be omitted in order to fill less space only if the paragraph is not parted */ - int nConditionalEliminableLines = 0; + int conditionalEliminableLines = 0; /* number of the first unbreakable lines */ - int nFirstLines = fobj.getOrphans(); + int firstLines = fobj.getOrphans(); /* number of the last unbreakable lines */ - int nLastLines = fobj.getWidows(); + int lastLines = fobj.getWidows(); /* sub-sequence used to separate the elements representing different lines */ List breaker = new LinkedList(); /* comment out the next lines in order to test particular situations */ if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getMinLineCount()) { - nInnerLines = llPoss.getMinLineCount() + innerLines = llPoss.getMinLineCount() - (fobj.getOrphans() + fobj.getWidows()); - nOptionalLines = llPoss.getMaxLineCount() + optionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount(); - nEliminableLines = llPoss.getOptLineCount() + eliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount(); } else if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getOptLineCount()) { - nOptionalLines = llPoss.getMaxLineCount() + optionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount(); - nEliminableLines = llPoss.getOptLineCount() + eliminableLines = llPoss.getOptLineCount() - (fobj.getOrphans() + fobj.getWidows()); - nConditionalEliminableLines = (fobj.getOrphans() + fobj.getWidows()) + conditionalEliminableLines = (fobj.getOrphans() + fobj.getWidows()) - llPoss.getMinLineCount(); } else if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getMaxLineCount()) { - nOptionalLines = llPoss.getMaxLineCount() + optionalLines = llPoss.getMaxLineCount() - (fobj.getOrphans() + fobj.getWidows()); - nConditionalOptionalLines = (fobj.getOrphans() + fobj.getWidows()) + conditionalOptionalLines = (fobj.getOrphans() + fobj.getWidows()) - llPoss.getOptLineCount(); - nConditionalEliminableLines = llPoss.getOptLineCount() + conditionalEliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount(); - nFirstLines -= nConditionalOptionalLines; + firstLines -= conditionalOptionalLines; } else { - nConditionalOptionalLines = llPoss.getMaxLineCount() + conditionalOptionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount(); - nConditionalEliminableLines = llPoss.getOptLineCount() + conditionalEliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount(); - nFirstLines = llPoss.getOptLineCount(); - nLastLines = 0; + firstLines = llPoss.getOptLineCount(); + lastLines = 0; } /* comment out the previous lines in order to test particular situations */ /* use these lines to test particular situations - nInnerLines = 0; - nOptionalLines = 1; - nConditionalOptionalLines = 2; - nEliminableLines = 0; - nConditionalEliminableLines = 0; - nFirstLines = 1; - nLastLines = 3; + innerLines = 0; + optionalLines = 1; + conditionalOptionalLines = 2; + eliminableLines = 0; + conditionalEliminableLines = 0; + firstLines = 1; + lastLines = 3; */ - if (nLastLines != 0 - && (nConditionalOptionalLines > 0 || nConditionalEliminableLines > 0)) { + if (lastLines != 0 + && (conditionalOptionalLines > 0 || conditionalEliminableLines > 0)) { breaker.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false)); - breaker.add(new KnuthGlue(0, -nConditionalOptionalLines * constantLineHeight, - -nConditionalEliminableLines * constantLineHeight, + breaker.add(new KnuthGlue(0, -conditionalOptionalLines * constantLineHeight, + -conditionalEliminableLines * constantLineHeight, Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false)); - breaker.add(new KnuthPenalty(nConditionalOptionalLines * constantLineHeight, + breaker.add(new KnuthPenalty(conditionalOptionalLines * constantLineHeight, 0, false, elementPosition, false)); - breaker.add(new KnuthGlue(0, nConditionalOptionalLines * constantLineHeight, - nConditionalEliminableLines * constantLineHeight, + breaker.add(new KnuthGlue(0, conditionalOptionalLines * constantLineHeight, + conditionalEliminableLines * constantLineHeight, Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false)); - } else if (nLastLines != 0) { + } else if (lastLines != 0) { breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false)); } - //log.debug("first=" + nFirstLines + " inner=" + nInnerLines - // + " optional=" + nOptionalLines + " eliminable=" + nEliminableLines - // + " last=" + nLastLines - // + " (condOpt=" + nConditionalOptionalLines + " condEl=" + nConditionalEliminableLines + ")"); + //log.debug("first=" + firstLines + " inner=" + innerLines + // + " optional=" + optionalLines + " eliminable=" + eliminableLines + // + " last=" + lastLines + // + " (condOpt=" + conditionalOptionalLines + // + " condEl=" + conditionalEliminableLines + ")"); // creation of the elements: // first group of lines - list.add(new KnuthBox(nFirstLines * constantLineHeight, elementPosition, - (nLastLines == 0 - && nConditionalOptionalLines == 0 - && nConditionalEliminableLines == 0 ? true : false))); - if (nConditionalOptionalLines > 0 - || nConditionalEliminableLines > 0) { + list.add(new KnuthBox(firstLines * constantLineHeight, elementPosition, + (lastLines == 0 + && conditionalOptionalLines == 0 + && conditionalEliminableLines == 0))); + if (conditionalOptionalLines > 0 + || conditionalEliminableLines > 0) { list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false)); - list.add(new KnuthGlue(0, nConditionalOptionalLines * constantLineHeight, - nConditionalEliminableLines * constantLineHeight, + list.add(new KnuthGlue(0, conditionalOptionalLines * constantLineHeight, + conditionalEliminableLines * constantLineHeight, Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false)); - list.add(new KnuthBox(0, elementPosition, - (nLastLines == 0 ? true : false))); + list.add(new KnuthBox(0, elementPosition, (lastLines == 0))); } // optional lines - for (int i = 0; i < nOptionalLines; i++) { + for (int i = 0; i < optionalLines; i++) { list.addAll(breaker); list.add(new KnuthBox(0, elementPosition, false)); list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false)); - list.add(new KnuthGlue(0, 1 * constantLineHeight, 0, + list.add(new KnuthGlue(0, constantLineHeight, 0, Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false)); list.add(new KnuthBox(0, elementPosition, false)); } // eliminable lines - for (int i = 0; i < nEliminableLines; i++) { + for (int i = 0; i < eliminableLines; i++) { list.addAll(breaker); - list.add(new KnuthBox(1 * constantLineHeight, elementPosition, false)); + list.add(new KnuthBox(constantLineHeight, elementPosition, false)); list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false)); - list.add(new KnuthGlue(0, 0, 1 * constantLineHeight, + list.add(new KnuthGlue(0, 0, constantLineHeight, Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false)); list.add(new KnuthBox(0, elementPosition, false)); } // inner lines - for (int i = 0; i < nInnerLines; i++) { + for (int i = 0; i < innerLines; i++) { list.addAll(breaker); - list.add(new KnuthBox(1 * constantLineHeight, elementPosition, false)); + list.add(new KnuthBox(constantLineHeight, elementPosition, false)); } // last group of lines - if (nLastLines > 0) { + if (lastLines > 0) { list.addAll(breaker); - list.add(new KnuthBox(nLastLines * constantLineHeight, + list.add(new KnuthBox(lastLines * constantLineHeight, elementPosition, true)); } } @@ -1170,34 +1186,29 @@ public class LineLayoutManager extends InlineStackingLayoutManager /** {@inheritDoc} */ public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) { LeafPosition pos = (LeafPosition)lastElement.getPosition(); - int totalAdj = adj; //if (lastElement.isPenalty()) { // totalAdj += lastElement.getWidth(); //} //int lineNumberDifference = (int)((double) totalAdj / constantLineHeight); - int lineNumberDifference = (int) Math.round((double) totalAdj / constantLineHeight - + (adj > 0 ? - 0.4 : 0.4)); - //log.debug(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight) + " variazione applicata = " + lineNumberDifference); + int lineNumberDifference = (int) Math.round((double) adj / constantLineHeight + + (adj > 0 ? -0.4 : 0.4)); + //log.debug(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight) + //+ " variazione applicata = " + lineNumberDifference); LineLayoutPossibilities llPoss; - llPoss = (LineLayoutPossibilities) lineLayoutsList.get(pos.getLeafPos()); + llPoss = lineLayoutsList[pos.getLeafPos()]; lineNumberDifference = llPoss.applyLineCountAdjustment(lineNumberDifference); return lineNumberDifference * constantLineHeight; } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public void discardSpace(KnuthGlue spaceGlue) { } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public List getChangedKnuthElements(List oldList, int alignment) { List returnList = new LinkedList(); for (int p = 0; p < knuthParagraphs.size(); p++) { - LineLayoutPossibilities llPoss; - llPoss = (LineLayoutPossibilities)lineLayoutsList.get(p); + LineLayoutPossibilities llPoss = lineLayoutsList[p]; //log.debug("demerits of the chosen layout: " + llPoss.getChosenDemerits()); for (int i = 0; i < llPoss.getChosenLineCount(); i++) { if (!((BlockLevelLayoutManager) parentLayoutManager).mustKeepTogether() @@ -1207,10 +1218,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false)); } LineBreakPosition lbp = (LineBreakPosition) llPoss.getChosenPosition(i); - //log.debug("LLM.getChangedKnuthElements> lineWidth= " + lbp.lineWidth + " difference= " + lbp.difference); - //log.debug(" shrink= " + lbp.availableShrink + " stretch= " + lbp.availableStretch); - - //log.debug("linewidth= " + lbp.lineWidth + " difference= " + lbp.difference + " indent= " + lbp.startIndent); + //log.debug("LLM.getChangedKnuthElements> lineWidth= " + // + lbp.lineWidth + " difference= " + lbp.difference); + //log.debug(" shrink= " + // + lbp.availableShrink + " stretch= " + lbp.availableStretch); + //log.debug("linewidth= " + lbp.lineWidth + " difference= " + //+ lbp.difference + " indent= " + lbp.startIndent); MinOptMax contentIPD; if (alignment == EN_JUSTIFY) { contentIPD = MinOptMax.getInstance( @@ -1222,7 +1235,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager } else if (alignment == EN_END) { contentIPD = MinOptMax.getInstance(lbp.lineWidth - lbp.startIndent); } else { - contentIPD = MinOptMax.getInstance(lbp.lineWidth - lbp.difference + lbp.startIndent); + contentIPD + = MinOptMax.getInstance(lbp.lineWidth - lbp.difference + lbp.startIndent); } returnList.add(new KnuthBlockBox(lbp.lineHeight, contentIPD, (lbp.ipdAdjust != 0 ? lbp.lineWidth - lbp.difference : 0), @@ -1233,24 +1247,23 @@ public class LineLayoutManager extends InlineStackingLayoutManager } /** - * find hyphenation points for every word int the current paragraph - * @ param currPar the paragraph whose words will be hyphenated + * Find hyphenation points for every word in the current paragraph. + * + * @param currPar the paragraph whose words will be hyphenated */ private void findHyphenationPoints(Paragraph currPar) { // hyphenate every word - ListIterator currParIterator - = currPar.listIterator(currPar.ignoreAtStart); + ListIterator currParIterator = currPar.listIterator(currPar.ignoreAtStart); // list of TLM involved in hyphenation List updateList = new LinkedList(); - KnuthElement firstElement = null; - KnuthElement nextElement = null; + KnuthElement firstElement, nextElement; // current InlineLevelLayoutManager InlineLevelLayoutManager currLM = null; // number of KnuthBox elements containing word fragments int boxCount; // number of auxiliary KnuthElements between KnuthBoxes int auxCount; - StringBuffer sbChars = null; + StringBuffer sbChars; // find all hyphenation points while (currParIterator.hasNext()) { @@ -1325,51 +1338,49 @@ public class LineLayoutManager extends InlineStackingLayoutManager } } } + processUpdates(currPar, updateList); + } + private void processUpdates(Paragraph par, List updateList) { // create iterator for the updateList ListIterator updateListIterator = updateList.listIterator(); - Update currUpdate = null; - //int iPreservedElements = 0; - int iAddedElements = 0; - //int iRemovedElements = 0; + Update currUpdate; + int elementsAdded = 0; while (updateListIterator.hasNext()) { // ask the LMs to apply the changes and return // the new KnuthElements to replace the old ones currUpdate = (Update) updateListIterator.next(); - int fromIndex = currUpdate.iFirstIndex; + int fromIndex = currUpdate.firstIndex; int toIndex; if (updateListIterator.hasNext()) { Update nextUpdate = (Update) updateListIterator.next(); - toIndex = nextUpdate.iFirstIndex; + toIndex = nextUpdate.firstIndex; updateListIterator.previous(); } else { // maybe this is not always correct! - toIndex = currPar.size() - currPar.ignoreAtEnd - - iAddedElements; + toIndex = par.size() - par.ignoreAtEnd + - elementsAdded; } // applyChanges() returns true if the LM modifies its data, // so it must return new KnuthElements to replace the old ones - if (((InlineLevelLayoutManager) currUpdate.inlineLM) - .applyChanges(currPar.subList(fromIndex + iAddedElements, - toIndex + iAddedElements))) { + if (currUpdate.inlineLM + .applyChanges(par.subList(fromIndex + elementsAdded, + toIndex + elementsAdded))) { // insert the new KnuthElements - List newElements = null; - newElements - = currUpdate.inlineLM.getChangedKnuthElements - (currPar.subList(fromIndex + iAddedElements, - toIndex + iAddedElements), + List newElements = currUpdate.inlineLM.getChangedKnuthElements + (par.subList(fromIndex + elementsAdded, + toIndex + elementsAdded), /*flaggedPenalty,*/ effectiveAlignment); // remove the old elements - currPar.subList(fromIndex + iAddedElements, - toIndex + iAddedElements).clear(); + par.subList(fromIndex + elementsAdded, + toIndex + elementsAdded).clear(); // insert the new elements - currPar.addAll(fromIndex + iAddedElements, newElements); - iAddedElements += newElements.size() - (toIndex - fromIndex); + par.addAll(fromIndex + elementsAdded, newElements); + elementsAdded += newElements.size() - (toIndex - fromIndex); } } - updateListIterator = null; updateList.clear(); } @@ -1456,7 +1467,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager /** * Add a line with inline content * @param context the context for adding areas - * @param pos the position for which the line is generated + * @param lbp the position for which the line is generated * @param isLastPosition true if this is the last position of this LM */ private void addInlineArea(LayoutContext context, LineBreakPosition lbp, @@ -1540,6 +1551,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager * have been optimized, recompute indents and / or adjust ratio, according * to the paragraph horizontal alignment */ + /* [GA] remove dead code if (false && textAlignment == EN_JUSTIFY) { // re-compute space adjust ratio int updatedDifference = context.getRefIPD() @@ -1551,8 +1563,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager updatedRatio = (float) updatedDifference / lbp.availableShrink; } lc.setIPDAdjust(updatedRatio); - //log.debug("LLM.addAreas> old difference = " + lbp.difference + " new difference = " + updatedDifference); - //log.debug(" old ratio = " + lbp.ipdAdjust + " new ratio = " + updatedRatio); + //log.debug("LLM.addAreas> old difference = " + lbp.difference + //+ " new difference = " + updatedDifference); + //log.debug(" old ratio = " + lbp.ipdAdjust + //+ " new ratio = " + updatedRatio); } else if (false && textAlignment == EN_CENTER) { // re-compute indent int updatedIndent = lbp.startIndent @@ -1564,6 +1578,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager + (context.getRefIPD() - lbp.lineWidth); lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent)); } + */ setCurrentArea(lineArea); setChildContext(lc); @@ -1598,8 +1613,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager * which creates one line area. */ List positionList = new ArrayList(1); - Position innerPosition; - innerPosition = ((NonLeafPosition) pos).getPosition(); + Position innerPosition = pos.getPosition(); positionList.add(innerPosition); // do we have the last LM? @@ -1634,9 +1648,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager parentLayoutManager.addChildArea(lineArea); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public void addChildArea(Area childArea) { // Make sure childArea is inline area if (childArea instanceof InlineArea) { @@ -1651,16 +1663,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager // --------- Property Resolution related functions --------- // - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public boolean getGeneratesBlockArea() { return true; } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public boolean getGeneratesLineArea() { return true; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java index c1b81c4ab..49c97b7b6 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java @@ -23,14 +23,18 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.layoutmgr.Position; +/** + * Line layout possibilities. + */ public class LineLayoutPossibilities { /** logger instance */ - protected static Log log = LogFactory.getLog(LineLayoutPossibilities.class); + private static final Log LOG = LogFactory.getLog(LineLayoutPossibilities.class); - private class Possibility { + private final class Possibility { private int lineCount; private double demerits; private List breakPositions; @@ -69,12 +73,18 @@ public class LineLayoutPossibilities { private int chosenIndex; private int savedOptLineCount; + /** default constructor */ public LineLayoutPossibilities() { possibilitiesList = new java.util.ArrayList(); savedPossibilities = new java.util.ArrayList(); optimumIndex = -1; } + /** + * Add possibility. + * @param ln line number + * @param dem demerits + */ public void addPossibility(int ln, double dem) { possibilitiesList.add(new Possibility(ln, dem)); if (possibilitiesList.size() == 1) { @@ -97,8 +107,10 @@ public class LineLayoutPossibilities { } } - /* save in a different array the computed Possibilities, - * so possibilitiesList is ready to store different Possibilities + /** + * Save in a different array the computed Possibilities, + * so possibilitiesList is ready to store different Possibilities. + * @param bSaveOptLineCount true if should save optimum line count */ public void savePossibilities(boolean bSaveOptLineCount) { if (bSaveOptLineCount) { @@ -110,8 +122,9 @@ public class LineLayoutPossibilities { possibilitiesList = new java.util.ArrayList(); } - /* replace the Possibilities stored in possibilitiesList with - * the ones stored in savedPossibilities and having the same line number + /** + * Replace the Possibilities stored in possibilitiesList with + * the ones stored in savedPossibilities and having the same line number. */ public void restorePossibilities() { int index = 0; @@ -124,9 +137,9 @@ public class LineLayoutPossibilities { // update minimumIndex minimumIndex = 0; // shift the other indexes; - optimumIndex ++; - maximumIndex ++; - chosenIndex ++; + optimumIndex++; + maximumIndex++; + chosenIndex++; } else if (restoredPossibility.getLineCount() > getMaxLineCount()) { // if the line number of restoredPossibility is greater than the maximum one, // add restoredPossibility at the end of the list @@ -138,13 +151,13 @@ public class LineLayoutPossibilities { // find the index of the Possibility that will be replaced while (index < maximumIndex && getLineCount(index) < restoredPossibility.getLineCount()) { - index ++; + index++; } if (getLineCount(index) == restoredPossibility.getLineCount()) { possibilitiesList.set(index, restoredPossibility); } else { // this should not happen - log.error("LineLayoutPossibilities restorePossibilities()," + LOG.error("LineLayoutPossibilities restorePossibilities()," + " min= " + getMinLineCount() + " max= " + getMaxLineCount() + " restored= " + restoredPossibility.getLineCount()); @@ -152,8 +165,10 @@ public class LineLayoutPossibilities { } } // update optimumIndex and chosenIndex - if (savedOptLineCount == 0 && getDemerits(optimumIndex) > restoredPossibility.getDemerits() - || savedOptLineCount != 0 && restoredPossibility.getLineCount() == savedOptLineCount) { + if (savedOptLineCount == 0 + && getDemerits(optimumIndex) > restoredPossibility.getDemerits() + || savedOptLineCount != 0 + && restoredPossibility.getLineCount() == savedOptLineCount) { optimumIndex = index; chosenIndex = optimumIndex; } @@ -162,73 +177,102 @@ public class LineLayoutPossibilities { // + " optLineCount = " + getOptLineCount() + " maxLineCount() = " + getMaxLineCount()); } + /** + * @param pos a position + * @param i an index into posibilities list + */ public void addBreakPosition(Position pos, int i) { ((Possibility)possibilitiesList.get(i)).addBreakPosition(pos); } + /** @return true if can use more lines */ public boolean canUseMoreLines() { return (getOptLineCount() < getMaxLineCount()); } + /** @return true if can use fewer lines */ public boolean canUseLessLines() { return (getMinLineCount() < getOptLineCount()); } + /** @return the line count of the minimum index */ public int getMinLineCount() { return getLineCount(minimumIndex); } + /** @return the line count of the optimum index */ public int getOptLineCount() { return getLineCount(optimumIndex); } + /** @return the line count of the maximum index */ public int getMaxLineCount() { return getLineCount(maximumIndex); } + /** @return the line count of the chosen index */ public int getChosenLineCount() { return getLineCount(chosenIndex); } + /** + * @param i the posibilities list index + * @return the line count + */ public int getLineCount(int i) { return ((Possibility)possibilitiesList.get(i)).getLineCount(); } + /** @return the demerits of the chosen index */ public double getChosenDemerits() { return getDemerits(chosenIndex); } + /** + * @param i the posibilities list index + * @return the demerits + */ public double getDemerits(int i) { return ((Possibility)possibilitiesList.get(i)).getDemerits(); } + /** @return the possibilities count */ public int getPossibilitiesNumber() { return possibilitiesList.size(); } + /** + * @param i the break position index + * @return the chosen position + */ public Position getChosenPosition(int i) { return ((Possibility)possibilitiesList.get(chosenIndex)).getBreakPosition(i); } + /** + * @param adj the adjustment + * @return the adjustment or zero + */ public int applyLineCountAdjustment(int adj) { if (adj >= (getMinLineCount() - getChosenLineCount()) && adj <= (getMaxLineCount() - getChosenLineCount()) && getLineCount(chosenIndex + adj) == getChosenLineCount() + adj) { chosenIndex += adj; - log.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj + LOG.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj + " => chosenLineCount= " + getLineCount(chosenIndex)); return adj; } else { // this should not happen! - log.warn("Cannot apply the desired line count adjustment."); + LOG.warn("Cannot apply the desired line count adjustment."); return 0; } } + /** print all */ public void printAll() { System.out.println("++++++++++"); System.out.println(" " + possibilitiesList.size() + " possibility':"); - for (int i = 0; i < possibilitiesList.size(); i ++) { + for (int i = 0; i < possibilitiesList.size(); i++) { System.out.println(" " + ((Possibility)possibilitiesList.get(i)).getLineCount() + (i == optimumIndex ? " *" : "") + (i == minimumIndex ? " -" : "") diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java index a38e3e2d8..f3e8784c1 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java @@ -37,7 +37,7 @@ public class PageNumberCitationLastLayoutManager extends AbstractPageNumberCitat * Constructor * * @param node the formatting object that creates this area - * @todo better retrieval of font info + * @asf.todo better retrieval of font info */ public PageNumberCitationLastLayoutManager(PageNumberCitationLast node) { super(node); diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java index 583f73d24..b9f786c97 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java @@ -25,7 +25,6 @@ import org.apache.fop.area.inline.TextArea; import org.apache.fop.area.inline.UnresolvedPageNumber; import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.layoutmgr.LayoutContext; -import org.apache.fop.layoutmgr.LayoutManager; /** * LayoutManager for the fo:page-number-citation formatting object @@ -36,7 +35,7 @@ public class PageNumberCitationLayoutManager extends AbstractPageNumberCitationL * Constructor * * @param node the formatting object that creates this area - * @todo better retrieval of font info + * @asf.todo better retrieval of font info */ public PageNumberCitationLayoutManager(PageNumberCitation node) { super(node); diff --git a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java b/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java index a2a1dce27..19a1a1f8a 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java +++ b/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java @@ -19,8 +19,6 @@ package org.apache.fop.layoutmgr.inline; -import org.apache.fop.datatypes.Length; - /** * The FOP specific incarnation of the XSL-FO scaled baseline table. * All baseline tables are scaled to the font size of the font they diff --git a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java b/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java index 1536552c4..0d48ccbfe 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java +++ b/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java @@ -28,7 +28,10 @@ import org.apache.fop.fonts.Font; * Currently supports alignment contexts for basic fonts * and graphic inlines. */ -public class ScaledBaselineTableFactory implements Constants { +public final class ScaledBaselineTableFactory implements Constants { + + private ScaledBaselineTableFactory() { + } /** * Creates a new instance of BasicScaledBaselineTable for the given diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index 43e8c5a31..4c45fbe66 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -81,15 +81,10 @@ public class TextLayoutManager extends LeafNodeLayoutManager { private boolean breakOppAfter; private final Font font; - AreaInfo(final int startIndex, - final int breakIndex, - final int wordSpaceCount, - final int letterSpaceCount, - final MinOptMax areaIPD, - final boolean isHyphenated, - final boolean isSpace, - final boolean breakOppAfter, - final Font font) { + AreaInfo // CSOK: ParameterNumber + (int startIndex, int breakIndex, int wordSpaceCount, int letterSpaceCount, + MinOptMax areaIPD, boolean isHyphenated, boolean isSpace, boolean breakOppAfter, + Font font) { assert startIndex <= breakIndex; this.startIndex = startIndex; this.breakIndex = breakIndex; @@ -776,7 +771,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } final boolean endsWithHyphen = checkEndsWithHyphen && foText.charAt(lastIndex) == CharUtilities.SOFT_HYPHEN; - Font font = FontSelector.selectFontForCharactersInText(foText, thisStart, lastIndex, foText, this); + Font font = FontSelector + .selectFontForCharactersInText(foText, thisStart, lastIndex, foText, this); int wordLength = lastIndex - thisStart; boolean kerning = font.hasKerning(); MinOptMax wordIPD = MinOptMax.ZERO; @@ -793,7 +789,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { if (i > thisStart) { char previousChar = foText.charAt(i - 1); kern = font.getKernValue(previousChar, currentChar); - } else if (prevAreaInfo != null && !prevAreaInfo.isSpace && prevAreaInfo.breakIndex > 0) { + } else if (prevAreaInfo != null + && !prevAreaInfo.isSpace && prevAreaInfo.breakIndex > 0) { char previousChar = foText.charAt(prevAreaInfo.breakIndex - 1); kern = font.getKernValue(previousChar, currentChar); } @@ -953,7 +950,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } // add letter spaces - boolean isWordEnd = stopIndex == areaInfo.breakIndex && areaInfo.letterSpaceCount < areaInfo.getCharLength(); + boolean isWordEnd + = stopIndex == areaInfo.breakIndex + && areaInfo.letterSpaceCount < areaInfo.getCharLength(); int letterSpaceCount = isWordEnd ? stopIndex - startIndex - 1 : stopIndex - startIndex; assert letterSpaceCount >= 0; @@ -1065,11 +1064,13 @@ public class TextLayoutManager extends LeafNodeLayoutManager { if (foText.charAt(areaInfo.startIndex) != CharUtilities.SPACE || foText.getWhitespaceTreatment() == Constants.EN_PRESERVE) { // a breaking space that needs to be preserved - baseList.addAll(getElementsForBreakingSpace(alignment, areaInfo, auxiliaryPosition, 0, + baseList + .addAll(getElementsForBreakingSpace(alignment, areaInfo, auxiliaryPosition, 0, mainPosition, areaInfo.areaIPD.getOpt(), true)); } else { // a (possible block) of breaking spaces - baseList.addAll(getElementsForBreakingSpace(alignment, areaInfo, mainPosition, + baseList + .addAll(getElementsForBreakingSpace(alignment, areaInfo, mainPosition, areaInfo.areaIPD.getOpt(), auxiliaryPosition, 0, false)); } } @@ -1103,17 +1104,31 @@ public class TextLayoutManager extends LeafNodeLayoutManager { // if the second element is chosen as a line break these elements // add a constant amount of stretch at the end of a line, otherwise // they don't add any stretch + KnuthGlue g; if (skipZeroCheck || lineStartBAP != 0 || lineEndBAP != 0) { - elements.add(new KnuthGlue(lineEndBAP, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, auxiliaryPosition, false)); + g = new KnuthGlue + (lineEndBAP, + 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, auxiliaryPosition, false); + elements.add(g); elements.add(makeZeroWidthPenalty(0)); - elements.add(new KnuthGlue(p2WidthOffset - (lineStartBAP + lineEndBAP), -3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos2, false)); + g = new KnuthGlue + (p2WidthOffset - (lineStartBAP + lineEndBAP), + -3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos2, false); + elements.add(g); elements.add(makeAuxiliaryZeroWidthBox()); elements.add(makeZeroWidthPenalty(KnuthElement.INFINITE)); - elements.add(new KnuthGlue(lineStartBAP + p3WidthOffset, 0, 0, pos3, false)); + g = new KnuthGlue(lineStartBAP + p3WidthOffset, 0, 0, pos3, false); + elements.add(g); } else { - elements.add(new KnuthGlue(0, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, auxiliaryPosition, false)); + g = new KnuthGlue + (0, + 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, auxiliaryPosition, false); + elements.add(g); elements.add(makeZeroWidthPenalty(0)); - elements.add(new KnuthGlue(areaInfo.areaIPD.getOpt(), -3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos2, false)); + g = new KnuthGlue + (areaInfo.areaIPD.getOpt(), + -3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos2, false); + elements.add(g); } break; @@ -1133,9 +1148,10 @@ public class TextLayoutManager extends LeafNodeLayoutManager { return elements; } - private List getElementsForJustifiedText(AreaInfo areaInfo, Position pos2, int p2WidthOffset, - Position pos3, int p3WidthOffset, boolean skipZeroCheck, - int shrinkability) { + private List getElementsForJustifiedText + (AreaInfo areaInfo, Position pos2, int p2WidthOffset, + Position pos3, int p3WidthOffset, boolean skipZeroCheck, + int shrinkability) { int stretchability = areaInfo.areaIPD.getStretch(); diff --git a/src/java/org/apache/fop/layoutmgr/table/CellPart.java b/src/java/org/apache/fop/layoutmgr/table/CellPart.java index 7dd2bc201..8af3a3d43 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CellPart.java +++ b/src/java/org/apache/fop/layoutmgr/table/CellPart.java @@ -61,7 +61,8 @@ class CellPart { * @param bpAfterLast width of (possibly optional) border- and padding-after if this * part will be the last one on the page */ - protected CellPart(PrimaryGridUnit pgu, int start, int end, boolean last, + protected CellPart // CSOK: ParameterNumber + (PrimaryGridUnit pgu, int start, int end, boolean last, int condBeforeContentLength, int length, int condAfterContentLength, int bpBeforeNormal, int bpBeforeFirst, int bpAfterNormal, int bpAfterLast) { diff --git a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java index ede6210ca..7221d4fee 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java +++ b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java @@ -196,7 +196,7 @@ public abstract class CollapsingBorderModel { * @param border1 a border specification * @param border2 another border specification * @return the winning border, null if the two borders are equivalent - * @see determineWinner + * @see #determineWinner(BorderSpecification,BorderSpecification,boolean) */ public abstract BorderSpecification determineWinner(BorderSpecification border1, BorderSpecification border2); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java index e28126c3e..ab37248ea 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java @@ -33,7 +33,7 @@ import org.apache.fop.layoutmgr.PositionIterator; * The caption contains blocks that are positioned next to the * table on the caption side. * The caption blocks have an implicit keep with the table. - * @todo Implement getNextKnuthElements() + * @asf.todo Implement getNextKnuthElements() */ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java index c7d0d0da4..96ffc0a90 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java @@ -31,7 +31,7 @@ import org.apache.fop.layoutmgr.PositionIterator; * LayoutManager for a table-caption FO. * The table caption contains blocks that are placed beside the * table. - * @todo Implement getNextKnuthElements() + * @asf.todo Implement getNextKnuthElements() */ public class TableCaptionLayoutManager extends BlockStackingLayoutManager { diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java index 0599b430c..5fb733a51 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java @@ -277,17 +277,10 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager * this row is placed on a previous page). Used to calculate the placement of the * row's background image if any */ - public void addAreas(PositionIterator parentIter, - LayoutContext layoutContext, - int[] spannedGridRowHeights, - int startRow, - int endRow, - int borderBeforeWhich, - int borderAfterWhich, - boolean firstOnPage, - boolean lastOnPage, - RowPainter painter, - int firstRowHeight) { + public void addAreas // CSOK: ParameterNumber + (PositionIterator parentIter, LayoutContext layoutContext, int[] spannedGridRowHeights, + int startRow, int endRow, int borderBeforeWhich, int borderAfterWhich, boolean firstOnPage, + boolean lastOnPage, RowPainter painter, int firstRowHeight) { getParentArea(null); addId(); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index 40ebf9e0d..db5b4736c 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -55,7 +55,7 @@ import org.apache.fop.util.BreakUtil; public class TableContentLayoutManager implements PercentBaseContext { /** Logger **/ - private static Log log = LogFactory.getLog(TableContentLayoutManager.class); + private static final Log LOG = LogFactory.getLog(TableContentLayoutManager.class); private TableLayoutManager tableLM; private TableRowIterator bodyIter; @@ -127,10 +127,18 @@ public class TableContentLayoutManager implements PercentBaseContext { return this.footerList; } - /** {@inheritDoc} */ - public LinkedList getNextKnuthElements(LayoutContext context, int alignment) { - if (log.isDebugEnabled()) { - log.debug("==> Columns: " + getTableLM().getColumns()); + /** + * Get a sequence of KnuthElements representing the content + * of the node assigned to the LM. + * + * @param context the LayoutContext used to store layout information + * @param alignment the desired text alignment + * @return the list of KnuthElements + * @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int) + */ + public List getNextKnuthElements(LayoutContext context, int alignment) { + if (LOG.isDebugEnabled()) { + LOG.debug("==> Columns: " + getTableLM().getColumns()); } KnuthBox headerAsFirst = null; KnuthBox headerAsSecondToLast = null; @@ -140,8 +148,8 @@ public class TableContentLayoutManager implements PercentBaseContext { headerIter, context, alignment, TableRowIterator.HEADER); this.headerNetHeight = ElementListUtils.calcContentLength(this.headerList); - if (log.isDebugEnabled()) { - log.debug("==> Header: " + if (LOG.isDebugEnabled()) { + LOG.debug("==> Header: " + headerNetHeight + " - " + this.headerList); } TableHeaderFooterPosition pos = new TableHeaderFooterPosition( @@ -160,8 +168,8 @@ public class TableContentLayoutManager implements PercentBaseContext { footerIter, context, alignment, TableRowIterator.FOOTER); this.footerNetHeight = ElementListUtils.calcContentLength(this.footerList); - if (log.isDebugEnabled()) { - log.debug("==> Footer: " + if (LOG.isDebugEnabled()) { + LOG.debug("==> Footer: " + footerNetHeight + " - " + this.footerList); } //We can simply add the table footer at the end of the whole list @@ -369,14 +377,14 @@ public class TableContentLayoutManager implements PercentBaseContext { } else if (pos instanceof TableContentPosition) { tablePositions.add(pos); } else { - if (log.isDebugEnabled()) { - log.debug("Ignoring position: " + pos); + if (LOG.isDebugEnabled()) { + LOG.debug("Ignoring position: " + pos); } } } if (lastPos instanceof TableHFPenaltyPosition) { TableHFPenaltyPosition penaltyPos = (TableHFPenaltyPosition)lastPos; - log.debug("Break at penalty!"); + LOG.debug("Break at penalty!"); if (penaltyPos.headerElements != null) { //Header positions for the penalty position are in the last element and need to //be handled first before all other TableContentPositions @@ -402,7 +410,7 @@ public class TableContentLayoutManager implements PercentBaseContext { if (tablePositions.isEmpty()) { // TODO make sure this actually never happens - log.error("tablePositions empty." + LOG.error("tablePositions empty." + " Please send your FO file to fop-users@xmlgraphics.apache.org"); } else { // Here we are sure that posIter iterates only over TableContentPosition instances diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 7ccab7898..2b432d0d4 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -240,7 +240,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager // Elements for the table-header/footer/body - LinkedList contentKnuthElements; + List contentKnuthElements; contentLM = new TableContentLayoutManager(this); LayoutContext childLC = new LayoutContext(0); /* diff --git a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java index 282cd0fd5..35cba6da6 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java @@ -28,8 +28,6 @@ import org.apache.fop.fo.FONode.FONodeIterator; import org.apache.fop.fo.flow.table.EffRow; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; -import org.apache.fop.fo.flow.table.TablePart; - /** * Iterator that lets the table layout manager step over all the rows of a part of the diff --git a/src/java/org/apache/fop/pdf/AbstractPDFStream.java b/src/java/org/apache/fop/pdf/AbstractPDFStream.java index 4107c7e7a..91605b293 100644 --- a/src/java/org/apache/fop/pdf/AbstractPDFStream.java +++ b/src/java/org/apache/fop/pdf/AbstractPDFStream.java @@ -191,7 +191,7 @@ public abstract class AbstractPDFStream extends PDFDictionary { StreamCache encodedStream = null; PDFNumber refLength = null; final Object lengthEntry; - if (getDocument().isEncodingOnTheFly()) { + if (isEncodingOnTheFly()) { refLength = new PDFNumber(); getDocumentSafely().registerObject(refLength); lengthEntry = refLength; @@ -218,6 +218,15 @@ public abstract class AbstractPDFStream extends PDFDictionary { } /** + * Indicates whether encoding may happen without buffering the encoded data. If this method + * returns true, the /Length entry will be an indirect object, a direct object otherwise. + * @return true if encoding should happen "on the fly" + */ + protected boolean isEncodingOnTheFly() { + return getDocument().isEncodingOnTheFly(); + } + + /** * Populates the dictionary with all necessary entries for the stream. * Override this method if you need additional entries. * @param lengthEntry value for the /Length entry diff --git a/src/java/org/apache/fop/pdf/AlphaRasterImage.java b/src/java/org/apache/fop/pdf/AlphaRasterImage.java index bd31148be..7272c5edd 100644 --- a/src/java/org/apache/fop/pdf/AlphaRasterImage.java +++ b/src/java/org/apache/fop/pdf/AlphaRasterImage.java @@ -116,7 +116,7 @@ public class AlphaRasterImage implements PDFImage { return null; } - /** {@inheritDoc} */ + /** @return null (unless overridden) */ public String getSoftMask() { return null; } diff --git a/src/java/org/apache/fop/pdf/CMapBuilder.java b/src/java/org/apache/fop/pdf/CMapBuilder.java index affb4fcad..84b3b2ce7 100644 --- a/src/java/org/apache/fop/pdf/CMapBuilder.java +++ b/src/java/org/apache/fop/pdf/CMapBuilder.java @@ -22,11 +22,19 @@ package org.apache.fop.pdf; import java.io.IOException; import java.io.Writer; +/** A cmap builder. */ public class CMapBuilder { + /** name */ protected String name; + /** writer */ protected Writer writer; + /** + * Construct cmap builder. + * @param writer a writer + * @param name a name + */ public CMapBuilder(Writer writer, String name) { this.writer = writer; this.name = name; @@ -52,12 +60,14 @@ public class CMapBuilder { writeUseCMap(); } + /** @throws IOException if i/o exception */ protected void writePreStream() throws IOException { // writer.write("/Type /CMap\n"); // writer.write(sysInfo.toPDFString()); // writer.write("/CMapName /" + name + EOL); } + /** @throws IOException if i/o exception */ protected void writeStreamComments() throws IOException { writer.write("%!PS-Adobe-3.0 Resource-CMap\n"); writer.write("%%DocumentNeededResources: ProcSet (CIDInit)\n"); @@ -66,12 +76,19 @@ public class CMapBuilder { writer.write("%%EndComments\n"); } + /** @throws IOException if i/o exception */ protected void writeCIDInit() throws IOException { writer.write("/CIDInit /ProcSet findresource begin\n"); writer.write("12 dict begin\n"); writer.write("begincmap\n"); } + /** + * @param registry string + * @param ordering string + * @param supplement string + * @throws IOException if i/o exception + */ protected void writeCIDSystemInfo(String registry, String ordering, int supplement) throws IOException { writer.write("/CIDSystemInfo 3 dict dup begin\n"); @@ -87,32 +104,50 @@ public class CMapBuilder { writer.write("end def\n"); } + /** @throws IOException if i/o exception */ protected void writeCIDSystemInfo() throws IOException { writeCIDSystemInfo("Adobe", "Identity", 0); } + /** + * @param version a version + * @throws IOException if i/o exception + */ protected void writeVersion(String version) throws IOException { writer.write("/CMapVersion "); writer.write(version); writer.write(" def\n"); } + /** + * @param type a type + * @throws IOException if i/o exception + */ protected void writeType(String type) throws IOException { writer.write("/CMapType "); writer.write(type); writer.write(" def\n"); } + /** + * @param name a name + * @throws IOException if i/o exception + */ protected void writeName(String name) throws IOException { writer.write("/CMapName /"); writer.write(name); writer.write(" def\n"); } + /** @throws IOException if i/o exception */ protected void writeCodeSpaceRange() throws IOException { writeCodeSpaceRange(false); } + /** + * @param singleByte true if single byte range + * @throws IOException if i/o exception + */ protected void writeCodeSpaceRange(boolean singleByte) throws IOException { writer.write("1 begincodespacerange\n"); if (singleByte) { @@ -123,18 +158,21 @@ public class CMapBuilder { writer.write("endcodespacerange\n"); } + /** @throws IOException if i/o exception */ protected void writeCIDRange() throws IOException { writer.write("1 begincidrange\n"); writer.write("<0000> <FFFF> 0\n"); writer.write("endcidrange\n"); } + /** @throws IOException if i/o exception */ protected void writeBFEntries() throws IOException { // writer.write("1 beginbfrange\n"); // writer.write("<0020> <0100> <0000>\n"); // writer.write("endbfrange\n"); } + /** @throws IOException if i/o exception */ protected void writeWrapUp() throws IOException { writer.write("endcmap\n"); writer.write("CMapName currentdict /CMap defineresource pop\n"); @@ -142,11 +180,13 @@ public class CMapBuilder { writer.write("end\n"); } + /** @throws IOException if i/o exception */ protected void writeStreamAfterComments() throws IOException { writer.write("%%EndResource\n"); writer.write("%%EOF\n"); } + /** does nothing */ protected void writeUseCMap() { /* * writer.write(" /Type /CMap"); diff --git a/src/java/org/apache/fop/pdf/DestinationComparator.java b/src/java/org/apache/fop/pdf/DestinationComparator.java index 87d6a00ff..0966853ea 100644 --- a/src/java/org/apache/fop/pdf/DestinationComparator.java +++ b/src/java/org/apache/fop/pdf/DestinationComparator.java @@ -30,6 +30,7 @@ public class DestinationComparator implements java.util.Comparator { return dest1.getIDRef().compareTo(dest2.getIDRef()); }*/ + /** {@inheritDoc} */ public int compare (Object obj1, Object obj2) { if (obj1 instanceof PDFDestination && obj2 instanceof PDFDestination) { PDFDestination dest1 = (PDFDestination)obj1; diff --git a/src/java/org/apache/fop/pdf/PDFAMode.java b/src/java/org/apache/fop/pdf/PDFAMode.java index 18c4a2489..b5b764dd4 100644 --- a/src/java/org/apache/fop/pdf/PDFAMode.java +++ b/src/java/org/apache/fop/pdf/PDFAMode.java @@ -49,7 +49,7 @@ public final class PDFAMode { * @return true if this mode obeys the restrictions established by PDF/A-1a. */ public boolean isPDFA1LevelA() { - return (this != DISABLED); + return (this == PDFA_1A); } /** diff --git a/src/java/org/apache/fop/pdf/PDFArray.java b/src/java/org/apache/fop/pdf/PDFArray.java index a7dfc388e..a79e2704f 100644 --- a/src/java/org/apache/fop/pdf/PDFArray.java +++ b/src/java/org/apache/fop/pdf/PDFArray.java @@ -172,6 +172,13 @@ public class PDFArray extends PDFObject { this.values.add(new Double(value)); } + /** + * Clears the PDF array. + */ + public void clear() { + this.values.clear(); + } + /** {@inheritDoc} */ protected int output(OutputStream stream) throws IOException { CountingOutputStream cout = new CountingOutputStream(stream); diff --git a/src/java/org/apache/fop/pdf/PDFCIDFont.java b/src/java/org/apache/fop/pdf/PDFCIDFont.java index 3224eb567..9a91dd992 100644 --- a/src/java/org/apache/fop/pdf/PDFCIDFont.java +++ b/src/java/org/apache/fop/pdf/PDFCIDFont.java @@ -56,9 +56,10 @@ public class PDFCIDFont extends PDFObject { * @param supplement Supplement number * @param descriptor CID font descriptor */ - public PDFCIDFont(String basefont, CIDFontType cidtype, int dw, - int[] w, String registry, String ordering, - int supplement, PDFCIDFontDescriptor descriptor) { + public PDFCIDFont // CSOK: ParameterNumber + (String basefont, CIDFontType cidtype, int dw, + int[] w, String registry, String ordering, + int supplement, PDFCIDFontDescriptor descriptor) { this(basefont, cidtype, dw, new PDFWArray(w), diff --git a/src/java/org/apache/fop/pdf/PDFColor.java b/src/java/org/apache/fop/pdf/PDFColor.java index 42a9c7223..2dc1da1ea 100644 --- a/src/java/org/apache/fop/pdf/PDFColor.java +++ b/src/java/org/apache/fop/pdf/PDFColor.java @@ -26,8 +26,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.color.ColorExt; +import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace; + +import org.apache.fop.util.ColorExt; /** * PDF Color object. @@ -122,7 +123,7 @@ public class PDFColor extends PDFPathPaint { ce = (ColorExt)col; cs = ce.getOrigColorSpace(); } - if (cs != null && cs instanceof CMYKColorSpace) { + if (cs != null && cs instanceof DeviceCMYKColorSpace) { // CMYK case this.colorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_CMYK); float[] cmyk = (ce == null diff --git a/src/java/org/apache/fop/pdf/PDFDocument.java b/src/java/org/apache/fop/pdf/PDFDocument.java index f0a777bdd..a17c8c4df 100644 --- a/src/java/org/apache/fop/pdf/PDFDocument.java +++ b/src/java/org/apache/fop/pdf/PDFDocument.java @@ -124,8 +124,8 @@ public class PDFDocument { private PDFEncryption encryption; /** the colorspace (0=RGB, 1=CMYK) */ - private PDFDeviceColorSpace colorspace = - new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB); + private PDFDeviceColorSpace colorspace + = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB); /** the counter for Pattern name numbering (e.g. 'Pattern1') */ private int patternCount = 0; @@ -1017,9 +1017,7 @@ public class PDFDocument { output(stream); for (int count = 0; count < this.trailerObjects.size(); count++) { PDFObject o = (PDFObject)this.trailerObjects.get(count); - this.location.set( - o.getObjectNumber() - 1, - new Integer(this.position)); + setLocation(o.getObjectNumber() - 1, this.position); this.position += o.output(stream); } /* output the xref table and increment the character position diff --git a/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java b/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java new file mode 100644 index 000000000..a5b44710a --- /dev/null +++ b/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java @@ -0,0 +1,59 @@ +/* + * 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.pdf; + +import java.io.IOException; +import java.util.Date; + +/** + * This class represents an embedded file stream. + */ +public class PDFEmbeddedFile extends PDFStream { + + /** + * Creates a new embedded file stream. + */ + public PDFEmbeddedFile() { + super(); + put("Type", new PDFName("EmbeddedFile")); + PDFDictionary params = new PDFDictionary(); + params.put("CreationDate", params.formatDateTime(new Date())); + put("Params", params); + } + + /** {@inheritDoc} */ + protected boolean isEncodingOnTheFly() { + //Acrobat doesn't like an indirect /Length object in this case, + //but only when the embedded file is a PDF file. + return false; + } + + /** {@inheritDoc} */ + protected void populateStreamDict(Object lengthEntry) { + super.populateStreamDict(lengthEntry); + try { + PDFDictionary dict = (PDFDictionary)get("Params"); + dict.put("Size", new Integer(data.getSize())); + } catch (IOException ioe) { + //ignore and just skip this entry as it's optional + } + } + +} diff --git a/src/java/org/apache/fop/pdf/PDFEmbeddedFiles.java b/src/java/org/apache/fop/pdf/PDFEmbeddedFiles.java new file mode 100644 index 000000000..8e89f5ada --- /dev/null +++ b/src/java/org/apache/fop/pdf/PDFEmbeddedFiles.java @@ -0,0 +1,66 @@ +/* + * 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.pdf; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.Writer; +import java.util.Iterator; +import java.util.Map; +import java.util.SortedMap; + +/** + * Class representing an /EmbeddedFiles dictionary object (name tree). + */ +public class PDFEmbeddedFiles extends PDFNameTreeNode { + + /** + * Create a /EmbeddedFiles dictionary. + */ + public PDFEmbeddedFiles() { + super(); + } + + /** {@inheritDoc} */ + protected void writeDictionary(OutputStream out, Writer writer) throws IOException { + sortNames(); //Sort the names before writing them out + super.writeDictionary(out, writer); + } + + private void sortNames() { + PDFArray names = getNames(); + SortedMap map = new java.util.TreeMap(); + int i = 0; + int c = names.length(); + while (i < c) { + Comparable key = (Comparable)names.get(i++); //Key must be a Comparable for sorting + Object value = names.get(i++); + map.put(key, value); + } + names.clear(); + Iterator iter = map.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry)iter.next(); + names.add(entry.getKey()); + names.add(entry.getValue()); + } + } +} + diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java b/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java index 43a323335..269f0639d 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java +++ b/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java @@ -21,7 +21,6 @@ package org.apache.fop.pdf; // Java import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.security.InvalidKeyException; import java.security.MessageDigest; @@ -80,26 +79,6 @@ public class PDFEncryptionJCE extends PDFObject implements PDFEncryption { } /** - * Encode the given data with the filter - * @param data The data to be encrypted - * @return The encrypted data - */ - public byte[] encode(byte[] data) { - return encryption.encryptData(data, number, generation); - } - - /** - * {@inheritDoc} - */ - public void encode(InputStream in, OutputStream out, int length) - throws IOException { - byte[] buffer = new byte[length]; - in.read(buffer); - buffer = encode(buffer); - out.write(buffer); - } - - /** * {@inheritDoc} */ public OutputStream applyFilter(OutputStream out) throws IOException { diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java b/src/java/org/apache/fop/pdf/PDFEncryptionManager.java index 5d5ea8586..3f5ae2a3d 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java +++ b/src/java/org/apache/fop/pdf/PDFEncryptionManager.java @@ -31,10 +31,13 @@ import org.apache.commons.logging.LogFactory; * This class acts as a factory for PDF encryption support. It enables the * feature to be optional to FOP depending on the availability of JCE. */ -public class PDFEncryptionManager { +public final class PDFEncryptionManager { + + private PDFEncryptionManager() { + } /** logging instance */ - protected static Log log = LogFactory.getLog(PDFEncryptionManager.class); + private static final Log LOG = LogFactory.getLog(PDFEncryptionManager.class); /** * Indicates whether JCE is available. @@ -60,12 +63,12 @@ public class PDFEncryptionManager { Provider[] providers; providers = Security.getProviders("Cipher.RC4"); if (providers == null) { - log.warn("Cipher provider for RC4 not available."); + LOG.warn("Cipher provider for RC4 not available."); return false; } providers = Security.getProviders("MessageDigest.MD5"); if (providers == null) { - log.warn("MessageDigest provider for MD5 not available."); + LOG.warn("MessageDigest provider for MD5 not available."); return false; } return true; @@ -88,13 +91,13 @@ public class PDFEncryptionManager { if (params != null) { if (!checkAvailableAlgorithms()) { if (isJCEAvailable()) { - log.warn("PDF encryption has been requested, JCE is " + LOG.warn("PDF encryption has been requested, JCE is " + "available but there's no " + "JCE provider available that provides the " + "necessary algorithms. The PDF won't be " + "encrypted."); } else { - log.warn("PDF encryption has been requested but JCE is " + LOG.warn("PDF encryption has been requested but JCE is " + "unavailable! The PDF won't be encrypted."); } } @@ -119,19 +122,19 @@ public class PDFEncryptionManager { return (PDFEncryption)obj; } catch (ClassNotFoundException e) { if (checkAvailableAlgorithms()) { - log.warn("JCE and algorithms available, but the " + LOG.warn("JCE and algorithms available, but the " + "implementation class unavailable. Please do a full " + "rebuild."); } return null; } catch (NoSuchMethodException e) { - log.error(e); + LOG.error(e); return null; } catch (IllegalAccessException e) { - log.error(e); + LOG.error(e); return null; } catch (InvocationTargetException e) { - log.error(e); + LOG.error(e); return null; } } diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index bf3399b09..8ebd15127 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -65,6 +65,9 @@ import org.apache.fop.fonts.type1.PFBParser; */ public class PDFFactory { + /** Resolution of the User Space coordinate system (72dpi). */ + public static final int DEFAULT_PDF_RESOLUTION = 72; + private PDFDocument document; private Log log = LogFactory.getLog(PDFFactory.class); @@ -289,12 +292,13 @@ public class PDFFactory { * It should be 0 as this is the constructor for sampled functions. * @return the PDF function that was created */ - public PDFFunction makeFunction(int theFunctionType, List theDomain, - List theRange, List theSize, - int theBitsPerSample, int theOrder, - List theEncode, List theDecode, - StringBuffer theFunctionDataStream, - List theFilter) { + public PDFFunction makeFunction // CSOK: ParameterNumber + (int theFunctionType, List theDomain, + List theRange, List theSize, + int theBitsPerSample, int theOrder, + List theEncode, List theDecode, + StringBuffer theFunctionDataStream, + List theFilter) { // Type 0 function PDFFunction function = new PDFFunction(theFunctionType, theDomain, theRange, theSize, @@ -462,12 +466,13 @@ public class PDFFactory { * @param theFunction The PDF Function that maps an (x,y) location to a color * @return the PDF shading that was created */ - public PDFShading makeShading(PDFResourceContext res, int theShadingType, - PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theDomain, - List theMatrix, - PDFFunction theFunction) { + public PDFShading makeShading // CSOK: ParameterNumber + (PDFResourceContext res, int theShadingType, + PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, List theDomain, + List theMatrix, + PDFFunction theFunction) { // make Shading of Type 1 PDFShading shading = new PDFShading(theShadingType, theColorSpace, theBackground, @@ -514,12 +519,13 @@ public class PDFFactory { * The default is [false, false] * @return the PDF shading that was created */ - public PDFShading makeShading(PDFResourceContext res, int theShadingType, - PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theCoords, - List theDomain, PDFFunction theFunction, - List theExtend) { + public PDFShading makeShading // CSOK: ParameterNumber + (PDFResourceContext res, int theShadingType, + PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, List theCoords, + List theDomain, PDFFunction theFunction, + List theExtend) { // make Shading of Type 2 or 3 PDFShading shading = new PDFShading(theShadingType, theColorSpace, theBackground, @@ -567,14 +573,15 @@ public class PDFFactory { * @param theFunction the PDFFunction * @return the PDF shading that was created */ - public PDFShading makeShading(PDFResourceContext res, int theShadingType, - PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, - int theBitsPerCoordinate, - int theBitsPerComponent, - int theBitsPerFlag, List theDecode, - PDFFunction theFunction) { + public PDFShading makeShading // CSOK: ParameterNumber + (PDFResourceContext res, int theShadingType, + PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, + int theBitsPerCoordinate, + int theBitsPerComponent, + int theBitsPerFlag, List theDecode, + PDFFunction theFunction) { // make Shading of type 4,6 or 7 PDFShading shading = new PDFShading(theShadingType, theColorSpace, theBackground, @@ -622,14 +629,15 @@ public class PDFFactory { * @param theFunction The PDFFunction that's mapped on to this shape * @return the PDF shading that was created */ - public PDFShading makeShading(PDFResourceContext res, int theShadingType, - PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, - int theBitsPerCoordinate, - int theBitsPerComponent, List theDecode, - int theVerticesPerRow, - PDFFunction theFunction) { + public PDFShading makeShading // CSOK: ParameterNumber + (PDFResourceContext res, int theShadingType, + PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, + int theBitsPerCoordinate, + int theBitsPerComponent, List theDecode, + int theVerticesPerRow, + PDFFunction theFunction) { // make shading of Type 5 PDFShading shading = new PDFShading(theShadingType, theColorSpace, theBackground, @@ -672,11 +680,12 @@ public class PDFFactory { * @param thePatternDataStream The stream of pattern data to be tiled. * @return the PDF pattern that was created */ - public PDFPattern makePattern(PDFResourceContext res, int thePatternType, // 1 - PDFResources theResources, int thePaintType, int theTilingType, - List theBBox, double theXStep, - double theYStep, List theMatrix, - List theXUID, StringBuffer thePatternDataStream) { + public PDFPattern makePattern // CSOK: ParameterNumber + (PDFResourceContext res, int thePatternType, // 1 + PDFResources theResources, int thePaintType, int theTilingType, + List theBBox, double theXStep, + double theYStep, List theMatrix, + List theXUID, StringBuffer thePatternDataStream) { // PDFResources theResources PDFPattern pattern = new PDFPattern(theResources, 1, thePaintType, theTilingType, @@ -871,7 +880,8 @@ public class PDFFactory { */ public PDFNames makeNames() { PDFNames names = new PDFNames(); - getDocument().registerObject(names); + getDocument().assignObjectNumber(names); + getDocument().addTrailerObject(names); return names; } @@ -1044,6 +1054,8 @@ public class PDFFactory { return link; } + private static final String EMBEDDED_FILE = "embedded-file:"; + /** * Create/find and return the appropriate external PDFAction according to the target * @@ -1056,32 +1068,88 @@ public class PDFFactory { public PDFAction getExternalAction(String target, boolean newWindow) { int index; String targetLo = target.toLowerCase(); - // HTTP URL? - if (targetLo.startsWith("http://")) { + if (target.startsWith(EMBEDDED_FILE)) { + // File Attachments (Embedded Files) + String filename = target.substring(EMBEDDED_FILE.length()); + return getActionForEmbeddedFile(filename, newWindow); + } else if (targetLo.startsWith("http://")) { + // HTTP URL? return new PDFUri(target); - // Non PDF files. Try to /Launch them. } else if (targetLo.startsWith("file://")) { + // Non PDF files. Try to /Launch them. target = target.substring("file://".length()); return getLaunchAction(target); - // Bare PDF file name? } else if (targetLo.endsWith(".pdf")) { + // Bare PDF file name? return getGoToPDFAction(target, null, -1, newWindow); - // PDF file + page? - } else if ((index = targetLo.indexOf(".pdf#page=")) > 0) { + } else if ((index = targetLo.indexOf(".pdf#page=")) > 0) { // CSOK: InnerAssignment + // PDF file + page? String filename = target.substring(0, index + 4); int page = Integer.parseInt(target.substring(index + 10)); return getGoToPDFAction(filename, null, page, newWindow); - // PDF file + destination? - } else if ((index = targetLo.indexOf(".pdf#dest=")) > 0) { + } else if ((index = targetLo.indexOf(".pdf#dest=")) > 0) { // CSOK: InnerAssignment + // PDF file + destination? String filename = target.substring(0, index + 4); String dest = target.substring(index + 10); return getGoToPDFAction(filename, dest, -1, newWindow); - // None of the above? Default to URI: } else { + // None of the above? Default to URI: return new PDFUri(target); } } + private PDFAction getActionForEmbeddedFile(String filename, boolean newWindow) { + PDFNames names = getDocument().getRoot().getNames(); + if (names == null) { + throw new IllegalStateException( + "No Names dictionary present." + + " Cannot create Launch Action for embedded file: " + filename); + } + PDFNameTreeNode embeddedFiles = names.getEmbeddedFiles(); + if (embeddedFiles == null) { + throw new IllegalStateException( + "No /EmbeddedFiles name tree present." + + " Cannot create Launch Action for embedded file: " + filename); + } + + //Find filespec reference for the embedded file + filename = PDFText.toPDFString(filename, '_'); + PDFArray files = embeddedFiles.getNames(); + PDFReference embeddedFileRef = null; + int i = 0; + while (i < files.length()) { + String name = (String)files.get(i); + i++; + PDFReference ref = (PDFReference)files.get(i); + if (name.equals(filename)) { + embeddedFileRef = ref; + break; + } + i++; + } + if (embeddedFileRef == null) { + throw new IllegalStateException( + "No embedded file with name " + filename + " present."); + } + + //Finally create the action + //PDFLaunch action = new PDFLaunch(embeddedFileRef); + //This works with Acrobat 8 but not with Acrobat 9 + + //The following two options didn't seem to have any effect. + //PDFGoToEmbedded action = new PDFGoToEmbedded(embeddedFileRef, 0, newWindow); + //PDFGoToRemote action = new PDFGoToRemote(embeddedFileRef, 0, newWindow); + + //This finally seems to work: + StringBuffer scriptBuffer = new StringBuffer(); + scriptBuffer.append("this.exportDataObject({cName:\""); + scriptBuffer.append(filename); + scriptBuffer.append("\", nLaunch:2});"); + + PDFJavaScriptLaunchAction action = new PDFJavaScriptLaunchAction(scriptBuffer.toString()); + return action; + } + /** * Create or find a PDF GoTo with the given page reference string and Y offset, * and return its PDF object reference diff --git a/src/java/org/apache/fop/pdf/PDFFileSpec.java b/src/java/org/apache/fop/pdf/PDFFileSpec.java index 8de4164af..b9a46c8b8 100644 --- a/src/java/org/apache/fop/pdf/PDFFileSpec.java +++ b/src/java/org/apache/fop/pdf/PDFFileSpec.java @@ -20,15 +20,9 @@ package org.apache.fop.pdf; /** - * class representing a /FileSpec object. - * + * Class representing a /FileSpec object. */ -public class PDFFileSpec extends PDFObject { - - /** - * the filename - */ - protected String filename; +public class PDFFileSpec extends PDFDictionary { /** * create a /FileSpec object. @@ -39,29 +33,30 @@ public class PDFFileSpec extends PDFObject { /* generic creation of object */ super(); + put("Type", new PDFName("Filespec")); + put("F", filename); + } - this.filename = filename; + private String getFilename() { + return (String)get("F"); } /** - * {@inheritDoc} + * Associates an dictionary with pointers to embedded file streams with this file spec. + * @param embeddedFileDict the dictionary with pointers to embedded file streams */ - public String toPDFString() { - return getObjectID() - + "<<\n/Type /FileSpec\n" - + "/F (" + this.filename + ")\n" - + ">>\nendobj\n"; + public void setEmbeddedFile(PDFDictionary embeddedFileDict) { + put("EF", embeddedFileDict); } - /* - * example - * 29 0 obj - * << - * /Type /FileSpec - * /F (table1.pdf) - * >> - * endobj + /** + * Sets a description for the file spec. + * @param description the description + * @since PDF 1.6 */ + public void setDescription(String description) { + put("Desc", description); + } /** {@inheritDoc} */ protected boolean contentEquals(PDFObject obj) { @@ -75,7 +70,7 @@ public class PDFFileSpec extends PDFObject { PDFFileSpec spec = (PDFFileSpec)obj; - if (!spec.filename.equals(filename)) { + if (!spec.getFilename().equals(getFilename())) { return false; } diff --git a/src/java/org/apache/fop/pdf/PDFFontDescriptor.java b/src/java/org/apache/fop/pdf/PDFFontDescriptor.java index d4b412e4c..4350ed7dd 100644 --- a/src/java/org/apache/fop/pdf/PDFFontDescriptor.java +++ b/src/java/org/apache/fop/pdf/PDFFontDescriptor.java @@ -40,10 +40,11 @@ public class PDFFontDescriptor extends PDFDictionary { * @param italicAngle the angle of the vertical dominant strokes * @param stemV the width of the dominant vertical stems of glyphs */ - public PDFFontDescriptor(String basefont, int ascent, - int descent, int capHeight, int flags, - PDFRectangle fontBBox, int italicAngle, - int stemV) { + public PDFFontDescriptor // CSOK: ParameterNumber + (String basefont, int ascent, + int descent, int capHeight, int flags, + PDFRectangle fontBBox, int italicAngle, + int stemV) { super(); put("Type", new PDFName("FontDescriptor")); diff --git a/src/java/org/apache/fop/pdf/PDFFormXObject.java b/src/java/org/apache/fop/pdf/PDFFormXObject.java index 5ede9b487..2ccc17086 100644 --- a/src/java/org/apache/fop/pdf/PDFFormXObject.java +++ b/src/java/org/apache/fop/pdf/PDFFormXObject.java @@ -34,7 +34,6 @@ import java.io.OutputStream; public class PDFFormXObject extends PDFXObject { private PDFStream contents; - private PDFReference resRef; /** * create a FormXObject with the given number and name and load the @@ -47,13 +46,15 @@ public class PDFFormXObject extends PDFXObject { public PDFFormXObject(int xnumber, PDFStream contents, PDFReference resources) { super(); put("Name", new PDFName("Form" + xnumber)); - this.resRef = resources; this.contents = contents; put("Type", new PDFName("XObject")); put("Subtype", new PDFName("Form")); put("FormType", new Integer(1)); setMatrix(new AffineTransform()); + if (resources != null) { + put("Resources", resources); + } } /** @@ -172,7 +173,6 @@ public class PDFFormXObject extends PDFXObject { if (get("Matrix") == null) { put("Matrix", new PDFArray(this, new int[] {1, 0, 0, 1, 0, 0})); } - put("Resources", resRef); super.populateStreamDict(lengthEntry); } diff --git a/src/java/org/apache/fop/pdf/PDFFunction.java b/src/java/org/apache/fop/pdf/PDFFunction.java index d57cabb50..5b5d41490 100644 --- a/src/java/org/apache/fop/pdf/PDFFunction.java +++ b/src/java/org/apache/fop/pdf/PDFFunction.java @@ -211,10 +211,11 @@ public class PDFFunction extends PDFObject { * @param theFunctionType This is the type of function (0,2,3, or 4). * It should be 0 as this is the constructor for sampled functions. */ - public PDFFunction(int theFunctionType, List theDomain, - List theRange, List theSize, int theBitsPerSample, - int theOrder, List theEncode, List theDecode, - StringBuffer theFunctionDataStream, List theFilter) { + public PDFFunction // CSOK: ParameterNumber + (int theFunctionType, List theDomain, + List theRange, List theSize, int theBitsPerSample, + int theOrder, List theEncode, List theDecode, + StringBuffer theFunctionDataStream, List theFilter) { super(); this.functionType = 0; // dang well better be 0; @@ -374,7 +375,7 @@ public class PDFFunction extends PDFObject { * * @return the PDF string. */ - public byte[] toPDF() { + public byte[] toPDF() { // CSOK: MethodLength int vectorSize = 0; int numberOfFunctions = 0; int tempInt = 0; diff --git a/src/java/org/apache/fop/pdf/PDFGoTo.java b/src/java/org/apache/fop/pdf/PDFGoTo.java index ad04650c6..0626f0fcd 100644 --- a/src/java/org/apache/fop/pdf/PDFGoTo.java +++ b/src/java/org/apache/fop/pdf/PDFGoTo.java @@ -42,10 +42,8 @@ public class PDFGoTo extends PDFAction { * @param pageReference the pageReference represented by this object */ public PDFGoTo(String pageReference) { - /* generic creation of object */ super(); - - this.pageReference = pageReference; + setPageReference(pageReference); } /** @@ -56,9 +54,7 @@ public class PDFGoTo extends PDFAction { */ public PDFGoTo(String pageReference, Point2D position) { /* generic creation of object */ - super(); - - this.pageReference = pageReference; + this(pageReference); setPosition(position); } diff --git a/src/java/org/apache/fop/pdf/PDFGoToRemote.java b/src/java/org/apache/fop/pdf/PDFGoToRemote.java index ee7660875..93fbe47de 100644 --- a/src/java/org/apache/fop/pdf/PDFGoToRemote.java +++ b/src/java/org/apache/fop/pdf/PDFGoToRemote.java @@ -27,7 +27,7 @@ public class PDFGoToRemote extends PDFAction { /** * the file specification */ - private PDFFileSpec pdfFileSpec; + private PDFReference pdfFileSpec; private int pageReference = 0; private String destination = null; private boolean newWindow = false; @@ -43,12 +43,12 @@ public class PDFGoToRemote extends PDFAction { /* generic creation of object */ super(); - this.pdfFileSpec = pdfFileSpec; + this.pdfFileSpec = pdfFileSpec.makeReference(); this.newWindow = newWindow; } /** - * create an GoToR object. + * Create an GoToR object. * * @param pdfFileSpec the fileSpec associated with the action * @param page a page reference within the remote document @@ -56,7 +56,18 @@ public class PDFGoToRemote extends PDFAction { * displayed in a new window */ public PDFGoToRemote(PDFFileSpec pdfFileSpec, int page, boolean newWindow) { - /* generic creation of object */ + this(pdfFileSpec.makeReference(), page, newWindow); + } + + /** + * Create an GoToR object. + * + * @param pdfFileSpec the fileSpec associated with the action + * @param page a page reference within the remote document + * @param newWindow boolean indicating whether the target should be + * displayed in a new window + */ + public PDFGoToRemote(PDFReference pdfFileSpec, int page, boolean newWindow) { super(); this.pdfFileSpec = pdfFileSpec; @@ -76,7 +87,7 @@ public class PDFGoToRemote extends PDFAction { /* generic creation of object */ super(); - this.pdfFileSpec = pdfFileSpec; + this.pdfFileSpec = pdfFileSpec.makeReference(); this.destination = dest; this.newWindow = newWindow; } @@ -97,7 +108,7 @@ public class PDFGoToRemote extends PDFAction { StringBuffer sb = new StringBuffer(64); sb.append(getObjectID()); sb.append("<<\n/S /GoToR\n/F "); - sb.append(pdfFileSpec.referencePDF()); + sb.append(pdfFileSpec.toString()); sb.append("\n"); if (destination != null) { @@ -139,7 +150,7 @@ public class PDFGoToRemote extends PDFAction { PDFGoToRemote remote = (PDFGoToRemote)obj; - if (!remote.pdfFileSpec.referencePDF().equals(pdfFileSpec.referencePDF())) { + if (!remote.pdfFileSpec.toString().equals(pdfFileSpec.toString())) { return false; } diff --git a/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java b/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java new file mode 100644 index 000000000..dcd3c6fea --- /dev/null +++ b/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java @@ -0,0 +1,72 @@ +/* + * 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.pdf; + +/** + * PDF Action which executes some JavaScript code. + * @since PDF 1.3 + */ +public class PDFJavaScriptLaunchAction extends PDFAction { + + private String script; + + /** + * Creates a new /Launch action. + * @param script the script to run when the launch action is triggered + */ + public PDFJavaScriptLaunchAction(String script) { + this.script = script; + } + + /** {@inheritDoc} */ + public String getAction() { + return this.referencePDF(); + } + + /** {@inheritDoc} */ + public String toPDFString() { + StringBuffer sb = new StringBuffer(64); + sb.append(getObjectID()); + sb.append("<<\n/S /JavaScript\n/JS ("); + sb.append(this.script); + sb.append(")\n>>\nendobj\n"); + return sb.toString(); + } + + /** {@inheritDoc} */ + protected boolean contentEquals(PDFObject obj) { + if (this == obj) { + return true; + } + + if (obj == null || !(obj instanceof PDFJavaScriptLaunchAction)) { + return false; + } + + PDFJavaScriptLaunchAction launch = (PDFJavaScriptLaunchAction) obj; + + if (!launch.script.toString().equals(script.toString())) { + return false; + } + + return true; + } + +} diff --git a/src/java/org/apache/fop/pdf/PDFLaunch.java b/src/java/org/apache/fop/pdf/PDFLaunch.java index 386a7a9a3..e62da5279 100644 --- a/src/java/org/apache/fop/pdf/PDFLaunch.java +++ b/src/java/org/apache/fop/pdf/PDFLaunch.java @@ -5,7 +5,7 @@ * 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 @@ -14,7 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /* $Id$ */ + package org.apache.fop.pdf; /** @@ -22,21 +24,39 @@ package org.apache.fop.pdf; */ public class PDFLaunch extends PDFAction { - private PDFFileSpec externalFileSpec; + private PDFReference externalFileSpec; + /** + * Creates a new /Launch action. + * @param fileSpec the file specification to launch + */ public PDFLaunch(PDFFileSpec fileSpec) { + this(fileSpec.makeReference()); + } + + /** + * Creates a new /Launch action. + * @param fileSpec a reference to the file specification + */ + public PDFLaunch(PDFReference fileSpec) { + PDFObject fs = fileSpec.getObject(); + if (fs != null) { + assert fs instanceof PDFFileSpec; + } this.externalFileSpec = fileSpec; } + /** {@inheritDoc} */ public String getAction() { return this.referencePDF(); } + /** {@inheritDoc} */ public String toPDFString() { StringBuffer sb = new StringBuffer(64); sb.append(getObjectID()); sb.append("<<\n/S /Launch\n/F "); - sb.append(externalFileSpec.referencePDF()); + sb.append(externalFileSpec.toString()); sb.append(" \n>>\nendobj\n"); return sb.toString(); @@ -54,7 +74,7 @@ public class PDFLaunch extends PDFAction { PDFLaunch launch = (PDFLaunch) obj; - if (!launch.externalFileSpec.referencePDF().equals(externalFileSpec.referencePDF())) { + if (!launch.externalFileSpec.toString().equals(externalFileSpec.toString())) { return false; } diff --git a/src/java/org/apache/fop/pdf/PDFMetadata.java b/src/java/org/apache/fop/pdf/PDFMetadata.java index 92796c0d1..49f762708 100644 --- a/src/java/org/apache/fop/pdf/PDFMetadata.java +++ b/src/java/org/apache/fop/pdf/PDFMetadata.java @@ -47,7 +47,11 @@ public class PDFMetadata extends PDFStream { private Metadata xmpMetadata; private boolean readOnly = true; - /** @see org.apache.fop.pdf.PDFObject#PDFObject() */ + /** + * @param xmp xmp metadata + * @param readOnly true if read only + * @see org.apache.fop.pdf.PDFObject#PDFObject() + */ public PDFMetadata(Metadata xmp, boolean readOnly) { super(); if (xmp == null) { diff --git a/src/java/org/apache/fop/pdf/PDFName.java b/src/java/org/apache/fop/pdf/PDFName.java index 19db917c8..8214cda76 100644 --- a/src/java/org/apache/fop/pdf/PDFName.java +++ b/src/java/org/apache/fop/pdf/PDFName.java @@ -49,16 +49,18 @@ public class PDFName extends PDFObject { */ static String escapeName(String name) { StringBuffer sb = new StringBuffer(Math.min(16, name.length() + 4)); - if (!name.startsWith("/")) { - sb.append('/'); + boolean skipFirst = false; + sb.append('/'); + if (name.startsWith("/")) { + skipFirst = true; } - for (int i = 0, c = name.length(); i < c; i++) { + for (int i = (skipFirst ? 1 : 0), c = name.length(); i < c; i++) { char ch = name.charAt(i); - if (ch >= 33 && ch <= 126) { - sb.append(ch); - } else { + if (ch < 33 || ch > 126 || ch == 0x2F) { sb.append('#'); toHex(ch, sb); + } else { + sb.append(ch); } } return sb.toString(); diff --git a/src/java/org/apache/fop/pdf/PDFNameTreeNode.java b/src/java/org/apache/fop/pdf/PDFNameTreeNode.java index 4bc00ef9c..4e1f1b71b 100644 --- a/src/java/org/apache/fop/pdf/PDFNameTreeNode.java +++ b/src/java/org/apache/fop/pdf/PDFNameTreeNode.java @@ -19,6 +19,7 @@ package org.apache.fop.pdf; + /** * Class representing a PDF name tree node. */ @@ -104,7 +105,6 @@ public class PDFNameTreeNode extends PDFDictionary { return (String)limits.get(1); } - private PDFArray prepareLimitsArray() { PDFArray limits = (PDFArray)get(LIMITS); if (limits == null) { diff --git a/src/java/org/apache/fop/pdf/PDFNames.java b/src/java/org/apache/fop/pdf/PDFNames.java index 4253dd6d1..fbea0d3f5 100644 --- a/src/java/org/apache/fop/pdf/PDFNames.java +++ b/src/java/org/apache/fop/pdf/PDFNames.java @@ -24,6 +24,9 @@ package org.apache.fop.pdf; */ public class PDFNames extends PDFDictionary { + private static final String DESTS = "Dests"; + private static final String EMBEDDED_FILES = "EmbeddedFiles"; + /** * Create the Names object */ @@ -37,7 +40,7 @@ public class PDFNames extends PDFDictionary { * @return the Dests object, or null if it's not used */ public PDFDests getDests() { - return (PDFDests)get("Dests"); + return (PDFDests)get(DESTS); } /** @@ -45,7 +48,23 @@ public class PDFNames extends PDFDictionary { * @param dests the Dests object */ public void setDests(PDFDests dests) { - put("Dests", dests); + put(DESTS, dests); + } + + /** + * Returns the EmbeddedFiles object + * @return the EmbeddedFiles object, or null if it's not used + */ + public PDFEmbeddedFiles getEmbeddedFiles() { + return (PDFEmbeddedFiles)get(EMBEDDED_FILES); + } + + /** + * Set the EmbeddedFiles object + * @param embeddedFiles the EmbeddedFiles object + */ + public void setEmbeddedFiles(PDFEmbeddedFiles embeddedFiles) { + put(EMBEDDED_FILES, embeddedFiles); } } diff --git a/src/java/org/apache/fop/pdf/PDFNull.java b/src/java/org/apache/fop/pdf/PDFNull.java index 01ec7898c..7e11a1763 100644 --- a/src/java/org/apache/fop/pdf/PDFNull.java +++ b/src/java/org/apache/fop/pdf/PDFNull.java @@ -33,7 +33,6 @@ public final class PDFNull implements PDFWritable { /** * Creates a new PDF name object. - * @param name the name value */ private PDFNull() { } diff --git a/src/java/org/apache/fop/pdf/PDFPattern.java b/src/java/org/apache/fop/pdf/PDFPattern.java index 89ae1efcd..ebde4ac6a 100644 --- a/src/java/org/apache/fop/pdf/PDFPattern.java +++ b/src/java/org/apache/fop/pdf/PDFPattern.java @@ -117,11 +117,12 @@ public class PDFPattern extends PDFPathPaint { * @param theXUID Optional vector of Integers that uniquely identify the pattern * @param thePatternDataStream The stream of pattern data to be tiled. */ - public PDFPattern(PDFResources theResources, int thePatternType, // 1 - int thePaintType, int theTilingType, List theBBox, - double theXStep, double theYStep, - List theMatrix, List theXUID, - StringBuffer thePatternDataStream) { + public PDFPattern // CSOK: ParameterNumber + (PDFResources theResources, int thePatternType, // 1 + int thePaintType, int theTilingType, List theBBox, + double theXStep, double theYStep, + List theMatrix, List theXUID, + StringBuffer thePatternDataStream) { super(); this.resources = theResources; // This next parameter is implicit to all constructors, and is diff --git a/src/java/org/apache/fop/pdf/PDFProfile.java b/src/java/org/apache/fop/pdf/PDFProfile.java index b645cb825..fb4575105 100644 --- a/src/java/org/apache/fop/pdf/PDFProfile.java +++ b/src/java/org/apache/fop/pdf/PDFProfile.java @@ -265,4 +265,16 @@ public class PDFProfile { } } + /** Checks if embedded files are allowed. */ + public void verifyEmbeddedFilesAllowed() { + final String err = "{0} does not allow embedded files."; + if (isPDFAActive()) { + throw new PDFConformanceException(format(err, getPDFAMode())); + } + if (isPDFXActive()) { + //Implicit since file specs are forbidden + throw new PDFConformanceException(format(err, getPDFXMode())); + } + } + } diff --git a/src/java/org/apache/fop/pdf/PDFShading.java b/src/java/org/apache/fop/pdf/PDFShading.java index fa4d454ed..10d7bf628 100644 --- a/src/java/org/apache/fop/pdf/PDFShading.java +++ b/src/java/org/apache/fop/pdf/PDFShading.java @@ -164,10 +164,11 @@ public class PDFShading extends PDFObject { * It's optional, the default is the identity matrix * @param theFunction The PDF Function that maps an (x,y) location to a color */ - public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theDomain, - List theMatrix, PDFFunction theFunction) { + public PDFShading // CSOK: ParameterNumber + (int theShadingType, PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, List theDomain, + List theMatrix, PDFFunction theFunction) { super(); this.shadingType = theShadingType; // 1 this.colorSpace = theColorSpace; @@ -202,11 +203,12 @@ public class PDFShading extends PDFObject { * and end colors past the start and end points * The default is [false, false] */ - public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theCoords, - List theDomain, PDFFunction theFunction, - List theExtend) { + public PDFShading // CSOK: ParameterNumber + (int theShadingType, PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, List theCoords, + List theDomain, PDFFunction theFunction, + List theExtend) { super(); this.shadingType = theShadingType; // 2 or 3 this.colorSpace = theColorSpace; @@ -242,11 +244,12 @@ public class PDFShading extends PDFObject { * @param theDecode List of Doubles see PDF 1.3 spec pages 303 to 312. * @param theFunction the PDFFunction */ - public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, int theBitsPerCoordinate, - int theBitsPerComponent, int theBitsPerFlag, - List theDecode, PDFFunction theFunction) { + public PDFShading // CSOK: ParameterNumber + (int theShadingType, PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, int theBitsPerCoordinate, + int theBitsPerComponent, int theBitsPerFlag, + List theDecode, PDFFunction theFunction) { super(); this.shadingType = theShadingType; // 4,6 or 7 @@ -281,11 +284,12 @@ public class PDFShading extends PDFObject { * @param theVerticesPerRow number of vertices in each "row" of the lattice. * @param theFunction The PDFFunction that's mapped on to this shape */ - public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, int theBitsPerCoordinate, - int theBitsPerComponent, List theDecode, - int theVerticesPerRow, PDFFunction theFunction) { + public PDFShading // CSOK: ParameterNumber + (int theShadingType, PDFDeviceColorSpace theColorSpace, + List theBackground, List theBBox, + boolean theAntiAlias, int theBitsPerCoordinate, + int theBitsPerComponent, List theDecode, + int theVerticesPerRow, PDFFunction theFunction) { super(); this.shadingType = theShadingType; // 5 this.colorSpace = theColorSpace; @@ -334,7 +338,7 @@ public class PDFShading extends PDFObject { * * @return the PDF string. */ - public String toPDFString() { + public String toPDFString() { // CSOK: MethodLength int vectorSize; int tempInt; StringBuffer p = new StringBuffer(128); diff --git a/src/java/org/apache/fop/pdf/PDFText.java b/src/java/org/apache/fop/pdf/PDFText.java index 02f845266..9566f60da 100644 --- a/src/java/org/apache/fop/pdf/PDFText.java +++ b/src/java/org/apache/fop/pdf/PDFText.java @@ -320,5 +320,41 @@ public class PDFText extends PDFObject { return bout.toByteArray(); } + /** + * Converts a text to PDF's "string" data type. Unsupported characters get converted to '?' + * characters (similar to what the Java "US-ASCII" encoding does). + * @see #toPDFString(CharSequence, char) + * @param text the text to convert + * @return the converted string + */ + public static String toPDFString(CharSequence text) { + return toPDFString(text, '?'); + } + + /** + * Converts a text to PDF's "string" data type. Unsupported characters get converted to the + * given replacement character. + * <p> + * The PDF library currently doesn't properly distinguish between the PDF + * data types "string" and "text string", so we currently restrict "string" to US-ASCII, also + * because "string" seems somewhat under-specified concerning the upper 128 bytes. + * @param text the text to convert + * @param replacement the replacement character used when substituting a character + * @return the converted string + */ + public static String toPDFString(CharSequence text, char replacement) { + StringBuffer sb = new StringBuffer(); + for (int i = 0, c = text.length(); i < c; i++) { + char ch = text.charAt(i); + if (ch > 127) { + //TODO Revisit the restriction to US-ASCII once "string" and "text string" are + //"disentangled". + sb.append(replacement); + } else { + sb.append(ch); + } + } + return sb.toString(); + } } diff --git a/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java b/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java index 95999b73f..56ca884f9 100644 --- a/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java +++ b/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java @@ -79,7 +79,6 @@ public class PDFToUnicodeCMap extends PDFCMap { /** * Writes the CMap to a Writer. - * @param writer the writer * @throws IOException if an I/O error occurs */ public void writeCMap() throws IOException { @@ -94,7 +93,6 @@ public class PDFToUnicodeCMap extends PDFCMap { /** * Writes the character mappings for this font. - * @param p StingBuffer to write to */ protected void writeBFEntries() throws IOException { if (unicodeCharMap != null) { @@ -106,7 +104,6 @@ public class PDFToUnicodeCMap extends PDFCMap { /** * Writes the entries for single characters of a base font (only characters which cannot be * expressed as part of a character range). - * @param p StringBuffer to write to * @param charArray all the characters to map * @throws IOException */ @@ -147,7 +144,6 @@ public class PDFToUnicodeCMap extends PDFCMap { /** * Writes the entries for character ranges for a base font. - * @param p StringBuffer to write to * @param charArray all the characters to map * @throws IOException */ diff --git a/src/java/org/apache/fop/pdf/TransitionDictionary.java b/src/java/org/apache/fop/pdf/TransitionDictionary.java index 6711c9508..079a6ce4e 100644 --- a/src/java/org/apache/fop/pdf/TransitionDictionary.java +++ b/src/java/org/apache/fop/pdf/TransitionDictionary.java @@ -28,8 +28,6 @@ public class TransitionDictionary extends PDFDictionary { /** * Create a Transition Dictionary - * - * @param values the dictionary values to output */ public TransitionDictionary() { put("Type", new PDFName("Trans")); diff --git a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java b/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java index ee18dff0d..f5a51b058 100644 --- a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java @@ -34,9 +34,10 @@ import java.awt.image.Raster; import java.awt.image.WritableRaster; import java.io.IOException; -import org.apache.fop.render.RendererContext.RendererContextWrapper; import org.apache.xmlgraphics.util.UnitConv; +import org.apache.fop.render.RendererContext.RendererContextWrapper; + /** * Abstract base class for Graphics2DAdapter implementations. */ @@ -151,6 +152,7 @@ public abstract class AbstractGraphics2DAdapter implements Graphics2DAdapter { public void paintImage(Graphics2DImagePainter painter, RendererContext context, int x, int y, int width, int height) throws IOException { + //TODO Deprecated method to be removed once Barcode4J 2.1 is released. paintImage((org.apache.xmlgraphics.java2d.Graphics2DImagePainter)painter, context, x, y, width, height); } diff --git a/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java b/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java index a79734d49..5bac4d88f 100644 --- a/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java +++ b/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java @@ -34,7 +34,7 @@ import java.awt.image.DataBuffer; import java.awt.image.Raster; import java.awt.image.WritableRaster; -import org.apache.fop.util.UnitConv; +import org.apache.xmlgraphics.util.UnitConv; /** * Abstract base class for ImageHandler implementations that process Java2D images through @@ -45,7 +45,6 @@ public abstract class AbstractImageHandlerGraphics2D implements ImageHandler { /** * Paints the image to a BufferedImage and returns that. * @param painter the painter which will paint the actual image - * @param context the renderer context for the current renderer * @param targetDimension the target dimensions of the image to be converted to a bitmap * @param resolution the requested bitmap resolution * @param gray true if the generated image should be in grayscales diff --git a/src/java/org/apache/fop/render/AbstractImageHandlerRegistry.java b/src/java/org/apache/fop/render/AbstractImageHandlerRegistry.java deleted file mode 100644 index 4196a1b19..000000000 --- a/src/java/org/apache/fop/render/AbstractImageHandlerRegistry.java +++ /dev/null @@ -1,209 +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.render; - -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.apache.xmlgraphics.image.loader.Image; -import org.apache.xmlgraphics.image.loader.ImageFlavor; -import org.apache.xmlgraphics.util.Service; - -/** - * This class holds references to various image handlers used by the renderers. It also - * supports automatic discovery of additional handlers available through - * the class path. - */ -public abstract class AbstractImageHandlerRegistry { - - /** the logger */ - private static Log log = LogFactory.getLog(AbstractImageHandlerRegistry.class); - - private static final Comparator HANDLER_COMPARATOR = new Comparator() { - public int compare(Object o1, Object o2) { - ImageHandlerBase h1 = (ImageHandlerBase)o1; - ImageHandlerBase h2 = (ImageHandlerBase)o2; - return h1.getPriority() - h2.getPriority(); - } - }; - - /** Map containing image handlers for various MIME types */ - private final Map/*<Class, ImageHandler>*/ handlers - = new java.util.HashMap/*<Class, ImageHandler>*/(); - - /** List containing the same handlers as above but ordered by priority */ - private final List/*<ImageHandler>*/ handlerList - = new java.util.LinkedList/*<ImageHandler>*/(); - - /** Sorted Set of registered handlers */ - private ImageFlavor[] supportedFlavors = new ImageFlavor[0]; - - private int handlerRegistrations; - private int lastSync; - - /** - * Default constructor. - */ - public AbstractImageHandlerRegistry() { - discoverHandlers(); - } - - /** - * Add an ImageHandler. The handler itself is inspected to find out what it supports. - * @param classname the fully qualified class name - */ - public void addHandler(String classname) { - try { - ImageHandlerBase handlerInstance - = (ImageHandlerBase)Class.forName(classname).newInstance(); - addHandler(handlerInstance); - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException("Could not find " - + classname); - } catch (InstantiationException e) { - throw new IllegalArgumentException("Could not instantiate " - + classname); - } catch (IllegalAccessException e) { - throw new IllegalArgumentException("Could not access " - + classname); - } catch (ClassCastException e) { - throw new IllegalArgumentException(classname - + " is not an " - + getHandlerClass().getName()); - } - } - - /** - * Add an image handler. The handler itself is inspected to find out what it supports. - * @param handler the ImageHandler instance - */ - public synchronized void addHandler(ImageHandlerBase handler) { - this.handlers.put(handler.getSupportedImageClass(), handler); - - //Sorted insert - ListIterator iter = this.handlerList.listIterator(); - while (iter.hasNext()) { - ImageHandlerBase h = (ImageHandlerBase)iter.next(); - if (getHandlerComparator().compare(handler, h) < 0) { - iter.previous(); - break; - } - } - iter.add(handler); - this.handlerRegistrations++; - } - - /** - * Returns an ImageHandler which handles an specific image type given the MIME type - * of the image. - * @param img the Image to be handled - * @return the ImageHandler responsible for handling the image or null if none is available - */ - public ImageHandlerBase getHandler(Image img) { - return getHandler(img.getClass()); - } - - /** - * Returns an ImageHandler which handles an specific image type given the MIME type - * of the image. - * @param imageClass the Image subclass for which to get a handler - * @return the ImageHandler responsible for handling the image or null if none is available - */ - public synchronized ImageHandlerBase getHandler(Class imageClass) { - ImageHandlerBase handler = null; - Class cl = imageClass; - while (cl != null) { - handler = (ImageHandlerBase)handlers.get(cl); - if (handler != null) { - break; - } - cl = cl.getSuperclass(); - } - return handler; - } - - /** - * Returns the ordered array of supported image flavors. - * @return the array of image flavors - */ - public synchronized ImageFlavor[] getSupportedFlavors() { - if (this.lastSync != this.handlerRegistrations) { - //Extract all ImageFlavors into a single array - List flavors = new java.util.ArrayList(); - Iterator iter = this.handlerList.iterator(); - while (iter.hasNext()) { - ImageFlavor[] f = ((ImageHandlerBase)iter.next()).getSupportedImageFlavors(); - for (int i = 0; i < f.length; i++) { - flavors.add(f[i]); - } - } - this.supportedFlavors = (ImageFlavor[])flavors.toArray(new ImageFlavor[flavors.size()]); - this.lastSync = this.handlerRegistrations; - } - return this.supportedFlavors; - } - - /** - * Discovers ImageHandler implementations through the classpath and dynamically - * registers them. - */ - private void discoverHandlers() { - // add mappings from available services - Class imageHandlerClass = getHandlerClass(); - Iterator providers = Service.providers(imageHandlerClass); - if (providers != null) { - while (providers.hasNext()) { - ImageHandlerBase handler = (ImageHandlerBase)providers.next(); - try { - if (log.isDebugEnabled()) { - log.debug("Dynamically adding ImageHandler: " - + handler.getClass().getName()); - } - addHandler(handler); - } catch (IllegalArgumentException e) { - log.error("Error while adding ImageHandler", e); - } - - } - } - } - - /** - * Returns the ImageHandler comparator - * - * @return the ImageHandler comparator - */ - public Comparator getHandlerComparator() { - return HANDLER_COMPARATOR; - } - - /** - * Returns the ImageHandler implementing class - * - * @return the ImageHandler implementing class - */ - public abstract Class getHandlerClass(); -} diff --git a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java index 54f6170db..ac4936a43 100644 --- a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java +++ b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java @@ -172,11 +172,10 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer { * @param bpsStart the border-start traits * @param bpsEnd the border-end traits */ - protected void drawBackground(float startx, float starty, - float width, float height, - Trait.Background back, - BorderProps bpsBefore, BorderProps bpsAfter, - BorderProps bpsStart, BorderProps bpsEnd) { + protected void drawBackground // CSOK: ParameterNumber + (float startx, float starty, float width, float height, Trait.Background back, + BorderProps bpsBefore, BorderProps bpsAfter, + BorderProps bpsStart, BorderProps bpsEnd) { if (back != null) { endTextObject(); @@ -262,10 +261,10 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer { * @param bpsStart the border-start traits * @param bpsEnd the border-end traits */ - protected void drawBorders(float startx, float starty, - float width, float height, - BorderProps bpsBefore, BorderProps bpsAfter, - BorderProps bpsStart, BorderProps bpsEnd) { + protected void drawBorders // CSOK: ParameterNumber + (float startx, float starty, float width, float height, + BorderProps bpsBefore, BorderProps bpsAfter, + BorderProps bpsStart, BorderProps bpsEnd) { Rectangle2D.Float borderRect = new Rectangle2D.Float(startx, starty, width, height); drawBorders(borderRect, bpsBefore, bpsAfter, bpsStart, bpsEnd); } @@ -283,7 +282,8 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer { * @param bpsStart the border specification on the start side * @param bpsEnd the border specification on the end side */ - protected void drawBorders(Rectangle2D.Float borderRect, + protected void drawBorders // CSOK: MethodLength + (Rectangle2D.Float borderRect, BorderProps bpsBefore, BorderProps bpsAfter, BorderProps bpsStart, BorderProps bpsEnd) { //TODO generalize each of the four conditions into using a parameterized drawBorder() boolean[] border = new boolean[] { @@ -858,8 +858,9 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer { * @param style the border style (one of Constants.EN_DASHED etc.) * @param col the color for the border segment */ - protected abstract void drawBorderLine(float x1, float y1, float x2, float y2, - boolean horz, boolean startOrBefore, int style, Color col); + protected abstract void drawBorderLine // CSOK: ParameterNumber + (float x1, float y1, float x2, float y2, boolean horz, + boolean startOrBefore, int style, Color col); /** {@inheritDoc} */ public void renderForeignObject(ForeignObject fo, Rectangle2D pos) { @@ -872,8 +873,6 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer { /** * Establishes a new coordinate system with the given transformation matrix. * The current graphics state is saved and the new coordinate system is concatenated. - * @param block - * * @param at the transformation matrix */ protected void establishTransformationMatrix(AffineTransform at) { diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 8233e480a..72be1b0b8 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -215,6 +215,7 @@ public abstract class AbstractRenderer /** {@inheritDoc} */ public void startPageSequence(PageSequence pageSequence) { + //TODO Discuss removing old deprecated method startPageSequence(LineArea) startPageSequence(pageSequence.getTitle()); } diff --git a/src/java/org/apache/fop/render/ImageHandlerRegistry.java b/src/java/org/apache/fop/render/ImageHandlerRegistry.java index e878e0dfe..02a26265c 100644 --- a/src/java/org/apache/fop/render/ImageHandlerRegistry.java +++ b/src/java/org/apache/fop/render/ImageHandlerRegistry.java @@ -133,6 +133,7 @@ public class ImageHandlerRegistry { /** * Returns the ordered array of supported image flavors. The array needs to be ordered by * priority so the image loader framework can return the preferred image type. + * @param context the rendering context * @return the array of image flavors */ public synchronized ImageFlavor[] getSupportedFlavors(RenderingContext context) { diff --git a/src/java/org/apache/fop/render/ImageHandlerUtil.java b/src/java/org/apache/fop/render/ImageHandlerUtil.java index 41e0e1d45..5aa5f152b 100644 --- a/src/java/org/apache/fop/render/ImageHandlerUtil.java +++ b/src/java/org/apache/fop/render/ImageHandlerUtil.java @@ -28,7 +28,10 @@ import org.apache.fop.fo.extensions.ExtensionElementMapping; /** * Utility methods for image handling. */ -public class ImageHandlerUtil { +public final class ImageHandlerUtil { + + private ImageHandlerUtil() { + } /** conversion-mode extension attribute */ public static final QName CONVERSION_MODE = new QName( diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/java/org/apache/fop/render/Renderer.java index 5fa9ca5b2..76f245251 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/java/org/apache/fop/render/Renderer.java @@ -149,7 +149,7 @@ public interface Renderer { * Tells the renderer that a new page sequence starts. * * @param seqTitle The title of the page sequence - * @deprecated Use startPageSequence(PageSequence) instead + * @deprecated Use {@link #startPageSequence(PageSequence)} instead */ void startPageSequence(LineArea seqTitle); @@ -162,7 +162,7 @@ public interface Renderer { /** * Tells the renderer to render a particular page. A renderer typically - * reponds by packing up the current page and writing it immediately to the + * responds by packing up the current page and writing it immediately to the * output device. * * @param page The page to be rendered diff --git a/src/java/org/apache/fop/render/RendererEventProducer.java b/src/java/org/apache/fop/render/RendererEventProducer.java index c61e4a8ee..87b01b1cc 100644 --- a/src/java/org/apache/fop/render/RendererEventProducer.java +++ b/src/java/org/apache/fop/render/RendererEventProducer.java @@ -30,7 +30,10 @@ import org.apache.fop.events.EventProducer; public interface RendererEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java b/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java index 235218cfc..a03aaf816 100644 --- a/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java +++ b/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java @@ -35,7 +35,7 @@ import org.apache.fop.render.afp.extensions.AFPElementMapping; * Parses any AFP foreign attributes */ public class AFPForeignAttributeReader { - private static final Log log = LogFactory.getLog("org.apache.xmlgraphics.afp"); + private static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp"); /** the resource-name attribute */ public static final QName RESOURCE_NAME = new QName( @@ -94,7 +94,7 @@ public class AFPForeignAttributeReader { = (String)foreignAttributes.get(RESOURCE_GROUP_FILE); if (resourceGroupFile == null) { String msg = RESOURCE_GROUP_FILE + " not specified"; - log.error(msg); + LOG.error(msg); throw new UnsupportedOperationException(msg); } File resourceExternalGroupFile = new File(resourceGroupFile); @@ -106,20 +106,20 @@ public class AFPForeignAttributeReader { } catch (SecurityException ex) { String msg = "unable to gain write access to external resource file: " + resourceGroupFile; - log.error(msg); + LOG.error(msg); } try { boolean exists = resourceExternalGroupFile.exists(); if (exists) { - log.warn("overwriting external resource file: " + LOG.warn("overwriting external resource file: " + resourceGroupFile); } resourceLevel.setExternalFilePath(resourceGroupFile); } catch (SecurityException ex) { String msg = "unable to gain read access to external resource file: " + resourceGroupFile; - log.error(msg); + LOG.error(msg); } } } diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandler.java b/src/java/org/apache/fop/render/afp/AFPImageHandler.java index 4a985db00..244263213 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandler.java +++ b/src/java/org/apache/fop/render/afp/AFPImageHandler.java @@ -19,10 +19,7 @@ package org.apache.fop.render.afp; -import java.awt.Point; import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; -import java.io.IOException; import java.util.Map; import org.apache.fop.afp.AFPDataObjectInfo; @@ -44,44 +41,6 @@ public abstract class AFPImageHandler implements ImageHandlerBase { = new AFPForeignAttributeReader(); /** - * Generates an intermediate AFPDataObjectInfo that is later used to construct - * the appropriate data object in the AFP DataStream. - * - * @param rendererImageInfo the renderer image info - * @return a data object info object - * @throws IOException thrown if an I/O exception of some sort has occurred. - */ - public AFPDataObjectInfo generateDataObjectInfo( - AFPRendererImageInfo rendererImageInfo) throws IOException { - AFPDataObjectInfo dataObjectInfo = createDataObjectInfo(); - - // set resource information - setResourceInformation(dataObjectInfo, - rendererImageInfo.getURI(), - rendererImageInfo.getForeignAttributes()); - - - Point origin = rendererImageInfo.getOrigin(); - Rectangle2D position = rendererImageInfo.getPosition(); - int srcX = Math.round(origin.x + (float)position.getX()); - int srcY = Math.round(origin.y + (float)position.getY()); - Rectangle targetRect = new Rectangle( - srcX, - srcY, - (int)Math.round(position.getWidth()), - (int)Math.round(position.getHeight())); - - AFPRendererContext rendererContext - = (AFPRendererContext)rendererImageInfo.getRendererContext(); - AFPInfo afpInfo = rendererContext.getInfo(); - AFPPaintingState paintingState = afpInfo.getPaintingState(); - - dataObjectInfo.setObjectAreaInfo(createObjectAreaInfo(paintingState, targetRect)); - - return dataObjectInfo; - } - - /** * Sets resource information on the data object info. * @param dataObjectInfo the data object info instance * @param uri the image's URI (or null if no URI is available) diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java b/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java index aaaecf2ea..07b712ceb 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java +++ b/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java @@ -49,47 +49,6 @@ public class AFPImageHandlerGraphics2D extends AFPImageHandler implements ImageH ImageFlavor.GRAPHICS2D }; - /** {@inheritDoc} */ - public AFPDataObjectInfo generateDataObjectInfo( - AFPRendererImageInfo rendererImageInfo) throws IOException { - - AFPRendererContext rendererContext - = (AFPRendererContext)rendererImageInfo.getRendererContext(); - AFPInfo afpInfo = rendererContext.getInfo(); - ImageGraphics2D imageG2D = (ImageGraphics2D)rendererImageInfo.getImage(); - Graphics2DImagePainter painter = imageG2D.getGraphics2DImagePainter(); - - if (afpInfo.paintAsBitmap()) { - int x = afpInfo.getX(); - int y = afpInfo.getY(); - int width = afpInfo.getWidth(); - int height = afpInfo.getHeight(); - AFPPaintingState paintingState = afpInfo.getPaintingState(); - AFPGraphics2DAdapter g2dAdapter = new AFPGraphics2DAdapter(paintingState); - g2dAdapter.paintImage(painter, rendererContext, x, y, width, height); - return null; - } else { - AFPGraphicsObjectInfo graphicsObjectInfo - = (AFPGraphicsObjectInfo)super.generateDataObjectInfo(rendererImageInfo); - - setDefaultResourceLevel(graphicsObjectInfo, afpInfo.getResourceManager()); - - // set mime type (unsupported by MOD:CA registry) - graphicsObjectInfo.setMimeType(MimeConstants.MIME_AFP_GOCA); - - // set g2d - boolean textAsShapes = false; - AFPGraphics2D g2d = afpInfo.createGraphics2D(textAsShapes); - - graphicsObjectInfo.setGraphics2D(g2d); - - // set painter - graphicsObjectInfo.setPainter(painter); - - return graphicsObjectInfo; - } - } - private void setDefaultResourceLevel(AFPGraphicsObjectInfo graphicsObjectInfo, AFPResourceManager resourceManager) { AFPResourceInfo resourceInfo = graphicsObjectInfo.getResourceInfo(); diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java b/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java index cb7b23da2..ca0544542 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java +++ b/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java @@ -66,29 +66,10 @@ public class AFPImageHandlerRenderedImage extends AFPImageHandler implements Ima ImageFlavor.RENDERED_IMAGE }; - /** {@inheritDoc} */ - public AFPDataObjectInfo generateDataObjectInfo( - AFPRendererImageInfo rendererImageInfo) throws IOException { - AFPImageObjectInfo imageObjectInfo - = (AFPImageObjectInfo)super.generateDataObjectInfo(rendererImageInfo); - - AFPRendererContext rendererContext - = (AFPRendererContext)rendererImageInfo.getRendererContext(); - AFPInfo afpInfo = rendererContext.getInfo(); - - setDefaultResourceLevel(imageObjectInfo, afpInfo.getResourceManager()); - - AFPPaintingState paintingState = afpInfo.getPaintingState(); - ImageRendered imageRendered = (ImageRendered) rendererImageInfo.img; - Dimension targetSize = new Dimension(afpInfo.getWidth(), afpInfo.getHeight()); - - updateDataObjectInfo(imageObjectInfo, paintingState, imageRendered, targetSize); - return imageObjectInfo; - } - - private AFPDataObjectInfo updateDataObjectInfo(AFPImageObjectInfo imageObjectInfo, - AFPPaintingState paintingState, ImageRendered imageRendered, Dimension targetSize) - throws IOException { + private AFPDataObjectInfo updateDataObjectInfo // CSOK: MethodLength + (AFPImageObjectInfo imageObjectInfo, + AFPPaintingState paintingState, ImageRendered imageRendered, Dimension targetSize) + throws IOException { long start = System.currentTimeMillis(); diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java b/src/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java index 67c19843b..4e4e1de31 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java +++ b/src/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java @@ -65,7 +65,7 @@ public class AFPImageHandlerSVG implements ImageHandler { BatikImageFlavors.SVG_DOM }; - /** {@inheritDoc} */ + /** @return a new AFP data object info instance */ protected AFPDataObjectInfo createDataObjectInfo() { return new AFPGraphicsObjectInfo(); } diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerXML.java b/src/java/org/apache/fop/render/afp/AFPImageHandlerXML.java deleted file mode 100644 index 7ea1a7a10..000000000 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerXML.java +++ /dev/null @@ -1,77 +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.render.afp; - -import java.awt.geom.Rectangle2D; -import java.io.IOException; -import java.util.Map; - -import org.apache.fop.afp.AFPDataObjectInfo; -import org.apache.fop.render.RendererContext; -import org.apache.fop.render.RendererContextConstants; -import org.apache.xmlgraphics.image.loader.ImageFlavor; -import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM; -import org.w3c.dom.Document; - -/** - * PDFImageHandler implementation which handles XML-based images. - */ -public class AFPImageHandlerXML extends AFPImageHandler { - - private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { - ImageFlavor.XML_DOM, - }; - - /** {@inheritDoc} */ - public AFPDataObjectInfo generateDataObjectInfo(AFPRendererImageInfo rendererImageInfo) - throws IOException { - RendererContext rendererContext = rendererImageInfo.getRendererContext(); - AFPRenderer renderer = (AFPRenderer)rendererContext.getRenderer(); - ImageXMLDOM imgXML = (ImageXMLDOM)rendererImageInfo.getImage(); - Document doc = imgXML.getDocument(); - String ns = imgXML.getRootNamespace(); - Map foreignAttributes = (Map)rendererContext.getProperty( - RendererContextConstants.FOREIGN_ATTRIBUTES); - Rectangle2D pos = rendererImageInfo.getPosition(); - renderer.renderDocument(doc, ns, pos, foreignAttributes); - return null; - } - - /** {@inheritDoc} */ - public int getPriority() { - return 400; - } - - /** {@inheritDoc} */ - public Class getSupportedImageClass() { - return ImageXMLDOM.class; - } - - /** {@inheritDoc} */ - public ImageFlavor[] getSupportedImageFlavors() { - return FLAVORS; - } - - /** {@inheritDoc} */ - protected AFPDataObjectInfo createDataObjectInfo() { - return null; - } - -} diff --git a/src/java/org/apache/fop/render/afp/AFPInfo.java b/src/java/org/apache/fop/render/afp/AFPInfo.java index fb1ec87a8..53a1aa046 100644 --- a/src/java/org/apache/fop/render/afp/AFPInfo.java +++ b/src/java/org/apache/fop/render/afp/AFPInfo.java @@ -256,7 +256,8 @@ public final class AFPInfo { public boolean strokeText() { boolean strokeText = false; if (handlerConfiguration != null) { - strokeText = handlerConfiguration.getChild("stroke-text", true).getValueAsBoolean(strokeText); + strokeText + = handlerConfiguration.getChild("stroke-text", true).getValueAsBoolean(strokeText); } return strokeText; } @@ -286,8 +287,9 @@ public final class AFPInfo { * @return a newly created AFPGraphics2D */ public AFPGraphics2D createGraphics2D(boolean textAsShapes) { - AFPGraphics2D g2d = new AFPGraphics2D( - textAsShapes, paintingState, resourceManager, resourceInfo, fontInfo); + AFPGraphics2D g2d + = new AFPGraphics2D + (textAsShapes, paintingState, resourceManager, resourceInfo, fontInfo); g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext()); return g2d; } diff --git a/src/java/org/apache/fop/render/afp/AFPPainter.java b/src/java/org/apache/fop/render/afp/AFPPainter.java index 22a5e0a58..21bc4ab48 100644 --- a/src/java/org/apache/fop/render/afp/AFPPainter.java +++ b/src/java/org/apache/fop/render/afp/AFPPainter.java @@ -281,7 +281,8 @@ public class AFPPainter extends AbstractIFPainter { return mpt / 1000f; } - protected void drawBorderLine(int x1, int y1, int x2, int y2, boolean horz, + protected void drawBorderLine // CSOK: ParameterNumber + (int x1, int y1, int x2, int y2, boolean horz, boolean startOrBefore, int style, Color color) throws IOException { BorderPaintingInfo borderPaintInfo = new BorderPaintingInfo( toPoints(x1), toPoints(y1), toPoints(x2), toPoints(y2), @@ -316,9 +317,9 @@ public class AFPPainter extends AbstractIFPainter { } /** {@inheritDoc} */ - public void drawText(int x, int y, - final int letterSpacing, final int wordSpacing, final int[] dx, - final String text) throws IFException { + public void drawText // CSOK: MethodLength + (int x, int y, final int letterSpacing, final int wordSpacing, final int[] dx, + final String text) throws IFException { final int fontSize = this.state.getFontSize(); getPaintingState().setFontSize(fontSize); diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java deleted file mode 100644 index 1f373023c..000000000 --- a/src/java/org/apache/fop/render/afp/AFPRenderer.java +++ /dev/null @@ -1,920 +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.render.afp; - -import java.awt.Color; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; -import java.awt.image.RenderedImage; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.xmlgraphics.image.loader.ImageException; -import org.apache.xmlgraphics.image.loader.ImageFlavor; -import org.apache.xmlgraphics.image.loader.ImageInfo; -import org.apache.xmlgraphics.image.loader.ImageManager; -import org.apache.xmlgraphics.image.loader.ImageSessionContext; -import org.apache.xmlgraphics.image.loader.util.ImageUtil; -import org.apache.xmlgraphics.ps.ImageEncodingHelper; - -import org.apache.fop.ResourceEventProducer; -import org.apache.fop.afp.AFPBorderPainter; -import org.apache.fop.afp.AFPDataObjectInfo; -import org.apache.fop.afp.AFPDitheredRectanglePainter; -import org.apache.fop.afp.AFPEventProducer; -import org.apache.fop.afp.AFPPaintingState; -import org.apache.fop.afp.AFPRectanglePainter; -import org.apache.fop.afp.AFPResourceLevelDefaults; -import org.apache.fop.afp.AFPResourceManager; -import org.apache.fop.afp.AFPTextDataInfo; -import org.apache.fop.afp.AFPUnitConverter; -import org.apache.fop.afp.AbstractAFPPainter; -import org.apache.fop.afp.BorderPaintingInfo; -import org.apache.fop.afp.DataStream; -import org.apache.fop.afp.RectanglePaintingInfo; -import org.apache.fop.afp.fonts.AFPFont; -import org.apache.fop.afp.fonts.AFPFontAttributes; -import org.apache.fop.afp.fonts.AFPFontCollection; -import org.apache.fop.afp.fonts.AFPPageFonts; -import org.apache.fop.afp.fonts.CharacterSet; -import org.apache.fop.afp.modca.PageObject; -import org.apache.fop.afp.modca.ResourceObject; -import org.apache.fop.afp.util.DefaultFOPResourceAccessor; -import org.apache.fop.afp.util.ResourceAccessor; -import org.apache.fop.apps.FOPException; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.area.CTM; -import org.apache.fop.area.OffDocumentExtensionAttachment; -import org.apache.fop.area.OffDocumentItem; -import org.apache.fop.area.PageSequence; -import org.apache.fop.area.PageViewport; -import org.apache.fop.area.Trait; -import org.apache.fop.area.inline.Image; -import org.apache.fop.area.inline.Leader; -import org.apache.fop.area.inline.TextArea; -import org.apache.fop.datatypes.URISpecification; -import org.apache.fop.fo.extensions.ExtensionAttachment; -import org.apache.fop.fonts.Font; -import org.apache.fop.fonts.FontCollection; -import org.apache.fop.fonts.FontInfo; -import org.apache.fop.fonts.FontManager; -import org.apache.fop.render.AbstractPathOrientedRenderer; -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.AFPExtensionAttachment; -import org.apache.fop.render.afp.extensions.AFPIncludeFormMap; -import org.apache.fop.render.afp.extensions.AFPInvokeMediumMap; -import org.apache.fop.render.afp.extensions.AFPPageOverlay; -import org.apache.fop.render.afp.extensions.AFPPageSetup; - -/** - * This is an implementation of a FOP Renderer that renders areas to AFP. - * <p> - * A renderer is primarily designed to convert a given area tree into the output - * document format. It should be able to produce pages and fill the pages with - * the text and graphical content. Usually the output is sent to an output - * stream. Some output formats may support extra information that is not - * available from the area tree or depends on the destination of the document. - * Each renderer is given an area tree to render to its output format. The area - * tree is simply a representation of the pages and the placement of text and - * graphical objects on those pages. - * </p> - * <p> - * The renderer will be given each page as it is ready and an output stream to - * write the data out. All pages are supplied in the order they appear in the - * document. In order to save memory it is possible to render the pages out of - * order. Any page that is not ready to be rendered is setup by the renderer - * first so that it can reserve a space or reference for when the page is ready - * to be rendered.The renderer is responsible for managing the output format and - * associated data and flow. - * </p> - * <p> - * Each renderer is totally responsible for its output format. Because font - * metrics (and therefore layout) are obtained in two different ways depending - * on the renderer, the renderer actually sets up the fonts being used. The font - * metrics are used during the layout process to determine the size of - * characters. - * </p> - * <p> - * The render context is used by handlers. It contains information about the - * current state of the renderer, such as the page, the position, and any other - * miscellaneous objects that are required to draw into the page. - * </p> - * <p> - * A renderer is created by implementing the Renderer interface. However, the - * AbstractRenderer does most of what is needed, including iterating through the - * tree parts, so it is this that is extended. This means that this object only - * need to implement the basic functionality such as text, images, and lines. - * AbstractRenderer's methods can easily be overridden to handle things in a - * different way or do some extra processing. - * </p> - * <p> - * The relevant AreaTree structures that will need to be rendered are Page, - * Viewport, Region, Span, Block, Line, Inline. A renderer implementation - * renders each individual page, clips and aligns child areas to a viewport, - * handle all types of inline area, text, image etc and draws various lines and - * rectangles. - * </p> - * - * Note: There are specific extensions that have been added to the FO. They are - * specific to their location within the FO and have to be processed accordingly - * (ie. at the start or end of the page). - * - */ -public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCustomizable { - - private static final int X = 0; - private static final int Y = 1; - - /** the resource manager */ - private AFPResourceManager resourceManager; - - /** the painting state */ - private final AFPPaintingState paintingState; - - /** unit converter */ - private final AFPUnitConverter unitConv; - - /** the line painter */ - private AFPBorderPainter borderPainter; - - /** the map of page segments */ - private final Map/*<String,String>*/pageSegmentMap - = new java.util.HashMap/*<String,String>*/(); - - /** the map of saved incomplete pages */ - private final Map pages = new java.util.HashMap/*<PageViewport,PageObject>*/(); - - /** the AFP datastream */ - private DataStream dataStream; - - /** the image handler registry */ - private final AFPImageHandlerRegistry imageHandlerRegistry; - - private AbstractAFPPainter rectanglePainter; - - /** the shading mode for filled rectangles */ - private AFPShadingMode shadingMode = AFPShadingMode.COLOR; - - /** medium map referenced used on previous page **/ - private String lastMediumMap; - - /** - * Constructor for AFPRenderer. - */ - public AFPRenderer() { - super(); - this.imageHandlerRegistry = new AFPImageHandlerRegistry(); - this.resourceManager = new AFPResourceManager(); - this.paintingState = new AFPPaintingState(); - this.unitConv = paintingState.getUnitConverter(); - } - - /** {@inheritDoc} */ - public void setupFontInfo(FontInfo inFontInfo) { - this.fontInfo = inFontInfo; - FontManager fontManager = userAgent.getFactory().getFontManager(); - FontCollection[] fontCollections = new FontCollection[] { - new AFPFontCollection(userAgent.getEventBroadcaster(), getFontList()) - }; - fontManager.setup(getFontInfo(), fontCollections); - } - - /** {@inheritDoc} */ - public void setUserAgent(FOUserAgent agent) { - super.setUserAgent(agent); - } - - /** {@inheritDoc} */ - public void startRenderer(OutputStream outputStream) throws IOException { - paintingState.setColor(Color.WHITE); - - this.dataStream = resourceManager.createDataStream(paintingState, outputStream); - this.borderPainter = new AFPBorderPainter(paintingState, dataStream); - this.rectanglePainter = createRectanglePainter(); - - dataStream.startDocument(); - } - - AbstractAFPPainter createRectanglePainter() { - if (AFPShadingMode.DITHERED.equals(this.shadingMode)) { - return new AFPDitheredRectanglePainter( - this.paintingState, this.dataStream, this.resourceManager); - } else { - return new AFPRectanglePainter( - this.paintingState, this.dataStream); - } - } - - /** {@inheritDoc} */ - public void stopRenderer() throws IOException { - dataStream.endDocument(); - resourceManager.writeToStream(); - resourceManager = null; - } - - /** {@inheritDoc} */ - public void startPageSequence(PageSequence pageSequence) { - super.startPageSequence(pageSequence); - try { - dataStream.startPageGroup(); - } catch (IOException e) { - log.error(e.getMessage()); - } - if (pageSequence.hasExtensionAttachments()) { - for (Iterator iter = pageSequence.getExtensionAttachments().iterator(); - iter.hasNext();) { - ExtensionAttachment attachment = (ExtensionAttachment)iter.next(); - if (attachment instanceof AFPInvokeMediumMap) { - AFPInvokeMediumMap imm = (AFPInvokeMediumMap)attachment; - String mediumMap = imm.getName(); - if (mediumMap != null) { - dataStream.createInvokeMediumMap(mediumMap); - } - } else if (attachment instanceof AFPPageSetup) { - AFPPageSetup aps = (AFPPageSetup)attachment; - String name = aps.getName(); - String value = aps.getValue(); - dataStream.createTagLogicalElement(name, value); - } - } - } - } - - /** {@inheritDoc} */ - public boolean supportsOutOfOrder() { - return false; - } - - /** {@inheritDoc} */ - public void preparePage(PageViewport page) { - int pageRotation = paintingState.getPageRotation(); - int pageWidth = paintingState.getPageWidth(); - int pageHeight = paintingState.getPageHeight(); - int resolution = paintingState.getResolution(); - dataStream.startPage(pageWidth, pageHeight, pageRotation, - resolution, resolution); - - renderPageObjectExtensions(page); - - PageObject currentPage = dataStream.savePage(); - pages.put(page, currentPage); - } - - /** {@inheritDoc} */ - public void processOffDocumentItem(OffDocumentItem odi) { - if (odi instanceof OffDocumentExtensionAttachment) { - ExtensionAttachment attachment = ((OffDocumentExtensionAttachment)odi).getAttachment(); - if (attachment != null) { - if (AFPExtensionAttachment.CATEGORY.equals(attachment.getCategory())) { - if (attachment instanceof AFPIncludeFormMap) { - handleIncludeFormMap((AFPIncludeFormMap)attachment); - } - } - } - } - } - - private void handleIncludeFormMap(AFPIncludeFormMap formMap) { - ResourceAccessor accessor = new DefaultFOPResourceAccessor( - getUserAgent(), null, null); - try { - this.resourceManager.createIncludedResource(formMap.getName(), - formMap.getSrc(), accessor, - ResourceObject.TYPE_FORMDEF); - } catch (IOException ioe) { - AFPEventProducer eventProducer - = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster()); - eventProducer.resourceEmbeddingError(this, formMap.getName(), ioe); - } - } - - /** {@inheritDoc} */ - public Graphics2DAdapter getGraphics2DAdapter() { - return new AFPGraphics2DAdapter(paintingState); - } - - /** {@inheritDoc} */ - public void startVParea(CTM ctm, Rectangle2D clippingRect) { - saveGraphicsState(); - if (ctm != null) { - AffineTransform at = ctm.toAffineTransform(); - concatenateTransformationMatrix(at); - } - if (clippingRect != null) { - clipRect((float)clippingRect.getX() / 1000f, - (float)clippingRect.getY() / 1000f, - (float)clippingRect.getWidth() / 1000f, - (float)clippingRect.getHeight() / 1000f); - } - } - - /** {@inheritDoc} */ - public void endVParea() { - restoreGraphicsState(); - } - - /** {@inheritDoc} */ - protected void concatenateTransformationMatrix(AffineTransform at) { - if (!at.isIdentity()) { - paintingState.concatenate(at); - } - } - - /** - * Returns the base AFP transform - * - * @return the base AFP transform - */ - private AffineTransform getBaseTransform() { - AffineTransform baseTransform = new AffineTransform(); - double scale = unitConv.mpt2units(1); - baseTransform.scale(scale, scale); - return baseTransform; - } - - /** {@inheritDoc} */ - public void renderPage(PageViewport pageViewport) throws IOException, FOPException { - paintingState.clear(); - - Rectangle2D bounds = pageViewport.getViewArea(); - - AffineTransform baseTransform = getBaseTransform(); - paintingState.concatenate(baseTransform); - - if (pages.containsKey(pageViewport)) { - dataStream.restorePage( - (PageObject)pages.remove(pageViewport)); - } else { - int pageWidth - = Math.round(unitConv.mpt2units((float)bounds.getWidth())); - paintingState.setPageWidth(pageWidth); - - int pageHeight - = Math.round(unitConv.mpt2units((float)bounds.getHeight())); - paintingState.setPageHeight(pageHeight); - - int pageRotation = paintingState.getPageRotation(); - - int resolution = paintingState.getResolution(); - - // IMM should occur before BPG - renderInvokeMediumMap(pageViewport); - - dataStream.startPage(pageWidth, pageHeight, pageRotation, - resolution, resolution); - - renderPageObjectExtensions(pageViewport); - } - - super.renderPage(pageViewport); - - AFPPageFonts pageFonts = paintingState.getPageFonts(); - if (pageFonts != null && !pageFonts.isEmpty()) { - dataStream.addFontsToCurrentPage(pageFonts); - } - - dataStream.endPage(); - } - - /** {@inheritDoc} */ - public void drawBorderLine(float x1, float y1, float x2, float y2, - boolean horz, boolean startOrBefore, int style, Color col) { - BorderPaintingInfo borderPaintInfo = new BorderPaintingInfo(x1, y1, x2, y2, horz, style, col); - borderPainter.paint(borderPaintInfo); - } - - /** {@inheritDoc} */ - public void fillRect(float x, float y, float width, float height) { - RectanglePaintingInfo rectanglePaintInfo = new RectanglePaintingInfo(x, y, width, height); - try { - rectanglePainter.paint(rectanglePaintInfo); - } catch (IOException ioe) { - //TODO not ideal, but the AFPRenderer is legacy - throw new RuntimeException("I/O error while painting a filled rectangle", ioe); - } - } - - /** {@inheritDoc} */ - protected RendererContext instantiateRendererContext() { - return new AFPRendererContext(this, getMimeType()); - } - - /** {@inheritDoc} */ - 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_FONT_INFO, - this.fontInfo); - context.setProperty(AFPRendererContextConstants.AFP_RESOURCE_MANAGER, - this.resourceManager); - context.setProperty(AFPRendererContextConstants.AFP_PAINTING_STATE, paintingState); - return context; - } - - private static final ImageFlavor[] NATIVE_FLAVORS = new ImageFlavor[] { - ImageFlavor.XML_DOM, - /*ImageFlavor.RAW_PNG, */ // PNG not natively supported in AFP - ImageFlavor.RAW_JPEG, ImageFlavor.RAW_CCITTFAX, ImageFlavor.RAW_EPS, - ImageFlavor.RAW_TIFF, - ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE }; - - private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { - ImageFlavor.XML_DOM, - ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE }; - - /** {@inheritDoc} */ - public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) { - uri = URISpecification.getURL(uri); - paintingState.setImageUri(uri); - - Point origin = new Point(currentIPPosition, currentBPPosition); - Rectangle posInt = new Rectangle( - (int)Math.round(pos.getX()), - (int)Math.round(pos.getY()), - (int)Math.round(pos.getWidth()), - (int)Math.round(pos.getHeight()) - ); - int x = origin.x + posInt.x; - int y = origin.y + posInt.y; - - String name = (String)pageSegmentMap.get(uri); - if (name != null) { - float[] srcPts = {x, y, posInt.width, posInt.height}; - int[] coords = unitConv.mpts2units(srcPts); - int width = Math.round(unitConv.mpt2units(posInt.width)); - int height = Math.round(unitConv.mpt2units(posInt.height)); - dataStream.createIncludePageSegment(name, coords[X], coords[Y], width, height); - } else { - ImageManager manager = userAgent.getFactory().getImageManager(); - ImageInfo info = null; - try { - ImageSessionContext sessionContext = userAgent - .getImageSessionContext(); - info = manager.getImageInfo(uri, sessionContext); - - // Only now fully load/prepare the image - Map hints = ImageUtil.getDefaultHints(sessionContext); - - boolean nativeImagesSupported = paintingState.isNativeImagesSupported(); - ImageFlavor[] flavors = nativeImagesSupported ? NATIVE_FLAVORS : FLAVORS; - - // Load image - org.apache.xmlgraphics.image.loader.Image img = manager.getImage( - info, flavors, hints, sessionContext); - - // Handle image - AFPImageHandler imageHandler - = (AFPImageHandler)imageHandlerRegistry.getHandler(img); - if (imageHandler != null) { - RendererContext rendererContext = createRendererContext( - x, y, posInt.width, posInt.height, foreignAttributes); - AFPRendererImageInfo rendererImageInfo = new AFPRendererImageInfo( - uri, pos, origin, info, img, rendererContext, foreignAttributes); - AFPDataObjectInfo dataObjectInfo = null; - try { - dataObjectInfo = imageHandler.generateDataObjectInfo(rendererImageInfo); - // Create image - if (dataObjectInfo != null) { - resourceManager.createObject(dataObjectInfo); - } - } catch (IOException ioe) { - ResourceEventProducer eventProducer - = ResourceEventProducer.Provider.get(userAgent.getEventBroadcaster()); - eventProducer.imageWritingError(this, ioe); - throw ioe; - } - } else { - throw new UnsupportedOperationException( - "No AFPImageHandler available for image: " - + info + " (" + img.getClass().getName() + ")"); - } - - } catch (ImageException ie) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider - .get(userAgent.getEventBroadcaster()); - eventProducer.imageError(this, (info != null ? info.toString() - : uri), ie, null); - } catch (FileNotFoundException fe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider - .get(userAgent.getEventBroadcaster()); - eventProducer.imageNotFound(this, (info != null ? info.toString() - : uri), fe, null); - } catch (IOException ioe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider - .get(userAgent.getEventBroadcaster()); - eventProducer.imageIOError(this, (info != null ? info.toString() - : uri), ioe, null); - } - } - } - - /** - * Writes a RenderedImage to an OutputStream as raw sRGB bitmaps. - * - * @param image - * the RenderedImage - * @param out - * the OutputStream - * @throws IOException - * In case of an I/O error. - * @deprecated use ImageEncodingHelper.encodeRenderedImageAsRGB(image, out) - * directly instead - */ - public static void writeImage(RenderedImage image, OutputStream out) - throws IOException { - ImageEncodingHelper.encodeRenderedImageAsRGB(image, out); - } - - /** {@inheritDoc} */ - public void updateColor(Color col, boolean fill) { - if (fill) { - paintingState.setColor(col); - } - } - - /** {@inheritDoc} */ - public void restoreStateStackAfterBreakOut(List breakOutList) { - log.debug("Block.FIXED --> restoring context after break-out"); - paintingState.saveAll(breakOutList); - } - - /** {@inheritDoc} */ - protected List breakOutOfStateStack() { - log.debug("Block.FIXED --> break out"); - return paintingState.restoreAll(); - } - - /** {@inheritDoc} */ - public void saveGraphicsState() { - paintingState.save(); - } - - /** {@inheritDoc} */ - public void restoreGraphicsState() { - paintingState.restore(); - } - - /** {@inheritDoc} */ - public void renderImage(Image image, Rectangle2D pos) { - drawImage(image.getURL(), pos, image.getForeignAttributes()); - } - - /** {@inheritDoc} */ - public void renderText(TextArea text) { - renderInlineAreaBackAndBorders(text); - - // set font size - int fontSize = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue(); - paintingState.setFontSize(fontSize); - - // register font as necessary - String internalFontName = getInternalFontNameForArea(text); - Map/*<String,FontMetrics>*/ fontMetricMap = fontInfo.getFonts(); - AFPFont font = (AFPFont)fontMetricMap.get(internalFontName); - AFPPageFonts pageFonts = paintingState.getPageFonts(); - AFPFontAttributes fontAttributes = pageFonts.registerFont(internalFontName, font, fontSize); - Font fnt = getFontFromArea(text); - - if (font.isEmbeddable()) { - CharacterSet charSet = font.getCharacterSet(fontSize); - try { - this.resourceManager.embedFont(font, charSet); - } catch (IOException ioe) { - AFPEventProducer eventProducer - = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster()); - eventProducer.resourceEmbeddingError(this, charSet.getName(), ioe); - } - } - - // create text data info - AFPTextDataInfo textDataInfo = new AFPTextDataInfo(); - - int fontReference = fontAttributes.getFontReference(); - textDataInfo.setFontReference(fontReference); - - int x = (currentIPPosition + text.getBorderAndPaddingWidthStart()); - int y = (currentBPPosition + text.getOffset() + text.getBaselineOffset()); - - int[] coords = unitConv.mpts2units(new float[] {x, y} ); - textDataInfo.setX(coords[X]); - textDataInfo.setY(coords[Y]); - - Color color = (Color) text.getTrait(Trait.COLOR); - textDataInfo.setColor(color); - - int textWordSpaceAdjust = text.getTextWordSpaceAdjust(); - int textLetterSpaceAdjust = text.getTextLetterSpaceAdjust(); - int textWidth = font.getWidth(' ', fontSize) / 1000; - textWidth = 0; //JM, the above is strange - int variableSpaceCharacterIncrement - = textWidth + textWordSpaceAdjust + textLetterSpaceAdjust; - - variableSpaceCharacterIncrement - = Math.round(unitConv.mpt2units(variableSpaceCharacterIncrement)); - textDataInfo.setVariableSpaceCharacterIncrement(variableSpaceCharacterIncrement); - - int interCharacterAdjustment - = Math.round(unitConv.mpt2units(textLetterSpaceAdjust)); - textDataInfo.setInterCharacterAdjustment(interCharacterAdjustment); - - CharacterSet charSet = font.getCharacterSet(fontSize); - String encoding = charSet.getEncoding(); - textDataInfo.setEncoding(encoding); - - String textString = text.getText(); - textDataInfo.setString(textString); - - try { - dataStream.createText(textDataInfo, textLetterSpaceAdjust, textWordSpaceAdjust, fnt, charSet); - } catch (UnsupportedEncodingException e) { - AFPEventProducer eventProducer - = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster()); - eventProducer.characterSetEncodingError(this, charSet.getName(), encoding); - } - // word.getOffset() = only height of text itself - // currentBlockIPPosition: 0 for beginning of line; nonzero - // where previous line area failed to take up entire allocated space - - super.renderText(text); - - renderTextDecoration(font, fontSize, text, y, x); - } - - /** - * Render leader area. This renders a leader area which is an area with a - * rule. - * - * @param area - * the leader area to render - */ - public void renderLeader(Leader area) { - renderInlineAreaBackAndBorders(area); - - int style = area.getRuleStyle(); - float startx = (currentIPPosition + area - .getBorderAndPaddingWidthStart()) / 1000f; - float starty = (currentBPPosition + area.getOffset()) / 1000f; - float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart() + area - .getIPD()) / 1000f; - float ruleThickness = area.getRuleThickness() / 1000f; - Color col = (Color) area.getTrait(Trait.COLOR); - - switch (style) { - case EN_SOLID: - case EN_DASHED: - case EN_DOUBLE: - case EN_DOTTED: - case EN_GROOVE: - case EN_RIDGE: - drawBorderLine(startx, starty, endx, starty + ruleThickness, true, - true, style, col); - break; - default: - throw new UnsupportedOperationException("rule style not supported"); - } - super.renderLeader(area); - } - - /** - * Get the MIME type of the renderer. - * - * @return The MIME type of the renderer - */ - public String getMimeType() { - return MimeConstants.MIME_AFP; - } - - /** - * checks for IMM Extension and renders if found and different - * from previous page - * - * @param pageViewport the page object - */ - private void renderInvokeMediumMap(PageViewport pageViewport) { - if (pageViewport.getExtensionAttachments() != null - && pageViewport.getExtensionAttachments().size() > 0) { - Iterator it = pageViewport.getExtensionAttachments().iterator(); - while (it.hasNext()) { - ExtensionAttachment attachment = (ExtensionAttachment) it.next(); - if (AFPExtensionAttachment.CATEGORY.equals(attachment.getCategory())) { - AFPExtensionAttachment aea = (AFPExtensionAttachment)attachment; - if (AFPElementMapping.INVOKE_MEDIUM_MAP.equals(aea.getElementName())) { - AFPInvokeMediumMap imm = (AFPInvokeMediumMap)attachment; - String mediumMap = imm.getName(); - if (mediumMap != null) { - if (!mediumMap.equals(lastMediumMap)) { - dataStream.createInvokeMediumMap(mediumMap); - lastMediumMap = mediumMap; - } - } - } - } - } - } - } - - /** - * Method to render the page extension. - * <p> - * - * @param pageViewport - * the page object - */ - private void renderPageObjectExtensions(PageViewport pageViewport) { - pageSegmentMap.clear(); - if (pageViewport.getExtensionAttachments() != null - && pageViewport.getExtensionAttachments().size() > 0) { - // Extract all AFPPageSetup instances from the attachment list on - // the s-p-m - Iterator it = pageViewport.getExtensionAttachments().iterator(); - while (it.hasNext()) { - ExtensionAttachment attachment = (ExtensionAttachment) it.next(); - if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) { - if (attachment instanceof AFPPageSetup) { - AFPPageSetup aps = (AFPPageSetup) attachment; - String element = aps.getElementName(); - if (AFPElementMapping.INCLUDE_PAGE_SEGMENT - .equals(element)) { - String name = aps.getName(); - String source = aps.getValue(); - pageSegmentMap.put(source, name); - } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT - .equals(element)) { - String name = aps.getName(); - String value = aps.getValue(); - dataStream.createTagLogicalElement(name, value); - } else if (AFPElementMapping.NO_OPERATION.equals(element)) { - String content = aps.getContent(); - if (content != null) { - dataStream.createNoOperation(content); - } - } - } else if (attachment instanceof AFPPageOverlay) { - AFPPageOverlay ipo = (AFPPageOverlay) attachment; - String element = ipo.getElementName(); - if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) { - String overlay = ipo.getName(); - if (overlay != null) { - dataStream.createIncludePageOverlay(overlay, ipo.getX(), ipo.getY()); - } - } - } - } - } - } - - } - - /** - * Sets the rotation to be used for portrait pages, valid values are 0 - * (default), 90, 180, 270. - * - * @param rotation - * The rotation in degrees. - */ - public void setPortraitRotation(int rotation) { - paintingState.setPortraitRotation(rotation); - } - - /** - * Sets the rotation to be used for landscape pages, valid values are 0, 90, - * 180, 270 (default). - * - * @param rotation - * The rotation in degrees. - */ - public void setLandscapeRotation(int rotation) { - paintingState.setLandscapeRotation(rotation); - } - - // ---=== AFPCustomizable ===--- - - /** {@inheritDoc} */ - public void setBitsPerPixel(int bitsPerPixel) { - paintingState.setBitsPerPixel(bitsPerPixel); - } - - /** {@inheritDoc} */ - public void setColorImages(boolean colorImages) { - paintingState.setColorImages(colorImages); - } - - /** {@inheritDoc} */ - public void setNativeImagesSupported(boolean nativeImages) { - paintingState.setNativeImagesSupported(nativeImages); - } - - /** {@inheritDoc} */ - public void setCMYKImagesSupported(boolean value) { - paintingState.setCMYKImagesSupported(value); - } - - /** {@inheritDoc} */ - public void setDitheringQuality(float quality) { - this.paintingState.setDitheringQuality(quality); - } - - /** {@inheritDoc} */ - public void setShadingMode(AFPShadingMode shadingMode) { - this.shadingMode = shadingMode; - } - - /** {@inheritDoc} */ - public void setResolution(int resolution) { - paintingState.setResolution(resolution); - } - - /** {@inheritDoc} */ - public int getResolution() { - return paintingState.getResolution(); - } - - /** {@inheritDoc} */ - public void setDefaultResourceGroupFilePath(String filePath) { - resourceManager.setDefaultResourceGroupFilePath(filePath); - } - - /** {@inheritDoc} */ - public void setResourceLevelDefaults(AFPResourceLevelDefaults defaults) { - resourceManager.setResourceLevelDefaults(defaults); - } - - /** {@inheritDoc} */ - protected void establishTransformationMatrix(AffineTransform at) { - saveGraphicsState(); - concatenateTransformationMatrix(at); - } - - /** {@inheritDoc} */ - public void clip() { - // TODO -// log.debug("NYI clip()"); - } - - /** {@inheritDoc} */ - public void clipRect(float x, float y, float width, float height) { - // TODO -// log.debug("NYI clipRect(x=" + x + ",y=" + y -// + ",width=" + width + ", height=" + height + ")"); - } - - /** {@inheritDoc} */ - public void moveTo(float x, float y) { - // TODO -// log.debug("NYI moveTo(x=" + x + ",y=" + y + ")"); - } - - /** {@inheritDoc} */ - public void lineTo(float x, float y) { - // TODO -// log.debug("NYI lineTo(x=" + x + ",y=" + y + ")"); - } - - /** {@inheritDoc} */ - public void closePath() { - // TODO -// log.debug("NYI closePath()"); - } - - /** Indicates the beginning of a text object. */ - public void beginTextObject() { - //TODO PDF specific maybe? -// log.debug("NYI beginTextObject()"); - } - - /** Indicates the end of a text object. */ - public void endTextObject() { - //TODO PDF specific maybe? -// log.debug("NYI endTextObject()"); - } - -} diff --git a/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java b/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java index 1720667df..8d4b3370c 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java +++ b/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java @@ -149,7 +149,7 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator * @param encoding character encoding e.g. 'Cp500', 'UnicodeBigUnmarked' * @param accessor * @param afpFontCfg - * @return + * @return the created AFPFont * @throws ConfigurationException */ private AFPFont fontFromType(String type, String codepage, String encoding, @@ -348,27 +348,12 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator private static final String IMAGES_MODE_COLOR = "color"; /** - * Configure the AFP renderer. + * Throws an UnsupportedOperationException. * - * @param renderer AFP renderer - * @throws FOPException fop exception - * @see org.apache.fop.render.PrintRendererConfigurator#configure(Renderer) + * @param renderer not used */ - public void configure(Renderer renderer) throws FOPException { - Configuration cfg = super.getRendererConfig(renderer); - if (cfg != null) { - AFPRenderer afpRenderer = (AFPRenderer)renderer; - - try { - List/*<AFPFontInfo>*/ fontList = buildFontListFromConfiguration(cfg); - afpRenderer.setFontList(fontList); - } catch (ConfigurationException e) { - LogUtil.handleException(log, e, - userAgent.getFactory().validateUserConfigStrictly()); - } - - configure(afpRenderer, cfg); - } + public void configure(Renderer renderer) { + throw new UnsupportedOperationException(); } private void configure(AFPCustomizable customizable, Configuration cfg) throws FOPException { diff --git a/src/java/org/apache/fop/render/afp/AFPRendererMaker.java b/src/java/org/apache/fop/render/afp/AFPRendererMaker.java deleted file mode 100644 index d283d992a..000000000 --- a/src/java/org/apache/fop/render/afp/AFPRendererMaker.java +++ /dev/null @@ -1,58 +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.render.afp; - -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.render.AbstractRendererMaker; -import org.apache.fop.render.Renderer; -import org.apache.fop.render.RendererConfigurator; - -/** - * RendererMaker for the AFP Renderer. - */ -public class AFPRendererMaker extends AbstractRendererMaker { - - private static final String[] MIMES = new String[] { - MimeConstants.MIME_AFP, - MimeConstants.MIME_AFP_ALT}; - - - /**{@inheritDoc} */ - public Renderer makeRenderer(FOUserAgent userAgent) { - return new AFPRenderer(); - } - - /** {@inheritDoc} */ - public RendererConfigurator getConfigurator(FOUserAgent userAgent) { - return new AFPRendererConfigurator(userAgent); - } - - /** {@inheritDoc} */ - public boolean needsOutputStream() { - return true; - } - - /** {@inheritDoc} */ - public String[] getSupportedMimeTypes() { - return MIMES; - } - -} diff --git a/src/java/org/apache/fop/render/afp/AFPRenderingContext.java b/src/java/org/apache/fop/render/afp/AFPRenderingContext.java index 35be58c22..22a91dd83 100644 --- a/src/java/org/apache/fop/render/afp/AFPRenderingContext.java +++ b/src/java/org/apache/fop/render/afp/AFPRenderingContext.java @@ -43,6 +43,7 @@ public class AFPRenderingContext extends AbstractRenderingContext { * Main constructor. * @param userAgent the user agent * @param resourceManager the resource manager + * @param paintingState the painting state * @param fontInfo the font list * @param foreignAttributes a map of foreign attributes */ @@ -70,6 +71,7 @@ public class AFPRenderingContext extends AbstractRenderingContext { return this.resourceManager; } + /** @return painting state */ public AFPPaintingState getPaintingState() { return this.paintingState; } diff --git a/src/java/org/apache/fop/render/afp/AFPSVGHandler.java b/src/java/org/apache/fop/render/afp/AFPSVGHandler.java index f76c4a89a..7ade64006 100644 --- a/src/java/org/apache/fop/render/afp/AFPSVGHandler.java +++ b/src/java/org/apache/fop/render/afp/AFPSVGHandler.java @@ -174,7 +174,8 @@ public class AFPSVGHandler extends AbstractGenericSVGHandler { return objectAreaInfo; } - private AFPGraphicsObjectInfo createGraphicsObjectInfo(AFPPaintingState paintingState, Graphics2DImagePainter painter, + private AFPGraphicsObjectInfo createGraphicsObjectInfo + (AFPPaintingState paintingState, Graphics2DImagePainter painter, FOUserAgent userAgent, AFPResourceInfo resourceInfo, AFPGraphics2D g2d) { AFPGraphicsObjectInfo graphicsObjectInfo = new AFPGraphicsObjectInfo(); @@ -193,6 +194,11 @@ public class AFPSVGHandler extends AbstractGenericSVGHandler { return graphicsObjectInfo; } + /** + * @param userAgent a user agent instance + * @param g2d a graphics context + * @return a bridge context + */ public static BridgeContext createBridgeContext(FOUserAgent userAgent, AFPGraphics2D g2d) { ImageManager imageManager = userAgent.getFactory().getImageManager(); @@ -208,7 +214,7 @@ public class AFPSVGHandler extends AbstractGenericSVGHandler { /** {@inheritDoc} */ public boolean supportsRenderer(Renderer renderer) { - return (renderer instanceof AFPRenderer); + return false; } /** {@inheritDoc} */ diff --git a/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java b/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java index 1228365f2..5374c7051 100644 --- a/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java +++ b/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java @@ -44,21 +44,6 @@ import org.apache.fop.render.RenderingContext; public abstract class AbstractAFPImageHandlerRawStream extends AFPImageHandler implements ImageHandler { - /** {@inheritDoc} */ - public AFPDataObjectInfo generateDataObjectInfo( - AFPRendererImageInfo rendererImageInfo) throws IOException { - AFPDataObjectInfo dataObjectInfo = super.generateDataObjectInfo(rendererImageInfo); - ImageRawStream rawStream = (ImageRawStream) rendererImageInfo.getImage(); - AFPRendererContext rendererContext - = (AFPRendererContext)rendererImageInfo.getRendererContext(); - AFPInfo afpInfo = rendererContext.getInfo(); - - updateDataObjectInfo(dataObjectInfo, rawStream, afpInfo.getResourceManager()); - - setAdditionalParameters(dataObjectInfo, rawStream); - return dataObjectInfo; - } - /** * Sets additional parameters on the image object info being built. By default, this * method does nothing but it can be overridden to provide additional functionality. diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java b/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java index b14a4eb9d..a82fe3457 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java @@ -19,8 +19,6 @@ package org.apache.fop.render.afp.extensions; -import java.net.URI; - import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index b50708112..0128cf90e 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -60,10 +60,10 @@ public class AWTRenderer extends Java2DRenderer implements Pageable { public static final String MIME_TYPE = MimeConstants.MIME_FOP_AWT_PREVIEW; /** flag for debugging */ - public boolean debug; + public boolean debug; // CSOK: VisibilityModifier /** If true, preview dialog is shown. */ - public boolean dialogDisplay = true; + public boolean dialogDisplay = true; // CSOK: VisibilityModifier /** true if the preview dialog should be the main window of the application */ private boolean previewAsMainWindow; diff --git a/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java b/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java index a96d73a46..9b3cac0a0 100644 --- a/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java +++ b/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java @@ -106,7 +106,7 @@ public class ImageProxyPanel extends JPanel { /** * Gets the image data and paints it on screen. Will make * calls to getPageImage as required. - * @param graphics + * @param graphics a graphics context * @see javax.swing.JComponent#paintComponent(Graphics) * @see org.apache.fop.render.java2d.Java2DRenderer#getPageImage(int) */ diff --git a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java index 031021a6f..32f31ce4c 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java +++ b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java @@ -17,11 +17,12 @@ /* $Id$ */ +package org.apache.fop.render.awt.viewer; + // Originally contributed by: // Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com, // Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com, // Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com -package org.apache.fop.render.awt.viewer; // Java import java.awt.BorderLayout; @@ -105,7 +106,8 @@ public class PreviewDialog extends JFrame implements StatusListener { * @param renderable the Renderable instance that is used to reload/re-render a document * after modifications. */ - public PreviewDialog(FOUserAgent foUserAgent, Renderable renderable) { + public PreviewDialog // CSOK: MethodLength + (FOUserAgent foUserAgent, Renderable renderable) { renderer = (AWTRenderer) foUserAgent.getRendererOverride(); this.foUserAgent = foUserAgent; this.configuredTargetResolution = this.foUserAgent.getTargetResolution(); @@ -579,7 +581,10 @@ public class PreviewDialog extends JFrame implements StatusListener { } } - /** Prints the document */ + /** + * Prints the document. + * @param showDialog true if show dialog + */ public void startPrinterJob(boolean showDialog) { //Restore originally configured target resolution float saveResolution = foUserAgent.getTargetResolution(); diff --git a/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java b/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java index 0808a7ac9..9a0b3b7bc 100644 --- a/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java +++ b/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java @@ -30,7 +30,10 @@ import org.apache.fop.events.EventProducer; public interface BitmapRendererEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/render/bitmap/PNGRenderer_onthefly.java b/src/java/org/apache/fop/render/bitmap/PNGRenderer_onthefly.java deleted file mode 100644 index a6a6e8dfe..000000000 --- a/src/java/org/apache/fop/render/bitmap/PNGRenderer_onthefly.java +++ /dev/null @@ -1,147 +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.render.bitmap; - -import java.awt.image.RenderedImage; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import org.apache.xmlgraphics.image.codec.png.PNGEncodeParam; -import org.apache.xmlgraphics.image.codec.png.PNGImageEncoder; - -import org.apache.commons.io.IOUtils; - -import org.apache.fop.apps.FOPException; -import org.apache.fop.area.PageViewport; -import org.apache.fop.render.java2d.Java2DRenderer; - -/** - * PNG Renderer This class actually does not render itself, instead it extends - * <code>org.apache.fop.render.java2D.Java2DRenderer</code> and just encode - * rendering results into PNG format using Batik's image codec - */ -public class PNGRenderer_onthefly extends Java2DRenderer { - - /** The MIME type for png-Rendering */ - public static final String MIME_TYPE = "image/png"; - - /** The file syntax prefix, eg. "page" will output "page1.png" etc */ - private String fileSyntax; - - /** The output directory where images are to be written */ - private File outputDir; - - /** The PNGEncodeParam for the image */ - private PNGEncodeParam renderParams; - - /** The OutputStream for the first Image */ - private OutputStream firstOutputStream; - - /** {@inheritDoc} */ - public String getMimeType() { - return MIME_TYPE; - } - - /** {@inheritDoc} */ - public boolean supportsOutOfOrder() { - return true; - } - - /** {@inheritDoc} */ - public void startRenderer(OutputStream outputStream) throws IOException { - log.info("rendering areas to PNG"); - setOutputDirectory(); - this.firstOutputStream = outputStream; - } - - /** - * Sets the output directory, either from the outfile specified on the - * command line, or from the directory specified in configuration file. Also - * sets the file name syntax, eg. "page" - */ - private void setOutputDirectory() { - - // the file provided on the command line - File f = getUserAgent().getOutputFile(); - - outputDir = f.getParentFile(); - - // extracting file name syntax - String s = f.getName(); - int i = s.lastIndexOf("."); - if (s.charAt(i - 1) == '1') { - i--; // getting rid of the "1" - } - fileSyntax = s.substring(0, i); - } - - /** - * {@inheritDoc} - */ - public void renderPage(PageViewport pageViewport) throws IOException { - - // Do the rendering: get the image for this page - RenderedImage image = (RenderedImage) getPageImage(pageViewport); - - // Encode this image - log.debug("Encoding page" + (getCurrentPageNumber() + 1)); - renderParams = PNGEncodeParam.getDefaultEncodeParam(image); - OutputStream os = getCurrentOutputStream(getCurrentPageNumber()); - if (os != null) { - try { - PNGImageEncoder encoder = new PNGImageEncoder(os, renderParams); - encoder.encode(image); - } finally { - //Only close self-created OutputStreams - if (os != firstOutputStream) { - IOUtils.closeQuietly(os); - } - } - } - - setCurrentPageNumber(getCurrentPageNumber() + 1); - } - - /** - * Builds the OutputStream corresponding to this page - * @param 0-based pageNumber - * @return the corresponding OutputStream - */ - private OutputStream getCurrentOutputStream(int pageNumber) { - - if (pageNumber == 0) { - return firstOutputStream; - } - - File f = new File(outputDir + File.separator + fileSyntax - + (pageNumber + 1) + ".png"); - try { - OutputStream os = new BufferedOutputStream(new FileOutputStream(f)); - return os; - } catch (FileNotFoundException e) { - new FOPException("Can't build the OutputStream\n" + e); - return null; - } - } -} diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java b/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java index c524ccc3a..7dd3bcd95 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java +++ b/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java @@ -219,10 +219,12 @@ public class TIFFRenderer extends Java2DRenderer implements TIFFConstants { } } + /** @param bufferedImageType an image type */ public void setBufferedImageType(int bufferedImageType) { this.bufferedImageType = bufferedImageType; } + /** @return image writer parameters */ public ImageWriterParams getWriterParams() { return writerParams; } diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java b/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java index cd15a9d72..b156b6c3a 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java +++ b/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java @@ -19,9 +19,6 @@ package org.apache.fop.render.intermediate; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.fop.apps.FOUserAgent; /** @@ -29,9 +26,6 @@ import org.apache.fop.apps.FOUserAgent; */ public abstract class AbstractIFDocumentHandler implements IFDocumentHandler { - /** logging instance */ - private static Log log = LogFactory.getLog(AbstractIFDocumentHandler.class); - private IFContext ifContext; /** diff --git a/src/java/org/apache/fop/render/intermediate/BorderPainter.java b/src/java/org/apache/fop/render/intermediate/BorderPainter.java index 75f773291..ad37b1dc1 100644 --- a/src/java/org/apache/fop/render/intermediate/BorderPainter.java +++ b/src/java/org/apache/fop/render/intermediate/BorderPainter.java @@ -41,7 +41,7 @@ public abstract class BorderPainter { * @param bpsEnd the border specification on the end side * @throws IOException if an I/O error occurs while creating the borders */ - public void drawBorders(Rectangle borderRect, + public void drawBorders(Rectangle borderRect, // CSOK: MethodLength BorderProps bpsBefore, BorderProps bpsAfter, BorderProps bpsStart, BorderProps bpsEnd) throws IOException { int startx = borderRect.x; @@ -217,8 +217,9 @@ public abstract class BorderPainter { * @param color the border color * @throws IOException if an I/O error occurs */ - protected abstract void drawBorderLine(int x1, int y1, int x2, int y2, - boolean horz, boolean startOrBefore, int style, Color color) throws IOException; + protected abstract void drawBorderLine // CSOK: ParameterNumber + (int x1, int y1, int x2, int y2, + boolean horz, boolean startOrBefore, int style, Color color) throws IOException; /** * Draws a line/rule. diff --git a/src/java/org/apache/fop/render/intermediate/IFConstants.java b/src/java/org/apache/fop/render/intermediate/IFConstants.java index fa234b4db..34fe2bd2c 100644 --- a/src/java/org/apache/fop/render/intermediate/IFConstants.java +++ b/src/java/org/apache/fop/render/intermediate/IFConstants.java @@ -33,22 +33,39 @@ public interface IFConstants extends XMLConstants { /** XML namespace of the intermediate format. */ String NAMESPACE = "http://xmlgraphics.apache.org/fop/intermediate"; + /** element name document */ String EL_DOCUMENT = "document"; + /** element name header */ String EL_HEADER = "header"; + /** element name trailer */ String EL_TRAILER = "trailer"; + /** element name page-sequence */ String EL_PAGE_SEQUENCE = "page-sequence"; + /** element name page */ String EL_PAGE = "page"; + /** element name page-header */ String EL_PAGE_HEADER = "page-header"; + /** element name page-trailer */ String EL_PAGE_TRAILER = "page-trailer"; + /** element name content */ String EL_PAGE_CONTENT = "content"; + /** element name viewport */ String EL_VIEWPORT = "viewport"; + /** element name group */ String EL_GROUP = "g"; + /** element name image */ String EL_IMAGE = "image"; + /** element name clip-rect */ String EL_CLIP_RECT = "clip-rect"; + /** element name rect */ String EL_RECT = "rect"; + /** element name line */ String EL_LINE = "line"; + /** element name border-rect */ String EL_BORDER_RECT = "border-rect"; + /** element name font */ String EL_FONT = "font"; + /** element name text */ String EL_TEXT = "text"; /** Parent element of the logical structure tree. */ String EL_STRUCTURE_TREE = "structure-tree"; diff --git a/src/java/org/apache/fop/render/intermediate/IFContentHandler.java b/src/java/org/apache/fop/render/intermediate/IFContentHandler.java index 55c65d82a..ac7feb269 100644 --- a/src/java/org/apache/fop/render/intermediate/IFContentHandler.java +++ b/src/java/org/apache/fop/render/intermediate/IFContentHandler.java @@ -24,62 +24,74 @@ import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; +/** intermediate format content handler */ public class IFContentHandler implements ContentHandler { + /** {@inheritDoc} */ public void characters(char[] arg0, int arg1, int arg2) throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void endDocument() throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void endElement(String arg0, String arg1, String arg2) throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void endPrefixMapping(String arg0) throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void processingInstruction(String arg0, String arg1) throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void setDocumentLocator(Locator arg0) { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void skippedEntity(String arg0) throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void startDocument() throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void startElement(String arg0, String arg1, String arg2, Attributes arg3) throws SAXException { // TODO Auto-generated method stub } + /** {@inheritDoc} */ public void startPrefixMapping(String arg0, String arg1) throws SAXException { // TODO Auto-generated method stub diff --git a/src/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java b/src/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java index eef13e105..09a641ce2 100644 --- a/src/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java +++ b/src/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java @@ -45,8 +45,16 @@ public interface IFDocumentNavigationHandler { */ void renderBookmarkTree(BookmarkTree tree) throws IFException; + /** + * @param link a link + * @throws IFException of not caught + */ void renderLink(Link link) throws IFException; + /** + * @param action an action + * @throws IFException of not caught + */ void addResolvedAction(AbstractAction action) throws IFException; } diff --git a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java b/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java index 34ac0bcb2..6e431e513 100644 --- a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java +++ b/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java @@ -56,6 +56,7 @@ public class IFGraphicContext extends GraphicContext { return new IFGraphicContext(this); } + /** @param group a group */ public void pushGroup(Group group) { //this.groupDepth++; this.groupList.add(group); @@ -64,44 +65,66 @@ public class IFGraphicContext extends GraphicContext { } } + /** @return array of groups */ public Group[] getGroups() { return (Group[])this.groupList.toArray(new Group[getGroupStackSize()]); } + /** @return array of groups after clearing group list */ public Group[] dropGroups() { Group[] groups = getGroups(); this.groupList.clear(); return groups; } + /** @return size of group list */ public int getGroupStackSize() { return this.groupList.size(); } + /** a group */ public static class Group { private AffineTransform[] transforms; + /** + * Construct a Group. + * @param transforms an array of transforms + */ public Group(AffineTransform[] transforms) { this.transforms = transforms; } + /** + * Construct a Group. + * @param transform a transform + */ public Group(AffineTransform transform) { this(new AffineTransform[] {transform}); } + /** Default constructor. */ public Group() { this(EMPTY_TRANSFORM_ARRAY); } + /** @return array of transforms */ public AffineTransform[] getTransforms() { return this.transforms; } + /** + * @param painter a painter + * @throws IFException in not caught + */ public void start(IFPainter painter) throws IFException { painter.startGroup(transforms); } + /** + * @param painter a painter + * @throws IFException in not caught + */ public void end(IFPainter painter) throws IFException { painter.endGroup(); } @@ -115,33 +138,50 @@ public class IFGraphicContext extends GraphicContext { } + /** a viewport */ public static class Viewport extends Group { private Dimension size; private Rectangle clipRect; + /** + * Construct a viewport. + * @param transforms an array of transforms + * @param size a dimension + * @param clipRect a clip rectangle + */ public Viewport(AffineTransform[] transforms, Dimension size, Rectangle clipRect) { super(transforms); this.size = size; this.clipRect = clipRect; } + /** + * Construct a viewport. + * @param transform a transform + * @param size a dimension + * @param clipRect a clip rectangle + */ public Viewport(AffineTransform transform, Dimension size, Rectangle clipRect) { this(new AffineTransform[] {transform}, size, clipRect); } + /** @return the viewport's size */ public Dimension getSize() { return this.size; } + /** @return the clip rectangle */ public Rectangle getClipRect() { return this.clipRect; } + /** {@inheritDoc} */ public void start(IFPainter painter) throws IFException { painter.startViewport(getTransforms(), size, clipRect); } + /** {@inheritDoc} */ public void end(IFPainter painter) throws IFException { painter.endViewport(); } diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java index 13ac401a7..23a5da3e3 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java @@ -1238,7 +1238,8 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } /** {@inheritDoc} */ - protected void drawBorders(float startx, float starty, + protected void drawBorders // CSOK: ParameterNumber + (float startx, float starty, float width, float height, BorderProps bpsBefore, BorderProps bpsAfter, BorderProps bpsStart, BorderProps bpsEnd) { @@ -1251,7 +1252,8 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } /** {@inheritDoc} */ - protected void drawBorderLine(float x1, float y1, float x2, float y2, boolean horz, + protected void drawBorderLine // CSOK: ParameterNumber + (float x1, float y1, float x2, float y2, boolean horz, boolean startOrBefore, int style, Color col) { //Simplified implementation that is only used by renderTextDecoration() //drawBorders() is overridden and uses the Painter's high-level method drawBorderRect() diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java index 37806cb8e..edeef9766 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java @@ -633,8 +633,11 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler } } - /** {@inheritDoc} */ - protected RenderingContext createRenderingContext() { + /** + * @return a new rendering context + * @throws IllegalStateException unless overridden + */ + protected RenderingContext createRenderingContext() throws IllegalStateException { throw new IllegalStateException("Should never be called!"); } diff --git a/src/java/org/apache/fop/render/intermediate/IFState.java b/src/java/org/apache/fop/render/intermediate/IFState.java index aa073d03c..c13382192 100644 --- a/src/java/org/apache/fop/render/intermediate/IFState.java +++ b/src/java/org/apache/fop/render/intermediate/IFState.java @@ -21,7 +21,8 @@ package org.apache.fop.render.intermediate; import java.awt.Color; -public class IFState { +/** a state class for intermediate format data */ +public final class IFState { private IFState parent; @@ -50,22 +51,27 @@ public class IFState { this.textColor = parent.textColor; } + /** @return create state */ public static IFState create() { return new IFState(); } + /** @return push state */ public IFState push() { return new IFState(this); } + /** @return pop state */ public IFState pop() { return this.parent; } + /** @return true if font changed */ public boolean isFontChanged() { return this.fontChanged; } + /** reset font changed */ public void resetFontChanged() { this.fontChanged = false; } diff --git a/src/java/org/apache/fop/render/intermediate/IFUtil.java b/src/java/org/apache/fop/render/intermediate/IFUtil.java index 955193000..1867b0294 100644 --- a/src/java/org/apache/fop/render/intermediate/IFUtil.java +++ b/src/java/org/apache/fop/render/intermediate/IFUtil.java @@ -30,7 +30,10 @@ import org.apache.fop.util.DecimalFormatCache; /** * Utility functions for the intermediate format. */ -public class IFUtil { +public final class IFUtil { + + private IFUtil() { + } private static String format(double value) { if (value == -0.0) { diff --git a/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java b/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java index 1d9d7d56e..6394964ac 100644 --- a/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java +++ b/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java @@ -16,6 +16,7 @@ */ /* $Id$ */ + package org.apache.fop.render.java2d; import java.awt.Font; @@ -29,6 +30,7 @@ import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import org.apache.fop.fonts.CustomFont; +import org.apache.fop.fonts.FontMetrics; import org.apache.fop.fonts.FontType; import org.apache.fop.fonts.LazyFont; import org.apache.fop.fonts.Typeface; @@ -36,7 +38,7 @@ import org.apache.fop.fonts.Typeface; /** * FontMetricsMapper that delegates most methods to an underlying * {@link FontMetrics} instance. This class was designed to allow - * the underlying {@link java.awt.Font} to be loaded from a + * the underlying {@link Font} to be loaded from a * user-configured file not registered in the current graphics environment. */ public class CustomFontMetricsMapper extends Typeface implements FontMetricsMapper { diff --git a/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java b/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java index 17073dd6c..806a07d6c 100644 --- a/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java +++ b/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java @@ -28,7 +28,7 @@ import org.apache.fop.fonts.FontMetrics; public interface FontMetricsMapper extends FontMetrics { /** - * Gets a {@link Font} instance of the font that this + * Gets a {@link java.awt.Font} instance of the font that this * {@link FontMetrics} describes in the desired size. * @param size font size * @return font with the desired characteristics. diff --git a/src/java/org/apache/fop/render/java2d/Java2DBorderPainter.java b/src/java/org/apache/fop/render/java2d/Java2DBorderPainter.java index c5e0a3f5c..e4576373d 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DBorderPainter.java +++ b/src/java/org/apache/fop/render/java2d/Java2DBorderPainter.java @@ -47,6 +47,10 @@ public class Java2DBorderPainter extends BorderPainter { private GeneralPath currentPath = null; + /** + * Construct a java2d border painter. + * @param painter a painter + */ public Java2DBorderPainter(Java2DPainter painter) { this.painter = painter; } @@ -60,7 +64,8 @@ public class Java2DBorderPainter extends BorderPainter { } /** {@inheritDoc} */ - protected void drawBorderLine(int x1, int y1, int x2, int y2, boolean horz, + protected void drawBorderLine // CSOK: ParameterNumber + (int x1, int y1, int x2, int y2, boolean horz, boolean startOrBefore, int style, Color color) { float w = x2 - x1; float h = y2 - y1; diff --git a/src/java/org/apache/fop/render/java2d/Java2DPainter.java b/src/java/org/apache/fop/render/java2d/Java2DPainter.java index a2b9c9613..396645768 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DPainter.java +++ b/src/java/org/apache/fop/render/java2d/Java2DPainter.java @@ -33,9 +33,6 @@ import java.util.Stack; import org.w3c.dom.Document; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; @@ -54,9 +51,6 @@ import org.apache.fop.util.CharUtilities; */ public class Java2DPainter extends AbstractIFPainter { - /** logging instance */ - private static Log log = LogFactory.getLog(Java2DPainter.class); - /** the IF context */ protected IFContext ifContext; diff --git a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java b/src/java/org/apache/fop/render/java2d/Java2DRenderer.java index 4cb0c988e..cbd50c954 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java +++ b/src/java/org/apache/fop/render/java2d/Java2DRenderer.java @@ -536,7 +536,8 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem } /** {@inheritDoc} */ - protected void drawBorderLine(float x1, float y1, float x2, float y2, + protected void drawBorderLine // CSOK: ParameterNumber + (float x1, float y1, float x2, float y2, boolean horz, boolean startOrBefore, int style, Color col) { Graphics2D g2d = state.getGraph(); float width = x2 - x1; diff --git a/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java b/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java index de987af25..4c20a8959 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java +++ b/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java @@ -81,16 +81,17 @@ public class Java2DSVGHandler extends AbstractGenericSVGHandler */ public static class Java2DInfo { /** see Java2D_STATE */ - public Java2DGraphicsState state; + public Java2DGraphicsState state; // CSOK: VisibilityModifier /** see Java2D_WIDTH */ - public int width; + public int width; // CSOK: VisibilityModifier /** see Java2D_HEIGHT */ - public int height; + public int height; // CSOK: VisibilityModifier /** see Java2D_XPOS */ - public int currentXPosition; + public int currentXPosition; // CSOK: VisibilityModifier /** see Java2D_YPOS */ - public int currentYPosition; - public boolean paintAsBitmap; + public int currentYPosition; // CSOK: VisibilityModifier + /** paint as bitmap */ + public boolean paintAsBitmap; // CSOK: VisibilityModifier /** {@inheritDoc} */ public String toString() { diff --git a/src/java/org/apache/fop/render/java2d/Java2DUtil.java b/src/java/org/apache/fop/render/java2d/Java2DUtil.java index aa2be78e0..7e11ab263 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DUtil.java +++ b/src/java/org/apache/fop/render/java2d/Java2DUtil.java @@ -30,7 +30,10 @@ import org.apache.fop.fonts.FontManager; /** * Rendering-related utilities for Java2D. */ -public class Java2DUtil { +public final class Java2DUtil { + + private Java2DUtil() { + } /** * Builds a default {@link FontInfo} object for use with output formats using the Java2D diff --git a/src/java/org/apache/fop/render/pcl/HardcodedFonts.java b/src/java/org/apache/fop/render/pcl/HardcodedFonts.java index a1c5a6059..185e1ece5 100644 --- a/src/java/org/apache/fop/render/pcl/HardcodedFonts.java +++ b/src/java/org/apache/fop/render/pcl/HardcodedFonts.java @@ -28,10 +28,13 @@ import org.apache.commons.logging.LogFactory; * This class hold code for selecting a set of hard-coded fonts available in practically all * PCL implementations. We hope this can be improved in the future. */ -class HardcodedFonts { +final class HardcodedFonts { + + private HardcodedFonts() { + } /** logging instance */ - private static Log log = LogFactory.getLog(HardcodedFonts.class); + private static final Log LOG = LogFactory.getLog(HardcodedFonts.class); /** * Sets the current font (NOTE: Hard-coded font mappings ATM!) @@ -58,7 +61,7 @@ class HardcodedFonts { try { fontcode = Integer.parseInt(name.substring(1)); } catch (Exception e) { - log.error(e); + LOG.error(e); } } //Note "(ON" selects ISO 8859-1 symbol set as used by PCLGenerator diff --git a/src/java/org/apache/fop/render/pcl/PCLEventProducer.java b/src/java/org/apache/fop/render/pcl/PCLEventProducer.java index 8afe0bb94..520c63baa 100644 --- a/src/java/org/apache/fop/render/pcl/PCLEventProducer.java +++ b/src/java/org/apache/fop/render/pcl/PCLEventProducer.java @@ -28,7 +28,10 @@ import org.apache.fop.events.EventProducer; public interface PCLEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java b/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java deleted file mode 100644 index f8c9682e9..000000000 --- a/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java +++ /dev/null @@ -1,123 +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.render.pcl; - -import java.awt.Dimension; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; -import java.io.IOException; - -import org.apache.commons.io.output.ByteArrayOutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.apache.xmlgraphics.java2d.GraphicContext; -import org.apache.xmlgraphics.java2d.Graphics2DImagePainter; - -import org.apache.fop.render.AbstractGraphics2DAdapter; -import org.apache.fop.render.RendererContext; -import org.apache.xmlgraphics.util.UnitConv; - -/** - * Graphics2DAdapter implementation for PCL and HP GL/2. - */ -public class PCLGraphics2DAdapter extends AbstractGraphics2DAdapter { - - /** logging instance */ - private static Log log = LogFactory.getLog(PCLGraphics2DAdapter.class); - - /** - * Main constructor - */ - public PCLGraphics2DAdapter() { - } - - /** {@inheritDoc} */ - public void paintImage(Graphics2DImagePainter painter, - RendererContext context, - int x, int y, int width, int height) throws IOException { - PCLRendererContext pclContext = PCLRendererContext.wrapRendererContext(context); - PCLRenderer pcl = (PCLRenderer)context.getRenderer(); - PCLGenerator gen = pcl.gen; - - // get the 'width' and 'height' attributes of the image/document - Dimension dim = painter.getImageSize(); - float imw = (float)dim.getWidth(); - float imh = (float)dim.getHeight(); - - boolean painted = false; - boolean paintAsBitmap = pclContext.paintAsBitmap(); - if (!paintAsBitmap) { - ByteArrayOutputStream baout = new ByteArrayOutputStream(); - PCLGenerator tempGen = new PCLGenerator(baout, gen.getMaximumBitmapResolution()); - try { - GraphicContext ctx = (GraphicContext)pcl.getGraphicContext().clone(); - - AffineTransform prepareHPGL2 = new AffineTransform(); - prepareHPGL2.scale(0.001, 0.001); - ctx.setTransform(prepareHPGL2); - - PCLGraphics2D graphics = new PCLGraphics2D(tempGen); - graphics.setGraphicContext(ctx); - graphics.setClippingDisabled(pclContext.isClippingDisabled()); - Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh); - painter.paint(graphics, area); - - //If we arrive here, the graphic is natively paintable, so write the graphic - pcl.saveGraphicsState(); - pcl.setCursorPos(x, y); - gen.writeCommand("*c" + gen.formatDouble4(width / 100f) + "x" - + gen.formatDouble4(height / 100f) + "Y"); - gen.writeCommand("*c0T"); - gen.enterHPGL2Mode(false); - gen.writeText("\nIN;"); - gen.writeText("SP1;"); - //One Plotter unit is 0.025mm! - double scale = imw / UnitConv.mm2pt(imw * 0.025); - gen.writeText("SC0," + gen.formatDouble4(scale) - + ",0,-" + gen.formatDouble4(scale) + ",2;"); - gen.writeText("IR0,100,0,100;"); - gen.writeText("PU;PA0,0;\n"); - baout.writeTo(gen.getOutputStream()); //Buffer is written to output stream - gen.writeText("\n"); - - gen.enterPCLMode(false); - pcl.restoreGraphicsState(); - painted = true; - } catch (UnsupportedOperationException uoe) { - log.debug( - "Cannot paint graphic natively. Falling back to bitmap painting. Reason: " - + uoe.getMessage()); - } - } - - if (!painted) { - //Fallback solution: Paint to a BufferedImage - int resolution = Math.round(context.getUserAgent().getTargetResolution()); - BufferedImage bi = paintToBufferedImage(painter, pclContext, - resolution, !pclContext.isColorCanvas(), false); - - pcl.setCursorPos(x, y); - gen.paintBitmap(bi, new Dimension(width, height), pclContext.isSourceTransparency()); - } - } - -} diff --git a/src/java/org/apache/fop/render/pcl/PCLPainter.java b/src/java/org/apache/fop/render/pcl/PCLPainter.java index b58b7f495..00b25a5e3 100644 --- a/src/java/org/apache/fop/render/pcl/PCLPainter.java +++ b/src/java/org/apache/fop/render/pcl/PCLPainter.java @@ -34,9 +34,6 @@ import java.util.Stack; import org.w3c.dom.Document; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.xmlgraphics.image.loader.ImageException; import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.ImageProcessingHints; @@ -65,9 +62,6 @@ import org.apache.fop.util.CharUtilities; */ public class PCLPainter extends AbstractIFPainter implements PCLConstants { - /** logging instance */ - private static Log log = LogFactory.getLog(PCLPainter.class); - private static final boolean DEBUG = false; private PCLDocumentHandler parent; @@ -396,10 +390,11 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants { private static final double SAFETY_MARGIN_FACTOR = 0.05; - private Rectangle getTextBoundingBox(int x, int y, - int letterSpacing, int wordSpacing, int[] dx, - String text, - Font font, FontMetricsMapper metrics) { + private Rectangle getTextBoundingBox // CSOK: ParameterNumber + (int x, int y, + int letterSpacing, int wordSpacing, int[] dx, + String text, + Font font, FontMetricsMapper metrics) { int maxAscent = metrics.getMaxAscent(font.getFontSize()) / 1000; int descent = metrics.getDescender(font.getFontSize()) / 1000; //is negative int safetyMargin = (int)(SAFETY_MARGIN_FACTOR * font.getFontSize()); diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderer.java b/src/java/org/apache/fop/render/pcl/PCLRenderer.java deleted file mode 100644 index 831dc99b4..000000000 --- a/src/java/org/apache/fop/render/pcl/PCLRenderer.java +++ /dev/null @@ -1,1514 +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.render.pcl; - -//Java -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.geom.AffineTransform; -import java.awt.geom.GeneralPath; -import java.awt.geom.Line2D; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; -import java.awt.image.RenderedImage; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; -import java.util.Stack; - -import org.w3c.dom.Document; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.apache.xmlgraphics.image.loader.ImageException; -import org.apache.xmlgraphics.image.loader.ImageFlavor; -import org.apache.xmlgraphics.image.loader.ImageInfo; -import org.apache.xmlgraphics.image.loader.ImageManager; -import org.apache.xmlgraphics.image.loader.ImageSessionContext; -import org.apache.xmlgraphics.image.loader.ImageSize; -import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D; -import org.apache.xmlgraphics.image.loader.impl.ImageRendered; -import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM; -import org.apache.xmlgraphics.image.loader.util.ImageUtil; -import org.apache.xmlgraphics.java2d.GraphicContext; -import org.apache.xmlgraphics.java2d.Graphics2DImagePainter; -import org.apache.xmlgraphics.util.UnitConv; - -import org.apache.fop.ResourceEventProducer; -import org.apache.fop.apps.FOPException; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.area.Area; -import org.apache.fop.area.Block; -import org.apache.fop.area.BlockViewport; -import org.apache.fop.area.CTM; -import org.apache.fop.area.NormalFlow; -import org.apache.fop.area.PageViewport; -import org.apache.fop.area.RegionViewport; -import org.apache.fop.area.Trait; -import org.apache.fop.area.inline.AbstractTextArea; -import org.apache.fop.area.inline.ForeignObject; -import org.apache.fop.area.inline.Image; -import org.apache.fop.area.inline.InlineArea; -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.Viewport; -import org.apache.fop.area.inline.WordArea; -import org.apache.fop.datatypes.URISpecification; -import org.apache.fop.fonts.Font; -import org.apache.fop.fonts.FontCollection; -import org.apache.fop.fonts.FontInfo; -import org.apache.fop.fonts.FontMetrics; -import org.apache.fop.render.Graphics2DAdapter; -import org.apache.fop.render.ImageHandlerUtil; -import org.apache.fop.render.PrintRenderer; -import org.apache.fop.render.RendererContext; -import org.apache.fop.render.RendererContextConstants; -import org.apache.fop.render.RendererEventProducer; -import org.apache.fop.render.java2d.Base14FontCollection; -import org.apache.fop.render.java2d.ConfiguredFontCollection; -import org.apache.fop.render.java2d.FontMetricsMapper; -import org.apache.fop.render.java2d.InstalledFontCollection; -import org.apache.fop.render.java2d.Java2DFontMetrics; -import org.apache.fop.render.java2d.Java2DRenderer; -import org.apache.fop.render.pcl.extensions.PCLElementMapping; -import org.apache.fop.traits.BorderProps; - -/* Note: - * There are some commonalities with AbstractPathOrientedRenderer but it's not possible - * to derive from it due to PCL's restrictions. We may need an additional common subclass to - * avoid methods copied from AbstractPathOrientedRenderer. Or we wait until after the IF redesign. - */ - -/** - * Renderer for the PCL 5 printer language. It also uses HP GL/2 for certain graphic elements. - */ -public class PCLRenderer extends PrintRenderer implements PCLConstants { - - /** logging instance */ - private static Log log = LogFactory.getLog(PCLRenderer.class); - - /** The MIME type for PCL */ - public static final String MIME_TYPE = MimeConstants.MIME_PCL_ALT; - - /** The OutputStream to write the PCL stream to */ - protected OutputStream out; - - /** The PCL generator */ - protected PCLGenerator gen; - private boolean ioTrouble = false; - - private final Stack graphicContextStack = new Stack(); - private GraphicContext graphicContext = new GraphicContext(); - - private PCLPageDefinition currentPageDefinition; - private int currentPrintDirection = 0; - private GeneralPath currentPath = null; - private java.awt.Color currentFillColor = null; - - /** - * Utility class which enables all sorts of features that are not directly connected to the - * normal rendering process. - */ - private PCLRenderingUtil pclUtil; - - /** contains the pageWith of the last printed page */ - private long pageWidth = 0; - /** contains the pageHeight of the last printed page */ - private long pageHeight = 0; - - /** - * Create the PCL renderer - */ - public PCLRenderer() { - } - - /** {@inheritDoc} */ - public void setUserAgent(FOUserAgent agent) { - super.setUserAgent(agent); - this.pclUtil = new PCLRenderingUtil(getUserAgent()); - } - - PCLRenderingUtil getPCLUtil() { - return this.pclUtil; - } - - /** - * Configures the renderer to trade speed for quality if desired. One example here is the way - * that borders are rendered. - * @param qualityBeforeSpeed true if quality is more important than speed - */ - public void setQualityBeforeSpeed(boolean qualityBeforeSpeed) { - pclUtil.setRenderingMode(qualityBeforeSpeed - ? PCLRenderingMode.QUALITY : PCLRenderingMode.SPEED); - } - - /** - * Controls whether PJL commands shall be generated by the PCL renderer. - * @param disable true to disable PJL commands - */ - public void setPJLDisabled(boolean disable) { - pclUtil.setPJLDisabled(disable); - } - - /** - * Indicates whether PJL generation is disabled. - * @return true if PJL generation is disabled. - */ - public boolean isPJLDisabled() { - return pclUtil.isPJLDisabled(); - } - - /** - * Controls whether all text should be generated as bitmaps or only text for which there's - * no native font. - * @param allTextAsBitmaps true if all text should be painted as bitmaps - */ - public void setAllTextAsBitmaps(boolean allTextAsBitmaps) { - pclUtil.setAllTextAsBitmaps(allTextAsBitmaps); - } - - /** - * {@inheritDoc} - */ - public void setupFontInfo(FontInfo inFontInfo) { - //Don't call super.setupFontInfo() here! - //The PCLRenderer uses the Java2D FontSetup which needs a special font setup - //create a temp Image to test font metrics on - fontInfo = inFontInfo; - Graphics2D graphics2D = Java2DFontMetrics.createFontMetricsGraphics2D(); - - FontCollection[] fontCollections = new FontCollection[] { - new Base14FontCollection(graphics2D), - new InstalledFontCollection(graphics2D), - new ConfiguredFontCollection(getFontResolver(), getFontList()) - }; - userAgent.getFactory().getFontManager().setup( - getFontInfo(), fontCollections); - } - - /** - * Central exception handler for I/O exceptions. - * @param ioe IOException to handle - */ - protected void handleIOTrouble(IOException ioe) { - if (!ioTrouble) { - RendererEventProducer eventProducer = RendererEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.ioError(this, ioe); - ioTrouble = true; - } - } - - /** {@inheritDoc} */ - public Graphics2DAdapter getGraphics2DAdapter() { - return new PCLGraphics2DAdapter(); - } - - /** @return the GraphicContext used to track coordinate system transformations */ - public GraphicContext getGraphicContext() { - return this.graphicContext; - } - - /** @return the target resolution */ - protected int getResolution() { - int resolution = Math.round(userAgent.getTargetResolution()); - if (resolution <= 300) { - return 300; - } else { - return 600; - } - } - - /** {@inheritDoc} */ - public void startRenderer(OutputStream outputStream) throws IOException { - log.debug("Rendering areas to PCL..."); - this.out = outputStream; - this.gen = new PCLGenerator(out, getResolution()); - - if (!isPJLDisabled()) { - gen.universalEndOfLanguage(); - gen.writeText("@PJL COMMENT Produced by " + userAgent.getProducer() + "\n"); - if (userAgent.getTitle() != null) { - gen.writeText("@PJL JOB NAME = \"" + userAgent.getTitle() + "\"\n"); - } - gen.writeText("@PJL SET RESOLUTION = " + getResolution() + "\n"); - gen.writeText("@PJL ENTER LANGUAGE = PCL\n"); - } - gen.resetPrinter(); - gen.setUnitOfMeasure(getResolution()); - gen.setRasterGraphicsResolution(getResolution()); - } - - /** {@inheritDoc} */ - public void stopRenderer() throws IOException { - gen.separateJobs(); - gen.resetPrinter(); - if (!isPJLDisabled()) { - gen.universalEndOfLanguage(); - } - } - - /** {@inheritDoc} */ - public String getMimeType() { - return MIME_TYPE; - } - - /** {@inheritDoc} */ - public void renderPage(PageViewport page) throws IOException, FOPException { - saveGraphicsState(); - - //Paper source - String paperSource = page.getForeignAttributeValue(PCLElementMapping.PCL_PAPER_SOURCE); - if (paperSource != null) { - gen.selectPaperSource(Integer.parseInt(paperSource)); - } - - //Output bin - String outputBin = page.getForeignAttributeValue(PCLElementMapping.PCL_OUTPUT_BIN); - if (outputBin != null) { - gen.selectOutputBin(Integer.parseInt(outputBin)); - } - - // Is Page duplex? - String pageDuplex = page.getForeignAttributeValue(PCLElementMapping.PCL_DUPLEX_MODE); - if (pageDuplex != null) { - gen.selectDuplexMode(Integer.parseInt(pageDuplex)); - } - - //Page size - final long pagewidth = Math.round(page.getViewArea().getWidth()); - final long pageheight = Math.round(page.getViewArea().getHeight()); - selectPageFormat(pagewidth, pageheight); - - super.renderPage(page); - - //Eject page - gen.formFeed(); - restoreGraphicsState(); - } - - private void selectPageFormat(long pagewidth, long pageheight) throws IOException { - //Only set the page format if it changes (otherwise duplex printing won't work) - if ((pagewidth != this.pageWidth) || (pageheight != this.pageHeight)) { - this.pageWidth = pagewidth; - this.pageHeight = pageheight; - - this.currentPageDefinition = PCLPageDefinition.getPageDefinition( - pagewidth, pageheight, 1000); - - if (this.currentPageDefinition == null) { - this.currentPageDefinition = PCLPageDefinition.getDefaultPageDefinition(); - log.warn("Paper type could not be determined. Falling back to: " - + this.currentPageDefinition.getName()); - } - if (log.isDebugEnabled()) { - log.debug("page size: " + currentPageDefinition.getPhysicalPageSize()); - log.debug("logical page: " + currentPageDefinition.getLogicalPageRect()); - } - - if (this.currentPageDefinition.isLandscapeFormat()) { - gen.writeCommand("&l1O"); //Landscape Orientation - } else { - gen.writeCommand("&l0O"); //Portrait Orientation - } - gen.selectPageSize(this.currentPageDefinition.getSelector()); - - gen.clearHorizontalMargins(); - gen.setTopMargin(0); - } - } - - /** Saves the current graphics state on the stack. */ - protected void saveGraphicsState() { - graphicContextStack.push(graphicContext); - graphicContext = (GraphicContext)graphicContext.clone(); - } - - /** Restores the last graphics state from the stack. */ - protected void restoreGraphicsState() { - graphicContext = (GraphicContext)graphicContextStack.pop(); - } - - /** - * Clip an area. write a clipping operation given coordinates in the current - * transform. Coordinates are in points. - * - * @param x the x coordinate - * @param y the y coordinate - * @param width the width of the area - * @param height the height of the area - */ - protected void clipRect(float x, float y, float width, float height) { - //PCL cannot clip (only HP GL/2 can) - } - - private Point2D transformedPoint(float x, float y) { - return transformedPoint(Math.round(x), Math.round(y)); - } - - private Point2D transformedPoint(int x, int y) { - return PCLRenderingUtil.transformedPoint(x, y, graphicContext.getTransform(), - currentPageDefinition, currentPrintDirection); - } - - private void changePrintDirection() { - AffineTransform at = graphicContext.getTransform(); - int newDir; - try { - newDir = PCLRenderingUtil.determinePrintDirection(at); - if (newDir != this.currentPrintDirection) { - this.currentPrintDirection = newDir; - gen.changePrintDirection(this.currentPrintDirection); - } - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * {@inheritDoc} - */ - protected void startVParea(CTM ctm, Rectangle2D clippingRect) { - saveGraphicsState(); - AffineTransform at = new AffineTransform(ctm.toArray()); - graphicContext.transform(at); - changePrintDirection(); - if (log.isDebugEnabled()) { - log.debug("startVPArea: " + at + " --> " + graphicContext.getTransform()); - } - } - - /** - * {@inheritDoc} - */ - protected void endVParea() { - restoreGraphicsState(); - changePrintDirection(); - if (log.isDebugEnabled()) { - log.debug("endVPArea() --> " + graphicContext.getTransform()); - } - } - - /** - * Handle block traits. - * The block could be any sort of block with any positioning - * so this should render the traits such as border and background - * in its position. - * - * @param block the block to render the traits - */ - protected void handleBlockTraits(Block block) { - int borderPaddingStart = block.getBorderAndPaddingWidthStart(); - int borderPaddingBefore = block.getBorderAndPaddingWidthBefore(); - - float startx = currentIPPosition / 1000f; - float starty = currentBPPosition / 1000f; - float width = block.getIPD() / 1000f; - float height = block.getBPD() / 1000f; - - startx += block.getStartIndent() / 1000f; - startx -= block.getBorderAndPaddingWidthStart() / 1000f; - - width += borderPaddingStart / 1000f; - width += block.getBorderAndPaddingWidthEnd() / 1000f; - height += borderPaddingBefore / 1000f; - height += block.getBorderAndPaddingWidthAfter() / 1000f; - - drawBackAndBorders(block, startx, starty, width, height); - } - - /** - * {@inheritDoc} - * @todo Copied from AbstractPathOrientedRenderer - */ - protected void handleRegionTraits(RegionViewport region) { - Rectangle2D viewArea = region.getViewArea(); - float startx = (float)(viewArea.getX() / 1000f); - float starty = (float)(viewArea.getY() / 1000f); - float width = (float)(viewArea.getWidth() / 1000f); - float height = (float)(viewArea.getHeight() / 1000f); - - if (region.getRegionReference().getRegionClass() == FO_REGION_BODY) { - currentBPPosition = region.getBorderAndPaddingWidthBefore(); - currentIPPosition = region.getBorderAndPaddingWidthStart(); - } - drawBackAndBorders(region, startx, starty, width, height); - } - - /** - * {@inheritDoc} - */ - protected void renderText(final TextArea text) { - renderInlineAreaBackAndBorders(text); - - String fontname = getInternalFontNameForArea(text); - final int fontsize = text.getTraitAsInteger(Trait.FONT_SIZE); - - //Determine position - int saveIP = currentIPPosition; - final int rx = currentIPPosition + text.getBorderAndPaddingWidthStart(); - int bl = currentBPPosition + text.getOffset() + text.getBaselineOffset(); - - try { - - final Color col = (Color)text.getTrait(Trait.COLOR); - boolean pclFont = pclUtil.isAllTextAsBitmaps() - ? false - : HardcodedFonts.setFont(gen, fontname, fontsize, text.getText()); - if (pclFont) { - //this.currentFill = col; - if (col != null) { - //useColor(ct); - gen.setTransparencyMode(true, false); - gen.selectGrayscale(col); - } - - saveGraphicsState(); - graphicContext.translate(rx, bl); - setCursorPos(0, 0); - gen.setTransparencyMode(true, true); - if (text.hasUnderline()) { - gen.writeCommand("&d0D"); - } - super.renderText(text); //Updates IPD and renders words and spaces - if (text.hasUnderline()) { - gen.writeCommand("&d@"); - } - restoreGraphicsState(); - } else { - //Use Java2D to paint different fonts via bitmap - final Font font = getFontFromArea(text); - final int baseline = text.getBaselineOffset(); - - //for cursive fonts, so the text isn't clipped - int extraWidth = font.getFontSize() / 3; - final FontMetricsMapper mapper = (FontMetricsMapper)fontInfo.getMetricsFor( - font.getFontName()); - int maxAscent = mapper.getMaxAscent(font.getFontSize()) / 1000; - final int additionalBPD = maxAscent - baseline; - - Graphics2DAdapter g2a = getGraphics2DAdapter(); - final Rectangle paintRect = new Rectangle( - rx, currentBPPosition + text.getOffset() - additionalBPD, - text.getIPD() + extraWidth, text.getBPD() + additionalBPD); - RendererContext rc = createRendererContext(paintRect.x, paintRect.y, - paintRect.width, paintRect.height, null); - Map atts = new java.util.HashMap(); - atts.put(ImageHandlerUtil.CONVERSION_MODE, ImageHandlerUtil.CONVERSION_MODE_BITMAP); - atts.put(SRC_TRANSPARENCY, "true"); - rc.setProperty(RendererContextConstants.FOREIGN_ATTRIBUTES, atts); - - Graphics2DImagePainter painter = new Graphics2DImagePainter() { - - public void paint(Graphics2D g2d, Rectangle2D area) { - g2d.setFont(mapper.getFont(font.getFontSize())); - g2d.translate(0, baseline + additionalBPD); - g2d.scale(1000, 1000); - g2d.setColor(col); - Java2DRenderer.renderText(text, g2d, font); - renderTextDecoration(g2d, mapper, fontsize, text, 0, 0); - } - - public Dimension getImageSize() { - return paintRect.getSize(); - } - - }; - g2a.paintImage(painter, rc, - paintRect.x, paintRect.y, paintRect.width, paintRect.height); - currentIPPosition = saveIP + text.getAllocIPD(); - } - - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * Paints the text decoration marks. - * @param g2d Graphics2D instance to paint to - * @param fm Current typeface - * @param fontsize Current font size - * @param inline inline area to paint the marks for - * @param baseline position of the baseline - * @param startx start IPD - */ - private static void renderTextDecoration(Graphics2D g2d, - FontMetrics fm, int fontsize, InlineArea inline, - int baseline, int startx) { - boolean hasTextDeco = inline.hasUnderline() - || inline.hasOverline() - || inline.hasLineThrough(); - if (hasTextDeco) { - float descender = fm.getDescender(fontsize) / 1000f; - float capHeight = fm.getCapHeight(fontsize) / 1000f; - float lineWidth = (descender / -4f) / 1000f; - float endx = (startx + inline.getIPD()) / 1000f; - if (inline.hasUnderline()) { - Color ct = (Color) inline.getTrait(Trait.UNDERLINE_COLOR); - g2d.setColor(ct); - float y = baseline - descender / 2f; - g2d.setStroke(new BasicStroke(lineWidth)); - g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f, - endx, y / 1000f)); - } - if (inline.hasOverline()) { - Color ct = (Color) inline.getTrait(Trait.OVERLINE_COLOR); - g2d.setColor(ct); - float y = (float)(baseline - (1.1 * capHeight)); - g2d.setStroke(new BasicStroke(lineWidth)); - g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f, - endx, y / 1000f)); - } - if (inline.hasLineThrough()) { - Color ct = (Color) inline.getTrait(Trait.LINETHROUGH_COLOR); - g2d.setColor(ct); - float y = (float)(baseline - (0.45 * capHeight)); - g2d.setStroke(new BasicStroke(lineWidth)); - g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f, - endx, y / 1000f)); - } - } - } - - /** - * Sets the current cursor position. The coordinates are transformed to the absolute position - * on the logical PCL page and then passed on to the PCLGenerator. - * @param x the x coordinate (in millipoints) - * @param y the y coordinate (in millipoints) - */ - void setCursorPos(float x, float y) { - try { - Point2D transPoint = transformedPoint(x, y); - gen.setCursorPos(transPoint.getX(), transPoint.getY()); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** Clip using the current path. */ - protected void clip() { - if (currentPath == null) { - throw new IllegalStateException("No current path available!"); - } - //TODO Find a good way to do clipping. PCL itself cannot clip. - currentPath = null; - } - - /** - * Closes the current subpath by appending a straight line segment from - * the current point to the starting point of the subpath. - */ - protected void closePath() { - currentPath.closePath(); - } - - /** - * Appends a straight line segment from the current point to (x, y). The - * new current point is (x, y). - * @param x x coordinate - * @param y y coordinate - */ - protected void lineTo(float x, float y) { - if (currentPath == null) { - currentPath = new GeneralPath(); - } - currentPath.lineTo(x, y); - } - - /** - * Moves the current point to (x, y), omitting any connecting line segment. - * @param x x coordinate - * @param y y coordinate - */ - protected void moveTo(float x, float y) { - if (currentPath == null) { - currentPath = new GeneralPath(); - } - currentPath.moveTo(x, y); - } - - /** - * Fill a rectangular area. - * @param x the x coordinate (in pt) - * @param y the y coordinate (in pt) - * @param width the width of the rectangle - * @param height the height of the rectangle - */ - protected void fillRect(float x, float y, float width, float height) { - try { - setCursorPos(x * 1000, y * 1000); - gen.fillRect((int)(width * 1000), (int)(height * 1000), - this.currentFillColor); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * Sets the new current fill color. - * @param color the color - */ - protected void updateFillColor(java.awt.Color color) { - this.currentFillColor = color; - } - - /** - * {@inheritDoc} - */ - protected void renderWord(WordArea word) { - //Font font = getFontFromArea(word.getParentArea()); - - String s = word.getWord(); - - try { - gen.writeText(s); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - - super.renderWord(word); - } - - /** - * {@inheritDoc} - */ - protected void renderSpace(SpaceArea space) { - AbstractTextArea textArea = (AbstractTextArea)space.getParentArea(); - String s = space.getSpace(); - char sp = s.charAt(0); - Font font = getFontFromArea(textArea); - - int tws = (space.isAdjustable() - ? textArea.getTextWordSpaceAdjust() - + 2 * textArea.getTextLetterSpaceAdjust() - : 0); - - double dx = (font.getCharWidth(sp) + tws) / 100f; - try { - gen.writeCommand("&a+" + gen.formatDouble2(dx) + "H"); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - super.renderSpace(space); - } - - /** - * Render an inline viewport. - * This renders an inline viewport by clipping if necessary. - * @param viewport the viewport to handle - * @todo Copied from AbstractPathOrientedRenderer - */ - public void renderViewport(Viewport viewport) { - - float x = currentIPPosition / 1000f; - float y = (currentBPPosition + viewport.getOffset()) / 1000f; - float width = viewport.getIPD() / 1000f; - float height = viewport.getBPD() / 1000f; - // TODO: Calculate the border rect correctly. - float borderPaddingStart = viewport.getBorderAndPaddingWidthStart() / 1000f; - float borderPaddingBefore = viewport.getBorderAndPaddingWidthBefore() / 1000f; - float bpwidth = borderPaddingStart - + (viewport.getBorderAndPaddingWidthEnd() / 1000f); - float bpheight = borderPaddingBefore - + (viewport.getBorderAndPaddingWidthAfter() / 1000f); - - drawBackAndBorders(viewport, x, y, width + bpwidth, height + bpheight); - - if (viewport.getClip()) { - saveGraphicsState(); - - clipRect(x + borderPaddingStart, y + borderPaddingBefore, width, height); - } - super.renderViewport(viewport); - - if (viewport.getClip()) { - restoreGraphicsState(); - } - } - - /** - * {@inheritDoc} - */ - protected void renderBlockViewport(BlockViewport bv, List children) { - // clip and position viewport if necessary - - // save positions - int saveIP = currentIPPosition; - int saveBP = currentBPPosition; - - CTM ctm = bv.getCTM(); - int borderPaddingStart = bv.getBorderAndPaddingWidthStart(); - int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore(); - //This is the content-rect - float width = bv.getIPD() / 1000f; - float height = bv.getBPD() / 1000f; - - - if (bv.getPositioning() == Block.ABSOLUTE - || bv.getPositioning() == Block.FIXED) { - - //For FIXED, we need to break out of the current viewports to the - //one established by the page. We save the state stack for restoration - //after the block-container has been painted. See below. - List breakOutList = null; - if (bv.getPositioning() == Block.FIXED) { - breakOutList = breakOutOfStateStack(); - } - - AffineTransform positionTransform = new AffineTransform(); - positionTransform.translate(bv.getXOffset(), bv.getYOffset()); - - //"left/"top" (bv.getX/YOffset()) specify the position of the content rectangle - positionTransform.translate(-borderPaddingStart, -borderPaddingBefore); - - saveGraphicsState(); - //Viewport position - concatenateTransformationMatrix(UnitConv.mptToPt(positionTransform)); - - //Background and borders - float bpwidth = (borderPaddingStart + bv.getBorderAndPaddingWidthEnd()) / 1000f; - float bpheight = (borderPaddingBefore + bv.getBorderAndPaddingWidthAfter()) / 1000f; - drawBackAndBorders(bv, 0, 0, width + bpwidth, height + bpheight); - - //Shift to content rectangle after border painting - AffineTransform contentRectTransform = new AffineTransform(); - contentRectTransform.translate(borderPaddingStart, borderPaddingBefore); - concatenateTransformationMatrix(UnitConv.mptToPt(contentRectTransform)); - - //Clipping - if (bv.getClip()) { - clipRect(0f, 0f, width, height); - } - - saveGraphicsState(); - //Set up coordinate system for content rectangle - AffineTransform contentTransform = ctm.toAffineTransform(); - concatenateTransformationMatrix(UnitConv.mptToPt(contentTransform)); - - currentIPPosition = 0; - currentBPPosition = 0; - renderBlocks(bv, children); - - restoreGraphicsState(); - restoreGraphicsState(); - - if (breakOutList != null) { - restoreStateStackAfterBreakOut(breakOutList); - } - - currentIPPosition = saveIP; - currentBPPosition = saveBP; - } else { - - currentBPPosition += bv.getSpaceBefore(); - - //borders and background in the old coordinate system - handleBlockTraits(bv); - - //Advance to start of content area - currentIPPosition += bv.getStartIndent(); - - CTM tempctm = new CTM(containingIPPosition, currentBPPosition); - ctm = tempctm.multiply(ctm); - - //Now adjust for border/padding - currentBPPosition += borderPaddingBefore; - - Rectangle2D clippingRect = null; - if (bv.getClip()) { - clippingRect = new Rectangle(currentIPPosition, currentBPPosition, - bv.getIPD(), bv.getBPD()); - } - - startVParea(ctm, clippingRect); - currentIPPosition = 0; - currentBPPosition = 0; - renderBlocks(bv, children); - endVParea(); - - currentIPPosition = saveIP; - currentBPPosition = saveBP; - - currentBPPosition += (bv.getAllocBPD()); - } - //currentFontName = saveFontName; - } - - /** {@inheritDoc} */ - protected void renderReferenceArea(Block block) { - //TODO This is the same code as in AbstractPathOrientedRenderer - //So there's some optimization potential but not otherwise PCLRenderer is a little - //difficult to derive from AbstractPathOrientedRenderer. Maybe an additional layer - //between PrintRenderer and AbstractPathOrientedRenderer is necessary. - - // save position and offset - int saveIP = currentIPPosition; - int saveBP = currentBPPosition; - - //Establish a new coordinate system - AffineTransform at = new AffineTransform(); - at.translate(currentIPPosition, currentBPPosition); - at.translate(block.getXOffset(), block.getYOffset()); - at.translate(0, block.getSpaceBefore()); - - if (!at.isIdentity()) { - saveGraphicsState(); - concatenateTransformationMatrix(UnitConv.mptToPt(at)); - } - - currentIPPosition = 0; - currentBPPosition = 0; - handleBlockTraits(block); - - List children = block.getChildAreas(); - if (children != null) { - renderBlocks(block, children); - } - - if (!at.isIdentity()) { - restoreGraphicsState(); - } - - // stacked and relative blocks effect stacking - currentIPPosition = saveIP; - currentBPPosition = saveBP; - } - - /** {@inheritDoc} */ - protected void renderFlow(NormalFlow flow) { - //TODO This is the same code as in AbstractPathOrientedRenderer - //So there's some optimization potential but not otherwise PCLRenderer is a little - //difficult to derive from AbstractPathOrientedRenderer. Maybe an additional layer - //between PrintRenderer and AbstractPathOrientedRenderer is necessary. - - // save position and offset - int saveIP = currentIPPosition; - int saveBP = currentBPPosition; - - //Establish a new coordinate system - AffineTransform at = new AffineTransform(); - at.translate(currentIPPosition, currentBPPosition); - - if (!at.isIdentity()) { - saveGraphicsState(); - concatenateTransformationMatrix(UnitConv.mptToPt(at)); - } - - currentIPPosition = 0; - currentBPPosition = 0; - super.renderFlow(flow); - - if (!at.isIdentity()) { - restoreGraphicsState(); - } - - // stacked and relative blocks effect stacking - currentIPPosition = saveIP; - currentBPPosition = saveBP; - } - - /** - * Concatenates the current transformation matrix with the given one, therefore establishing - * a new coordinate system. - * @param at the transformation matrix to process (coordinates in points) - */ - protected void concatenateTransformationMatrix(AffineTransform at) { - if (!at.isIdentity()) { - graphicContext.transform(UnitConv.ptToMpt(at)); - changePrintDirection(); - } - } - - private List breakOutOfStateStack() { - log.debug("Block.FIXED --> break out"); - List breakOutList = new java.util.ArrayList(); - while (!this.graphicContextStack.empty()) { - breakOutList.add(0, this.graphicContext); - restoreGraphicsState(); - } - return breakOutList; - } - - private void restoreStateStackAfterBreakOut(List breakOutList) { - log.debug("Block.FIXED --> restoring context after break-out"); - for (int i = 0, c = breakOutList.size(); i < c; i++) { - saveGraphicsState(); - this.graphicContext = (GraphicContext)breakOutList.get(i); - } - } - - /** {@inheritDoc} */ - protected RendererContext createRendererContext(int x, int y, int width, int height, - Map foreignAttributes) { - RendererContext context = super.createRendererContext( - x, y, width, height, foreignAttributes); - context.setProperty(PCLRendererContextConstants.PCL_COLOR_CANVAS, - Boolean.valueOf(pclUtil.isColorCanvasEnabled())); - return context; - } - - /** {@inheritDoc} */ - public void renderImage(Image image, Rectangle2D pos) { - drawImage(image.getURL(), pos, image.getForeignAttributes()); - } - - private static final ImageFlavor[] FLAVORS = new ImageFlavor[] - {ImageFlavor.GRAPHICS2D, - ImageFlavor.BUFFERED_IMAGE, - ImageFlavor.RENDERED_IMAGE, - ImageFlavor.XML_DOM}; - /** - * Draw an image at the indicated location. - * @param uri the URI/URL of the image - * @param pos the position of the image - * @param foreignAttributes an optional Map with foreign attributes, may be null - */ - protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) { - uri = URISpecification.getURL(uri); - Rectangle posInt = new Rectangle( - (int)pos.getX(), - (int)pos.getY(), - (int)pos.getWidth(), - (int)pos.getHeight()); - Point origin = new Point(currentIPPosition, currentBPPosition); - int x = origin.x + posInt.x; - int y = origin.y + posInt.y; - - ImageManager manager = getUserAgent().getFactory().getImageManager(); - ImageInfo info = null; - try { - ImageSessionContext sessionContext = getUserAgent().getImageSessionContext(); - info = manager.getImageInfo(uri, sessionContext); - - //Only now fully load/prepare the image - Map hints = ImageUtil.getDefaultHints(sessionContext); - org.apache.xmlgraphics.image.loader.Image img = manager.getImage( - info, FLAVORS, hints, sessionContext); - - //...and process the image - if (img instanceof ImageGraphics2D) { - ImageGraphics2D imageG2D = (ImageGraphics2D)img; - RendererContext context = createRendererContext( - posInt.x, posInt.y, - posInt.width, posInt.height, foreignAttributes); - getGraphics2DAdapter().paintImage(imageG2D.getGraphics2DImagePainter(), - context, x, y, posInt.width, posInt.height); - } else if (img instanceof ImageRendered) { - ImageRendered imgRend = (ImageRendered)img; - RenderedImage ri = imgRend.getRenderedImage(); - setCursorPos(x, y); - gen.paintBitmap(ri, - new Dimension(posInt.width, posInt.height), - false); - } else if (img instanceof ImageXMLDOM) { - ImageXMLDOM imgXML = (ImageXMLDOM)img; - renderDocument(imgXML.getDocument(), imgXML.getRootNamespace(), - pos, foreignAttributes); - } else { - throw new UnsupportedOperationException("Unsupported image type: " + img); - } - - } catch (ImageException ie) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageError(this, (info != null ? info.toString() : uri), ie, null); - } catch (FileNotFoundException fe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageNotFound(this, (info != null ? info.toString() : uri), fe, null); - } catch (IOException ioe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageIOError(this, (info != null ? info.toString() : uri), ioe, null); - } - } - - /** {@inheritDoc} */ - public void renderForeignObject(ForeignObject fo, Rectangle2D pos) { - Document doc = fo.getDocument(); - String ns = fo.getNameSpace(); - renderDocument(doc, ns, pos, fo.getForeignAttributes()); - } - - /** - * Common method to render the background and borders for any inline area. - * The all borders and padding are drawn outside the specified area. - * @param area the inline area for which the background, border and padding is to be - * rendered - * @todo Copied from AbstractPathOrientedRenderer - */ - protected void renderInlineAreaBackAndBorders(InlineArea area) { - float x = currentIPPosition / 1000f; - float y = (currentBPPosition + area.getOffset()) / 1000f; - float width = area.getIPD() / 1000f; - float height = area.getBPD() / 1000f; - float borderPaddingStart = area.getBorderAndPaddingWidthStart() / 1000f; - float borderPaddingBefore = area.getBorderAndPaddingWidthBefore() / 1000f; - float bpwidth = borderPaddingStart - + (area.getBorderAndPaddingWidthEnd() / 1000f); - float bpheight = borderPaddingBefore - + (area.getBorderAndPaddingWidthAfter() / 1000f); - - if (height != 0.0f || bpheight != 0.0f && bpwidth != 0.0f) { - drawBackAndBorders(area, x, y - borderPaddingBefore - , width + bpwidth - , height + bpheight); - } - } - - /** - * Draw the background and borders. This draws the background and border - * traits for an area given the position. - * - * @param area the area whose traits are used - * @param startx the start x position - * @param starty the start y position - * @param width the width of the area - * @param height the height of the area - */ - protected void drawBackAndBorders(Area area, float startx, float starty, - float width, float height) { - BorderProps bpsBefore = (BorderProps) area.getTrait(Trait.BORDER_BEFORE); - BorderProps bpsAfter = (BorderProps) area.getTrait(Trait.BORDER_AFTER); - BorderProps bpsStart = (BorderProps) area.getTrait(Trait.BORDER_START); - BorderProps bpsEnd = (BorderProps) area.getTrait(Trait.BORDER_END); - - // draw background - Trait.Background back; - back = (Trait.Background) area.getTrait(Trait.BACKGROUND); - if (back != null) { - - // Calculate padding rectangle - float sx = startx; - float sy = starty; - float paddRectWidth = width; - float paddRectHeight = height; - - if (bpsStart != null) { - sx += bpsStart.width / 1000f; - paddRectWidth -= bpsStart.width / 1000f; - } - if (bpsBefore != null) { - sy += bpsBefore.width / 1000f; - paddRectHeight -= bpsBefore.width / 1000f; - } - if (bpsEnd != null) { - paddRectWidth -= bpsEnd.width / 1000f; - } - if (bpsAfter != null) { - paddRectHeight -= bpsAfter.width / 1000f; - } - - if (back.getColor() != null) { - updateFillColor(back.getColor()); - fillRect(sx, sy, paddRectWidth, paddRectHeight); - } - - // background image - if (back.getImageInfo() != null) { - ImageSize imageSize = back.getImageInfo().getSize(); - saveGraphicsState(); - clipRect(sx, sy, paddRectWidth, paddRectHeight); - int horzCount = (int) ((paddRectWidth * 1000 / imageSize.getWidthMpt()) + 1.0f); - int vertCount = (int) ((paddRectHeight * 1000 / imageSize.getHeightMpt()) + 1.0f); - if (back.getRepeat() == EN_NOREPEAT) { - horzCount = 1; - vertCount = 1; - } else if (back.getRepeat() == EN_REPEATX) { - vertCount = 1; - } else if (back.getRepeat() == EN_REPEATY) { - horzCount = 1; - } - // change from points to millipoints - sx *= 1000; - sy *= 1000; - if (horzCount == 1) { - sx += back.getHoriz(); - } - if (vertCount == 1) { - sy += back.getVertical(); - } - for (int x = 0; x < horzCount; x++) { - for (int y = 0; y < vertCount; y++) { - // place once - Rectangle2D pos; - // Image positions are relative to the currentIP/BP - pos = new Rectangle2D.Float( - sx - currentIPPosition - + (x * imageSize.getWidthMpt()), - sy - currentBPPosition - + (y * imageSize.getHeightMpt()), - imageSize.getWidthMpt(), - imageSize.getHeightMpt()); - drawImage(back.getURL(), pos, null); - } - } - restoreGraphicsState(); - } - } - - Rectangle2D.Float borderRect = new Rectangle2D.Float(startx, starty, width, height); - drawBorders(borderRect, bpsBefore, bpsAfter, bpsStart, bpsEnd); - } - - /** - * Draws borders. - * @param borderRect the border rectangle - * @param bpsBefore the border specification on the before side - * @param bpsAfter the border specification on the after side - * @param bpsStart the border specification on the start side - * @param bpsEnd the border specification on the end side - */ - protected void drawBorders(Rectangle2D.Float borderRect, - final BorderProps bpsBefore, final BorderProps bpsAfter, - final BorderProps bpsStart, final BorderProps bpsEnd) { - if (bpsBefore == null && bpsAfter == null && bpsStart == null && bpsEnd == null) { - return; //no borders to paint - } - if (PCLRenderingMode.SPEED == pclUtil.getRenderingMode()) { - drawFastBorders(borderRect, bpsBefore, bpsAfter, bpsStart, bpsEnd); - } else { - drawQualityBorders(borderRect, bpsBefore, bpsAfter, bpsStart, bpsEnd); - } - } - - /** - * Draws borders. Borders are drawn as shaded rectangles with no clipping. - * @param borderRect the border rectangle - * @param bpsBefore the border specification on the before side - * @param bpsAfter the border specification on the after side - * @param bpsStart the border specification on the start side - * @param bpsEnd the border specification on the end side - */ - protected void drawFastBorders(Rectangle2D.Float borderRect, - final BorderProps bpsBefore, final BorderProps bpsAfter, - final BorderProps bpsStart, final BorderProps bpsEnd) { - float startx = borderRect.x; - float starty = borderRect.y; - float width = borderRect.width; - float height = borderRect.height; - if (bpsBefore != null) { - float borderWidth = bpsBefore.width / 1000f; - updateFillColor(bpsBefore.color); - fillRect(startx, starty, width, borderWidth); - } - if (bpsAfter != null) { - float borderWidth = bpsAfter.width / 1000f; - updateFillColor(bpsAfter.color); - fillRect(startx, (starty + height - borderWidth), - width, borderWidth); - } - if (bpsStart != null) { - float borderWidth = bpsStart.width / 1000f; - updateFillColor(bpsStart.color); - fillRect(startx, starty, borderWidth, height); - } - if (bpsEnd != null) { - float borderWidth = bpsEnd.width / 1000f; - updateFillColor(bpsEnd.color); - fillRect((startx + width - borderWidth), starty, borderWidth, height); - } - } - - /** - * Draws borders. Borders are drawn in-memory and painted as a bitmap. - * @param borderRect the border rectangle - * @param bpsBefore the border specification on the before side - * @param bpsAfter the border specification on the after side - * @param bpsStart the border specification on the start side - * @param bpsEnd the border specification on the end side - */ - protected void drawQualityBorders(Rectangle2D.Float borderRect, - final BorderProps bpsBefore, final BorderProps bpsAfter, - final BorderProps bpsStart, final BorderProps bpsEnd) { - Graphics2DAdapter g2a = getGraphics2DAdapter(); - final Rectangle.Float effBorderRect = new Rectangle2D.Float( - 0, - 0, - borderRect.width, - borderRect.height); - final Rectangle paintRect = new Rectangle( - Math.round(borderRect.x * 1000f), - Math.round(borderRect.y * 1000f), - (int)Math.floor(borderRect.width * 1000f) + 1, - (int)Math.floor(borderRect.height * 1000f) + 1); - //Add one pixel wide safety margin around the paint area - int pixelWidth = (int)Math.round(UnitConv.in2mpt(1) / userAgent.getTargetResolution()); - final int xoffset = Math.round(-effBorderRect.x * 1000f) + pixelWidth; - final int yoffset = pixelWidth; - paintRect.x += xoffset; - paintRect.y += yoffset; - paintRect.width += 2 * pixelWidth; - paintRect.height += 2 * pixelWidth; - - RendererContext rc = createRendererContext(paintRect.x, paintRect.y, - paintRect.width, paintRect.height, null); - Map atts = new java.util.HashMap(); - atts.put(ImageHandlerUtil.CONVERSION_MODE, ImageHandlerUtil.CONVERSION_MODE_BITMAP); - atts.put(SRC_TRANSPARENCY, "true"); - rc.setProperty(RendererContextConstants.FOREIGN_ATTRIBUTES, atts); - - Graphics2DImagePainter painter = new Graphics2DImagePainter() { - - public void paint(Graphics2D g2d, Rectangle2D area) { - g2d.translate(xoffset, yoffset); - g2d.scale(1000, 1000); - float startx = effBorderRect.x; - float starty = effBorderRect.y; - float width = effBorderRect.width; - float height = effBorderRect.height; - boolean[] b = new boolean[] { - (bpsBefore != null), (bpsEnd != null), - (bpsAfter != null), (bpsStart != null)}; - if (!b[0] && !b[1] && !b[2] && !b[3]) { - return; - } - float[] bw = new float[] { - (b[0] ? bpsBefore.width / 1000f : 0.0f), - (b[1] ? bpsEnd.width / 1000f : 0.0f), - (b[2] ? bpsAfter.width / 1000f : 0.0f), - (b[3] ? bpsStart.width / 1000f : 0.0f)}; - float[] clipw = new float[] { - BorderProps.getClippedWidth(bpsBefore) / 1000f, - BorderProps.getClippedWidth(bpsEnd) / 1000f, - BorderProps.getClippedWidth(bpsAfter) / 1000f, - BorderProps.getClippedWidth(bpsStart) / 1000f}; - starty += clipw[0]; - height -= clipw[0]; - height -= clipw[2]; - startx += clipw[3]; - width -= clipw[3]; - width -= clipw[1]; - - boolean[] slant = new boolean[] { - (b[3] && b[0]), (b[0] && b[1]), (b[1] && b[2]), (b[2] && b[3])}; - if (bpsBefore != null) { - //endTextObject(); - - float sx1 = startx; - float sx2 = (slant[0] ? sx1 + bw[3] - clipw[3] : sx1); - float ex1 = startx + width; - float ex2 = (slant[1] ? ex1 - bw[1] + clipw[1] : ex1); - float outery = starty - clipw[0]; - float clipy = outery + clipw[0]; - float innery = outery + bw[0]; - - //saveGraphicsState(); - Graphics2D g = (Graphics2D)g2d.create(); - moveTo(sx1, clipy); - float sx1a = sx1; - float ex1a = ex1; - if (bpsBefore.mode == BorderProps.COLLAPSE_OUTER) { - if (bpsStart != null && bpsStart.mode == BorderProps.COLLAPSE_OUTER) { - sx1a -= clipw[3]; - } - if (bpsEnd != null && bpsEnd.mode == BorderProps.COLLAPSE_OUTER) { - ex1a += clipw[1]; - } - lineTo(sx1a, outery); - lineTo(ex1a, outery); - } - lineTo(ex1, clipy); - lineTo(ex2, innery); - lineTo(sx2, innery); - closePath(); - //clip(); - g.clip(currentPath); - currentPath = null; - Rectangle2D.Float lineRect = new Rectangle2D.Float( - sx1a, outery, ex1a - sx1a, innery - outery); - Java2DRenderer.drawBorderLine(lineRect, true, true, - bpsBefore.style, bpsBefore.color, g); - //restoreGraphicsState(); - } - if (bpsEnd != null) { - //endTextObject(); - - float sy1 = starty; - float sy2 = (slant[1] ? sy1 + bw[0] - clipw[0] : sy1); - float ey1 = starty + height; - float ey2 = (slant[2] ? ey1 - bw[2] + clipw[2] : ey1); - float outerx = startx + width + clipw[1]; - float clipx = outerx - clipw[1]; - float innerx = outerx - bw[1]; - - //saveGraphicsState(); - Graphics2D g = (Graphics2D)g2d.create(); - moveTo(clipx, sy1); - float sy1a = sy1; - float ey1a = ey1; - if (bpsEnd.mode == BorderProps.COLLAPSE_OUTER) { - if (bpsBefore != null && bpsBefore.mode == BorderProps.COLLAPSE_OUTER) { - sy1a -= clipw[0]; - } - if (bpsAfter != null && bpsAfter.mode == BorderProps.COLLAPSE_OUTER) { - ey1a += clipw[2]; - } - lineTo(outerx, sy1a); - lineTo(outerx, ey1a); - } - lineTo(clipx, ey1); - lineTo(innerx, ey2); - lineTo(innerx, sy2); - closePath(); - //clip(); - g.setClip(currentPath); - currentPath = null; - Rectangle2D.Float lineRect = new Rectangle2D.Float( - innerx, sy1a, outerx - innerx, ey1a - sy1a); - Java2DRenderer.drawBorderLine(lineRect, false, false, - bpsEnd.style, bpsEnd.color, g); - //restoreGraphicsState(); - } - if (bpsAfter != null) { - //endTextObject(); - - float sx1 = startx; - float sx2 = (slant[3] ? sx1 + bw[3] - clipw[3] : sx1); - float ex1 = startx + width; - float ex2 = (slant[2] ? ex1 - bw[1] + clipw[1] : ex1); - float outery = starty + height + clipw[2]; - float clipy = outery - clipw[2]; - float innery = outery - bw[2]; - - //saveGraphicsState(); - Graphics2D g = (Graphics2D)g2d.create(); - moveTo(ex1, clipy); - float sx1a = sx1; - float ex1a = ex1; - if (bpsAfter.mode == BorderProps.COLLAPSE_OUTER) { - if (bpsStart != null && bpsStart.mode == BorderProps.COLLAPSE_OUTER) { - sx1a -= clipw[3]; - } - if (bpsEnd != null && bpsEnd.mode == BorderProps.COLLAPSE_OUTER) { - ex1a += clipw[1]; - } - lineTo(ex1a, outery); - lineTo(sx1a, outery); - } - lineTo(sx1, clipy); - lineTo(sx2, innery); - lineTo(ex2, innery); - closePath(); - //clip(); - g.setClip(currentPath); - currentPath = null; - Rectangle2D.Float lineRect = new Rectangle2D.Float( - sx1a, innery, ex1a - sx1a, outery - innery); - Java2DRenderer.drawBorderLine(lineRect, true, false, - bpsAfter.style, bpsAfter.color, g); - //restoreGraphicsState(); - } - if (bpsStart != null) { - //endTextObject(); - - float sy1 = starty; - float sy2 = (slant[0] ? sy1 + bw[0] - clipw[0] : sy1); - float ey1 = sy1 + height; - float ey2 = (slant[3] ? ey1 - bw[2] + clipw[2] : ey1); - float outerx = startx - clipw[3]; - float clipx = outerx + clipw[3]; - float innerx = outerx + bw[3]; - - //saveGraphicsState(); - Graphics2D g = (Graphics2D)g2d.create(); - moveTo(clipx, ey1); - float sy1a = sy1; - float ey1a = ey1; - if (bpsStart.mode == BorderProps.COLLAPSE_OUTER) { - if (bpsBefore != null && bpsBefore.mode == BorderProps.COLLAPSE_OUTER) { - sy1a -= clipw[0]; - } - if (bpsAfter != null && bpsAfter.mode == BorderProps.COLLAPSE_OUTER) { - ey1a += clipw[2]; - } - lineTo(outerx, ey1a); - lineTo(outerx, sy1a); - } - lineTo(clipx, sy1); - lineTo(innerx, sy2); - lineTo(innerx, ey2); - closePath(); - //clip(); - g.setClip(currentPath); - currentPath = null; - Rectangle2D.Float lineRect = new Rectangle2D.Float( - outerx, sy1a, innerx - outerx, ey1a - sy1a); - Java2DRenderer.drawBorderLine(lineRect, false, false, - bpsStart.style, bpsStart.color, g); - //restoreGraphicsState(); - } - } - - public Dimension getImageSize() { - return paintRect.getSize(); - } - - }; - try { - g2a.paintImage(painter, rc, - paintRect.x - xoffset, paintRect.y, paintRect.width, paintRect.height); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** {@inheritDoc} */ - public void renderLeader(Leader area) { - renderInlineAreaBackAndBorders(area); - - saveGraphicsState(); - int style = area.getRuleStyle(); - float startx = (currentIPPosition + area.getBorderAndPaddingWidthStart()) / 1000f; - float starty = (currentBPPosition + area.getOffset()) / 1000f; - float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart() - + area.getIPD()) / 1000f; - float ruleThickness = area.getRuleThickness() / 1000f; - Color col = (Color)area.getTrait(Trait.COLOR); - - switch (style) { - case EN_SOLID: - case EN_DASHED: //TODO Improve me and following (this is just a quick-fix ATM) - case EN_DOUBLE: - case EN_DOTTED: - case EN_GROOVE: - case EN_RIDGE: - updateFillColor(col); - fillRect(startx, starty, endx - startx, ruleThickness); - break; - default: - throw new UnsupportedOperationException("rule style not supported"); - } - - restoreGraphicsState(); - super.renderLeader(area); - } - -} diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java b/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java index 802ba4176..339880b64 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java +++ b/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java @@ -57,20 +57,12 @@ public class PCLRendererConfigurator extends PrintRendererConfigurator } /** - * Configure the PCL renderer. + * Throws an UnsupportedOperationException. * - * @param renderer PCL renderer - * @throws FOPException fop exception + * @param renderer not used */ - public void configure(Renderer renderer) throws FOPException { - Configuration cfg = super.getRendererConfig(renderer); - if (cfg != null) { - PCLRenderer pclRenderer = (PCLRenderer)renderer; - - PCLRenderingUtil pclUtil = pclRenderer.getPCLUtil(); - configure(cfg, pclUtil); - } - super.configure(renderer); + public void configure(Renderer renderer) { + throw new UnsupportedOperationException(); } private void configure(Configuration cfg, PCLRenderingUtil pclUtil) throws FOPException { diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererContext.java b/src/java/org/apache/fop/render/pcl/PCLRendererContext.java index 6c2c592b1..d54973ac8 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererContext.java +++ b/src/java/org/apache/fop/render/pcl/PCLRendererContext.java @@ -19,9 +19,6 @@ package org.apache.fop.render.pcl; -import org.apache.xmlgraphics.util.QName; - -import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RendererContext; diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererMaker.java b/src/java/org/apache/fop/render/pcl/PCLRendererMaker.java deleted file mode 100644 index a7651a6ac..000000000 --- a/src/java/org/apache/fop/render/pcl/PCLRendererMaker.java +++ /dev/null @@ -1,57 +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.render.pcl; - -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.render.AbstractRendererMaker; -import org.apache.fop.render.Renderer; -import org.apache.fop.render.RendererConfigurator; - -/** - * RendererMaker for the PCL Renderer. - */ -public class PCLRendererMaker extends AbstractRendererMaker { - - private static final String[] MIMES = new String[] { - MimeConstants.MIME_PCL, - MimeConstants.MIME_PCL_ALT - }; - - /**{@inheritDoc} */ - public Renderer makeRenderer(FOUserAgent userAgent) { - return new PCLRenderer(); - } - - /** {@inheritDoc} */ - public RendererConfigurator getConfigurator(FOUserAgent userAgent) { - return new PCLRendererConfigurator(userAgent); - } - - /** {@inheritDoc} */ - public boolean needsOutputStream() { - return true; - } - - /** {@inheritDoc} */ - public String[] getSupportedMimeTypes() { - return MIMES; - } -} diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderingContext.java b/src/java/org/apache/fop/render/pcl/PCLRenderingContext.java index 014b267dd..8ac7fc973 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRenderingContext.java +++ b/src/java/org/apache/fop/render/pcl/PCLRenderingContext.java @@ -41,6 +41,7 @@ public abstract class PCLRenderingContext extends AbstractRenderingContext { * Main constructor. * @param userAgent the user agent * @param generator the PCL generator + * @param pclUtil rendering utility */ public PCLRenderingContext(FOUserAgent userAgent, PCLGenerator generator, PCLRenderingUtil pclUtil) { diff --git a/src/java/org/apache/fop/render/pcl/PCLSVGHandler.java b/src/java/org/apache/fop/render/pcl/PCLSVGHandler.java index fb2389758..f07a7a7e2 100644 --- a/src/java/org/apache/fop/render/pcl/PCLSVGHandler.java +++ b/src/java/org/apache/fop/render/pcl/PCLSVGHandler.java @@ -28,13 +28,12 @@ import org.apache.fop.render.RendererContext; * PCL XML handler for SVG. Uses Apache Batik for SVG processing. * This handler handles XML for foreign objects when rendering to HP GL/2. * It renders SVG to HP GL/2 using the PCLGraphics2D. - * @see PCLGraphics2DAdapter */ public class PCLSVGHandler extends AbstractGenericSVGHandler { /** {@inheritDoc} */ public boolean supportsRenderer(Renderer renderer) { - return (renderer instanceof PCLRenderer); + return false; } /** {@inheritDoc} */ diff --git a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java b/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java index 165236359..00dfdfa03 100644 --- a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java +++ b/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java @@ -165,7 +165,7 @@ public abstract class AbstractImageAdapter implements PDFImage { return null; } - /** {@inheritDoc} */ + /** @return null (if not overridden) */ public String getSoftMask() { return null; } diff --git a/src/java/org/apache/fop/render/pdf/CTMHelper.java b/src/java/org/apache/fop/render/pdf/CTMHelper.java index ced025ea3..5f1706905 100644 --- a/src/java/org/apache/fop/render/pdf/CTMHelper.java +++ b/src/java/org/apache/fop/render/pdf/CTMHelper.java @@ -33,6 +33,10 @@ import org.apache.fop.pdf.PDFNumber; * @see org.apache.fop.area.CTM */ public final class CTMHelper { + + private CTMHelper() { + } + /** * <p>Converts the sourceMatrix to a string for use in the PDFRenderer cm operations.</p> * <p>For example: diff --git a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java b/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java index 27d25e15b..e34165d5a 100644 --- a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java +++ b/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java @@ -66,7 +66,7 @@ public class ImageRenderedAdapter extends AbstractImageAdapter { */ public ImageRenderedAdapter(ImageRendered image, String key) { super(image, key); - this.encodingHelper = new ImageEncodingHelper(image.getRenderedImage()); + this.encodingHelper = new ImageEncodingHelper(image.getRenderedImage(), true); } /** diff --git a/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java b/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java index d1b2e87dd..287f89607 100644 --- a/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java +++ b/src/java/org/apache/fop/render/pdf/PDFBorderPainter.java @@ -37,29 +37,39 @@ import org.apache.fop.util.ColorUtil; public class PDFBorderPainter extends BorderPainter { /** logging instance */ - private static Log log = LogFactory.getLog(PDFBorderPainter.class); + private static final Log LOG = LogFactory.getLog(PDFBorderPainter.class); private PDFContentGenerator generator; + /** + * Construct a border painter. + * @param generator a pdf content generator + */ public PDFBorderPainter(PDFContentGenerator generator) { this.generator = generator; } /** {@inheritDoc} */ - protected void drawBorderLine(int x1, int y1, int x2, int y2, boolean horz, - boolean startOrBefore, int style, Color col) { + protected void drawBorderLine // CSOK: ParameterNumber + (int x1, int y1, int x2, int y2, boolean horz, + boolean startOrBefore, int style, Color col) { drawBorderLine(generator, x1 / 1000f, y1 / 1000f, x2 / 1000f, y2 / 1000f, horz, startOrBefore, style, col); } - /** {@inheritDoc} */ - public static void drawBorderLine(PDFContentGenerator generator, - float x1, float y1, float x2, float y2, boolean horz, - boolean startOrBefore, int style, Color col) { + /** + * @param generator pdf content generator + * @see BorderPainter#drawBorderLine + */ + public static void drawBorderLine // CSOK: ParameterNumber|MethodLength + (PDFContentGenerator generator, + float x1, float y1, float x2, float y2, boolean horz, // CSOK: JavadocMethod + boolean startOrBefore, int style, Color col) { // CSOK: JavadocMethod + float colFactor; float w = x2 - x1; float h = y2 - y1; if ((w < 0) || (h < 0)) { - log.error("Negative extent received (w=" + w + ", h=" + h + LOG.error("Negative extent received (w=" + w + ", h=" + h + "). Border won't be painted."); return; } @@ -146,8 +156,7 @@ public class PDFBorderPainter extends BorderPainter { break; case Constants.EN_GROOVE: case Constants.EN_RIDGE: - { - float colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f); + colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f); generator.add("[] 0 d "); if (horz) { Color uppercol = ColorUtil.lightenColor(col, -colFactor); @@ -181,11 +190,9 @@ public class PDFBorderPainter extends BorderPainter { + format(xm1 + w3 + w3) + " " + format(y2) + " l S\n"); } break; - } case Constants.EN_INSET: case Constants.EN_OUTSET: - { - float colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f); + colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f); generator.add("[] 0 d "); Color c = col; if (horz) { @@ -204,7 +211,6 @@ public class PDFBorderPainter extends BorderPainter { + format(xm1) + " " + format(y2) + " l S\n"); } break; - } case Constants.EN_HIDDEN: break; default: diff --git a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java index fb5fc4e8d..074faa5d3 100644 --- a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java +++ b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java @@ -115,7 +115,7 @@ public class PDFContentGenerator { } /** - * Returns the {@link PDFState} associated with this instance. + * Returns the {@link PDFPaintingState} associated with this instance. * @return the PDF state */ public PDFPaintingState getState() { @@ -148,14 +148,18 @@ public class PDFContentGenerator { } } - /** {@inheritDoc} */ + /** Save graphics state. */ protected void saveGraphicsState() { endTextObject(); currentState.save(); currentStream.add("q\n"); } - /** {@inheritDoc} */ + /** + * Save graphics state. + * @param structElemType an element type + * @param sequenceNum a sequence number + */ protected void saveGraphicsState(String structElemType, int sequenceNum) { endTextObject(); currentState.save(); diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java b/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java index bc2f16f45..c7210344d 100644 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java @@ -51,6 +51,7 @@ import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator; import org.apache.fop.render.intermediate.IFDocumentNavigationHandler; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFPainter; +import org.apache.fop.render.pdf.extensions.PDFEmbeddedFileExtensionAttachment; import org.apache.fop.util.XMLUtil; /** @@ -292,6 +293,14 @@ public class PDFDocumentHandler extends AbstractBinaryWritingIFDocumentHandler { } else if (extension instanceof Metadata) { XMPMetadata wrapper = new XMPMetadata(((Metadata)extension)); pdfUtil.renderXMPMetadata(wrapper); + } else if (extension instanceof PDFEmbeddedFileExtensionAttachment) { + PDFEmbeddedFileExtensionAttachment embeddedFile + = (PDFEmbeddedFileExtensionAttachment)extension; + try { + pdfUtil.addEmbeddedFile(embeddedFile); + } catch (IOException ioe) { + throw new IFException("Error adding embedded file: " + embeddedFile.getSrc(), ioe); + } } else { log.debug("Don't know how to handle extension object. Ignoring: " + extension + " (" + extension.getClass().getName() + ")"); diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java b/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java index 5e1b1b250..c215243a7 100644 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java @@ -166,10 +166,11 @@ public class PDFDocumentNavigationHandler implements IFDocumentNavigationHandler } else if (action instanceof URIAction) { URIAction u = (URIAction)action; assert u.isComplete(); + String uri = u.getURI(); PDFFactory factory = getPDFDoc().getFactory(); - pdfAction = factory.getExternalAction(u.getURI(), u.isNewWindow()); + pdfAction = factory.getExternalAction(uri, u.isNewWindow()); if (!pdfAction.hasObjectNumber()) { - //Some PDF actions a pooled + //Some PDF actions are pooled getPDFDoc().registerObject(pdfAction); } this.completeActions.put(action.getID(), pdfAction); diff --git a/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java b/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java deleted file mode 100644 index 102c1ab45..000000000 --- a/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java +++ /dev/null @@ -1,132 +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.render.pdf; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.RenderingHints; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; -import java.io.IOException; - -import org.apache.xmlgraphics.java2d.Graphics2DImagePainter; - -import org.apache.fop.render.AbstractGraphics2DAdapter; -import org.apache.fop.render.RendererContext; -import org.apache.fop.render.RendererContext.RendererContextWrapper; -import org.apache.fop.svg.PDFGraphics2D; - -/** - * Graphics2DAdapter implementation for PDF. - */ -public class PDFGraphics2DAdapter extends AbstractGraphics2DAdapter { - - private PDFRenderer renderer; - - /** - * Main constructor - * @param renderer the Renderer instance to which this instance belongs - */ - public PDFGraphics2DAdapter(PDFRenderer renderer) { - this.renderer = renderer; - } - - /** {@inheritDoc} */ - public void paintImage(Graphics2DImagePainter painter, - RendererContext context, - int x, int y, int width, int height) throws IOException { - - PDFContentGenerator generator = renderer.getGenerator(); - PDFSVGHandler.PDFInfo pdfInfo = PDFSVGHandler.getPDFInfo(context); - float fwidth = width / 1000f; - float fheight = height / 1000f; - float fx = x / 1000f; - float fy = y / 1000f; - - // get the 'width' and 'height' attributes of the SVG document - Dimension dim = painter.getImageSize(); - float imw = (float)dim.getWidth() / 1000f; - float imh = (float)dim.getHeight() / 1000f; - - float sx = pdfInfo.paintAsBitmap ? 1.0f : (fwidth / (float)imw); - float sy = pdfInfo.paintAsBitmap ? 1.0f : (fheight / (float)imh); - - generator.comment("G2D start"); - generator.saveGraphicsState(); - generator.updateColor(Color.black, false, null); - generator.updateColor(Color.black, true, null); - - //TODO Clip to the image area. - - // transform so that the coordinates (0,0) is from the top left - // and positive is down and to the right. (0,0) is where the - // viewBox puts it. - generator.add(sx + " 0 0 " + sy + " " + fx + " " - + fy + " cm\n"); - - - final boolean textAsShapes = false; - if (pdfInfo.pdfContext == null) { - pdfInfo.pdfContext = pdfInfo.pdfPage; - } - PDFGraphics2D graphics = new PDFGraphics2D(textAsShapes, - pdfInfo.fi, pdfInfo.pdfDoc, - pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(), - pdfInfo.currentFontName, - pdfInfo.currentFontSize); - graphics.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext()); - - AffineTransform transform = new AffineTransform(); - transform.translate(fx, fy); - generator.getState().concatenate(transform); - graphics.setPaintingState(generator.getState()); - graphics.setOutputStream(pdfInfo.outputStream); - - if (pdfInfo.paintAsBitmap) { - //Fallback solution: Paint to a BufferedImage - int resolution = (int)Math.round(context.getUserAgent().getTargetResolution()); - RendererContextWrapper ctx = RendererContext.wrapRendererContext(context); - BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false); - - float scale = PDFRenderer.NORMAL_PDF_RESOLUTION - / context.getUserAgent().getTargetResolution(); - graphics.drawImage(bi, new AffineTransform(scale, 0, 0, scale, 0, 0), null); - } else { - Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh); - painter.paint(graphics, area); - } - - generator.add(graphics.getString()); - generator.restoreGraphicsState(); - generator.comment("G2D end"); - } - - /** {@inheritDoc} */ - protected void setRenderingHintsForBufferedImage(Graphics2D g2d) { - super.setRenderingHintsForBufferedImage(g2d); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - } - -} diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandler.java b/src/java/org/apache/fop/render/pdf/PDFImageHandler.java deleted file mode 100644 index 934d306b9..000000000 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandler.java +++ /dev/null @@ -1,52 +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.render.pdf; - -import java.awt.Point; -import java.awt.Rectangle; -import java.io.IOException; - -import org.apache.xmlgraphics.image.loader.Image; - -import org.apache.fop.pdf.PDFXObject; -import org.apache.fop.render.ImageHandlerBase; -import org.apache.fop.render.RendererContext; - -/** - * This interface is used for handling all sorts of image type for PDF output. - */ -public interface PDFImageHandler extends ImageHandlerBase { - - /** - * Generates the PDF objects for the given {@link Image} instance. If the handler generates - * an XObject, it shall return it or otherwise return null. A generated XObject shall be - * placed in the current viewport according to the two parameters "origin" and "pos". - * @param context the PDF renderer context - * @param image the image to be handled - * @param origin the current position in the current viewport (in millipoints) - * @param pos the position and scaling of the image relative to the origin point - * (in millipoints) - * @return the generated XObject or null if no XObject was generated - * @throws IOException if an I/O error occurs - */ - PDFXObject generateImage(RendererContext context, Image image, - Point origin, Rectangle pos) throws IOException; - -} diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java index c3242827a..d309a00aa 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java +++ b/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java @@ -21,7 +21,6 @@ package org.apache.fop.render.pdf; import java.awt.Color; import java.awt.Dimension; -import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; @@ -31,9 +30,7 @@ import org.apache.xmlgraphics.image.loader.Image; import org.apache.xmlgraphics.image.loader.ImageFlavor; import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D; -import org.apache.fop.pdf.PDFXObject; import org.apache.fop.render.AbstractImageHandlerGraphics2D; -import org.apache.fop.render.RendererContext; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo; import org.apache.fop.svg.PDFGraphics2D; @@ -41,37 +38,13 @@ import org.apache.fop.svg.PDFGraphics2D; /** * PDFImageHandler implementation which handles Graphics2D images. */ -public class PDFImageHandlerGraphics2D extends AbstractImageHandlerGraphics2D - implements PDFImageHandler { +public class PDFImageHandlerGraphics2D extends AbstractImageHandlerGraphics2D { private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { ImageFlavor.GRAPHICS2D, }; /** {@inheritDoc} */ - public PDFXObject generateImage(RendererContext context, Image image, - Point origin, Rectangle pos) - throws IOException { - PDFRenderer renderer = (PDFRenderer)context.getRenderer(); - /* - ImageGraphics2D imageG2D = (ImageGraphics2D)image; - renderer.getGraphics2DAdapter().paintImage(imageG2D.getGraphics2DImagePainter(), - context, origin.x + pos.x, origin.y + pos.y, pos.width, pos.height); - */ - PDFRenderingContext pdfContext = new PDFRenderingContext( - context.getUserAgent(), - renderer.getGenerator(), - renderer.currentPage, - renderer.getFontInfo()); - Rectangle effPos = new Rectangle(origin.x + pos.x, origin.y + pos.y, pos.width, pos.height); - if (context.getUserAgent().isAccessibilityEnabled()) { - pdfContext.setMarkedContentInfo(renderer.addCurrentImageToStructureTree()); - } - handleImage(pdfContext, image, effPos); - return null; - } - - /** {@inheritDoc} */ public void handleImage(RenderingContext context, Image image, Rectangle pos) throws IOException { PDFRenderingContext pdfContext = (PDFRenderingContext)context; diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java index 75b1d356e..b7d47ad58 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java +++ b/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java @@ -19,7 +19,6 @@ package org.apache.fop.render.pdf; -import java.awt.Point; import java.awt.Rectangle; import java.io.IOException; @@ -27,48 +26,22 @@ import org.apache.xmlgraphics.image.loader.Image; import org.apache.xmlgraphics.image.loader.ImageFlavor; import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax; -import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFImage; -import org.apache.fop.pdf.PDFResourceContext; import org.apache.fop.pdf.PDFXObject; import org.apache.fop.render.ImageHandler; -import org.apache.fop.render.RendererContext; import org.apache.fop.render.RenderingContext; /** * Image handler implementation which handles CCITT encoded images (CCITT fax group 3/4) * for PDF output. */ -public class PDFImageHandlerRawCCITTFax implements PDFImageHandler, ImageHandler { +public class PDFImageHandlerRawCCITTFax implements ImageHandler { private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { ImageFlavor.RAW_CCITTFAX, }; /** {@inheritDoc} */ - public PDFXObject generateImage(RendererContext context, Image image, - Point origin, Rectangle pos) - throws IOException { - PDFRenderer renderer = (PDFRenderer)context.getRenderer(); - ImageRawCCITTFax ccitt = (ImageRawCCITTFax)image; - PDFDocument pdfDoc = (PDFDocument)context.getProperty( - PDFRendererContextConstants.PDF_DOCUMENT); - PDFResourceContext resContext = (PDFResourceContext)context.getProperty( - PDFRendererContextConstants.PDF_CONTEXT); - - PDFImage pdfimage = new ImageRawCCITTFaxAdapter(ccitt, image.getInfo().getOriginalURI()); - PDFXObject xobj = pdfDoc.addImage(resContext, pdfimage); - - float x = (float)pos.getX() / 1000f; - float y = (float)pos.getY() / 1000f; - float w = (float)pos.getWidth() / 1000f; - float h = (float)pos.getHeight() / 1000f; - renderer.placeImage(x, y, w, h, xobj); - - return xobj; - } - - /** {@inheritDoc} */ public void handleImage(RenderingContext context, Image image, Rectangle pos) throws IOException { PDFRenderingContext pdfContext = (PDFRenderingContext)context; diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java index 02dd98ecf..7ac181014 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java +++ b/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java @@ -19,7 +19,6 @@ package org.apache.fop.render.pdf; -import java.awt.Point; import java.awt.Rectangle; import java.io.IOException; @@ -27,48 +26,22 @@ import org.apache.xmlgraphics.image.loader.Image; import org.apache.xmlgraphics.image.loader.ImageFlavor; import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG; -import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFImage; -import org.apache.fop.pdf.PDFResourceContext; import org.apache.fop.pdf.PDFXObject; import org.apache.fop.render.ImageHandler; -import org.apache.fop.render.RendererContext; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo; /** * Image handler implementation which handles raw JPEG images for PDF output. */ -public class PDFImageHandlerRawJPEG implements PDFImageHandler, ImageHandler { +public class PDFImageHandlerRawJPEG implements ImageHandler { private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { ImageFlavor.RAW_JPEG, }; /** {@inheritDoc} */ - public PDFXObject generateImage(RendererContext context, Image image, - Point origin, Rectangle pos) - throws IOException { - PDFRenderer renderer = (PDFRenderer)context.getRenderer(); - ImageRawJPEG jpeg = (ImageRawJPEG)image; - PDFDocument pdfDoc = (PDFDocument)context.getProperty( - PDFRendererContextConstants.PDF_DOCUMENT); - PDFResourceContext resContext = (PDFResourceContext)context.getProperty( - PDFRendererContextConstants.PDF_CONTEXT); - - PDFImage pdfimage = new ImageRawJPEGAdapter(jpeg, image.getInfo().getOriginalURI()); - PDFXObject xobj = pdfDoc.addImage(resContext, pdfimage); - - float x = (float)pos.getX() / 1000f; - float y = (float)pos.getY() / 1000f; - float w = (float)pos.getWidth() / 1000f; - float h = (float)pos.getHeight() / 1000f; - renderer.placeImage(x, y, w, h, xobj); - - return xobj; - } - - /** {@inheritDoc} */ public void handleImage(RenderingContext context, Image image, Rectangle pos) throws IOException { PDFRenderingContext pdfContext = (PDFRenderingContext)context; diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java index 3c02cb6f3..e0ff3cdd4 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java +++ b/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java @@ -19,7 +19,6 @@ package org.apache.fop.render.pdf; -import java.awt.Point; import java.awt.Rectangle; import java.io.IOException; @@ -27,19 +26,16 @@ import org.apache.xmlgraphics.image.loader.Image; import org.apache.xmlgraphics.image.loader.ImageFlavor; import org.apache.xmlgraphics.image.loader.impl.ImageRendered; -import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFImage; -import org.apache.fop.pdf.PDFResourceContext; import org.apache.fop.pdf.PDFXObject; import org.apache.fop.render.ImageHandler; -import org.apache.fop.render.RendererContext; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo; /** * Image handler implementation which handles RenderedImage instances for PDF output. */ -public class PDFImageHandlerRenderedImage implements PDFImageHandler, ImageHandler { +public class PDFImageHandlerRenderedImage implements ImageHandler { private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { ImageFlavor.BUFFERED_IMAGE, @@ -47,29 +43,6 @@ public class PDFImageHandlerRenderedImage implements PDFImageHandler, ImageHandl }; /** {@inheritDoc} */ - public PDFXObject generateImage(RendererContext context, Image image, - Point origin, Rectangle pos) - throws IOException { - PDFRenderer renderer = (PDFRenderer)context.getRenderer(); - ImageRendered imageRend = (ImageRendered)image; - PDFDocument pdfDoc = (PDFDocument)context.getProperty( - PDFRendererContextConstants.PDF_DOCUMENT); - PDFResourceContext resContext = (PDFResourceContext)context.getProperty( - PDFRendererContextConstants.PDF_CONTEXT); - - PDFImage pdfimage = new ImageRenderedAdapter(imageRend, image.getInfo().getOriginalURI()); - PDFXObject xobj = pdfDoc.addImage(resContext, pdfimage); - - float x = (float)pos.getX() / 1000f; - float y = (float)pos.getY() / 1000f; - float w = (float)pos.getWidth() / 1000f; - float h = (float)pos.getHeight() / 1000f; - renderer.placeImage(x, y, w, h, xobj); - - return xobj; - } - - /** {@inheritDoc} */ public void handleImage(RenderingContext context, Image image, Rectangle pos) throws IOException { PDFRenderingContext pdfContext = (PDFRenderingContext)context; diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java index e6d2c8a71..99233abb6 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java +++ b/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java @@ -71,11 +71,6 @@ public class PDFImageHandlerSVG implements ImageHandler { final float uaResolution = userAgent.getSourceResolution(); SVGUserAgent ua = new SVGUserAgent(userAgent, new AffineTransform()); - //Scale for higher resolution on-the-fly images from Batik - double s = uaResolution / deviceResolution; - AffineTransform resolutionScaling = new AffineTransform(); - resolutionScaling.scale(s, s); - GVTBuilder builder = new GVTBuilder(); //Controls whether text painted by Batik is generated using text or path operations @@ -99,8 +94,8 @@ public class PDFImageHandlerSVG implements ImageHandler { return; } // get the 'width' and 'height' attributes of the SVG document - float w = (float)ctx.getDocumentSize().getWidth() * 1000f; - float h = (float)ctx.getDocumentSize().getHeight() * 1000f; + float w = image.getSize().getWidthMpt(); + float h = image.getSize().getHeightMpt(); float sx = pos.width / w; float sy = pos.height / h; @@ -109,6 +104,12 @@ public class PDFImageHandlerSVG implements ImageHandler { AffineTransform scaling = new AffineTransform( sx, 0, 0, sy, pos.x / 1000f, pos.y / 1000f); + //Scale for higher resolution on-the-fly images from Batik + double s = uaResolution / deviceResolution; + AffineTransform resolutionScaling = new AffineTransform(); + resolutionScaling.scale(s, s); + resolutionScaling.scale(1.0 / sx, 1.0 / sy); + //Transformation matrix that establishes the local coordinate system for the SVG graphic //in relation to the current coordinate system AffineTransform imageTransform = new AffineTransform(); @@ -147,7 +148,9 @@ public class PDFImageHandlerSVG implements ImageHandler { + " -> " + deviceResolution + "\n"); generator.add( CTMHelper.toPDFString(resolutionScaling, false) + " cm\n"); - graphics.scale(1 / s, 1 / s); + graphics.scale( + 1.0 / resolutionScaling.getScaleX(), + 1.0 / resolutionScaling.getScaleY()); } generator.comment("SVG start"); diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerXML.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerXML.java deleted file mode 100644 index 26ba83371..000000000 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerXML.java +++ /dev/null @@ -1,72 +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.render.pdf; - -import java.awt.Point; -import java.awt.Rectangle; -import java.io.IOException; -import java.util.Map; - -import org.apache.fop.pdf.PDFXObject; -import org.apache.fop.render.RendererContext; -import org.apache.xmlgraphics.image.loader.Image; -import org.apache.xmlgraphics.image.loader.ImageFlavor; -import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM; -import org.w3c.dom.Document; - -/** - * PDFImageHandler implementation which handles XML-based images. - */ -public class PDFImageHandlerXML implements PDFImageHandler { - - private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { - ImageFlavor.XML_DOM, - }; - - /** {@inheritDoc} */ - public PDFXObject generateImage(RendererContext context, Image image, - Point origin, Rectangle pos) - throws IOException { - PDFRenderer renderer = (PDFRenderer)context.getRenderer(); - ImageXMLDOM imgXML = (ImageXMLDOM)image; - Document doc = imgXML.getDocument(); - String ns = imgXML.getRootNamespace(); - Map foreignAttributes = (Map)context.getProperty( - PDFRendererContextConstants.FOREIGN_ATTRIBUTES); - renderer.renderDocument(doc, ns, pos, foreignAttributes); - return null; - } - - /** {@inheritDoc} */ - public int getPriority() { - return 400; - } - - /** {@inheritDoc} */ - public Class getSupportedImageClass() { - return ImageXMLDOM.class; - } - - /** {@inheritDoc} */ - public ImageFlavor[] getSupportedImageFlavors() { - return FLAVORS; - } - -} diff --git a/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java b/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java index 42b873270..ba9584597 100644 --- a/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java @@ -87,12 +87,12 @@ class PDFLogicalStructureHandler { * operator. This is the structure type of the corresponding structure * element. */ - final String tag; + final String tag; // CSOK: VisibilityModifier /** * The value for the MCID entry of the marked-content sequence's property list. */ - final int mcid; + final int mcid; // CSOK: VisibilityModifier private final PDFStructElem parent; diff --git a/src/java/org/apache/fop/render/pdf/PDFPainter.java b/src/java/org/apache/fop/render/pdf/PDFPainter.java index f72f09ad0..161b46617 100644 --- a/src/java/org/apache/fop/render/pdf/PDFPainter.java +++ b/src/java/org/apache/fop/render/pdf/PDFPainter.java @@ -162,10 +162,7 @@ public class PDFPainter extends AbstractIFPainter { /** * Places a previously registered image at a certain place on the page. - * @param x X coordinate - * @param y Y coordinate - * @param w width for image - * @param h height for image + * @param rect the rectangle for the image * @param xobj the image XObject */ private void placeImage(Rectangle rect, PDFXObject xobj) { @@ -179,10 +176,7 @@ public class PDFPainter extends AbstractIFPainter { } /** * Places a previously registered image at a certain place on the page - Accessibility version - * @param x X coordinate - * @param y Y coordinate - * @param w width for image - * @param h height for image + * @param rect the rectangle for the image * @param xobj the image XObject */ private void placeImageAccess(Rectangle rect, PDFXObject xobj) { diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java deleted file mode 100644 index aab84807c..000000000 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ /dev/null @@ -1,1352 +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.render.pdf; - -// Java -import java.awt.Color; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.geom.AffineTransform; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import org.apache.xmlgraphics.image.loader.ImageException; -import org.apache.xmlgraphics.image.loader.ImageFlavor; -import org.apache.xmlgraphics.image.loader.ImageInfo; -import org.apache.xmlgraphics.image.loader.ImageManager; -import org.apache.xmlgraphics.image.loader.ImageSessionContext; -import org.apache.xmlgraphics.image.loader.util.ImageUtil; - -import org.apache.fop.ResourceEventProducer; -import org.apache.fop.apps.FOPException; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.area.Area; -import org.apache.fop.area.Block; -import org.apache.fop.area.BookmarkData; -import org.apache.fop.area.CTM; -import org.apache.fop.area.DestinationData; -import org.apache.fop.area.LineArea; -import org.apache.fop.area.OffDocumentExtensionAttachment; -import org.apache.fop.area.OffDocumentItem; -import org.apache.fop.area.PageSequence; -import org.apache.fop.area.PageViewport; -import org.apache.fop.area.Trait; -import org.apache.fop.area.inline.AbstractTextArea; -import org.apache.fop.area.inline.Image; -import org.apache.fop.area.inline.InlineArea; -import org.apache.fop.area.inline.InlineParent; -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.Viewport; -import org.apache.fop.area.inline.WordArea; -import org.apache.fop.datatypes.URISpecification; -import org.apache.fop.fo.extensions.ExtensionAttachment; -import org.apache.fop.fo.extensions.xmp.XMPMetadata; -import org.apache.fop.fonts.Font; -import org.apache.fop.fonts.LazyFont; -import org.apache.fop.fonts.SingleByteFont; -import org.apache.fop.fonts.Typeface; -import org.apache.fop.pdf.PDFAMode; -import org.apache.fop.pdf.PDFAction; -import org.apache.fop.pdf.PDFAnnotList; -import org.apache.fop.pdf.PDFDocument; -import org.apache.fop.pdf.PDFEncryptionParams; -import org.apache.fop.pdf.PDFFactory; -import org.apache.fop.pdf.PDFGoTo; -import org.apache.fop.pdf.PDFInfo; -import org.apache.fop.pdf.PDFLink; -import org.apache.fop.pdf.PDFNumber; -import org.apache.fop.pdf.PDFOutline; -import org.apache.fop.pdf.PDFPage; -import org.apache.fop.pdf.PDFPaintingState; -import org.apache.fop.pdf.PDFResourceContext; -import org.apache.fop.pdf.PDFResources; -import org.apache.fop.pdf.PDFTextUtil; -import org.apache.fop.pdf.PDFXMode; -import org.apache.fop.pdf.PDFXObject; -import org.apache.fop.render.AbstractPathOrientedRenderer; -import org.apache.fop.render.Graphics2DAdapter; -import org.apache.fop.render.RendererContext; -import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo; -import org.apache.fop.traits.RuleStyle; -import org.apache.fop.util.AbstractPaintingState; -import org.apache.fop.util.CharUtilities; -import org.apache.fop.util.XMLUtil; -import org.apache.fop.util.AbstractPaintingState.AbstractData; - -/** - * Renderer that renders areas to PDF. - */ -public class PDFRenderer extends AbstractPathOrientedRenderer implements PDFConfigurationConstants { - - /** The MIME type for PDF */ - public static final String MIME_TYPE = MimeConstants.MIME_PDF; - - /** Normal PDF resolution (72dpi) */ - public static final int NORMAL_PDF_RESOLUTION = 72; - - - /** Controls whether comments are written to the PDF stream. */ - protected static final boolean WRITE_COMMENTS = true; - - /** - * the PDF Document being created - */ - protected PDFDocument pdfDoc; - - /** - * Utility class which enables all sorts of features that are not directly connected to the - * normal rendering process. - */ - protected PDFRenderingUtil pdfUtil; - - /** - * Map of pages using the PageViewport as the key - * this is used for prepared pages that cannot be immediately - * rendered - */ - private Map pages; - - /** - * Maps unique PageViewport key to PDF page reference - */ - protected Map pageReferences = new java.util.HashMap(); - - /** - * Maps unique PageViewport key back to PageViewport itself - */ - //protected Map pvReferences = new java.util.HashMap(); - - /** - * Maps XSL-FO element IDs to their on-page XY-positions - * Must be used in conjunction with the page reference to fully specify the PDFGoTo details - */ - protected Map idPositions = new java.util.HashMap(); - - /** - * Maps XSL-FO element IDs to PDFGoTo objects targeting the corresponding areas - * These objects may not all be fully filled in yet - */ - protected Map idGoTos = new java.util.HashMap(); - - /** - * The PDFGoTos in idGoTos that are not complete yet - */ - protected List unfinishedGoTos = new java.util.ArrayList(); - // can't use a Set because PDFGoTo.equals returns true if the target is the same, - // even if the object number differs - - /** - * The output stream to write the document to - */ - protected OutputStream ostream; - - /** - * the /Resources object of the PDF document being created - */ - protected PDFResources pdfResources; - - /** The current content generator to produce PDF commands with */ - protected PDFContentGenerator generator; - private PDFBorderPainter borderPainter; - - /** - * the current annotation list to add annotations to - */ - protected PDFResourceContext currentContext = null; - - /** - * the current page to add annotations to - */ - protected PDFPage currentPage; - - /** - * the current page's PDF reference string (to avoid numerous function calls) - */ - protected String currentPageRef; - - /** page height */ - protected int pageHeight; - - /** Image handler registry */ - private final PDFImageHandlerRegistry imageHandlerRegistry = new PDFImageHandlerRegistry(); - - private boolean accessEnabled; - - private PDFLogicalStructureHandler logicalStructureHandler; - - private int pageSequenceIndex; - - /** Reference in the structure tree to the image being rendered. */ - private String imageReference; - - /** - * create the PDF renderer - */ - public PDFRenderer() { - } - - /** {@inheritDoc} */ - public void setUserAgent(FOUserAgent agent) { - super.setUserAgent(agent); - this.pdfUtil = new PDFRenderingUtil(getUserAgent()); - accessEnabled = agent.isAccessibilityEnabled(); - } - - PDFRenderingUtil getPDFUtil() { - return this.pdfUtil; - } - - PDFContentGenerator getGenerator() { - return this.generator; - } - - PDFPaintingState getState() { - return getGenerator().getState(); - } - - /** {@inheritDoc} */ - public void startRenderer(OutputStream stream) throws IOException { - if (userAgent == null) { - throw new IllegalStateException("UserAgent must be set before starting the renderer"); - } - ostream = stream; - this.pdfDoc = pdfUtil.setupPDFDocument(stream); - if (accessEnabled) { - pdfDoc.getRoot().makeTagged(); - logicalStructureHandler = new PDFLogicalStructureHandler(pdfDoc, - userAgent.getEventBroadcaster()); - } - } - - /** - * Checks if there are any unfinished PDFGoTos left in the list and resolves them - * to a default position on the page. Logs a warning, as this should not happen. - */ - protected void finishOpenGoTos() { - int count = unfinishedGoTos.size(); - if (count > 0) { - // TODO : page height may not be the same for all targeted pages - Point2D.Float defaultPos = new Point2D.Float(0f, pageHeight / 1000f); // top-o-page - while (!unfinishedGoTos.isEmpty()) { - PDFGoTo gt = (PDFGoTo) unfinishedGoTos.get(0); - finishIDGoTo(gt, defaultPos); - } - PDFEventProducer eventProducer = PDFEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.nonFullyResolvedLinkTargets(this, count); - // dysfunctional if pageref is null - } - } - - /** {@inheritDoc} */ - public void stopRenderer() throws IOException { - finishOpenGoTos(); - - pdfDoc.getResources().addFonts(pdfDoc, fontInfo); - pdfDoc.outputTrailer(ostream); - - this.pdfDoc = null; - ostream = null; - - pages = null; - - pageReferences.clear(); - //pvReferences.clear(); - pdfResources = null; - this.generator = null; - currentContext = null; - currentPage = null; - - idPositions.clear(); - idGoTos.clear(); - } - - /** - * {@inheritDoc} - */ - public boolean supportsOutOfOrder() { - return !accessEnabled; - } - - /** - * {@inheritDoc} - */ - public void processOffDocumentItem(OffDocumentItem odi) { - if (odi instanceof DestinationData) { - // render Destinations - renderDestination((DestinationData) odi); - } else if (odi instanceof BookmarkData) { - // render Bookmark-Tree - renderBookmarkTree((BookmarkData) odi); - } else if (odi instanceof OffDocumentExtensionAttachment) { - ExtensionAttachment attachment = ((OffDocumentExtensionAttachment)odi).getAttachment(); - if (XMPMetadata.CATEGORY.equals(attachment.getCategory())) { - pdfUtil.renderXMPMetadata((XMPMetadata)attachment); - } - } - } - - private void renderDestination(DestinationData dd) { - String targetID = dd.getIDRef(); - if (targetID == null || targetID.length() == 0) { - throw new IllegalArgumentException("DestinationData must contain a ID reference"); - } - PageViewport pv = dd.getPageViewport(); - if (pv != null) { - PDFGoTo gt = getPDFGoToForID(targetID, pv.getKey()); - pdfDoc.getFactory().makeDestination( - dd.getIDRef(), gt.makeReference()); - } else { - //Warning already issued by AreaTreeHandler (debug level is sufficient) - log.debug("Unresolved destination item received: " + dd.getIDRef()); - } - } - - /** - * Renders a Bookmark-Tree object - * @param bookmarks the BookmarkData object containing all the Bookmark-Items - */ - protected void renderBookmarkTree(BookmarkData bookmarks) { - for (int i = 0; i < bookmarks.getCount(); i++) { - BookmarkData ext = bookmarks.getSubData(i); - renderBookmarkItem(ext, null); - } - } - - private void renderBookmarkItem(BookmarkData bookmarkItem, - PDFOutline parentBookmarkItem) { - PDFOutline pdfOutline = null; - - String targetID = bookmarkItem.getIDRef(); - if (targetID == null || targetID.length() == 0) { - throw new IllegalArgumentException("DestinationData must contain a ID reference"); - } - PageViewport pv = bookmarkItem.getPageViewport(); - if (pv != null) { - String pvKey = pv.getKey(); - PDFGoTo gt = getPDFGoToForID(targetID, pvKey); - // create outline object: - PDFOutline parent = parentBookmarkItem != null - ? parentBookmarkItem - : pdfDoc.getOutlineRoot(); - pdfOutline = pdfDoc.getFactory().makeOutline(parent, - bookmarkItem.getBookmarkTitle(), gt, bookmarkItem.showChildItems()); - } else { - //Warning already issued by AreaTreeHandler (debug level is sufficient) - log.debug("Bookmark with IDRef \"" + targetID + "\" has a null PageViewport."); - } - - for (int i = 0; i < bookmarkItem.getCount(); i++) { - renderBookmarkItem(bookmarkItem.getSubData(i), pdfOutline); - } - } - - /** {@inheritDoc} */ - public Graphics2DAdapter getGraphics2DAdapter() { - return new PDFGraphics2DAdapter(this); - } - - /** {@inheritDoc} */ - protected void saveGraphicsState() { - generator.saveGraphicsState(); - } - - /** {@inheritDoc} */ - protected void restoreGraphicsState() { - generator.restoreGraphicsState(); - } - - /** Indicates the beginning of a text object. */ - protected void beginTextObject() { - generator.beginTextObject(); - } - - /** Indicates the end of a text object. */ - protected void endTextObject() { - generator.endTextObject(); - } - - /** - * Start the next page sequence. - * For the PDF renderer there is no concept of page sequences - * but it uses the first available page sequence title to set - * as the title of the PDF document, and the language of the - * document. - * @param pageSequence the page sequence - */ - public void startPageSequence(PageSequence pageSequence) { - super.startPageSequence(pageSequence); - LineArea seqTitle = pageSequence.getTitle(); - if (seqTitle != null) { - String str = convertTitleToString(seqTitle); - PDFInfo info = this.pdfDoc.getInfo(); - if (info.getTitle() == null) { - info.setTitle(str); - } - } - Locale language = null; - if (pageSequence.getLanguage() != null) { - String lang = pageSequence.getLanguage(); - String country = pageSequence.getCountry(); - if (lang != null) { - language = (country == null) ? new Locale(lang) : new Locale(lang, country); - } - if (pdfDoc.getRoot().getLanguage() == null) { - //Only set if not set already (first non-null is used) - //Note: No checking is performed whether the values are valid! - pdfDoc.getRoot().setLanguage(XMLUtil.toRFC3066(language)); - } - } - pdfUtil.generateDefaultXMPMetadata(); - if (accessEnabled) { - NodeList nodes = getUserAgent().getStructureTree().getPageSequence(pageSequenceIndex++); - logicalStructureHandler.processStructureTree(nodes, language); - } - } - - /** - * The pdf page is prepared by making the page. - * The page is made in the pdf document without any contents - * and then stored to add the contents later. - * The page objects is stored using the area tree PageViewport - * as a key. - * - * @param page the page to prepare - */ - public void preparePage(PageViewport page) { - setupPage(page); - if (pages == null) { - pages = new java.util.HashMap(); - } - pages.put(page, currentPage); - } - - private void setupPage(PageViewport page) { - this.pdfResources = this.pdfDoc.getResources(); - - Rectangle2D bounds = page.getViewArea(); - double w = bounds.getWidth(); - double h = bounds.getHeight(); - this.currentPage = this.pdfDoc.getFactory().makePage( - this.pdfResources, - (int) Math.round(w / 1000), (int) Math.round(h / 1000), - page.getPageIndex()); - pageReferences.put(page.getKey(), currentPage.referencePDF()); - //pvReferences.put(page.getKey(), page); - - pdfUtil.generatePageLabel(page.getPageIndex(), page.getPageNumberString()); - } - - /** - * This method creates a PDF stream for the current page - * uses it as the contents of a new page. The page is written - * immediately to the output stream. - * {@inheritDoc} - */ - public void renderPage(PageViewport page) - throws IOException, FOPException { - if (pages != null - && (currentPage = (PDFPage) pages.get(page)) != null) { - //Retrieve previously prepared page (out-of-line rendering) - pages.remove(page); - } else { - setupPage(page); - } - currentPageRef = currentPage.referencePDF(); - - if (accessEnabled) { - logicalStructureHandler.startPage(currentPage); - } - - Rectangle bounds = page.getViewArea(); - pageHeight = bounds.height; - - this.generator = new PDFContentGenerator(this.pdfDoc, this.ostream, this.currentPage); - this.borderPainter = new PDFBorderPainter(this.generator); - - // Transform the PDF's default coordinate system (0,0 at lower left) to the PDFRenderer's - saveGraphicsState(); - AffineTransform basicPageTransform = new AffineTransform(1, 0, 0, -1, 0, - pageHeight / 1000f); - generator.concatenate(basicPageTransform); - - super.renderPage(page); - - restoreGraphicsState(); - if (accessEnabled) { - logicalStructureHandler.endPage(); - } - - this.pdfDoc.registerObject(generator.getStream()); - currentPage.setContents(generator.getStream()); - PDFAnnotList annots = currentPage.getAnnotations(); - if (annots != null) { - this.pdfDoc.addObject(annots); - } - this.pdfDoc.addObject(currentPage); - this.borderPainter = null; - this.generator.flushPDFDoc(); - this.generator = null; - } - - /** {@inheritDoc} */ - protected void startVParea(CTM ctm, Rectangle2D clippingRect) { - saveGraphicsState(); - // Set the given CTM in the graphics state - /* - currentState.concatenate( - new AffineTransform(CTMHelper.toPDFArray(ctm))); - */ - - if (clippingRect != null) { - clipRect((float)clippingRect.getX() / 1000f, - (float)clippingRect.getY() / 1000f, - (float)clippingRect.getWidth() / 1000f, - (float)clippingRect.getHeight() / 1000f); - } - // multiply with current CTM - generator.concatenate(new AffineTransform(CTMHelper.toPDFArray(ctm))); - } - - /** {@inheritDoc} */ - protected void endVParea() { - restoreGraphicsState(); - } - - /** {@inheritDoc} */ - protected void concatenateTransformationMatrix(AffineTransform at) { - generator.concatenate(at); - } - - /** - * Formats a float value (normally coordinates) as Strings. - * @param value the value - * @return the formatted value - */ - protected static String format(float value) { - return PDFNumber.doubleOut(value); - } - - /** {@inheritDoc} */ - protected void drawBorderLine(float x1, float y1, float x2, float y2, - boolean horz, boolean startOrBefore, int style, Color col) { - PDFBorderPainter.drawBorderLine(generator, x1, y1, x2, y2, horz, startOrBefore, style, col); - } - - /** {@inheritDoc} */ - protected void clipRect(float x, float y, float width, float height) { - generator.add(format(x) + " " + format(y) + " " - + format(width) + " " + format(height) + " re "); - clip(); - } - - /** - * Clip an area. - */ - protected void clip() { - generator.add("W\n" + "n\n"); - } - - /** - * Moves the current point to (x, y), omitting any connecting line segment. - * @param x x coordinate - * @param y y coordinate - */ - protected void moveTo(float x, float y) { - generator.add(format(x) + " " + format(y) + " m "); - } - - /** - * Appends a straight line segment from the current point to (x, y). The - * new current point is (x, y). - * @param x x coordinate - * @param y y coordinate - */ - protected void lineTo(float x, float y) { - generator.add(format(x) + " " + format(y) + " l "); - } - - /** - * Closes the current subpath by appending a straight line segment from - * the current point to the starting point of the subpath. - */ - protected void closePath() { - generator.add("h "); - } - - /** - * {@inheritDoc} - */ - protected void fillRect(float x, float y, float width, float height) { - if (width > 0 && height > 0) { - generator.add(format(x) + " " + format(y) + " " - + format(width) + " " + format(height) + " re f\n"); - } - } - - /** - * Draw a line. - * - * @param startx the start x position - * @param starty the start y position - * @param endx the x end position - * @param endy the y end position - */ - private void drawLine(float startx, float starty, float endx, float endy) { - generator.add(format(startx) + " " + format(starty) + " m "); - generator.add(format(endx) + " " + format(endy) + " l S\n"); - } - - /** - * Breaks out of the state stack to handle fixed block-containers. - * @return the saved state stack to recreate later - */ - protected List breakOutOfStateStack() { - PDFPaintingState paintingState = getState(); - List breakOutList = new java.util.ArrayList(); - AbstractPaintingState.AbstractData data; - while (true) { - data = paintingState.getData(); - if (paintingState.restore() == null) { - break; - } - if (breakOutList.size() == 0) { - generator.comment("------ break out!"); - } - breakOutList.add(0, data); //Insert because of stack-popping - generator.restoreGraphicsState(false); - } - return breakOutList; - } - - /** - * Restores the state stack after a break out. - * @param breakOutList the state stack to restore. - */ - protected void restoreStateStackAfterBreakOut(List breakOutList) { - generator.comment("------ restoring context after break-out..."); -// currentState.pushAll(breakOutList); - AbstractData data; - Iterator i = breakOutList.iterator(); - while (i.hasNext()) { - data = (AbstractData)i.next(); - saveGraphicsState(); - AffineTransform at = data.getTransform(); - concatenateTransformationMatrix(at); - //TODO Break-out: Also restore items such as line width and color - //Left out for now because all this painting stuff is very - //inconsistent. Some values go over PDFState, some don't. - } - generator.comment("------ done."); - } - - /** - * Returns area's id if it is the first area in the document with that id - * (i.e. if the area qualifies as a link target). - * Otherwise, or if the area has no id, null is returned. - * - * <i>NOTE</i>: area must be on currentPageViewport, otherwise result may be wrong! - * - * @param area the area for which to return the id - * @return the area's id (null if the area has no id or - * other preceding areas have the same id) - */ - protected String getTargetableID(Area area) { - String id = (String) area.getTrait(Trait.PROD_ID); - if (id == null || id.length() == 0 - || !currentPageViewport.isFirstWithID(id) - || idPositions.containsKey(id)) { - return null; - } else { - return id; - } - } - - /** - * Set XY position in the PDFGoTo and add it to the PDF trailer. - * - * @param gt the PDFGoTo object - * @param position the X,Y position to set - */ - protected void finishIDGoTo(PDFGoTo gt, Point2D.Float position) { - gt.setPosition(position); - pdfDoc.addTrailerObject(gt); - unfinishedGoTos.remove(gt); - } - - /** - * Set page reference and XY position in the PDFGoTo and add it to the PDF trailer. - * - * @param gt the PDFGoTo object - * @param pdfPageRef the PDF reference string of the target page object - * @param position the X,Y position to set - */ - protected void finishIDGoTo(PDFGoTo gt, String pdfPageRef, Point2D.Float position) { - gt.setPageReference(pdfPageRef); - finishIDGoTo(gt, position); - } - - /** - * Get a PDFGoTo pointing to the given id. Create one if necessary. - * It is possible that the PDFGoTo is not fully resolved yet. In that case - * it must be completed (and added to the PDF trailer) later. - * - * @param targetID the target id of the PDFGoTo - * @param pvKey the unique key of the target PageViewport - * - * @return the PDFGoTo that was found or created - */ - protected PDFGoTo getPDFGoToForID(String targetID, String pvKey) { - // Already a PDFGoTo present for this target? If not, create. - PDFGoTo gt = (PDFGoTo) idGoTos.get(targetID); - if (gt == null) { - String pdfPageRef = (String) pageReferences.get(pvKey); - Point2D.Float position = (Point2D.Float) idPositions.get(targetID); - // can the GoTo already be fully filled in? - if (pdfPageRef != null && position != null) { - // getPDFGoTo shares PDFGoTo objects as much as possible. - // It also takes care of assignObjectNumber and addTrailerObject. - gt = pdfDoc.getFactory().getPDFGoTo(pdfPageRef, position); - } else { - // Not complete yet, can't use getPDFGoTo: - gt = new PDFGoTo(pdfPageRef); - pdfDoc.assignObjectNumber(gt); - // pdfDoc.addTrailerObject() will be called later, from finishIDGoTo() - unfinishedGoTos.add(gt); - } - idGoTos.put(targetID, gt); - } - return gt; - } - - /** - * Saves id's absolute position on page for later retrieval by PDFGoTos - * - * @param id the id of the area whose position must be saved - * @param pdfPageRef the PDF page reference string - * @param relativeIPP the *relative* IP position in millipoints - * @param relativeBPP the *relative* BP position in millipoints - * @param tf the transformation to apply once the relative positions have been - * converted to points - */ - protected void saveAbsolutePosition(String id, String pdfPageRef, - int relativeIPP, int relativeBPP, AffineTransform tf) { - Point2D.Float position = new Point2D.Float(relativeIPP / 1000f, relativeBPP / 1000f); - tf.transform(position, position); - idPositions.put(id, position); - // is there already a PDFGoTo waiting to be completed? - PDFGoTo gt = (PDFGoTo) idGoTos.get(id); - if (gt != null) { - finishIDGoTo(gt, pdfPageRef, position); - } -/* - // The code below auto-creates a named destination for every id in the document. - // This should probably be controlled by a user-configurable setting, as it may - // make the PDF file grow noticeably. - // *** NOT YET WELL-TESTED ! *** - if (true) { - PDFFactory factory = pdfDoc.getFactory(); - if (gt == null) { - gt = factory.getPDFGoTo(pdfPageRef, position); - idGoTos.put(id, gt); // so others can pick it up too - } - factory.makeDestination(id, gt.referencePDF(), currentPageViewport); - // Note: using currentPageViewport is only correct if the id is indeed on - // the current PageViewport. But even if incorrect, it won't interfere with - // what gets created in the PDF. - // For speedup, we should also create a lookup map id -> PDFDestination - } -*/ - } - - /** - * Saves id's absolute position on page for later retrieval by PDFGoTos, - * using the currently valid transformation and the currently valid PDF page reference - * - * @param id the id of the area whose position must be saved - * @param relativeIPP the *relative* IP position in millipoints - * @param relativeBPP the *relative* BP position in millipoints - */ - protected void saveAbsolutePosition(String id, int relativeIPP, int relativeBPP) { - saveAbsolutePosition(id, currentPageRef, - relativeIPP, relativeBPP, getState().getTransform()); - } - - /** - * If the given block area is a possible link target, its id + absolute position will - * be saved. The saved position is only correct if this function is called at the very - * start of renderBlock! - * - * @param block the block area in question - */ - protected void saveBlockPosIfTargetable(Block block) { - String id = getTargetableID(block); - if (id != null) { - // FIXME: Like elsewhere in the renderer code, absolute and relative - // directions are happily mixed here. This makes sure that the - // links point to the right location, but it is not correct. - int ipp = block.getXOffset(); - int bpp = block.getYOffset() + block.getSpaceBefore(); - int positioning = block.getPositioning(); - if (!(positioning == Block.FIXED || positioning == Block.ABSOLUTE)) { - ipp += currentIPPosition; - bpp += currentBPPosition; - } - AffineTransform tf = positioning == Block.FIXED - ? getState().getBaseTransform() - : getState().getTransform(); - saveAbsolutePosition(id, currentPageRef, ipp, bpp, tf); - } - } - - /** - * If the given inline area is a possible link target, its id + absolute position will - * be saved. The saved position is only correct if this function is called at the very - * start of renderInlineArea! - * - * @param inlineArea the inline area in question - */ - protected void saveInlinePosIfTargetable(InlineArea inlineArea) { - String id = getTargetableID(inlineArea); - if (id != null) { - int extraMarginBefore = 5000; // millipoints - int ipp = currentIPPosition; - int bpp = currentBPPosition + inlineArea.getOffset() - extraMarginBefore; - saveAbsolutePosition(id, ipp, bpp); - } - } - - /** - * {@inheritDoc} - */ - protected void renderBlock(Block block) { - saveBlockPosIfTargetable(block); - super.renderBlock(block); - } - - /** {@inheritDoc} */ - protected void renderLineArea(LineArea line) { - super.renderLineArea(line); - } - - /** - * {@inheritDoc} - */ - protected void renderInlineArea(InlineArea inlineArea) { - saveInlinePosIfTargetable(inlineArea); - super.renderInlineArea(inlineArea); - } - - /** - * Render inline parent area. - * For pdf this handles the inline parent area traits such as - * links, border, background. - * @param ip the inline parent area - */ - public void renderInlineParent(InlineParent ip) { - - boolean annotsAllowed = pdfDoc.getProfile().isAnnotationAllowed(); - - // stuff we only need if a link must be created: - Rectangle2D ipRect = null; - PDFFactory factory = null; - PDFAction action = null; - if (annotsAllowed) { - // make sure the rect is determined *before* calling super! - int ipp = currentIPPosition; - int bpp = currentBPPosition + ip.getOffset(); - ipRect = new Rectangle2D.Float(ipp / 1000f, bpp / 1000f, - ip.getIPD() / 1000f, ip.getBPD() / 1000f); - AffineTransform transform = getState().getTransform(); - ipRect = transform.createTransformedShape(ipRect).getBounds2D(); - - factory = pdfDoc.getFactory(); - } - - // render contents - super.renderInlineParent(ip); - - boolean linkTraitFound = false; - - // try INTERNAL_LINK first - Trait.InternalLink intLink = (Trait.InternalLink) ip.getTrait(Trait.INTERNAL_LINK); - if (intLink != null) { - linkTraitFound = true; - String pvKey = intLink.getPVKey(); - String idRef = intLink.getIDRef(); - boolean pvKeyOK = pvKey != null && pvKey.length() > 0; - boolean idRefOK = idRef != null && idRef.length() > 0; - if (pvKeyOK && idRefOK) { - if (annotsAllowed) { - action = getPDFGoToForID(idRef, pvKey); - } - } else { - //Warnings already issued by AreaTreeHandler - } - } - - // no INTERNAL_LINK, look for EXTERNAL_LINK - if (!linkTraitFound) { - Trait.ExternalLink extLink = (Trait.ExternalLink) ip.getTrait(Trait.EXTERNAL_LINK); - if (extLink != null) { - String extDest = extLink.getDestination(); - if (extDest != null && extDest.length() > 0) { - linkTraitFound = true; - if (annotsAllowed) { - action = factory.getExternalAction(extDest, extLink.newWindow()); - } - } - } - } - - // warn if link trait found but not allowed, else create link - if (linkTraitFound) { - if (!annotsAllowed) { - log.warn("Skipping annotation for a link due to PDF profile: " - + pdfDoc.getProfile()); - } else if (action != null) { - PDFLink pdfLink = factory.makeLink(ipRect, action); - if (accessEnabled) { - String ptr = (String) ip.getTrait(Trait.PTR); - logicalStructureHandler.addLinkContentItem(pdfLink, ptr); - } - currentPage.addAnnotation(pdfLink); - } - } - } - - /** {@inheritDoc} */ - public void renderViewport(Viewport viewport) { - imageReference = (String) viewport.getTrait(Trait.PTR); - super.renderViewport(viewport); - imageReference = null; - } - - private Typeface getTypeface(String fontName) { - Typeface tf = (Typeface) fontInfo.getFonts().get(fontName); - if (tf instanceof LazyFont) { - tf = ((LazyFont)tf).getRealFont(); - } - return tf; - } - - /** {@inheritDoc} */ - public void renderText(TextArea text) { - renderInlineAreaBackAndBorders(text); - Color ct = (Color) text.getTrait(Trait.COLOR); - updateColor(ct, true); - - if (accessEnabled) { - String ptr = (String) text.getTrait(Trait.PTR); - MarkedContentInfo mci = logicalStructureHandler.addTextContentItem(ptr); - if (generator.getTextUtil().isInTextObject()) { - generator.separateTextElements(mci.tag, mci.mcid); - } - generator.beginTextObject(mci.tag, mci.mcid); - } else { - beginTextObject(); - } - - String fontName = getInternalFontNameForArea(text); - int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue(); - - // This assumes that *all* CIDFonts use a /ToUnicode mapping - Typeface tf = getTypeface(fontName); - - PDFTextUtil textutil = generator.getTextUtil(); - textutil.updateTf(fontName, size / 1000f, tf.isMultiByte()); - - - // word.getOffset() = only height of text itself - // currentBlockIPPosition: 0 for beginning of line; nonzero - // where previous line area failed to take up entire allocated space - int rx = currentIPPosition + text.getBorderAndPaddingWidthStart(); - int bl = currentBPPosition + text.getOffset() + text.getBaselineOffset(); - - textutil.writeTextMatrix(new AffineTransform(1, 0, 0, -1, rx / 1000f, bl / 1000f)); - - super.renderText(text); - - textutil.writeTJ(); - - renderTextDecoration(tf, size, text, bl, rx); - } - - /** {@inheritDoc} */ - public void renderWord(WordArea word) { - Font font = getFontFromArea(word.getParentArea()); - String s = word.getWord(); - - escapeText(s, word.getLetterAdjustArray(), - font, (AbstractTextArea)word.getParentArea()); - - super.renderWord(word); - } - - /** {@inheritDoc} */ - public void renderSpace(SpaceArea space) { - Font font = getFontFromArea(space.getParentArea()); - String s = space.getSpace(); - - AbstractTextArea textArea = (AbstractTextArea)space.getParentArea(); - escapeText(s, null, font, textArea); - - if (space.isAdjustable()) { - int tws = -((TextArea) space.getParentArea()).getTextWordSpaceAdjust() - - 2 * textArea.getTextLetterSpaceAdjust(); - - if (tws != 0) { - float adjust = tws / (font.getFontSize() / 1000f); - generator.getTextUtil().adjustGlyphTJ(adjust); - } - } - - super.renderSpace(space); - } - - /** - * Escapes text according to PDF rules. - * @param s Text to escape - * @param letterAdjust an array of widths for letter adjustment (may be null) - * @param font to font in use - * @param parentArea the parent text area to retrieve certain traits from - */ - protected void escapeText(String s, - int[] letterAdjust, - Font font, AbstractTextArea parentArea) { - escapeText(s, 0, s.length(), letterAdjust, font, parentArea); - } - - /** - * Escapes text according to PDF rules. - * @param s Text to escape - * @param start the start position in the text - * @param end the end position in the text - * @param letterAdjust an array of widths for letter adjustment (may be null) - * @param font to font in use - * @param parentArea the parent text area to retrieve certain traits from - */ - protected void escapeText(String s, int start, int end, - int[] letterAdjust, - Font font, AbstractTextArea parentArea) { - String fontName = font.getFontName(); - float fontSize = font.getFontSize() / 1000f; - Typeface tf = getTypeface(fontName); - SingleByteFont singleByteFont = null; - if (tf instanceof SingleByteFont) { - singleByteFont = (SingleByteFont)tf; - } - PDFTextUtil textutil = generator.getTextUtil(); - - int l = s.length(); - - for (int i = start; i < end; i++) { - char orgChar = s.charAt(i); - char ch; - float glyphAdjust = 0; - if (font.hasChar(orgChar)) { - ch = font.mapChar(orgChar); - if (singleByteFont != null && singleByteFont.hasAdditionalEncodings()) { - int encoding = ch / 256; - if (encoding == 0) { - textutil.updateTf(fontName, fontSize, tf.isMultiByte()); - } else { - textutil.updateTf(fontName + "_" + Integer.toString(encoding), - fontSize, tf.isMultiByte()); - ch = (char)(ch % 256); - } - } - int tls = (i < l - 1 ? parentArea.getTextLetterSpaceAdjust() : 0); - glyphAdjust -= tls; - } else { - if (CharUtilities.isFixedWidthSpace(orgChar)) { - //Fixed width space are rendered as spaces so copy/paste works in a reader - ch = font.mapChar(CharUtilities.SPACE); - glyphAdjust = font.getCharWidth(ch) - font.getCharWidth(orgChar); - } else { - ch = font.mapChar(orgChar); - } - } - if (letterAdjust != null && i < l - 1) { - glyphAdjust -= letterAdjust[i + 1]; - } - - textutil.writeTJMappedChar(ch); - - float adjust = glyphAdjust / fontSize; - - if (adjust != 0) { - textutil.adjustGlyphTJ(adjust); - } - - } - } - - /** {@inheritDoc} */ - protected void updateColor(Color col, boolean fill) { - generator.updateColor(col, fill, null); - } - - /** {@inheritDoc} */ - public void renderImage(Image image, Rectangle2D pos) { - endTextObject(); - String url = image.getURL(); - putImage(url, pos, image.getForeignAttributes()); - } - - /** {@inheritDoc} */ - protected void drawImage(String url, Rectangle2D pos, Map foreignAttributes) { - endTextObject(); - putImage(url, pos, foreignAttributes); - } - - /** - * Adds a PDF XObject (a bitmap or form) to the PDF that will later be referenced. - * @param uri URL of the bitmap - * @param pos Position of the bitmap - * @deprecated Use {@link #putImage(String, Rectangle2D, Map)} instead. - */ - protected void putImage(String uri, Rectangle2D pos) { - putImage(uri, pos, null); - } - - /** - * Adds a PDF XObject (a bitmap or form) to the PDF that will later be referenced. - * @param uri URL of the bitmap - * @param pos Position of the bitmap - * @param foreignAttributes foreign attributes associated with the image - */ - protected void putImage(String uri, Rectangle2D pos, Map foreignAttributes) { - Rectangle posInt = new Rectangle( - (int)pos.getX(), - (int)pos.getY(), - (int)pos.getWidth(), - (int)pos.getHeight()); - - uri = URISpecification.getURL(uri); - PDFXObject xobject = pdfDoc.getXObject(uri); - if (xobject != null) { - float w = (float) pos.getWidth() / 1000f; - float h = (float) pos.getHeight() / 1000f; - placeImage((float)pos.getX() / 1000f, - (float)pos.getY() / 1000f, w, h, xobject); - return; - } - Point origin = new Point(currentIPPosition, currentBPPosition); - int x = origin.x + posInt.x; - int y = origin.y + posInt.y; - - ImageManager manager = getUserAgent().getFactory().getImageManager(); - ImageInfo info = null; - try { - ImageSessionContext sessionContext = getUserAgent().getImageSessionContext(); - info = manager.getImageInfo(uri, sessionContext); - - Map hints = ImageUtil.getDefaultHints(sessionContext); - ImageFlavor[] supportedFlavors = imageHandlerRegistry.getSupportedFlavors(); - org.apache.xmlgraphics.image.loader.Image img = manager.getImage( - info, supportedFlavors, hints, sessionContext); - - //First check for a dynamically registered handler - PDFImageHandler handler - = (PDFImageHandler)imageHandlerRegistry.getHandler(img.getClass()); - if (handler != null) { - if (log.isDebugEnabled()) { - log.debug("Using PDFImageHandler: " + handler.getClass().getName()); - } - try { - RendererContext context = createRendererContext( - x, y, posInt.width, posInt.height, foreignAttributes); - handler.generateImage(context, img, origin, posInt); - } catch (IOException ioe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageWritingError(this, ioe); - return; - } - } else { - throw new UnsupportedOperationException( - "No PDFImageHandler available for image: " - + info + " (" + img.getClass().getName() + ")"); - } - } catch (ImageException ie) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageError(this, (info != null ? info.toString() : uri), ie, null); - } catch (FileNotFoundException fe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageNotFound(this, (info != null ? info.toString() : uri), fe, null); - } catch (IOException ioe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageIOError(this, (info != null ? info.toString() : uri), ioe, null); - } - - // output new data - try { - this.generator.flushPDFDoc(); - } catch (IOException ioe) { - // ioexception will be caught later - log.error(ioe.getMessage()); - } - } - - /** - * Places a previously registered image at a certain place on the page. - * @param x X coordinate - * @param y Y coordinate - * @param w width for image - * @param h height for image - * @param xobj the image XObject - */ - public void placeImage(float x, float y, float w, float h, PDFXObject xobj) { - if (accessEnabled) { - MarkedContentInfo mci = logicalStructureHandler.addImageContentItem(imageReference); - generator.saveGraphicsState(mci.tag, mci.mcid); - } else { - saveGraphicsState(); - } - generator.add(format(w) + " 0 0 " - + format(-h) + " " - + format(currentIPPosition / 1000f + x) + " " - + format(currentBPPosition / 1000f + h + y) - + " cm\n" + xobj.getName() + " Do\n"); - if (accessEnabled) { - generator.restoreGraphicsStateAccess(); - } else { - restoreGraphicsState(); - } - } - - /** {@inheritDoc} */ - protected RendererContext createRendererContext(int x, int y, int width, int height, - Map foreignAttributes) { - RendererContext context = super.createRendererContext( - x, y, width, height, foreignAttributes); - context.setProperty(PDFRendererContextConstants.PDF_DOCUMENT, pdfDoc); - context.setProperty(PDFRendererContextConstants.OUTPUT_STREAM, ostream); - context.setProperty(PDFRendererContextConstants.PDF_PAGE, currentPage); - context.setProperty(PDFRendererContextConstants.PDF_CONTEXT, currentContext); - context.setProperty(PDFRendererContextConstants.PDF_STREAM, generator.getStream()); - context.setProperty(PDFRendererContextConstants.PDF_FONT_INFO, fontInfo); - context.setProperty(PDFRendererContextConstants.PDF_FONT_NAME, ""); - context.setProperty(PDFRendererContextConstants.PDF_FONT_SIZE, new Integer(0)); - return context; - } - - /** {@inheritDoc} */ - public void renderDocument(Document doc, String ns, Rectangle2D pos, Map foreignAttributes) { - if (accessEnabled) { - MarkedContentInfo mci = logicalStructureHandler.addImageContentItem(imageReference); - generator.beginMarkedContentSequence(mci.tag, mci.mcid); - } - super.renderDocument(doc, ns, pos, foreignAttributes); - if (accessEnabled) { - generator.endMarkedContentSequence(); - } - } - - /** - * Render leader area. - * This renders a leader area which is an area with a rule. - * @param area the leader area to render - */ - public void renderLeader(Leader area) { - renderInlineAreaBackAndBorders(area); - - int style = area.getRuleStyle(); - int ruleThickness = area.getRuleThickness(); - int startx = currentIPPosition + area.getBorderAndPaddingWidthStart(); - int starty = currentBPPosition + area.getOffset() + (ruleThickness / 2); - int endx = currentIPPosition - + area.getBorderAndPaddingWidthStart() - + area.getIPD(); - Color col = (Color)area.getTrait(Trait.COLOR); - - endTextObject(); - borderPainter.drawLine(new Point(startx, starty), new Point(endx, starty), - ruleThickness, col, RuleStyle.valueOf(style)); - super.renderLeader(area); - } - - /** {@inheritDoc} */ - public String getMimeType() { - return MIME_TYPE; - } - - /** - * Sets the PDF/A mode for the PDF renderer. - * @param mode the PDF/A mode - */ - public void setAMode(PDFAMode mode) { - this.pdfUtil.setAMode(mode); - } - - /** - * Sets the PDF/X mode for the PDF renderer. - * @param mode the PDF/X mode - */ - public void setXMode(PDFXMode mode) { - this.pdfUtil.setXMode(mode); - } - - /** - * Sets the output color profile for the PDF renderer. - * @param outputProfileURI the URI to the output color profile - */ - public void setOutputProfileURI(String outputProfileURI) { - this.pdfUtil.setOutputProfileURI(outputProfileURI); - } - - /** - * Sets the filter map to be used by the PDF renderer. - * @param filterMap the filter map - */ - public void setFilterMap(Map filterMap) { - this.pdfUtil.setFilterMap(filterMap); - } - - /** - * Sets the encryption parameters used by the PDF renderer. - * @param encryptionParams the encryption parameters - */ - public void setEncryptionParams(PDFEncryptionParams encryptionParams) { - this.pdfUtil.setEncryptionParams(encryptionParams); - } - - MarkedContentInfo addCurrentImageToStructureTree() { - return logicalStructureHandler.addImageContentItem(imageReference); - } -} - diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java b/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java index f3511298e..9ebb1d5a1 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java +++ b/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java @@ -51,22 +51,12 @@ public class PDFRendererConfigurator extends PrintRendererConfigurator { } /** - * Configure the PDF renderer. - * Get the configuration to be used for pdf stream filters, - * fonts etc. + * Throws an UnsupportedOperationException. * - * @param renderer pdf renderer - * @throws FOPException fop exception + * @param renderer not used */ - public void configure(Renderer renderer) throws FOPException { - Configuration cfg = super.getRendererConfig(renderer); - if (cfg != null) { - PDFRenderer pdfRenderer = (PDFRenderer)renderer; - super.configure(renderer); - - PDFRenderingUtil pdfUtil = pdfRenderer.getPDFUtil(); - configure(cfg, pdfUtil); - } + public void configure(Renderer renderer) { + throw new UnsupportedOperationException(); } private void configure(Configuration cfg, PDFRenderingUtil pdfUtil) throws FOPException { @@ -80,20 +70,20 @@ public class PDFRendererConfigurator extends PrintRendererConfigurator { LogUtil.handleException(log, e, false); } - String s = cfg.getChild(PDFRenderer.PDF_A_MODE, true).getValue(null); + String s = cfg.getChild(PDFConfigurationConstants.PDF_A_MODE, true).getValue(null); if (s != null) { pdfUtil.setAMode(PDFAMode.valueOf(s)); } - s = cfg.getChild(PDFRenderer.PDF_X_MODE, true).getValue(null); + s = cfg.getChild(PDFConfigurationConstants.PDF_X_MODE, true).getValue(null); if (s != null) { pdfUtil.setXMode(PDFXMode.valueOf(s)); } Configuration encryptionParamsConfig - = cfg.getChild(PDFRenderer.ENCRYPTION_PARAMS, false); + = cfg.getChild(PDFConfigurationConstants.ENCRYPTION_PARAMS, false); if (encryptionParamsConfig != null) { PDFEncryptionParams encryptionParams = new PDFEncryptionParams(); Configuration ownerPasswordConfig = encryptionParamsConfig.getChild( - PDFRenderer.OWNER_PASSWORD, false); + PDFConfigurationConstants.OWNER_PASSWORD, false); if (ownerPasswordConfig != null) { String ownerPassword = ownerPasswordConfig.getValue(null); if (ownerPassword != null) { @@ -101,7 +91,7 @@ public class PDFRendererConfigurator extends PrintRendererConfigurator { } } Configuration userPasswordConfig = encryptionParamsConfig.getChild( - PDFRenderer.USER_PASSWORD, false); + PDFConfigurationConstants.USER_PASSWORD, false); if (userPasswordConfig != null) { String userPassword = userPasswordConfig.getValue(null); if (userPassword != null) { @@ -109,33 +99,33 @@ public class PDFRendererConfigurator extends PrintRendererConfigurator { } } Configuration noPrintConfig = encryptionParamsConfig.getChild( - PDFRenderer.NO_PRINT, false); + PDFConfigurationConstants.NO_PRINT, false); if (noPrintConfig != null) { encryptionParams.setAllowPrint(false); } Configuration noCopyContentConfig = encryptionParamsConfig.getChild( - PDFRenderer.NO_COPY_CONTENT, false); + PDFConfigurationConstants.NO_COPY_CONTENT, false); if (noCopyContentConfig != null) { encryptionParams.setAllowCopyContent(false); } Configuration noEditContentConfig = encryptionParamsConfig.getChild( - PDFRenderer.NO_EDIT_CONTENT, false); + PDFConfigurationConstants.NO_EDIT_CONTENT, false); if (noEditContentConfig != null) { encryptionParams.setAllowEditContent(false); } Configuration noAnnotationsConfig = encryptionParamsConfig.getChild( - PDFRenderer.NO_ANNOTATIONS, false); + PDFConfigurationConstants.NO_ANNOTATIONS, false); if (noAnnotationsConfig != null) { encryptionParams.setAllowEditAnnotations(false); } pdfUtil.setEncryptionParams(encryptionParams); } - s = cfg.getChild(PDFRenderer.KEY_OUTPUT_PROFILE, true).getValue(null); + s = cfg.getChild(PDFConfigurationConstants.KEY_OUTPUT_PROFILE, true).getValue(null); if (s != null) { pdfUtil.setOutputProfileURI(s); } Configuration disableColorSpaceConfig = cfg.getChild( - PDFRenderer.KEY_DISABLE_SRGB_COLORSPACE, false); + PDFConfigurationConstants.KEY_DISABLE_SRGB_COLORSPACE, false); if (disableColorSpaceConfig != null) { pdfUtil.setDisableSRGBColorSpace( disableColorSpaceConfig.getValueAsBoolean(false)); diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java b/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java index 3d68812b1..ae205a1e5 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java @@ -20,6 +20,7 @@ package org.apache.fop.render.pdf; import java.awt.color.ICC_Profile; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -33,6 +34,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.xmlgraphics.image.loader.util.ImageUtil; import org.apache.xmlgraphics.xmp.Metadata; import org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter; import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema; @@ -41,19 +43,27 @@ import org.apache.fop.accessibility.Accessibility; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.extensions.xmp.XMPMetadata; import org.apache.fop.pdf.PDFAMode; +import org.apache.fop.pdf.PDFArray; import org.apache.fop.pdf.PDFConformanceException; import org.apache.fop.pdf.PDFDictionary; import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFEmbeddedFile; +import org.apache.fop.pdf.PDFEmbeddedFiles; import org.apache.fop.pdf.PDFEncryptionManager; import org.apache.fop.pdf.PDFEncryptionParams; +import org.apache.fop.pdf.PDFFileSpec; import org.apache.fop.pdf.PDFICCBasedColorSpace; import org.apache.fop.pdf.PDFICCStream; import org.apache.fop.pdf.PDFInfo; import org.apache.fop.pdf.PDFMetadata; +import org.apache.fop.pdf.PDFNames; import org.apache.fop.pdf.PDFNumsArray; import org.apache.fop.pdf.PDFOutputIntent; import org.apache.fop.pdf.PDFPageLabels; +import org.apache.fop.pdf.PDFReference; +import org.apache.fop.pdf.PDFText; import org.apache.fop.pdf.PDFXMode; +import org.apache.fop.render.pdf.extensions.PDFEmbeddedFileExtensionAttachment; import org.apache.fop.util.ColorProfileUtil; /** @@ -413,4 +423,63 @@ class PDFRenderingUtil implements PDFConfigurationConstants { nums.put(pageIndex, dict); } + /** + * Adds an embedded file to the PDF file. + * @param embeddedFile the object representing the embedded file to be added + * @throws IOException if an I/O error occurs + */ + public void addEmbeddedFile(PDFEmbeddedFileExtensionAttachment embeddedFile) + throws IOException { + this.pdfDoc.getProfile().verifyEmbeddedFilesAllowed(); + PDFNames names = this.pdfDoc.getRoot().getNames(); + if (names == null) { + //Add Names if not already present + names = this.pdfDoc.getFactory().makeNames(); + this.pdfDoc.getRoot().setNames(names); + } + + //Create embedded file + PDFEmbeddedFile file = new PDFEmbeddedFile(); + this.pdfDoc.registerObject(file); + Source src = getUserAgent().resolveURI(embeddedFile.getSrc()); + InputStream in = ImageUtil.getInputStream(src); + if (in == null) { + throw new FileNotFoundException(embeddedFile.getSrc()); + } + try { + OutputStream out = file.getBufferOutputStream(); + IOUtils.copyLarge(in, out); + } finally { + IOUtils.closeQuietly(in); + } + PDFDictionary dict = new PDFDictionary(); + dict.put("F", file); + String filename = PDFText.toPDFString(embeddedFile.getFilename(), '_'); + PDFFileSpec fileSpec = new PDFFileSpec(filename); + fileSpec.setEmbeddedFile(dict); + if (embeddedFile.getDesc() != null) { + fileSpec.setDescription(embeddedFile.getDesc()); + } + this.pdfDoc.registerObject(fileSpec); + + //Make sure there is an EmbeddedFiles in the Names dictionary + PDFEmbeddedFiles embeddedFiles = names.getEmbeddedFiles(); + if (embeddedFiles == null) { + embeddedFiles = new PDFEmbeddedFiles(); + this.pdfDoc.assignObjectNumber(embeddedFiles); + this.pdfDoc.addTrailerObject(embeddedFiles); + names.setEmbeddedFiles(embeddedFiles); + } + + //Add to EmbeddedFiles in the Names dictionary + PDFArray nameArray = embeddedFiles.getNames(); + if (nameArray == null) { + nameArray = new PDFArray(); + embeddedFiles.setNames(nameArray); + } + String name = PDFText.toPDFString(filename); + nameArray.add(name); + nameArray.add(new PDFReference(fileSpec)); + } + } diff --git a/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java b/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java index f9fa8bfeb..434daa5b0 100644 --- a/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java @@ -19,26 +19,14 @@ package org.apache.fop.render.pdf; -import java.awt.Color; -import java.awt.geom.AffineTransform; -import java.io.IOException; import java.io.OutputStream; import java.util.Map; -import org.w3c.dom.Document; - import org.apache.avalon.framework.configuration.Configuration; -import org.apache.batik.bridge.BridgeContext; -import org.apache.batik.bridge.GVTBuilder; -import org.apache.batik.dom.svg.SVGDOMImplementation; -import org.apache.batik.gvt.GraphicsNode; -import org.apache.batik.util.SVGConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fonts.FontInfo; -import org.apache.fop.image.loader.batik.BatikUtil; import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFPage; import org.apache.fop.pdf.PDFResourceContext; @@ -47,11 +35,6 @@ import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.Renderer; import org.apache.fop.render.RendererContext; import org.apache.fop.render.RendererContextConstants; -import org.apache.fop.svg.PDFAElementBridge; -import org.apache.fop.svg.PDFBridgeContext; -import org.apache.fop.svg.PDFGraphics2D; -import org.apache.fop.svg.SVGEventProducer; -import org.apache.fop.svg.SVGUserAgent; /** * PDF XML handler for SVG (uses Apache Batik). @@ -97,177 +80,37 @@ public class PDFSVGHandler extends AbstractGenericSVGHandler */ public static class PDFInfo { /** see PDF_DOCUMENT */ - public PDFDocument pdfDoc; + public PDFDocument pdfDoc; // CSOK: VisibilityModifier /** see OUTPUT_STREAM */ - public OutputStream outputStream; + public OutputStream outputStream; // CSOK: VisibilityModifier /** see PDF_PAGE */ - public PDFPage pdfPage; + public PDFPage pdfPage; // CSOK: VisibilityModifier /** see PDF_CONTEXT */ - public PDFResourceContext pdfContext; + public PDFResourceContext pdfContext; // CSOK: VisibilityModifier /** see PDF_STREAM */ //public PDFStream currentStream; /** see PDF_WIDTH */ - public int width; + public int width; // CSOK: VisibilityModifier /** see PDF_HEIGHT */ - public int height; + public int height; // CSOK: VisibilityModifier /** see PDF_FONT_INFO */ - public FontInfo fi; + public FontInfo fi; // CSOK: VisibilityModifier /** see PDF_FONT_NAME */ - public String currentFontName; + public String currentFontName; // CSOK: VisibilityModifier /** see PDF_FONT_SIZE */ - public int currentFontSize; + public int currentFontSize; // CSOK: VisibilityModifier /** see PDF_XPOS */ - public int currentXPosition; + public int currentXPosition; // CSOK: VisibilityModifier /** see PDF_YPOS */ - public int currentYPosition; + public int currentYPosition; // CSOK: VisibilityModifier /** see PDF_HANDLER_CONFIGURATION */ - public Configuration cfg; + public Configuration cfg; // CSOK: VisibilityModifier /** true if SVG should be rendered as a bitmap instead of natively */ - public boolean paintAsBitmap; - } - - /** - * {@inheritDoc} - */ - protected void renderSVGDocument(RendererContext context, - Document doc) { - PDFRenderer renderer = (PDFRenderer)context.getRenderer(); - PDFInfo pdfInfo = getPDFInfo(context); - if (pdfInfo.paintAsBitmap) { - try { - super.renderSVGDocument(context, doc); - } catch (IOException ioe) { - SVGEventProducer eventProducer = SVGEventProducer.Provider.get( - context.getUserAgent().getEventBroadcaster()); - eventProducer.svgRenderingError(this, ioe, getDocumentURI(doc)); - } - return; - } - int xOffset = pdfInfo.currentXPosition; - int yOffset = pdfInfo.currentYPosition; - - FOUserAgent userAgent = context.getUserAgent(); - final float deviceResolution = userAgent.getTargetResolution(); - if (log.isDebugEnabled()) { - log.debug("Generating SVG at " + deviceResolution + "dpi."); - } - - final float uaResolution = userAgent.getSourceResolution(); - SVGUserAgent ua = new SVGUserAgent(userAgent, new AffineTransform()); - - //Scale for higher resolution on-the-fly images from Batik - double s = uaResolution / deviceResolution; - AffineTransform resolutionScaling = new AffineTransform(); - resolutionScaling.scale(s, s); - - //Controls whether text painted by Batik is generated using text or path operations - boolean strokeText = false; - Configuration cfg = pdfInfo.cfg; - if (cfg != null) { - strokeText = cfg.getChild("stroke-text", true).getValueAsBoolean(strokeText); - } - - BridgeContext ctx = new PDFBridgeContext(ua, - (strokeText ? null : pdfInfo.fi), - userAgent.getFactory().getImageManager(), - userAgent.getImageSessionContext(), - new AffineTransform()); - - //Cloning SVG DOM as Batik attaches non-thread-safe facilities (like the CSS engine) - //to it. - Document clonedDoc = BatikUtil.cloneSVGDocument(doc); - - GraphicsNode root; - try { - GVTBuilder builder = new GVTBuilder(); - root = builder.build(ctx, clonedDoc); - } catch (Exception e) { - SVGEventProducer eventProducer = SVGEventProducer.Provider.get( - context.getUserAgent().getEventBroadcaster()); - eventProducer.svgNotBuilt(this, e, getDocumentURI(doc)); - return; - } - // get the 'width' and 'height' attributes of the SVG document - float w = (float)ctx.getDocumentSize().getWidth() * 1000f; - float h = (float)ctx.getDocumentSize().getHeight() * 1000f; - - float sx = pdfInfo.width / w; - float sy = pdfInfo.height / h; - - //Scaling and translation for the bounding box of the image - AffineTransform scaling = new AffineTransform( - sx, 0, 0, sy, xOffset / 1000f, yOffset / 1000f); - - //Transformation matrix that establishes the local coordinate system for the SVG graphic - //in relation to the current coordinate system - AffineTransform imageTransform = new AffineTransform(); - imageTransform.concatenate(scaling); - imageTransform.concatenate(resolutionScaling); - - /* - * Clip to the svg area. - * Note: To have the svg overlay (under) a text area then use - * an fo:block-container - */ - PDFContentGenerator generator = renderer.getGenerator(); - generator.comment("SVG setup"); - generator.saveGraphicsState(); - generator.setColor(Color.black, false); - generator.setColor(Color.black, true); - - if (!scaling.isIdentity()) { - generator.comment("viewbox"); - generator.add(CTMHelper.toPDFString(scaling, false) + " cm\n"); - } - - //SVGSVGElement svg = ((SVGDocument)doc).getRootElement(); - - if (pdfInfo.pdfContext == null) { - pdfInfo.pdfContext = pdfInfo.pdfPage; - } - PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fi, - pdfInfo.pdfDoc, - pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(), - pdfInfo.currentFontName, pdfInfo.currentFontSize); - graphics.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext()); - - if (!resolutionScaling.isIdentity()) { - generator.comment("resolution scaling for " + uaResolution - + " -> " + deviceResolution + "\n"); - generator.add( - CTMHelper.toPDFString(resolutionScaling, false) + " cm\n"); - graphics.scale(1 / s, 1 / s); - } - - generator.comment("SVG start"); - - //Save state and update coordinate system for the SVG image - generator.getState().save(); - generator.getState().concatenate(imageTransform); - - //Now that we have the complete transformation matrix for the image, we can update the - //transformation matrix for the AElementBridge. - PDFAElementBridge aBridge = (PDFAElementBridge)ctx.getBridge( - SVGDOMImplementation.SVG_NAMESPACE_URI, SVGConstants.SVG_A_TAG); - aBridge.getCurrentTransform().setTransform(generator.getState().getTransform()); - - graphics.setPaintingState(generator.getState()); - graphics.setOutputStream(pdfInfo.outputStream); - try { - root.paint(graphics); - generator.add(graphics.getString()); - } catch (Exception e) { - SVGEventProducer eventProducer = SVGEventProducer.Provider.get( - context.getUserAgent().getEventBroadcaster()); - eventProducer.svgRenderingError(this, e, getDocumentURI(doc)); - } - generator.getState().restore(); - generator.restoreGraphicsState(); - generator.comment("SVG end"); + public boolean paintAsBitmap; // CSOK: VisibilityModifier } /** {@inheritDoc} */ public boolean supportsRenderer(Renderer renderer) { - return (renderer instanceof PDFRenderer); + return false; } } diff --git a/src/java/org/apache/fop/render/pdf/extensions/AbstractPDFExtensionElement.java b/src/java/org/apache/fop/render/pdf/extensions/AbstractPDFExtensionElement.java new file mode 100644 index 000000000..2b50112c0 --- /dev/null +++ b/src/java/org/apache/fop/render/pdf/extensions/AbstractPDFExtensionElement.java @@ -0,0 +1,73 @@ +/* + * 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.pdf.extensions; + +// FOP +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.extensions.ExtensionAttachment; + +/** + * Base class for the PDF-specific extension elements. + */ +public abstract class AbstractPDFExtensionElement extends FONode { + + /**Extension attachment. */ + protected PDFExtensionAttachment attachment; + + /** + * Default constructor + * + * @param parent parent of this node + * @see org.apache.fop.fo.FONode#FONode(FONode) + */ + public AbstractPDFExtensionElement(FONode parent) { + super(parent); + } + + /** {@inheritDoc} */ + public String getNamespaceURI() { + return PDFElementMapping.NAMESPACE; + } + + /** {@inheritDoc} */ + public String getNormalNamespacePrefix() { + return "pdf"; + } + + /** + * Returns the extension attachment. + * @return the extension attachment if one is created by the extension element, null otherwise. + * @see org.apache.fop.fo.FONode#getExtensionAttachment() + */ + public ExtensionAttachment getExtensionAttachment() { + if (attachment == null) { + this.attachment = (PDFExtensionAttachment)instantiateExtensionAttachment(); + } + return this.attachment; + } + + /** + * Instantiates extension attachment object. + * @return extension attachment + */ + protected abstract ExtensionAttachment instantiateExtensionAttachment(); + +} + diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererMaker.java b/src/java/org/apache/fop/render/pdf/extensions/PDFElementMapping.java index fb65c9d74..55795f4fa 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRendererMaker.java +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFElementMapping.java @@ -17,39 +17,35 @@ /* $Id$ */ -package org.apache.fop.render.pdf; +package org.apache.fop.render.pdf.extensions; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.render.AbstractRendererMaker; -import org.apache.fop.render.Renderer; -import org.apache.fop.render.RendererConfigurator; +import org.apache.fop.fo.ElementMapping; +import org.apache.fop.fo.FONode; /** - * RendererMaker for the PDF Renderer. + * This class provides the element mapping for the PDF-specific extensions. */ -public class PDFRendererMaker extends AbstractRendererMaker { +public class PDFElementMapping extends ElementMapping { - private static final String[] MIMES = new String[] {MimeConstants.MIME_PDF}; + /** Namespace for the extension */ + public static final String NAMESPACE = "http://xmlgraphics.apache.org/fop/extensions/pdf"; - /** {@inheritDoc} */ - public Renderer makeRenderer(FOUserAgent userAgent) { - return new PDFRenderer(); - } - - /** {@inheritDoc} */ - public RendererConfigurator getConfigurator(FOUserAgent userAgent) { - return new PDFRendererConfigurator(userAgent); + /** Main constructor */ + public PDFElementMapping() { + this.namespaceURI = NAMESPACE; } /** {@inheritDoc} */ - public boolean needsOutputStream() { - return true; + protected void initialize() { + if (foObjs == null) { + foObjs = new java.util.HashMap(); + foObjs.put(PDFEmbeddedFileElement.ELEMENT, new PDFEmbeddedFileMaker()); + } } - /** {@inheritDoc} */ - public String[] getSupportedMimeTypes() { - return MIMES; + static class PDFEmbeddedFileMaker extends ElementMapping.Maker { + public FONode make(FONode parent) { + return new PDFEmbeddedFileElement(parent); + } } - } diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java new file mode 100644 index 000000000..b2d85dd10 --- /dev/null +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java @@ -0,0 +1,106 @@ +/* + * 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.pdf.extensions; + +import java.net.URI; +import java.net.URISyntaxException; + +import org.xml.sax.Attributes; +import org.xml.sax.Locator; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.URISpecification; +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.extensions.ExtensionAttachment; + +/** + * Extension element for pdf:embedded-file. + */ +public class PDFEmbeddedFileElement extends AbstractPDFExtensionElement { + + /** name of element */ + protected static final String ELEMENT = "embedded-file"; + + /** + * Main constructor + * @param parent parent FO node + */ + protected PDFEmbeddedFileElement(FONode parent) { + super(parent); + } + + /** {@inheritDoc} */ + protected void startOfNode() throws FOPException { + super.startOfNode(); + if (parent.getNameId() != Constants.FO_DECLARATIONS) { + invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), + "rule.childOfDeclarations"); + } + } + + /** {@inheritDoc} */ + public void processNode(String elementName, Locator locator, + Attributes attlist, PropertyList propertyList) + throws FOPException { + PDFEmbeddedFileExtensionAttachment embeddedFile + = (PDFEmbeddedFileExtensionAttachment)getExtensionAttachment(); + String desc = attlist.getValue("description"); + if (desc != null && desc.length() > 0) { + embeddedFile.setDesc(desc); + } + String src = attlist.getValue("src"); + src = URISpecification.getURL(src); + if (src != null && src.length() > 0) { + embeddedFile.setSrc(src); + } else { + missingPropertyError("src"); + } + String filename = attlist.getValue("filename"); + if (filename == null || filename.length() == 0) { + try { + URI uri = new URI(src); + String path = uri.getPath(); + int idx = path.lastIndexOf('/'); + if (idx > 0) { + filename = path.substring(idx + 1); + } else { + filename = path; + } + embeddedFile.setFilename(filename); + } catch (URISyntaxException e) { + //Filename could not be deduced from URI + missingPropertyError("name"); + } + } + embeddedFile.setFilename(filename); + } + + /** {@inheritDoc} */ + public String getLocalName() { + return ELEMENT; + } + + /** {@inheritDoc} */ + protected ExtensionAttachment instantiateExtensionAttachment() { + return new PDFEmbeddedFileExtensionAttachment(); + } +} diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileExtensionAttachment.java b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileExtensionAttachment.java new file mode 100644 index 000000000..5f3f16dbb --- /dev/null +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileExtensionAttachment.java @@ -0,0 +1,154 @@ +/* + * 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.pdf.extensions; + +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 PDF extension. + */ +public class PDFEmbeddedFileExtensionAttachment extends PDFExtensionAttachment { + + /** element name */ + protected static final String ELEMENT = "embedded-file"; + + /** name of file to be embedded */ + private static final String ATT_NAME = "filename"; + + /** source of file to be embedded (URI) */ + private static final String ATT_SRC = "src"; + + /** a description of the file to be embedded */ + private static final String ATT_DESC = "desc"; + + /** filename attribute */ + private String filename = null; + + /** description attribute (optional) */ + private String desc = null; + + /** source name attribute */ + private String src = null; + + /** + * No-argument contructor. + */ + public PDFEmbeddedFileExtensionAttachment() { + super(); + } + + /** + * Default constructor. + * @param filename the name of the file + * @param src the location of the file + * @param desc the description of the file + */ + public PDFEmbeddedFileExtensionAttachment(String filename, String src, String desc) { + super(); + this.filename = filename; + this.src = src; + this.desc = desc; + } + + /** + * Returns the file name. + * @return the file name + */ + public String getFilename() { + return filename; + } + + /** + * Sets the file name. + * @param name The file name to set. + */ + public void setFilename(String name) { + this.filename = name; + } + + /** + * Returns the file description. + * @return the description + */ + public String getDesc() { + return desc; + } + + /** + * Sets the description of the file. + * @param desc the description to set + */ + public void setDesc(String desc) { + this.desc = desc; + } + + /** + * Returns the source URI of the file. + * @return the source URI + */ + public String getSrc() { + return src; + } + + /** + * Sets the source URI of the file. + * @param src the source URI + */ + public void setSrc(String src) { + this.src = src; + } + + /** {@inheritDoc} */ + public String getCategory() { + return CATEGORY; + } + + /** {@inheritDoc} */ + public String toString() { + return "PDFEmbeddedFile(name=" + getFilename() + ", " + getSrc() + ")"; + } + + /** + * @return the element name + */ + protected String getElement() { + return ELEMENT; + } + + /** {@inheritDoc} */ + public void toSAX(ContentHandler handler) throws SAXException { + AttributesImpl atts = new AttributesImpl(); + if (filename != null && filename.length() > 0) { + atts.addAttribute(null, ATT_NAME, ATT_NAME, "CDATA", filename); + } + if (src != null && src.length() > 0) { + atts.addAttribute(null, ATT_SRC, ATT_SRC, "CDATA", src); + } + if (desc != null && desc.length() > 0) { + atts.addAttribute(null, ATT_DESC, ATT_DESC, "CDATA", desc); + } + String element = getElement(); + handler.startElement(CATEGORY, element, element, atts); + handler.endElement(CATEGORY, element, element); + } + +} diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionAttachment.java b/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionAttachment.java new file mode 100644 index 000000000..a4f5b47b7 --- /dev/null +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionAttachment.java @@ -0,0 +1,65 @@ +/* + * 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.pdf.extensions; + +import org.apache.xmlgraphics.util.XMLizable; + +import org.apache.fop.fo.extensions.ExtensionAttachment; + +/** + * This is the pass-through value object for the PDF extension. + */ +public abstract class PDFExtensionAttachment implements ExtensionAttachment, XMLizable { + + /** The category URI for this extension attachment. */ + public static final String CATEGORY = "apache:fop:extensions:pdf"; + + /** + * Default constructor. + */ + public PDFExtensionAttachment() { + //nop + } + + /** + * @return the category URI + * @see org.apache.fop.fo.extensions.ExtensionAttachment#getCategory() + */ + public String getCategory() { + return CATEGORY; + } + + /** @return type name */ + public String getType() { + String className = getClass().getName(); + return className.substring(className.lastIndexOf('.') + 3); + } + + /** + * @return a string representation of this object + * @see java.lang.Object#toString() + */ + public String toString() { + return getType(); + } + + /** @return element */ + protected abstract String getElement(); +} diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java b/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java new file mode 100644 index 000000000..d285904a8 --- /dev/null +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java @@ -0,0 +1,97 @@ +/* + * 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.pdf.extensions; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +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; + +/** + * ContentHandler (parser) for restoring PDF extension objects from XML. + */ +public class PDFExtensionHandler extends DefaultHandler + implements ContentHandlerFactory.ObjectSource { + + /** Logger instance */ + protected static Log log = LogFactory.getLog(PDFExtensionHandler.class); + + private Attributes lastAttributes; + + private PDFExtensionAttachment returnedObject; + private ObjectBuiltListener listener; + + /** {@inheritDoc} */ + public void startElement(String uri, String localName, String qName, Attributes attributes) + throws SAXException { + boolean handled = false; + if (PDFExtensionAttachment.CATEGORY.equals(uri)) { + lastAttributes = attributes; + handled = false; + if (localName.equals(PDFEmbeddedFileExtensionAttachment.ELEMENT)) { + //handled in endElement + handled = true; + } + } + if (!handled) { + if (PDFExtensionAttachment.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 (PDFExtensionAttachment.CATEGORY.equals(uri)) { + if (PDFEmbeddedFileExtensionAttachment.ELEMENT.equals(localName)) { + String name = lastAttributes.getValue("name"); + String src = lastAttributes.getValue("src"); + String desc = lastAttributes.getValue("description"); + this.returnedObject = new PDFEmbeddedFileExtensionAttachment(name, src, desc); + } + } + } + + /** {@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/ps/PSBorderPainter.java b/src/java/org/apache/fop/render/ps/PSBorderPainter.java index cddbe9cd1..f5d5169c4 100644 --- a/src/java/org/apache/fop/render/ps/PSBorderPainter.java +++ b/src/java/org/apache/fop/render/ps/PSBorderPainter.java @@ -52,8 +52,9 @@ public class PSBorderPainter extends BorderPainter { } /** {@inheritDoc} */ - protected void drawBorderLine(int x1, int y1, int x2, int y2, boolean horz, - boolean startOrBefore, int style, Color col) throws IOException { + protected void drawBorderLine // CSOK: ParameterNumber + (int x1, int y1, int x2, int y2, boolean horz, + boolean startOrBefore, int style, Color col) throws IOException { drawBorderLine(generator, toPoints(x1), toPoints(y1), toPoints(x2), toPoints(y2), horz, startOrBefore, style, col); } @@ -66,10 +67,15 @@ public class PSBorderPainter extends BorderPainter { + gen.formatDouble(endy) + " lineto stroke newpath"); } - /** {@inheritDoc} */ - public static void drawBorderLine(PSGenerator gen, - float x1, float y1, float x2, float y2, boolean horz, - boolean startOrBefore, int style, Color col) throws IOException { + /** + * @param gen ps content generator + * @see BorderPainter#drawBorderLine + */ + public static void drawBorderLine // CSOK: ParameterNumber + (PSGenerator gen, + float x1, float y1, float x2, float y2, boolean horz, // CSOK: JavadocMethod + boolean startOrBefore, int style, Color col) // CSOK: JavadocMethod + throws IOException { // CSOK: JavadocMethod float w = x2 - x1; float h = y2 - y1; if ((w < 0) || (h < 0)) { diff --git a/src/java/org/apache/fop/render/ps/PSBridgeContext.java b/src/java/org/apache/fop/render/ps/PSBridgeContext.java index 1ec6acadf..c0244db04 100644 --- a/src/java/org/apache/fop/render/ps/PSBridgeContext.java +++ b/src/java/org/apache/fop/render/ps/PSBridgeContext.java @@ -102,6 +102,7 @@ public class PSBridgeContext extends AbstractFOPBridgeContext { // Make sure any 'sub bridge contexts' also have our bridges. //TODO There's no matching method in the super-class here + /** @return a bridge context */ public BridgeContext createBridgeContext() { return new PSBridgeContext(getUserAgent(), getDocumentLoader(), fontInfo, diff --git a/src/java/org/apache/fop/render/ps/PSEventProducer.java b/src/java/org/apache/fop/render/ps/PSEventProducer.java index 3da5b1edb..d702a5701 100644 --- a/src/java/org/apache/fop/render/ps/PSEventProducer.java +++ b/src/java/org/apache/fop/render/ps/PSEventProducer.java @@ -28,7 +28,10 @@ import org.apache.fop.events.EventProducer; public interface PSEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/render/ps/PSFontUtils.java b/src/java/org/apache/fop/render/ps/PSFontUtils.java index d27954c23..7adb9f756 100644 --- a/src/java/org/apache/fop/render/ps/PSFontUtils.java +++ b/src/java/org/apache/fop/render/ps/PSFontUtils.java @@ -564,8 +564,9 @@ public class PSFontUtils extends org.apache.xmlgraphics.ps.PSFontUtils { * @return the PSResource representing the derived font * @throws IOException In case of an I/O problem */ - public static PSResource defineDerivedFont(PSGenerator gen, String baseFontName, String fontName, - String encoding) throws IOException { + public static PSResource defineDerivedFont + (PSGenerator gen, String baseFontName, String fontName, String encoding) + throws IOException { PSResource res = new PSResource(PSResource.TYPE_FONT, fontName); gen.writeDSCComment(DSCConstants.BEGIN_RESOURCE, res); gen.commentln("%XGCDependencies: font " + baseFontName); diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java b/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java index 3858cc716..e13591ae3 100644 --- a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java @@ -30,12 +30,12 @@ import org.apache.xmlgraphics.java2d.Graphics2DImagePainter; import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; import org.apache.xmlgraphics.ps.PSGenerator; +import org.apache.fop.pdf.PDFFactory; import org.apache.fop.render.AbstractGraphics2DAdapter; import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RendererContext; import org.apache.fop.render.RendererContextConstants; import org.apache.fop.render.RendererContext.RendererContextWrapper; -import org.apache.fop.render.pdf.PDFRenderer; /** * Graphics2DAdapter implementation for PostScript. @@ -46,15 +46,7 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter { private boolean clip = true; /** - * Main constructor - * @param renderer the Renderer instance to which this instance belongs - */ - public PSGraphics2DAdapter(PSRenderer renderer) { - this(renderer.gen, true); - } - - /** - * Constructor for use without a PSRenderer instance. + * Creates a new instance. * @param gen the PostScript generator * @param clip true if the image should be clipped */ @@ -114,7 +106,7 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter { RendererContextWrapper ctx = RendererContext.wrapRendererContext(context); BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false); - float scale = PDFRenderer.NORMAL_PDF_RESOLUTION + float scale = PDFFactory.DEFAULT_PDF_RESOLUTION / context.getUserAgent().getTargetResolution(); graphics.drawImage(bi, new AffineTransform(scale, 0, 0, scale, 0, 0), null); } else { diff --git a/src/java/org/apache/fop/render/ps/PSImageHandler.java b/src/java/org/apache/fop/render/ps/PSImageHandler.java index ff94fdd2c..0aeafa6fa 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandler.java +++ b/src/java/org/apache/fop/render/ps/PSImageHandler.java @@ -30,7 +30,8 @@ import org.apache.fop.render.RenderingContext; * Specialized image handler interface for PostScript output. Implementations can optionally * support creating PostScript forms. The implementation shall check the rendering context * to see if forms functionality is enabled in the - * {@link #isCompatible(org.apache.fop.render.RenderingContext, org.apache.xmlgraphics.image.loader.Image)} + * {@link #isCompatible(org.apache.fop.render.RenderingContext, + * org.apache.xmlgraphics.image.loader.Image)} * method. */ public interface PSImageHandler extends ImageHandler { diff --git a/src/java/org/apache/fop/render/ps/PSPainter.java b/src/java/org/apache/fop/render/ps/PSPainter.java index 894b4fb9d..1fc7b8667 100644 --- a/src/java/org/apache/fop/render/ps/PSPainter.java +++ b/src/java/org/apache/fop/render/ps/PSPainter.java @@ -403,9 +403,10 @@ public class PSPainter extends AbstractIFPainter { } } - private void writeText(String text, int start, int len, - int letterSpacing, int wordSpacing, int[] dx, - Font font, Typeface tf, boolean multiByte) throws IOException { + private void writeText // CSOK: ParameterNumber + (String text, int start, int len, + int letterSpacing, int wordSpacing, int[] dx, + Font font, Typeface tf, boolean multiByte) throws IOException { PSGenerator generator = getGenerator(); int end = start + len; int initialSize = len; diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java deleted file mode 100644 index 103d714bf..000000000 --- a/src/java/org/apache/fop/render/ps/PSRenderer.java +++ /dev/null @@ -1,1289 +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.render.ps; - -// Java -import java.awt.Color; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; -import java.awt.image.RenderedImage; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.transform.Source; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.apache.xmlgraphics.image.loader.ImageException; -import org.apache.xmlgraphics.image.loader.ImageFlavor; -import org.apache.xmlgraphics.image.loader.ImageInfo; -import org.apache.xmlgraphics.image.loader.ImageManager; -import org.apache.xmlgraphics.image.loader.ImageSessionContext; -import org.apache.xmlgraphics.image.loader.util.ImageUtil; -import org.apache.xmlgraphics.ps.DSCConstants; -import org.apache.xmlgraphics.ps.PSDictionary; -import org.apache.xmlgraphics.ps.PSDictionaryFormatException; -import org.apache.xmlgraphics.ps.PSGenerator; -import org.apache.xmlgraphics.ps.PSPageDeviceDictionary; -import org.apache.xmlgraphics.ps.PSProcSets; -import org.apache.xmlgraphics.ps.PSResource; -import org.apache.xmlgraphics.ps.PSState; -import org.apache.xmlgraphics.ps.dsc.DSCException; -import org.apache.xmlgraphics.ps.dsc.ResourceTracker; -import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox; -import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox; - -import org.apache.fop.ResourceEventProducer; -import org.apache.fop.apps.FOPException; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.area.Area; -import org.apache.fop.area.BlockViewport; -import org.apache.fop.area.CTM; -import org.apache.fop.area.OffDocumentExtensionAttachment; -import org.apache.fop.area.OffDocumentItem; -import org.apache.fop.area.PageViewport; -import org.apache.fop.area.RegionViewport; -import org.apache.fop.area.Trait; -import org.apache.fop.area.inline.AbstractTextArea; -import org.apache.fop.area.inline.Image; -import org.apache.fop.area.inline.InlineParent; -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; -import org.apache.fop.datatypes.URISpecification; -import org.apache.fop.fo.extensions.ExtensionAttachment; -import org.apache.fop.fonts.Font; -import org.apache.fop.fonts.LazyFont; -import org.apache.fop.fonts.SingleByteFont; -import org.apache.fop.fonts.Typeface; -import org.apache.fop.render.AbstractPathOrientedRenderer; -import org.apache.fop.render.Graphics2DAdapter; -import org.apache.fop.render.ImageAdapter; -import org.apache.fop.render.ImageHandler; -import org.apache.fop.render.ImageHandlerRegistry; -import org.apache.fop.render.RendererContext; -import org.apache.fop.render.RendererEventProducer; -import org.apache.fop.render.ps.extensions.PSCommentAfter; -import org.apache.fop.render.ps.extensions.PSCommentBefore; -import org.apache.fop.render.ps.extensions.PSExtensionAttachment; -import org.apache.fop.render.ps.extensions.PSSetPageDevice; -import org.apache.fop.render.ps.extensions.PSSetupCode; -import org.apache.fop.traits.RuleStyle; -import org.apache.fop.util.CharUtilities; - -/** - * Renderer that renders to PostScript. - * <br> - * This class currently generates PostScript Level 2 code. The only exception - * is the FlateEncode filter which is a Level 3 feature. The filters in use - * are hardcoded at the moment. - * <br> - * This class follows the Document Structuring Conventions (DSC) version 3.0. - * If anyone modifies this renderer please make - * sure to also follow the DSC to make it simpler to programmatically modify - * the generated Postscript files (ex. extract pages etc.). - * <br> - * This renderer inserts FOP-specific comments into the PostScript stream which - * may help certain users to do certain types of post-processing of the output. - * These comments all start with "%FOP". - * - * @author <a href="mailto:fop-dev@xmlgraphics.apache.org">Apache FOP Development Team</a> - * @version $Id$ - */ -public class PSRenderer extends AbstractPathOrientedRenderer - implements ImageAdapter, PSSupportedFlavors, PSConfigurationConstants { - - /** logging instance */ - private static Log log = LogFactory.getLog(PSRenderer.class); - - /** The MIME type for PostScript */ - public static final String MIME_TYPE = "application/postscript"; - - /** The application producing the PostScript */ - private int currentPageNumber = 0; - - /** the OutputStream the PS file is written to */ - private OutputStream outputStream; - /** the temporary file in case of two-pass processing */ - private File tempFile; - - /** The PostScript generator used to output the PostScript */ - protected PSGenerator gen; - private boolean ioTrouble = false; - - private boolean inTextMode = false; - - /** Used to temporarily store PSSetupCode instance until they can be written. */ - private List setupCodeList; - - /** This is a map of PSResource instances of all fonts defined (key: font key) */ - private Map fontResources; - /** This is a map of PSResource instances of all forms (key: uri) */ - private Map formResources; - - /** encapsulation of dictionary used in setpagedevice instruction **/ - private PSPageDeviceDictionary pageDeviceDictionary; - - /** - * Utility class which enables all sorts of features that are not directly connected to the - * normal rendering process. - */ - protected PSRenderingUtil psUtil; - private PSBorderPainter borderPainter; - - /** Is used to determine the document's bounding box */ - private Rectangle2D documentBoundingBox; - - /** This is a collection holding all document header comments */ - private Collection headerComments; - - /** This is a collection holding all document footer comments */ - private Collection footerComments; - - /** {@inheritDoc} */ - public void setUserAgent(FOUserAgent agent) { - super.setUserAgent(agent); - this.psUtil = new PSRenderingUtil(getUserAgent()); - } - - PSRenderingUtil getPSUtil() { - return this.psUtil; - } - - /** - * Sets the landscape mode for this renderer. - * @param value false will normally generate a "pseudo-portrait" page, true will rotate - * a "wider-than-long" page by 90 degrees. - */ - public void setAutoRotateLandscape(boolean value) { - getPSUtil().setAutoRotateLandscape(value); - } - - /** @return true if the renderer is configured to rotate landscape pages */ - public boolean isAutoRotateLandscape() { - return getPSUtil().isAutoRotateLandscape(); - } - - /** - * Sets the PostScript language level that the renderer should produce. - * @param level the language level (currently allowed: 2 or 3) - */ - public void setLanguageLevel(int level) { - getPSUtil().setLanguageLevel(level); - } - - /** - * Return the PostScript language level that the renderer produces. - * @return the language level - */ - public int getLanguageLevel() { - return getPSUtil().getLanguageLevel(); - } - - /** - * Sets the resource optimization mode. If set to true, the renderer does two passes to - * only embed the necessary resources in the PostScript file. This is slower, but produces - * smaller files. - * @param value true to enable the resource optimization - */ - public void setOptimizeResources(boolean value) { - getPSUtil().setOptimizeResources(value); - } - - /** @return true if the renderer does two passes to optimize PostScript resources */ - public boolean isOptimizeResources() { - return getPSUtil().isOptimizeResources(); - } - - /** {@inheritDoc} */ - public Graphics2DAdapter getGraphics2DAdapter() { - return new PSGraphics2DAdapter(this); - } - - /** {@inheritDoc} */ - public ImageAdapter getImageAdapter() { - return this; - } - - /** - * Write out a command - * @param cmd PostScript command - */ - protected void writeln(String cmd) { - try { - gen.writeln(cmd); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * Central exception handler for I/O exceptions. - * @param ioe IOException to handle - */ - protected void handleIOTrouble(IOException ioe) { - if (!ioTrouble) { - RendererEventProducer eventProducer = RendererEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.ioError(this, ioe); - ioTrouble = true; - } - } - - /** - * Write out a comment - * @param comment Comment to write - */ - protected void comment(String comment) { - try { - if (comment.startsWith("%")) { - gen.commentln(comment); - writeln(comment); - } else { - gen.commentln("%" + comment); - } - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * Make sure the cursor is in the right place. - */ - protected void movetoCurrPosition() { - moveTo(this.currentIPPosition, this.currentBPPosition); - } - - /** {@inheritDoc} */ - protected void clip() { - writeln("clip newpath"); - } - - /** {@inheritDoc} */ - protected void clipRect(float x, float y, float width, float height) { - try { - gen.defineRect(x, y, width, height); - clip(); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** {@inheritDoc} */ - protected void moveTo(float x, float y) { - writeln(gen.formatDouble(x) + " " + gen.formatDouble(y) + " M"); - } - - /** - * Moves the current point by (x, y) relative to the current position, - * omitting any connecting line segment. - * @param x x coordinate - * @param y y coordinate - */ - protected void rmoveTo(float x, float y) { - writeln(gen.formatDouble(x) + " " + gen.formatDouble(y) + " RM"); - } - - /** {@inheritDoc} */ - protected void lineTo(float x, float y) { - writeln(gen.formatDouble(x) + " " + gen.formatDouble(y) + " lineto"); - } - - /** {@inheritDoc} */ - protected void closePath() { - writeln("cp"); - } - - /** {@inheritDoc} */ - protected void fillRect(float x, float y, float width, float height) { - if (width != 0 && height != 0) { - try { - gen.defineRect(x, y, width, height); - gen.writeln("fill"); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - } - - /** {@inheritDoc} */ - protected void updateColor(Color col, boolean fill) { - try { - useColor(col); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** {@inheritDoc} */ - protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) { - endTextObject(); - int x = currentIPPosition + (int)Math.round(pos.getX()); - int y = currentBPPosition + (int)Math.round(pos.getY()); - uri = URISpecification.getURL(uri); - if (log.isDebugEnabled()) { - log.debug("Handling image: " + uri); - } - int width = (int)pos.getWidth(); - int height = (int)pos.getHeight(); - Rectangle targetRect = new Rectangle(x, y, width, height); - - ImageManager manager = getUserAgent().getFactory().getImageManager(); - ImageInfo info = null; - try { - ImageSessionContext sessionContext = getUserAgent().getImageSessionContext(); - info = manager.getImageInfo(uri, sessionContext); - - PSRenderingContext renderingContext = new PSRenderingContext( - getUserAgent(), gen, getFontInfo()); - - if (!isOptimizeResources() - || PSImageUtils.isImageInlined(info, renderingContext)) { - if (log.isDebugEnabled()) { - log.debug("Image " + info + " is inlined"); - } - - //Determine supported flavors - ImageFlavor[] flavors; - ImageHandlerRegistry imageHandlerRegistry - = userAgent.getFactory().getImageHandlerRegistry(); - flavors = imageHandlerRegistry.getSupportedFlavors(renderingContext); - - //Only now fully load/prepare the image - Map hints = ImageUtil.getDefaultHints(sessionContext); - org.apache.xmlgraphics.image.loader.Image img = manager.getImage( - info, flavors, hints, sessionContext); - - //Get handler for image - ImageHandler basicHandler = imageHandlerRegistry.getHandler(renderingContext, img); - - //...and embed as inline image - basicHandler.handleImage(renderingContext, img, targetRect); - } else { - if (log.isDebugEnabled()) { - log.debug("Image " + info + " is embedded as a form later"); - } - //Don't load image at this time, just put a form placeholder in the stream - PSResource form = getFormForImage(info.getOriginalURI()); - PSImageUtils.drawForm(form, info, targetRect, gen); - } - - } catch (ImageException ie) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageError(this, (info != null ? info.toString() : uri), ie, null); - } catch (FileNotFoundException fe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageNotFound(this, (info != null ? info.toString() : uri), fe, null); - } catch (IOException ioe) { - ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.imageIOError(this, (info != null ? info.toString() : uri), ioe, null); - } - } - - /** - * Returns a PSResource instance representing a image as a PostScript form. - * @param uri the image URI - * @return a PSResource instance - */ - protected PSResource getFormForImage(String uri) { - if (uri == null || "".equals(uri)) { - throw new IllegalArgumentException("uri must not be empty or null"); - } - if (this.formResources == null) { - this.formResources = new java.util.HashMap(); - } - PSResource form = (PSResource)this.formResources.get(uri); - if (form == null) { - form = new PSImageFormResource(this.formResources.size() + 1, uri); - this.formResources.put(uri, form); - } - return form; - } - - /** {@inheritDoc} */ - public void paintImage(RenderedImage image, RendererContext context, - int x, int y, int width, int height) throws IOException { - float fx = x / 1000f; - x += currentIPPosition / 1000f; - float fy = y / 1000f; - y += currentBPPosition / 1000f; - float fw = width / 1000f; - float fh = height / 1000f; - PSImageUtils.renderBitmapImage(image, fx, fy, fw, fh, gen); - } - - /** - * Draw a line. - * - * @param startx the start x position - * @param starty the start y position - * @param endx the x end position - * @param endy the y end position - */ - private void drawLine(float startx, float starty, float endx, float endy) { - writeln(gen.formatDouble(startx) + " " - + gen.formatDouble(starty) + " M " - + gen.formatDouble(endx) + " " - + gen.formatDouble(endy) + " lineto stroke newpath"); - } - - /** Saves the graphics state of the rendering engine. */ - public void saveGraphicsState() { - endTextObject(); - try { - //delegate - gen.saveGraphicsState(); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** Restores the last graphics state of the rendering engine. */ - public void restoreGraphicsState() { - try { - endTextObject(); - //delegate - gen.restoreGraphicsState(); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * Concats the transformation matrix. - * @param a A part - * @param b B part - * @param c C part - * @param d D part - * @param e E part - * @param f F part - */ - protected void concatMatrix(double a, double b, - double c, double d, - double e, double f) { - try { - gen.concatMatrix(a, b, c, d, e, f); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * Concats the transformations matrix. - * @param matrix Matrix to use - */ - protected void concatMatrix(double[] matrix) { - try { - gen.concatMatrix(matrix); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** {@inheritDoc} */ - protected void concatenateTransformationMatrix(AffineTransform at) { - try { - gen.concatMatrix(at); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - private String getPostScriptNameForFontKey(String key) { - int pos = key.indexOf('_'); - String postFix = null; - if (pos > 0) { - postFix = key.substring(pos); - key = key.substring(0, pos); - } - Map fonts = fontInfo.getFonts(); - Typeface tf = (Typeface)fonts.get(key); - if (tf instanceof LazyFont) { - tf = ((LazyFont)tf).getRealFont(); - } - if (tf == null) { - throw new IllegalStateException("Font not available: " + key); - } - if (postFix == null) { - return tf.getFontName(); - } else { - return tf.getFontName() + postFix; - } - } - - /** - * Returns the PSResource for the given font key. - * @param key the font key ("F*") - * @return the matching PSResource - */ - protected PSResource getPSResourceForFontKey(String key) { - PSResource res = null; - if (this.fontResources != null) { - res = (PSResource)this.fontResources.get(key); - } else { - this.fontResources = new java.util.HashMap(); - } - if (res == null) { - res = new PSResource(PSResource.TYPE_FONT, getPostScriptNameForFontKey(key)); - this.fontResources.put(key, res); - } - return res; - } - - /** - * Changes the currently used font. - * @param key key of the font ("F*") - * @param size font size - */ - protected void useFont(String key, int size) { - try { - PSResource res = getPSResourceForFontKey(key); - gen.useFont("/" + res.getName(), size / 1000f); - gen.getResourceTracker().notifyResourceUsageOnPage(res); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - private void useColor(Color col) throws IOException { - gen.useColor(col); - } - - /** {@inheritDoc} */ - protected void drawBackAndBorders(Area area, float startx, float starty, - float width, float height) { - if (area.hasTrait(Trait.BACKGROUND) - || area.hasTrait(Trait.BORDER_BEFORE) - || area.hasTrait(Trait.BORDER_AFTER) - || area.hasTrait(Trait.BORDER_START) - || area.hasTrait(Trait.BORDER_END)) { - comment("%FOPBeginBackgroundAndBorder: " - + startx + " " + starty + " " + width + " " + height); - super.drawBackAndBorders(area, startx, starty, width, height); - comment("%FOPEndBackgroundAndBorder"); - } - } - - /** {@inheritDoc} */ - protected void drawBorderLine(float x1, float y1, float x2, float y2, - boolean horz, boolean startOrBefore, int style, Color col) { - try { - PSBorderPainter.drawBorderLine(gen, x1, y1, x2, y2, horz, startOrBefore, style, col); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** {@inheritDoc} */ - public void startRenderer(OutputStream outputStream) - throws IOException { - log.debug("Rendering areas to PostScript..."); - - this.outputStream = outputStream; - OutputStream out; - if (isOptimizeResources()) { - this.tempFile = File.createTempFile("fop", null); - out = new java.io.FileOutputStream(this.tempFile); - out = new java.io.BufferedOutputStream(out); - } else { - out = this.outputStream; - } - - //Setup for PostScript generation - this.gen = new PSGenerator(out) { - /** Need to subclass PSGenerator to have better URI resolution */ - public Source resolveURI(String uri) { - return userAgent.resolveURI(uri); - } - }; - this.gen.setPSLevel(getLanguageLevel()); - this.borderPainter = new PSBorderPainter(this.gen); - this.currentPageNumber = 0; - - //Initial default page device dictionary settings - this.pageDeviceDictionary = new PSPageDeviceDictionary(); - pageDeviceDictionary.setFlushOnRetrieval(!getPSUtil().isDSCComplianceEnabled()); - pageDeviceDictionary.put("/ImagingBBox", "null"); - } - - private void writeHeader() throws IOException { - //PostScript Header - writeln(DSCConstants.PS_ADOBE_30); - gen.writeDSCComment(DSCConstants.CREATOR, new String[] {userAgent.getProducer()}); - gen.writeDSCComment(DSCConstants.CREATION_DATE, new Object[] {new java.util.Date()}); - gen.writeDSCComment(DSCConstants.LANGUAGE_LEVEL, new Integer(gen.getPSLevel())); - gen.writeDSCComment(DSCConstants.PAGES, new Object[] {DSCConstants.ATEND}); - gen.writeDSCComment(DSCConstants.BBOX, DSCConstants.ATEND); - gen.writeDSCComment(DSCConstants.HIRES_BBOX, DSCConstants.ATEND); - this.documentBoundingBox = new Rectangle2D.Double(); - gen.writeDSCComment(DSCConstants.DOCUMENT_SUPPLIED_RESOURCES, - new Object[] {DSCConstants.ATEND}); - if (headerComments != null) { - for (Iterator iter = headerComments.iterator(); iter.hasNext();) { - PSExtensionAttachment comment = (PSExtensionAttachment)iter.next(); - gen.writeln("%" + comment.getContent()); - } - } - gen.writeDSCComment(DSCConstants.END_COMMENTS); - - //Defaults - gen.writeDSCComment(DSCConstants.BEGIN_DEFAULTS); - gen.writeDSCComment(DSCConstants.END_DEFAULTS); - - //Prolog and Setup written right before the first page-sequence, see startPageSequence() - //Do this only once, as soon as we have all the content for the Setup section! - //Prolog - gen.writeDSCComment(DSCConstants.BEGIN_PROLOG); - PSProcSets.writeStdProcSet(gen); - PSProcSets.writeEPSProcSet(gen); - gen.writeDSCComment(DSCConstants.END_PROLOG); - - //Setup - gen.writeDSCComment(DSCConstants.BEGIN_SETUP); - PSRenderingUtil.writeSetupCodeList(gen, setupCodeList, "SetupCode"); - if (!isOptimizeResources()) { - this.fontResources = PSFontUtils.writeFontDict(gen, fontInfo); - } else { - gen.commentln("%FOPFontSetup"); //Place-holder, will be replaced in the second pass - } - gen.writeDSCComment(DSCConstants.END_SETUP); - } - - /** {@inheritDoc} */ - public void stopRenderer() throws IOException { - //Write trailer - gen.writeDSCComment(DSCConstants.TRAILER); - if (footerComments != null) { - for (Iterator iter = footerComments.iterator(); iter.hasNext();) { - PSExtensionAttachment comment = (PSExtensionAttachment)iter.next(); - gen.commentln("%" + comment.getContent()); - } - footerComments.clear(); - } - gen.writeDSCComment(DSCConstants.PAGES, new Integer(this.currentPageNumber)); - new DSCCommentBoundingBox(this.documentBoundingBox).generate(gen); - new DSCCommentHiResBoundingBox(this.documentBoundingBox).generate(gen); - gen.getResourceTracker().writeResources(false, gen); - gen.writeDSCComment(DSCConstants.EOF); - gen.flush(); - log.debug("Rendering to PostScript complete."); - if (isOptimizeResources()) { - IOUtils.closeQuietly(gen.getOutputStream()); - rewritePostScriptFile(); - } - if (footerComments != null) { - headerComments.clear(); - } - if (pageDeviceDictionary != null) { - pageDeviceDictionary.clear(); - } - this.borderPainter = null; - this.gen = null; - } - - /** - * Used for two-pass production. This will rewrite the PostScript file from the temporary - * file while adding all needed resources. - * @throws IOException In case of an I/O error. - */ - private void rewritePostScriptFile() throws IOException { - log.debug("Processing PostScript resources..."); - long startTime = System.currentTimeMillis(); - ResourceTracker resTracker = gen.getResourceTracker(); - InputStream in = new java.io.FileInputStream(this.tempFile); - in = new java.io.BufferedInputStream(in); - try { - try { - ResourceHandler handler = new ResourceHandler(this.userAgent, this.fontInfo, - resTracker, this.formResources); - handler.process(in, this.outputStream, - this.currentPageNumber, this.documentBoundingBox); - this.outputStream.flush(); - } catch (DSCException e) { - throw new RuntimeException(e.getMessage()); - } - } finally { - IOUtils.closeQuietly(in); - if (!this.tempFile.delete()) { - this.tempFile.deleteOnExit(); - log.warn("Could not delete temporary file: " + this.tempFile); - } - } - if (log.isDebugEnabled()) { - long duration = System.currentTimeMillis() - startTime; - log.debug("Resource Processing complete in " + duration + " ms."); - } - } - - /** {@inheritDoc} */ - public void processOffDocumentItem(OffDocumentItem oDI) { - if (log.isDebugEnabled()) { - log.debug("Handling OffDocumentItem: " + oDI.getName()); - } - if (oDI instanceof OffDocumentExtensionAttachment) { - ExtensionAttachment attachment = ((OffDocumentExtensionAttachment)oDI).getAttachment(); - if (attachment != null) { - if (PSExtensionAttachment.CATEGORY.equals(attachment.getCategory())) { - if (attachment instanceof PSSetupCode) { - if (setupCodeList == null) { - setupCodeList = new java.util.ArrayList(); - } - if (!setupCodeList.contains(attachment)) { - setupCodeList.add(attachment); - } - } else if (attachment instanceof PSSetPageDevice) { - /** - * Extract all PSSetPageDevice instances from the - * attachment list on the s-p-m and add all dictionary - * entries to our internal representation of the the - * page device dictionary. - */ - PSSetPageDevice setPageDevice = (PSSetPageDevice)attachment; - String content = setPageDevice.getContent(); - if (content != null) { - try { - this.pageDeviceDictionary.putAll(PSDictionary.valueOf(content)); - } catch (PSDictionaryFormatException e) { - PSEventProducer eventProducer = PSEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.postscriptDictionaryParseError(this, content, e); - } - } - } else if (attachment instanceof PSCommentBefore) { - if (headerComments == null) { - headerComments = new java.util.ArrayList(); - } - headerComments.add(attachment); - } else if (attachment instanceof PSCommentAfter) { - if (footerComments == null) { - footerComments = new java.util.ArrayList(); - } - footerComments.add(attachment); - } - } - } - } - super.processOffDocumentItem(oDI); - } - - /** {@inheritDoc} */ - public void renderPage(PageViewport page) - throws IOException, FOPException { - log.debug("renderPage(): " + page); - - if (this.currentPageNumber == 0) { - writeHeader(); - } - - this.currentPageNumber++; - - gen.getResourceTracker().notifyStartNewPage(); - gen.getResourceTracker().notifyResourceUsageOnPage(PSProcSets.STD_PROCSET); - gen.writeDSCComment(DSCConstants.PAGE, new Object[] - {page.getPageNumberString(), - new Integer(this.currentPageNumber)}); - - double pageWidth = page.getViewArea().width / 1000f; - double pageHeight = page.getViewArea().height / 1000f; - boolean rotate = false; - List pageSizes = new java.util.ArrayList(); - if (getPSUtil().isAutoRotateLandscape() && (pageHeight < pageWidth)) { - rotate = true; - pageSizes.add(new Long(Math.round(pageHeight))); - pageSizes.add(new Long(Math.round(pageWidth))); - } else { - pageSizes.add(new Long(Math.round(pageWidth))); - pageSizes.add(new Long(Math.round(pageHeight))); - } - pageDeviceDictionary.put("/PageSize", pageSizes); - - if (page.hasExtensionAttachments()) { - for (Iterator iter = page.getExtensionAttachments().iterator(); - iter.hasNext();) { - ExtensionAttachment attachment = (ExtensionAttachment) iter.next(); - if (attachment instanceof PSSetPageDevice) { - /** - * Extract all PSSetPageDevice instances from the - * attachment list on the s-p-m and add all - * dictionary entries to our internal representation - * of the the page device dictionary. - */ - PSSetPageDevice setPageDevice = (PSSetPageDevice)attachment; - String content = setPageDevice.getContent(); - if (content != null) { - try { - pageDeviceDictionary.putAll(PSDictionary.valueOf(content)); - } catch (PSDictionaryFormatException e) { - PSEventProducer eventProducer = PSEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.postscriptDictionaryParseError(this, content, e); - } - } - } - } - } - - try { - if (setupCodeList != null) { - PSRenderingUtil.writeEnclosedExtensionAttachments(gen, setupCodeList); - setupCodeList.clear(); - } - } catch (IOException e) { - log.error(e.getMessage()); - } - final Integer zero = new Integer(0); - Rectangle2D pageBoundingBox = new Rectangle2D.Double(); - if (rotate) { - pageBoundingBox.setRect(0, 0, pageHeight, pageWidth); - gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] { - zero, zero, new Long(Math.round(pageHeight)), - new Long(Math.round(pageWidth)) }); - gen.writeDSCComment(DSCConstants.PAGE_HIRES_BBOX, new Object[] { - zero, zero, new Double(pageHeight), - new Double(pageWidth) }); - gen.writeDSCComment(DSCConstants.PAGE_ORIENTATION, "Landscape"); - } else { - pageBoundingBox.setRect(0, 0, pageWidth, pageHeight); - gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] { - zero, zero, new Long(Math.round(pageWidth)), - new Long(Math.round(pageHeight)) }); - gen.writeDSCComment(DSCConstants.PAGE_HIRES_BBOX, new Object[] { - zero, zero, new Double(pageWidth), - new Double(pageHeight) }); - if (getPSUtil().isAutoRotateLandscape()) { - gen.writeDSCComment(DSCConstants.PAGE_ORIENTATION, - "Portrait"); - } - } - this.documentBoundingBox.add(pageBoundingBox); - gen.writeDSCComment(DSCConstants.PAGE_RESOURCES, - new Object[] {DSCConstants.ATEND}); - - gen.commentln("%FOPSimplePageMaster: " + page.getSimplePageMasterName()); - - gen.writeDSCComment(DSCConstants.BEGIN_PAGE_SETUP); - - if (page.hasExtensionAttachments()) { - List extensionAttachments = page.getExtensionAttachments(); - for (int i = 0; i < extensionAttachments.size(); i++) { - Object attObj = extensionAttachments.get(i); - if (attObj instanceof PSExtensionAttachment) { - PSExtensionAttachment attachment = (PSExtensionAttachment)attObj; - if (attachment instanceof PSCommentBefore) { - gen.commentln("%" + attachment.getContent()); - } else if (attachment instanceof PSSetupCode) { - gen.writeln(attachment.getContent()); - } - } - } - } - - // Write any unwritten changes to page device dictionary - if (!pageDeviceDictionary.isEmpty()) { - String content = pageDeviceDictionary.getContent(); - if (getPSUtil().isSafeSetPageDevice()) { - content += " SSPD"; - } else { - content += " setpagedevice"; - } - PSRenderingUtil.writeEnclosedExtensionAttachment(gen, new PSSetPageDevice(content)); - } - - if (rotate) { - gen.writeln(Math.round(pageHeight) + " 0 translate"); - gen.writeln("90 rotate"); - } - concatMatrix(1, 0, 0, -1, 0, pageHeight); - - gen.writeDSCComment(DSCConstants.END_PAGE_SETUP); - - //Process page - super.renderPage(page); - - //Show page - gen.showPage(); - gen.writeDSCComment(DSCConstants.PAGE_TRAILER); - if (page.hasExtensionAttachments()) { - List extensionAttachments = page.getExtensionAttachments(); - for (int i = 0; i < extensionAttachments.size(); i++) { - Object attObj = extensionAttachments.get(i); - if (attObj instanceof PSExtensionAttachment) { - PSExtensionAttachment attachment = (PSExtensionAttachment)attObj; - if (attachment instanceof PSCommentAfter) { - gen.commentln("%" + attachment.getContent()); - } - } - } - } - gen.getResourceTracker().writeResources(true, gen); - } - - /** {@inheritDoc} */ - protected void renderRegionViewport(RegionViewport port) { - if (port != null) { - comment("%FOPBeginRegionViewport: " + port.getRegionReference().getRegionName()); - super.renderRegionViewport(port); - comment("%FOPEndRegionViewport"); - } - } - - /** Indicates the beginning of a text object. */ - protected void beginTextObject() { - if (!inTextMode) { - saveGraphicsState(); - writeln("BT"); - inTextMode = true; - } - } - - /** Indicates the end of a text object. */ - protected void endTextObject() { - if (inTextMode) { - inTextMode = false; //set before restoreGraphicsState() to avoid recursion - writeln("ET"); - restoreGraphicsState(); - } - } - - /** {@inheritDoc} */ - public void renderText(TextArea area) { - renderInlineAreaBackAndBorders(area); - String fontkey = getInternalFontNameForArea(area); - int fontsize = area.getTraitAsInteger(Trait.FONT_SIZE); - - // This assumes that *all* CIDFonts use a /ToUnicode mapping - Typeface tf = (Typeface) fontInfo.getFonts().get(fontkey); - - //Determine position - int rx = currentIPPosition + area.getBorderAndPaddingWidthStart(); - int bl = currentBPPosition + area.getOffset() + area.getBaselineOffset(); - - Color ct = (Color)area.getTrait(Trait.COLOR); - if (ct != null) { - try { - useColor(ct); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - beginTextObject(); - writeln("1 0 0 -1 " + gen.formatDouble(rx / 1000f) - + " " + gen.formatDouble(bl / 1000f) + " Tm"); - - super.renderText(area); //Updates IPD - - renderTextDecoration(tf, fontsize, area, bl, rx); - } - - /** {@inheritDoc} */ - protected void renderWord(WordArea word) { - renderText((TextArea)word.getParentArea(), word.getWord(), word.getLetterAdjustArray()); - super.renderWord(word); - } - - /** {@inheritDoc} */ - protected void renderSpace(SpaceArea space) { - AbstractTextArea textArea = (AbstractTextArea)space.getParentArea(); - String s = space.getSpace(); - char sp = s.charAt(0); - Font font = getFontFromArea(textArea); - - int tws = (space.isAdjustable() - ? ((TextArea) space.getParentArea()).getTextWordSpaceAdjust() - + 2 * textArea.getTextLetterSpaceAdjust() - : 0); - - rmoveTo((font.getCharWidth(sp) + tws) / 1000f, 0); - super.renderSpace(space); - } - - private Typeface getTypeface(String fontName) { - Typeface tf = (Typeface)fontInfo.getFonts().get(fontName); - if (tf instanceof LazyFont) { - tf = ((LazyFont)tf).getRealFont(); - } - return tf; - } - - private void renderText(AbstractTextArea area, String text, int[] letterAdjust) { - String fontkey = getInternalFontNameForArea(area); - int fontSize = area.getTraitAsInteger(Trait.FONT_SIZE); - Font font = getFontFromArea(area); - Typeface tf = getTypeface(font.getFontName()); - SingleByteFont singleByteFont = null; - if (tf instanceof SingleByteFont) { - singleByteFont = (SingleByteFont)tf; - } - - int textLen = text.length(); - if (singleByteFont != null && singleByteFont.hasAdditionalEncodings()) { - int start = 0; - int currentEncoding = -1; - for (int i = 0; i < textLen; i++) { - char c = text.charAt(i); - char mapped = tf.mapChar(c); - int encoding = mapped / 256; - if (currentEncoding != encoding) { - if (i > 0) { - writeText(area, text, start, i - start, letterAdjust, fontSize, tf); - } - if (encoding == 0) { - useFont(fontkey, fontSize); - } else { - useFont(fontkey + "_" + Integer.toString(encoding), fontSize); - } - currentEncoding = encoding; - start = i; - } - } - writeText(area, text, start, textLen - start, letterAdjust, fontSize, tf); - } else { - useFont(fontkey, fontSize); - writeText(area, text, 0, textLen, letterAdjust, fontSize, tf); - } - } - - private void writeText(AbstractTextArea area, String text, int start, int len, - int[] letterAdjust, int fontsize, Typeface tf) { - int end = start + len; - int initialSize = text.length(); - initialSize += initialSize / 2; - StringBuffer sb = new StringBuffer(initialSize); - if (letterAdjust == null - && area.getTextLetterSpaceAdjust() == 0 - && area.getTextWordSpaceAdjust() == 0) { - sb.append("("); - for (int i = start; i < end; i++) { - final char c = text.charAt(i); - final char mapped = (char)(tf.mapChar(c) % 256); - PSGenerator.escapeChar(mapped, sb); - } - sb.append(") t"); - } else { - sb.append("("); - int[] offsets = new int[len]; - for (int i = start; i < end; i++) { - final char c = text.charAt(i); - final char mapped = tf.mapChar(c); - char codepoint = (char)(mapped % 256); - int wordSpace; - - if (CharUtilities.isAdjustableSpace(mapped)) { - wordSpace = area.getTextWordSpaceAdjust(); - } else { - wordSpace = 0; - } - int cw = tf.getWidth(mapped, fontsize) / 1000; - int ladj = (letterAdjust != null && i < end - 1 ? letterAdjust[i + 1] : 0); - int tls = (i < end - 1 ? area.getTextLetterSpaceAdjust() : 0); - offsets[i - start] = cw + ladj + tls + wordSpace; - PSGenerator.escapeChar(codepoint, sb); - } - sb.append(")" + PSGenerator.LF + "["); - for (int i = 0; i < len; i++) { - if (i > 0) { - if (i % 8 == 0) { - sb.append(PSGenerator.LF); - } else { - sb.append(" "); - } - } - sb.append(gen.formatDouble(offsets[i] / 1000f)); - } - sb.append("]" + PSGenerator.LF + "xshow"); - } - writeln(sb.toString()); - } - - /** {@inheritDoc} */ - protected List breakOutOfStateStack() { - try { - List breakOutList = new java.util.ArrayList(); - PSState state; - while (true) { - if (breakOutList.size() == 0) { - endTextObject(); - comment("------ break out!"); - } - state = gen.getCurrentState(); - if (!gen.restoreGraphicsState()) { - break; - } - breakOutList.add(0, state); //Insert because of stack-popping - } - return breakOutList; - } catch (IOException ioe) { - handleIOTrouble(ioe); - return null; - } - } - - /** {@inheritDoc} */ - protected void restoreStateStackAfterBreakOut(List breakOutList) { - try { - comment("------ restoring context after break-out..."); - PSState state; - Iterator i = breakOutList.iterator(); - while (i.hasNext()) { - state = (PSState)i.next(); - saveGraphicsState(); - state.reestablish(gen); - } - comment("------ done."); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - } - - /** - * {@inheritDoc} - */ - protected void startVParea(CTM ctm, Rectangle2D clippingRect) { - saveGraphicsState(); - if (clippingRect != null) { - clipRect((float)clippingRect.getX() / 1000f, - (float)clippingRect.getY() / 1000f, - (float)clippingRect.getWidth() / 1000f, - (float)clippingRect.getHeight() / 1000f); - } - // multiply with current CTM - final double[] matrix = ctm.toArray(); - matrix[4] /= 1000f; - matrix[5] /= 1000f; - concatMatrix(matrix); - } - - /** - * {@inheritDoc} - */ - protected void endVParea() { - restoreGraphicsState(); - } - - /** {@inheritDoc} */ - protected void renderBlockViewport(BlockViewport bv, List children) { - comment("%FOPBeginBlockViewport: " + bv.toString()); - super.renderBlockViewport(bv, children); - comment("%FOPEndBlockViewport"); - } - - /** {@inheritDoc} */ - protected void renderInlineParent(InlineParent ip) { - super.renderInlineParent(ip); - } - - /** {@inheritDoc} */ - public void renderLeader(Leader area) { - renderInlineAreaBackAndBorders(area); - - int style = area.getRuleStyle(); - int ruleThickness = area.getRuleThickness(); - int startx = currentIPPosition + area.getBorderAndPaddingWidthStart(); - int starty = currentBPPosition + area.getOffset() + (ruleThickness / 2); - int endx = currentIPPosition - + area.getBorderAndPaddingWidthStart() - + area.getIPD(); - Color col = (Color)area.getTrait(Trait.COLOR); - - endTextObject(); - try { - borderPainter.drawLine(new Point(startx, starty), new Point(endx, starty), - ruleThickness, col, RuleStyle.valueOf(style)); - } catch (IOException ioe) { - handleIOTrouble(ioe); - } - - super.renderLeader(area); - } - - /** - * {@inheritDoc} - */ - public void renderImage(Image image, Rectangle2D pos) { - drawImage(image.getURL(), pos, image.getForeignAttributes()); - } - - /** - * {@inheritDoc} - */ - protected RendererContext createRendererContext(int x, int y, int width, int height, - Map foreignAttributes) { - RendererContext context = super.createRendererContext( - x, y, width, height, foreignAttributes); - context.setProperty(PSRendererContextConstants.PS_GENERATOR, this.gen); - context.setProperty(PSRendererContextConstants.PS_FONT_INFO, fontInfo); - return context; - } - - /** {@inheritDoc} */ - public String getMimeType() { - return MIME_TYPE; - } - - /** - * Sets whether or not the safe set page device macro should be used - * (as opposed to directly invoking setpagedevice) when setting the - * postscript page device. - * - * This option is a useful option when you want to guard against the possibility - * of invalid/unsupported postscript key/values being placed in the page device. - * - * @param safeSetPageDevice setting to false and the renderer will make a - * standard "setpagedevice" call, setting to true will make a safe set page - * device macro call (default is false). - */ - public void setSafeSetPageDevice(boolean safeSetPageDevice) { - getPSUtil().setSafeSetPageDevice(safeSetPageDevice); - } - - /** - * Sets whether or not PostScript Document Structuring Conventions (dsc) compliance are - * enforced. - * <p> - * It can cause problems (unwanted PostScript subsystem initgraphics/erasepage calls) - * on some printers when the pagedevice is set. If this causes problems on a - * particular implementation then use this setting with a 'false' value to try and - * minimize the number of setpagedevice calls in the postscript document output. - * <p> - * Set this value to false if you experience unwanted blank pages in your - * postscript output. - * @param dscCompliant boolean value (default is true) - */ - public void setDSCCompliant(boolean dscCompliant) { - getPSUtil().setDSCComplianceEnabled(dscCompliant); - } - -} diff --git a/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java b/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java index 0f880a928..2280bf0dc 100644 --- a/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java +++ b/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java @@ -45,18 +45,12 @@ public class PSRendererConfigurator extends PrintRendererConfigurator } /** - * Configure the PS renderer. - * @param renderer postscript renderer - * @throws FOPException fop exception + * Throws an UnsupportedOperationException. + * + * @param renderer not used */ - public void configure(Renderer renderer) throws FOPException { - Configuration cfg = super.getRendererConfig(renderer); - if (cfg != null) { - super.configure(renderer); - - PSRenderer psRenderer = (PSRenderer)renderer; - configure(psRenderer.getPSUtil(), cfg); - } + public void configure(Renderer renderer) { + throw new UnsupportedOperationException(); } private void configure(PSRenderingUtil psUtil, Configuration cfg) { diff --git a/src/java/org/apache/fop/render/ps/PSRendererContextConstants.java b/src/java/org/apache/fop/render/ps/PSRendererContextConstants.java index 433f2ce7c..3150e4273 100644 --- a/src/java/org/apache/fop/render/ps/PSRendererContextConstants.java +++ b/src/java/org/apache/fop/render/ps/PSRendererContextConstants.java @@ -27,10 +27,9 @@ import org.apache.fop.render.RendererContextConstants; public interface PSRendererContextConstants extends RendererContextConstants { /** The PostScript generator that is being used to drawn into. */ - public static final String PS_GENERATOR = "psGenerator"; + String PS_GENERATOR = "psGenerator"; /** The font information for the PostScript renderer. */ - public static final String PS_FONT_INFO = "psFontInfo"; - + String PS_FONT_INFO = "psFontInfo"; } diff --git a/src/java/org/apache/fop/render/ps/PSRendererMaker.java b/src/java/org/apache/fop/render/ps/PSRendererMaker.java deleted file mode 100644 index 8c64f2806..000000000 --- a/src/java/org/apache/fop/render/ps/PSRendererMaker.java +++ /dev/null @@ -1,54 +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.render.ps; - -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.render.AbstractRendererMaker; -import org.apache.fop.render.Renderer; -import org.apache.fop.render.RendererConfigurator; - -/** - * RendererMaker for the PostScript Renderer. - */ -public class PSRendererMaker extends AbstractRendererMaker { - - private static final String[] MIMES = new String[] {MimeConstants.MIME_POSTSCRIPT}; - - /** {@inheritDoc} */ - public Renderer makeRenderer(FOUserAgent userAgent) { - return new PSRenderer(); - } - - /** {@inheritDoc} */ - public RendererConfigurator getConfigurator(FOUserAgent userAgent) { - return new PSRendererConfigurator(userAgent); - } - - /** {@inheritDoc} */ - public boolean needsOutputStream() { - return true; - } - - /** {@inheritDoc} */ - public String[] getSupportedMimeTypes() { - return MIMES; - } -} diff --git a/src/java/org/apache/fop/render/ps/PSRenderingUtil.java b/src/java/org/apache/fop/render/ps/PSRenderingUtil.java index 696634a48..d7890d144 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderingUtil.java +++ b/src/java/org/apache/fop/render/ps/PSRenderingUtil.java @@ -229,6 +229,7 @@ public class PSRenderingUtil implements PSConfigurationConstants { this.dscCompliant = value; } + /** @return true if DSC complicance is enabled */ public boolean isDSCComplianceEnabled() { return this.dscCompliant; } diff --git a/src/java/org/apache/fop/render/ps/PSSVGHandler.java b/src/java/org/apache/fop/render/ps/PSSVGHandler.java index 5cc1a1b01..14e2beddd 100644 --- a/src/java/org/apache/fop/render/ps/PSSVGHandler.java +++ b/src/java/org/apache/fop/render/ps/PSSVGHandler.java @@ -30,8 +30,6 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.GVTBuilder; import org.apache.batik.gvt.GraphicsNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; import org.apache.xmlgraphics.ps.PSGenerator; @@ -57,9 +55,6 @@ import org.apache.fop.svg.SVGUserAgent; public class PSSVGHandler extends AbstractGenericSVGHandler implements PSRendererContextConstants { - /** logging instance */ - private static Log log = LogFactory.getLog(PSSVGHandler.class); - /** * Create a new PostScript XML handler for use by the PostScript renderer. */ @@ -338,7 +333,7 @@ public class PSSVGHandler extends AbstractGenericSVGHandler /** {@inheritDoc} */ public boolean supportsRenderer(Renderer renderer) { - return (renderer instanceof PSRenderer); + return false; } } diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index 4625ff299..e3dace703 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -49,7 +49,7 @@ import org.apache.fop.svg.NativeTextPainter; import org.apache.fop.util.CharUtilities; /** - * Renders the attributed character iterator of a {@link TextNode}. + * Renders the attributed character iterator of a text node. * This class draws the text directly using PostScript text operators so * the text is not drawn using shapes which makes the PS files larger. * <p> diff --git a/src/java/org/apache/fop/render/rtf/RTFEventProducer.java b/src/java/org/apache/fop/render/rtf/RTFEventProducer.java index b2b47d7f2..5c12c4e2c 100644 --- a/src/java/org/apache/fop/render/rtf/RTFEventProducer.java +++ b/src/java/org/apache/fop/render/rtf/RTFEventProducer.java @@ -31,7 +31,10 @@ import org.apache.fop.fo.FONode; public interface RTFEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index fc42a1b8f..5698329c8 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -1468,7 +1468,7 @@ public class RTFHandler extends FOEventHandler { * @param foNode FO node whose event is to be called * @param bStart TRUE calls the start handler, FALSE the end handler */ - private void invokeDeferredEvent(FONode foNode, boolean bStart) { + private void invokeDeferredEvent(FONode foNode, boolean bStart) { // CSOK: MethodLength if (foNode instanceof PageSequence) { if (bStart) { startPageSequence( (PageSequence) foNode); diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java index 764c2c93e..2944b230a 100644 --- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java @@ -65,11 +65,8 @@ public final class TableAttributesConverter { /** * Converts table-only attributes to rtf attributes. * - * @param attrs Given attributes - * @param defaultAttributes Default rtf attributes - * + * @param fobj the table for which the attributes are converted * @return All valid rtf attributes together - * * @throws ConverterException On convertion error */ static RtfAttributes convertTableAttributes(Table fobj) @@ -83,11 +80,8 @@ public final class TableAttributesConverter { /** * Converts table-only attributes to rtf attributes. * - * @param attrs Given attributes - * @param defaultAttributes Default rtf attributes - * + * @param part the table part for which the attributes are converted * @return All valid rtf attributes together - * * @throws ConverterException On convertion error */ static RtfAttributes convertTablePartAttributes(TablePart part) @@ -226,8 +220,6 @@ public final class TableAttributesConverter { * Converts table and row attributes to rtf attributes. * * @param fobj FObj to be converted - * @param defaultAttributes Default rtf attributes - * * @return All valid rtf attributes together * @throws ConverterException On converion error */ diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java index 63c470b5d..1b7e21bd3 100644 --- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java @@ -68,7 +68,7 @@ final class TextAttributesConverter { /** * Converts all known text FO properties to RtfAttributes - * @param props list of FO properites, which are to be converted + * @param fobj the FO for which the attributes are to be converted */ public static RtfAttributes convertAttributes(Block fobj) throws FOPException { @@ -86,7 +86,7 @@ final class TextAttributesConverter { /** * Converts all known text FO properties to RtfAttributes - * @param props list of FO properites, which are to be converted + * @param fobj FObj whose properties are to be converted */ public static RtfAttributes convertBlockContainerAttributes(BlockContainer fobj) throws FOPException { @@ -442,7 +442,7 @@ final class TextAttributesConverter { /** * Reads background-color from bl and writes it to rtfAttr. * - * @param bl the Block object the properties are read from + * @param bpb the CommonBorderPaddingBackground from which the properties are read * @param rtfAttr the RtfAttributes object the attributes are written to */ private static void attrBackgroundColor(CommonBorderPaddingBackground bpb, diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java index aec0237e5..f231a1f06 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java @@ -33,16 +33,15 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc; * */ -public class ParagraphKeeptogetherContext { +public final class ParagraphKeeptogetherContext { private static int paraKeepTogetherOpen = 0; private static boolean paraResetProperties = false; private static ParagraphKeeptogetherContext instance = null; - ParagraphKeeptogetherContext() { + private ParagraphKeeptogetherContext() { } - /** * Singelton. * diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java index f691c211c..7da14061e 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java @@ -59,8 +59,8 @@ public class RtfBookmark extends RtfElement { * @param writer a <code>Writer</code> value * @param bookmark Name of the bookmark */ - RtfBookmark (RtfContainer parent, Writer w, String bookmark) throws IOException { - super (parent, w); + RtfBookmark (RtfContainer parent, Writer writer, String bookmark) throws IOException { + super (parent, writer); int now = bookmark.length (); diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java index 6123ac563..e2a19389e 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java @@ -87,8 +87,8 @@ public class RtfExternalGraphic extends RtfElement { /** * Convert image data if necessary - for example when format is not supported by rtf. * + * @param format Format type * @param data Image - * @param type Format type */ public FormatBase convert(FormatBase format, byte[] data) { return format; @@ -640,7 +640,7 @@ public class RtfExternalGraphic extends RtfElement { tmpUrl = new URL (urlString); } catch (MalformedURLException e) { try { - tmpUrl = new File (urlString).toURL (); + tmpUrl = new File (urlString).toURI().toURL (); } catch (MalformedURLException ee) { throw new ExternalGraphicException("The attribute 'src' of " + "<fo:external-graphic> has a invalid value: '" diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java index 631f2d901..c08008fee 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java @@ -102,6 +102,13 @@ public class RtfExtraRowSet extends RtfContainer { return result; } + public int hashCode() { + int hc = super.hashCode(); + hc ^= ( hc * 11 ) + xOffset; + hc ^= ( hc * 19 ) + rowIndex; + return hc; + } + public boolean equals(Object o) { return o != null && this.compareTo(o) == 0; } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java index d5eaa304d..9376f5564 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java @@ -80,9 +80,10 @@ extends RtfContainer { * If called, must be called before startDocumentArea * @return the new RtfHeader * @throws IOException for I/O problems + * @throws RtfStructureException for illegal RTF structure */ public RtfHeader startHeader() - throws IOException { + throws IOException, RtfStructureException { if (header != null) { throw new RtfStructureException("startHeader called more than once"); } @@ -128,7 +129,7 @@ extends RtfContainer { * @throws RtfStructureException for illegal RTF structure */ public RtfPageArea startPageArea() - throws IOException { + throws IOException, RtfStructureException { if (pageArea != null) { throw new RtfStructureException("startPageArea called more than once"); } @@ -149,7 +150,7 @@ extends RtfContainer { * @throws RtfStructureException for illegal RTF structure */ public RtfPageArea getPageArea() - throws IOException { + throws IOException, RtfStructureException { if (pageArea == null) { return startPageArea(); } @@ -164,7 +165,7 @@ extends RtfContainer { * @throws RtfStructureException for illegal RTF structure */ public RtfDocumentArea startDocumentArea() - throws IOException { + throws IOException, RtfStructureException { if (docArea != null) { throw new RtfStructureException("startDocumentArea called more than once"); } @@ -187,7 +188,7 @@ extends RtfContainer { * @throws RtfStructureException for illegal RTF structure */ public RtfDocumentArea getDocumentArea() - throws IOException { + throws IOException, RtfStructureException { if (docArea == null) { return startDocumentArea(); } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java index f3b2ebf72..1a71ed670 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java @@ -17,7 +17,6 @@ /* $Id$ */ - package org.apache.fop.render.rtf.rtflib.rtfdoc; //Java @@ -33,18 +32,27 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun; */ public class RtfFootnote extends RtfContainer implements IRtfTextrunContainer, IRtfListContainer { - RtfTextrun textrunInline = null; - RtfContainer body = null; - RtfList list = null; - boolean bBody = false; + RtfTextrun textrunInline = null; // CSOK: VisibilityModifier + RtfContainer body = null; // CSOK: VisibilityModifier + RtfList list = null; // CSOK: VisibilityModifier + boolean bBody = false; // CSOK: VisibilityModifier - /** Create an RTF list item as a child of given container with default attributes */ + /** + * Create an RTF list item as a child of given container with default attributes. + * @param parent a container + * @param w a writer + * @throws IOException if not caught + */ RtfFootnote(RtfContainer parent, Writer w) throws IOException { super(parent, w); textrunInline = new RtfTextrun(this, writer, null); body = new RtfContainer(this, writer); } + /** + * @return a text run + * @throws IOException if not caught + */ public RtfTextrun getTextrun() throws IOException { if (bBody) { RtfTextrun textrun = RtfTextrun.getTextrun(body, writer, null); @@ -72,6 +80,11 @@ public class RtfFootnote extends RtfContainer writeGroupMark(false); } + /** + * @param attrs some attributes + * @return an rtf list + * @throws IOException if not caught + */ public RtfList newList(RtfAttributes attrs) throws IOException { if (list != null) { list.close(); @@ -82,10 +95,12 @@ public class RtfFootnote extends RtfContainer return list; } + /** start body */ public void startBody() { bBody = true; } + /** end body */ public void endBody() { bBody = false; } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java index 1dd00c66d..ce51f93a0 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java @@ -27,7 +27,12 @@ import java.io.Writer; */ public class RtfGenerator extends RtfElement { - /** Default constructor for the generator element. */ + /** + * Default constructor for the generator element. + * @param h a header + * @param w a writer + * @throws IOException if not caught + */ public RtfGenerator(RtfHeader h, Writer w) throws IOException { super(h, w); } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java index cd80c6993..a021948ab 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java @@ -57,7 +57,7 @@ implements IRtfTextContainer, /** - * Default constructor. + * A constructor. * * @param parent a <code>RtfContainer</code> value * @param writer a <code>Writer</code> value @@ -71,6 +71,14 @@ implements IRtfTextContainer, new RtfText (this, writer, str, attr); } + /** + * A constructor. + * + * @param parent a <code>RtfContainer</code> value + * @param writer a <code>Writer</code> value + * @param attr a <code>RtfAttributes</code> value + * @throws IOException for I/O problems + */ public RtfHyperLink (RtfTextrun parent, Writer writer, RtfAttributes attr) throws IOException { super ((RtfContainer) parent, writer, attr); @@ -217,8 +225,11 @@ implements IRtfTextContainer, return false; } - public RtfTextrun getTextrun() - throws IOException { + /** + * @return a text run + * @throws IOException if not caught + */ + public RtfTextrun getTextrun() throws IOException { RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, null); return textrun; } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java index f44199bee..13748a3bf 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java @@ -26,9 +26,8 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc; * the FOP project. */ -import java.io.Writer; import java.io.IOException; -import java.util.Date; +import java.io.Writer; import java.util.Random; /** diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java index c7cc6d36f..7ef4b98b9 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.rtfdoc; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,8 +26,6 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.rtfdoc; - import java.io.IOException; import java.io.Writer; @@ -59,10 +58,12 @@ public class RtfString extends RtfElement { RtfStringConverter.getInstance().writeRtfString(writer, text); } + /** @return the text */ public String getText() { return text; } + /** @param s some text */ public void setText(String s) { text = s; } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java index 40460bb4d..9afe35b29 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.rtfdoc; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,8 +26,6 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.rtfdoc; - import java.util.Map; import java.util.HashMap; import java.io.IOException; @@ -36,9 +35,9 @@ import java.io.Writer; * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ -public class RtfStringConverter { - private static final RtfStringConverter INSTANCE = new RtfStringConverter(); +public final class RtfStringConverter { + private static final RtfStringConverter INSTANCE = new RtfStringConverter(); private static final Map SPECIAL_CHARS; private static final Character DBLQUOTE = new Character('\"'); private static final Character QUOTE = new Character('\''); diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java index b838fb8a4..30dee96d7 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.rtfdoc; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,8 +26,6 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.rtfdoc; - import java.util.Vector; import java.util.Hashtable; import java.io.IOException; @@ -37,7 +36,7 @@ import java.util.Iterator; * This class belongs to the <jfor:stylesheet> tag processing. * @author <a href="mailto:a.putz@skynamics.com">Andreas Putz</a> */ -public class RtfStyleSheetTable { +public final class RtfStyleSheetTable { ////////////////////////////////////////////////// // @@ Symbolic constants ////////////////////////////////////////////////// diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java index 09c39be12..da11de1bc 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java @@ -181,8 +181,8 @@ public class RtfTableCell } /** used by RtfTableRow to write the <celldef> cell definition control words - * @param widthOffset sum of the widths of preceeding cells in same row - * @return widthOffset + width of this cell + * @param offset sum of the widths of preceeding cells in same row + * @return offset + width of this cell */ int writeCellDef(int offset) throws IOException { /* diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java index a02d6db8f..74e9eca25 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.rtfdoc; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,8 +26,6 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.rtfdoc; - import java.io.IOException; /** @@ -34,7 +33,7 @@ import java.io.IOException; * This class belongs to the <jfor:style-template> tag processing. */ -public class RtfTemplate { +public final class RtfTemplate { /** Singelton instance */ private static RtfTemplate instance = null; diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java index b176e1ee2..f7c08d628 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.rtfdoc; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,8 +26,6 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.rtfdoc; - import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java index a9ba432b1..4831ffd86 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java @@ -355,8 +355,8 @@ public class RtfTextrun extends RtfContainer { * Maybe this can be done more efficient. */ - boolean bHasTableCellParent = - this.getParentOfClass(RtfTableCell.class) != null; + boolean bHasTableCellParent + = this.getParentOfClass(RtfTableCell.class) != null; RtfAttributes attrBlockLevel = new RtfAttributes(); //determine, if this RtfTextrun is the last child of its parent diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java index 339434b69..723b4fb00 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.rtfdoc; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,8 +26,6 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.rtfdoc; - import java.util.Iterator; import java.util.StringTokenizer; @@ -34,11 +33,15 @@ import java.util.StringTokenizer; * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ -class WhitespaceCollapser { +final class WhitespaceCollapser { + private static final String SPACE = " "; private boolean lastEndSpace = true; - /** remove extra whitespace in RtfText elements that are inside c */ + /** + * Remove extra whitespace in RtfText elements that are inside container. + * @param c the container + */ WhitespaceCollapser(RtfContainer c) { // process all texts for (Iterator it = c.getChildren().iterator(); it.hasNext();) { @@ -56,6 +59,11 @@ class WhitespaceCollapser { } } + /** @return last end space */ + public boolean getLastEndSpace() { + return lastEndSpace; + } + /** process one RtfText from our container */ private void processText(RtfText txt) { final String newString = processString(txt.getText()); diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java b/src/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java index 430231792..547c959d3 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java @@ -49,6 +49,10 @@ public class BuilderContext { /** Rtf options */ private IRtfOptions options; + /** + * Construct a builder context. + * @param rtfOptions some options + */ public BuilderContext(IRtfOptions rtfOptions) { options = rtfOptions; } @@ -82,9 +86,13 @@ public class BuilderContext { return result; }*/ - /** find the "nearest" container that implements the given interface on our stack - * @param required if true, ConverterException is thrown if no container found - * @param forWhichBuilder used in error message if container not found + /** + * Find the "nearest" container that implements the given interface on our stack. + * @param containerClass class of container + * @param required if true, ConverterException is thrown if no container found + * @param forWhichBuilder used in error message if container not found + * @return the container + * @throws RtfException if not caught */ public RtfContainer getContainer(Class containerClass, boolean required, Object /*IBuilder*/ forWhichBuilder) throws RtfException { @@ -103,7 +111,10 @@ public class BuilderContext { return result; } - /** push an RtfContainer on our stack */ + /** + * Push an RtfContainer on our stack. + * @param c the container + */ public void pushContainer(RtfContainer c) { containers.push(c); } @@ -115,6 +126,9 @@ public class BuilderContext { * paragraph container to handle what follows the nested block. * TODO: what happens to elements that are "more on top" than oldC on the * stack? shouldn't they be closed or something? + * @param oldC old container + * @param newC new container + * @throws Exception if not caught */ public void replaceContainer(RtfContainer oldC, RtfContainer newC) throws Exception { @@ -150,17 +164,23 @@ public class BuilderContext { return result; } */ - /** return the current TableContext */ + + /** @return the current TableContext */ public TableContext getTableContext() { return (TableContext)tableContexts.peek(); } - /** push a TableContext to our stack */ + /** + * Push a TableContext to our stack. + * @param tc the table context + */ public void pushTableContext(TableContext tc) { tableContexts.push(tc); } - /** pop a TableContext from our stack */ + /** + * Pop a TableContext from our stack. + */ public void popTableContext() { tableContexts.pop(); } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java b/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java index 859472709..c3dadb652 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.tools; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,15 +26,12 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.tools; - - /** Here will be defined all supported image formats. * This class belongs to the <fo:external-graphic> tag processing. * @author a.putz@skynamics.com (Andreas Putz) */ -public class ImageConstants { +public final class ImageConstants { ////////////////////////////////////////////////// // @@ Symbolic constants ////////////////////////////////////////////////// diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java b/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java index c5e3cb191..82367e0ad 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java @@ -17,6 +17,7 @@ /* $Id$ */ +package org.apache.fop.render.rtf.rtflib.tools; /* * This file is part of the RTF library of the FOP project, which was originally @@ -25,13 +26,11 @@ * the FOP project. */ -package org.apache.fop.render.rtf.rtflib.tools; - /** Misc.utilities for images handling * This class belongs to the <fo:external-graphic> tag processing. * @author <a href="mailto:a.putz@skynamics.com">Andreas Putz</a> */ -public class ImageUtil { +public final class ImageUtil { ////////////////////////////////////////////////// // @@ Construction diff --git a/src/java/org/apache/fop/render/txt/TXTRenderer.java b/src/java/org/apache/fop/render/txt/TXTRenderer.java index 3e2fab230..b64eb172c 100644 --- a/src/java/org/apache/fop/render/txt/TXTRenderer.java +++ b/src/java/org/apache/fop/render/txt/TXTRenderer.java @@ -494,8 +494,9 @@ public class TXTRenderer extends AbstractPathOrientedRenderer { /** * {@inheritDoc} */ - protected void drawBorderLine(float x1, float y1, float x2, float y2, - boolean horz, boolean startOrBefore, int style, Color col) { + protected void drawBorderLine // CSOK: ParameterNumber + (float x1, float y1, float x2, float y2, + boolean horz, boolean startOrBefore, int style, Color col) { int borderHeight = bm.getHeight(); int borderWidth = bm.getWidth(); diff --git a/src/java/org/apache/fop/render/txt/TXTStream.java b/src/java/org/apache/fop/render/txt/TXTStream.java index 49e36be3a..a534d4108 100644 --- a/src/java/org/apache/fop/render/txt/TXTStream.java +++ b/src/java/org/apache/fop/render/txt/TXTStream.java @@ -71,10 +71,11 @@ public class TXTStream { * @param encoding the encoding, if null, "UTF-8" is chosen as default */ public void setEncoding(String encoding) { - if (encoding != null) + if (encoding != null) { this.encoding = encoding; - else + } else { this.encoding = DEFAULT_ENCODING; + } } } diff --git a/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java b/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java index 4f62155a3..497e3c047 100644 --- a/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java @@ -43,7 +43,9 @@ import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.AttributesImpl; +/** Abstract xml renderer base class. */ public abstract class AbstractXMLRenderer extends PrintRenderer { + /** Main namespace in use. */ public static final String NS = ""; @@ -62,6 +64,7 @@ public abstract class AbstractXMLRenderer extends PrintRenderer { /** The OutputStream to write the generated XML to. */ protected OutputStream out; + /** The renderer context. */ protected RendererContext context; /** A list of ExtensionAttachements received through processOffDocumentItem() */ @@ -237,7 +240,7 @@ public abstract class AbstractXMLRenderer extends PrintRenderer { } } - /** {@inheritDoc} */ + /** Handle document extension attachments. */ protected void handleDocumentExtensionAttachments() { if (extensionAttachments != null && extensionAttachments.size() > 0) { handleExtensionAttachments(extensionAttachments); diff --git a/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java b/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java index acb59ed7d..1622d4f51 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java +++ b/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java @@ -37,12 +37,13 @@ import org.apache.fop.fonts.FontInfo; */ public abstract class AbstractFOPBridgeContext extends BridgeContext { - /** The font list. */ + /** the font list */ protected final FontInfo fontInfo; - + /** image manager */ protected final ImageManager imageManager; + /** image session context */ protected final ImageSessionContext imageSessionContext; - + /** link transform */ protected final AffineTransform linkTransform; /** @@ -122,6 +123,10 @@ public abstract class AbstractFOPBridgeContext extends BridgeContext { return this.imageSessionContext; } + /** + * @param className name of bridge class to load and construct + * @param testFor class name to test for presence + */ protected void putElementBridgeConditional(String className, String testFor) { try { Class.forName(testFor); @@ -137,6 +142,7 @@ public abstract class AbstractFOPBridgeContext extends BridgeContext { // Make sure any 'sub bridge contexts' also have our bridges. //TODO There's no matching method in the super-class here + /** @return new bridge context */ public abstract BridgeContext createBridgeContext(); } diff --git a/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java b/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java index 31895cebe..c4191077f 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java +++ b/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java @@ -160,10 +160,15 @@ public abstract class AbstractFOPImageElementBridge extends SVGImageElementBridg */ public class LoaderImageNode extends AbstractGraphicsNode { + /** image */ protected final Image image; + /** bridge context */ protected final BridgeContext ctx; + /** image element */ protected final Element imageElement; + /** parsed url */ protected final ParsedURL purl; + /** original graphics mode */ protected GraphicsNode origGraphicsNode = null; /** diff --git a/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java b/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java index eec402075..fc007b90a 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java +++ b/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java @@ -129,7 +129,10 @@ public abstract class AbstractFOPTranscoder extends SVGAbstractTranscoder { this.resolver = resolver; } - /** {@inheritDoc} */ + /** + * @param cfg the configuration + * @throws ConfigurationException if not caught + */ public void configure(Configuration cfg) throws ConfigurationException { this.cfg = cfg; } diff --git a/src/java/org/apache/fop/svg/FOPTextHandler.java b/src/java/org/apache/fop/svg/FOPTextHandler.java index 8fa9eeedd..cb59c7472 100644 --- a/src/java/org/apache/fop/svg/FOPTextHandler.java +++ b/src/java/org/apache/fop/svg/FOPTextHandler.java @@ -19,9 +19,12 @@ package org.apache.fop.svg; +/** an fop extension to text handler */ public interface FOPTextHandler extends org.apache.xmlgraphics.java2d.TextHandler { + /** @param font override font */ void setOverrideFont(org.apache.fop.fonts.Font font); + /** @return font info */ org.apache.fop.fonts.FontInfo getFontInfo(); } diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRegistry.java b/src/java/org/apache/fop/svg/FOPTextHandlerAdapter.java index 1d4c733a3..6f326546e 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRegistry.java +++ b/src/java/org/apache/fop/svg/FOPTextHandlerAdapter.java @@ -17,20 +17,15 @@ /* $Id$ */ -package org.apache.fop.render.pdf; +package org.apache.fop.svg; -import org.apache.fop.render.AbstractImageHandlerRegistry; +import org.apache.xmlgraphics.java2d.StrokingTextHandler; /** - * This class holds references to various image handlers used by the PDF renderer. It also - * supports automatic discovery of additional handlers available through - * the class path. + * The <code>FOPTextHandlerAdapter</code> class is an adapter class to permit use of + * FOPTextHandler without incurring deprecation warnings caused by the underlying + * org.apache.xmlgraphics.java2d.TextHandler.drawString(String...) method. + * @see org.apache.xmlgraphics.java2d.TextHandler */ -public class PDFImageHandlerRegistry extends AbstractImageHandlerRegistry { - - /** {@inheritDoc} */ - public Class getHandlerClass() { - return PDFImageHandler.class; - } - +public abstract class FOPTextHandlerAdapter extends StrokingTextHandler implements FOPTextHandler { } diff --git a/src/java/org/apache/fop/svg/GraphicsConfiguration.java b/src/java/org/apache/fop/svg/GraphicsConfiguration.java index 881096b9a..83fd79b9d 100644 --- a/src/java/org/apache/fop/svg/GraphicsConfiguration.java +++ b/src/java/org/apache/fop/svg/GraphicsConfiguration.java @@ -29,9 +29,12 @@ import java.awt.image.VolatileImage; * for JDK 1.3 because there is no VolatileImage there. * */ -abstract public class GraphicsConfiguration extends java.awt.GraphicsConfiguration { +public abstract class GraphicsConfiguration extends java.awt.GraphicsConfiguration { /** + * @param width of image + * @param height of image + * @return new volatile image * @see java.awt.GraphicsConfiguration#createCompatibleVolatileImage(int, int) * @since JDK 1.4 */ @@ -40,6 +43,10 @@ abstract public class GraphicsConfiguration extends java.awt.GraphicsConfigurati } /** + * @param width of image + * @param height of image + * @param transparency of image + * @return new volatile image * @see java.awt.GraphicsConfiguration#createCompatibleVolatileImage(int, int, int) * @since JDK 1.5 */ diff --git a/src/java/org/apache/fop/svg/NativeImageHandler.java b/src/java/org/apache/fop/svg/NativeImageHandler.java index 8e74cba1d..e9d8116e6 100644 --- a/src/java/org/apache/fop/svg/NativeImageHandler.java +++ b/src/java/org/apache/fop/svg/NativeImageHandler.java @@ -19,6 +19,7 @@ package org.apache.fop.svg; +/** native image handler */ public interface NativeImageHandler { /** diff --git a/src/java/org/apache/fop/svg/NativeTextPainter.java b/src/java/org/apache/fop/svg/NativeTextPainter.java index 7da7269c2..14fa6460d 100644 --- a/src/java/org/apache/fop/svg/NativeTextPainter.java +++ b/src/java/org/apache/fop/svg/NativeTextPainter.java @@ -190,6 +190,10 @@ public abstract class NativeTextPainter extends StrokingTextPainter { return chars; } + /** + * @param runaci an attributed character iterator + * @param layout a text span layout + */ protected final void logTextRun(AttributedCharacterIterator runaci, TextSpanLayout layout) { if (log.isTraceEnabled()) { int charCount = runaci.getEndIndex() - runaci.getBeginIndex(); @@ -202,6 +206,12 @@ public abstract class NativeTextPainter extends StrokingTextPainter { } } + /** + * @param ch a character + * @param layout a text span layout + * @param index an index + * @param visibleChar visible character flag + */ protected final void logCharacter(char ch, TextSpanLayout layout, int index, boolean visibleChar) { if (log.isTraceEnabled()) { diff --git a/src/java/org/apache/fop/svg/PDFBridgeContext.java b/src/java/org/apache/fop/svg/PDFBridgeContext.java index e8569f881..a38465ed4 100644 --- a/src/java/org/apache/fop/svg/PDFBridgeContext.java +++ b/src/java/org/apache/fop/svg/PDFBridgeContext.java @@ -125,6 +125,7 @@ public class PDFBridgeContext extends AbstractFOPBridgeContext { // Make sure any 'sub bridge contexts' also have our bridges. //TODO There's no matching method in the super-class here + /** @return the new bridge context */ public BridgeContext createBridgeContext() { return new PDFBridgeContext(getUserAgent(), getDocumentLoader(), fontInfo, diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index f0084da09..45189133a 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -67,7 +67,6 @@ import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG; import org.apache.xmlgraphics.image.loader.impl.ImageRendered; import org.apache.xmlgraphics.java2d.AbstractGraphics2D; import org.apache.xmlgraphics.java2d.GraphicContext; -import org.apache.xmlgraphics.java2d.color.ColorExt; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; @@ -92,6 +91,7 @@ import org.apache.fop.pdf.PDFXObject; import org.apache.fop.render.pdf.ImageRawCCITTFaxAdapter; import org.apache.fop.render.pdf.ImageRawJPEGAdapter; import org.apache.fop.render.pdf.ImageRenderedAdapter; +import org.apache.fop.util.ColorExt; /** * PDF Graphics 2D. @@ -776,7 +776,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand * @param fill true if the paint should be set for filling * @return true if the paint is handled natively, false if the paint should be rasterized */ - protected boolean applyPaint(Paint paint, boolean fill) { + protected boolean applyPaint(Paint paint, boolean fill) { // CSOK: MethodLength preparePainting(); if (paint instanceof Color) { @@ -1053,6 +1053,11 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand return true; } + /** + * @param paint some paint + * @param shape a shape + * @return true (always) + */ protected boolean applyUnknownPaint(Paint paint, Shape shape) { preparePainting(); @@ -1200,6 +1205,8 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand case BasicStroke.CAP_SQUARE: currentStream.write(2 + " J\n"); break; + default: + break; } int lj = bs.getLineJoin(); @@ -1213,6 +1220,8 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand case BasicStroke.JOIN_BEVEL: currentStream.write(2 + " j\n"); break; + default: + break; } float lw = bs.getLineWidth(); currentStream.write(PDFNumber.doubleOut(lw) + " w\n"); @@ -1228,7 +1237,11 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand drawInnerRenderedImage(key, img, xform); } - /** {@inheritDoc} */ + /** + * @param key a key + * @param img an image + * @param xform a transform + */ public void drawInnerRenderedImage(String key, RenderedImage img, AffineTransform xform) { preparePainting(); PDFXObject xObject = pdfDoc.getXObject(key); diff --git a/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java b/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java index 4ec6ad634..a41b7e229 100644 --- a/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java +++ b/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java @@ -33,11 +33,11 @@ import java.awt.image.ColorModel; */ class PDFGraphicsConfiguration extends GraphicsConfiguration { // We use this to get a good colormodel.. - private static final BufferedImage BI_WITH_ALPHA = - new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); + private static final BufferedImage BI_WITH_ALPHA + = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); // We use this to get a good colormodel.. - private static final BufferedImage BI_WITHOUT_ALPHA = - new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); + private static final BufferedImage BI_WITHOUT_ALPHA + = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); /** * Construct a buffered image with an alpha channel, unless diff --git a/src/java/org/apache/fop/svg/PDFGraphicsDevice.java b/src/java/org/apache/fop/svg/PDFGraphicsDevice.java index 5da2d50ee..538dd16c2 100644 --- a/src/java/org/apache/fop/svg/PDFGraphicsDevice.java +++ b/src/java/org/apache/fop/svg/PDFGraphicsDevice.java @@ -39,7 +39,7 @@ class PDFGraphicsDevice extends GraphicsDevice { /** * Create a new PDF graphics device. * - * @param The gc we should reference + * @param gc The graphics configuration we should reference */ PDFGraphicsDevice(PDFGraphicsConfiguration gc) { this.gc = gc; @@ -62,7 +62,7 @@ class PDFGraphicsDevice extends GraphicsDevice { * @return an array containing the one graphics configuration */ public GraphicsConfiguration[] getConfigurations() { - return new GraphicsConfiguration[]{ gc }; + return new GraphicsConfiguration[] {gc}; } /** diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/java/org/apache/fop/svg/PDFTextPainter.java index e962d5a59..fe8ad1c7e 100644 --- a/src/java/org/apache/fop/svg/PDFTextPainter.java +++ b/src/java/org/apache/fop/svg/PDFTextPainter.java @@ -40,7 +40,7 @@ import org.apache.fop.fonts.FontInfo; import org.apache.fop.util.CharUtilities; /** - * Renders the attributed character iterator of a {@link TextNode}. + * Renders the attributed character iterator of a {@link org.apache.batik.gvt.TextNode}. * This class draws the text directly into the PDFGraphics2D so that * the text is not drawn using shapes which makes the PDF files larger. * If the text is simple enough to draw then it sets the font and calls diff --git a/src/java/org/apache/fop/svg/SVGEventProducer.java b/src/java/org/apache/fop/svg/SVGEventProducer.java index 27d7da215..743649717 100644 --- a/src/java/org/apache/fop/svg/SVGEventProducer.java +++ b/src/java/org/apache/fop/svg/SVGEventProducer.java @@ -30,7 +30,10 @@ public interface SVGEventProducer extends EventProducer { /** * Provider class for the event producer. */ - class Provider { + final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/svg/SVGUtilities.java b/src/java/org/apache/fop/svg/SVGUtilities.java index 97cd31eed..3401307cf 100644 --- a/src/java/org/apache/fop/svg/SVGUtilities.java +++ b/src/java/org/apache/fop/svg/SVGUtilities.java @@ -34,7 +34,11 @@ import org.apache.batik.util.XMLConstants; /** * Some utilities for creating svg DOM documents and elements. */ -public class SVGUtilities { +public final class SVGUtilities { + + private SVGUtilities() { + } + private static final String SVG_NS = SVGDOMImplementation.SVG_NAMESPACE_URI; /** @@ -43,7 +47,7 @@ public class SVGUtilities { * @param height the height of the root svg element * @return a new SVG Document */ - public static final Document createSVGDocument(float width, + public static Document createSVGDocument(float width, float height) { DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); Document doc = impl.createDocument(SVG_NS, "svg", null); @@ -60,9 +64,9 @@ public class SVGUtilities { * @param font the font * @return the width of the string in the given font */ - public static final float getStringWidth(String str, java.awt.Font font) { - Rectangle2D rect = - font.getStringBounds(str, 0, str.length(), + public static float getStringWidth(String str, java.awt.Font font) { + Rectangle2D rect + = font.getStringBounds(str, 0, str.length(), new FontRenderContext(new AffineTransform(), true, true)); return (float)rect.getWidth(); @@ -74,10 +78,10 @@ public class SVGUtilities { * @param font the font * @return the height of the string in the given font */ - public static final float getStringHeight(String str, + public static float getStringHeight(String str, java.awt.Font font) { - Rectangle2D rect = - font.getStringBounds(str, 0, str.length(), + Rectangle2D rect + = font.getStringBounds(str, 0, str.length(), new FontRenderContext(new AffineTransform(), true, true)); return (float)rect.getHeight(); @@ -89,7 +93,7 @@ public class SVGUtilities { * @param font the font * @return the bounds of the string */ - public static final Rectangle2D getStringBounds(String str, + public static Rectangle2D getStringBounds(String str, java.awt.Font font) { return font.getStringBounds(str, 0, str.length(), new FontRenderContext(new AffineTransform(), @@ -105,7 +109,7 @@ public class SVGUtilities { * @param y2 the end y position * @return the new line element */ - public static final Element createLine(Document doc, float x, float y, + public static Element createLine(Document doc, float x, float y, float x2, float y2) { Element ellipse = doc.createElementNS(SVG_NS, "line"); ellipse.setAttributeNS(null, "x1", "" + x); @@ -124,7 +128,7 @@ public class SVGUtilities { * @param ry the y axis radius * @return the new ellipse element */ - public static final Element createEllipse(Document doc, float cx, + public static Element createEllipse(Document doc, float cx, float cy, float rx, float ry) { Element ellipse = doc.createElementNS(SVG_NS, "ellipse"); ellipse.setAttributeNS(null, "cx", "" + cx); @@ -140,7 +144,7 @@ public class SVGUtilities { * @param str the string for the d attribute on the path * @return the new path element */ - public static final Element createPath(Document doc, String str) { + public static Element createPath(Document doc, String str) { Element path = doc.createElementNS(SVG_NS, "path"); path.setAttributeNS(null, "d", str); return path; @@ -154,7 +158,7 @@ public class SVGUtilities { * @param str the string * @return the new text element */ - public static final Element createText(Document doc, float x, float y, + public static Element createText(Document doc, float x, float y, String str) { Element textGraph = doc.createElementNS(SVG_NS, "text"); textGraph.setAttributeNS(null, "x", "" + x); @@ -173,7 +177,7 @@ public class SVGUtilities { * @param height the height of the rectangle * @return the new rectangle element */ - public static final Element createRect(Document doc, float x, float y, + public static Element createRect(Document doc, float x, float y, float width, float height) { Element border = doc.createElementNS(SVG_NS, "rect"); border.setAttributeNS(null, "x", "" + x); @@ -188,7 +192,7 @@ public class SVGUtilities { * @param doc the document to create the element * @return the new g element */ - public static final Element createG(Document doc) { + public static Element createG(Document doc) { Element border = doc.createElementNS(SVG_NS, "g"); return border; } @@ -200,7 +204,7 @@ public class SVGUtilities { * @param id the id of the clipping path * @return the new clip element */ - public static final Element createClip(Document doc, Element els, + public static Element createClip(Document doc, Element els, String id) { Element border = doc.createElementNS(SVG_NS, "clipPath"); border.setAttributeNS(null, "id", id); @@ -216,7 +220,7 @@ public class SVGUtilities { * @param height the height to set on the image * @return a new image element */ - public static final Element createImage(Document doc, String ref, + public static Element createImage(Document doc, String ref, float width, float height) { Element border = doc.createElementNS(SVG_NS, "image"); border.setAttributeNS(XMLConstants.XLINK_NAMESPACE_URI, "href", @@ -234,7 +238,7 @@ public class SVGUtilities { * @param width the width to wrap * @return the new element containing the wrapped text */ - public static final Element wrapText(Document doc, String str, + public static Element wrapText(Document doc, String str, java.awt.Font font, float width) { Element g = createG(doc); Element text; diff --git a/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java b/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java index 15f3434d9..df5027373 100644 --- a/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java +++ b/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java @@ -62,8 +62,9 @@ public class LineBreakStatus { /** * Check whether a line break may happen according to the rules described in - * the <a href="http://unicode.org/reports/tr14/#Algorithm">Unicode Line Breaking Algorithm</a>. - * The function returns the line breaking status of the point <em>before</em> the given character. + * the <a href="http://unicode.org/reports/tr14/#Algorithm">Unicode Line Breaking + * Algorithm</a>. The function returns the line breaking status of the point + * <em>before</em> the given character. * The algorithm is the table-driven algorithm, as described in * <a href="http://unicode.org/reports/tr14/#PairBasedImplementation"> * Unicode Technical Report #14</a>. diff --git a/src/java/org/apache/fop/text/linebreak/LineBreakUtils.java b/src/java/org/apache/fop/text/linebreak/LineBreakUtils.java index 49557a6c9..343191eea 100644 --- a/src/java/org/apache/fop/text/linebreak/LineBreakUtils.java +++ b/src/java/org/apache/fop/text/linebreak/LineBreakUtils.java @@ -29,8 +29,15 @@ package org.apache.fop.text.linebreak; * - commit BOTH changed files */ +// CSOFF: WhitespaceAfterCheck +// CSOFF: LineLengthCheck + +/** Line breaking utilities. */ public final class LineBreakUtils { + private LineBreakUtils() { + } + /** Break class constant */ public static final byte DIRECT_BREAK = 0; /** Break class constant */ @@ -44,179 +51,180 @@ public final class LineBreakUtils { /** Break class constant */ public static final byte EXPLICIT_BREAK = 5; - private static final byte PAIR_TABLE[][] = { - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 4, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 1, 1, 1, 0, 0, 4, 2, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 4, 1, 0, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 1, 1, 1, 0, 0, 4, 2, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 1, 1, 1, 0, 1, 4, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 4, 4, 4, 4, 0, 0, 4, 3, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 1, 1, 1, 1, 0, 4, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 1, 1, 1, 0, 0, 4, 2, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 4, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 4, 2, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 1, 1, 1, 1, 0, 0, 4, 2, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}}; + private static final byte[][] PAIR_TABLE = { + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 4, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 1, 1, 1, 0, 0, 4, 2, 4, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 4, 1, 0, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 4, 1, 0, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 1, 1, 1, 0, 0, 4, 2, 4, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 1, 1, 1, 0, 1, 4, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 4, 4, 4, 4, 0, 0, 4, 3, 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 1, 1, 1, 1, 0, 4, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 1, 1, 1, 0, 0, 4, 2, 4, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 4, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 4, 2, 4, 0, 4, 1, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 1, 1, 1, 1, 0, 0, 4, 2, 4, 0, 4, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 4, 4, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}}; - private static byte lineBreakProperties[][] = new byte[512][]; + private static byte[][] lineBreakProperties = new byte[512][]; - private static void init_0() { - lineBreakProperties[0] = new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 22, 6, 6, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 32, 11, 29, 2, 28, 27, 2, 29, 26, 8, 2, 28, 18, 15, 18, 33, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 18, 18, 2, 2, 2, 11, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 28, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 4, 8, 2, 9}; - lineBreakProperties[1] = new byte[] { 9, 9, 9, 9, 9, 23, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 26, 27, 28, 28, 28, 2, 1, 1, 2, 1, 29, 2, 4, 2, 2, 27, 28, 1, 1, 5, 2, 1, 1, 1, 1, 1, 29, 1, 1, 1, 26, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2}; + private static void init0() { + lineBreakProperties[0] = new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 23, 6, 6, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 33, 12, 30, 2, 29, 28, 2, 30, 27, 10, 2, 29, 19, 16, 19, 34, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 19, 19, 2, 2, 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 29, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 4, 8, 2, 9}; + lineBreakProperties[1] = new byte[] { 9, 9, 9, 9, 9, 24, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 27, 28, 29, 29, 29, 2, 1, 1, 2, 1, 30, 2, 4, 2, 2, 28, 29, 1, 1, 5, 2, 1, 1, 1, 1, 1, 30, 1, 1, 1, 27, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[2] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[5] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 5, 1, 1, 1, 5, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 1, 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[6] = new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 18, 0}; + lineBreakProperties[6] = new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 19, 0}; lineBreakProperties[7] = new byte[] { 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[9] = new byte[] { 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[10] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[11] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 0, 18, 4, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 9, 2, 9, 9, 2, 9, 9, 11, 9, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[12] = new byte[] { 2, 2, 2, 2, 0, 0, 2, 2, 2, 27, 27, 27, 18, 18, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 0, 0, 11, 11, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 27, 25, 25, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[13] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 11, 2, 9, 9, 9, 9, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9, 2, 2, 9, 9, 2, 9, 9, 9, 9, 2, 2, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[10] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[11] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 0, 19, 4, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 9, 2, 9, 9, 2, 9, 9, 12, 9, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[12] = new byte[] { 2, 2, 2, 2, 0, 0, 2, 2, 2, 28, 28, 28, 19, 19, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 0, 0, 12, 12, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 28, 26, 26, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[13] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, 9, 9, 9, 9, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9, 2, 2, 9, 9, 2, 9, 9, 9, 9, 2, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 2, 2, 2}; lineBreakProperties[14] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[15] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 18, 11, 2, 0, 0, 0, 0, 0}; - lineBreakProperties[16] = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[18] = new byte[] { 0, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 2, 9, 9, 9, 9, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 4, 4, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2}; - lineBreakProperties[19] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 2, 2, 0, 2, 2, 2, 9, 9, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 28, 28, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0}; - lineBreakProperties[20] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 0, 9, 0, 9, 9, 9, 9, 9, 0, 0, 0, 0, 9, 9, 0, 0, 9, 9, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 9, 9, 2, 2, 2, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[21] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[22] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 2, 2, 0, 2, 2, 2, 9, 9, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[23] = new byte[] { 0, 0, 9, 2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 9, 9, 9, 9, 9, 0, 0, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 2, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 28, 2, 0, 0, 0, 0, 0}; - lineBreakProperties[24] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 2, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[25] = new byte[] { 0, 0, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 9, 9, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[26] = new byte[] { 0, 0, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 0, 0, 0, 27, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[15] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 19, 12, 2, 0, 0, 0, 0, 0}; + lineBreakProperties[16] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[17] = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[18] = new byte[] { 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 2, 9, 9, 9, 9, 9, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 4, 4, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[19] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 2, 2, 0, 2, 2, 2, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 28, 28, 2, 2, 2, 2, 2, 28, 2, 29, 0, 0, 0, 0}; + lineBreakProperties[20] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 0, 9, 0, 9, 9, 9, 9, 9, 0, 0, 0, 0, 9, 9, 0, 0, 9, 9, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 9, 9, 2, 2, 2, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[21] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[22] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 2, 2, 0, 2, 2, 2, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[23] = new byte[] { 0, 0, 9, 2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 9, 9, 9, 9, 9, 0, 0, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 2, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 2, 2, 2, 2, 2, 2, 29, 2, 0, 0, 0, 0, 0}; + lineBreakProperties[24] = new byte[] { 0, 9, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 2, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[25] = new byte[] { 0, 0, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 9, 2, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[26] = new byte[] { 0, 0, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 2, 2, 2, 0, 0, 0, 28, 2, 2, 2, 2, 2, 2}; lineBreakProperties[27] = new byte[] { 0, 0, 9, 9, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 9, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 0, 9, 0, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[28] = new byte[] { 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 2, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[29] = new byte[] { 0, 30, 30, 0, 30, 0, 0, 30, 30, 0, 30, 0, 0, 30, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 0, 30, 30, 30, 30, 30, 30, 30, 0, 30, 30, 30, 0, 30, 0, 30, 0, 0, 30, 30, 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 30, 30, 30, 0, 0, 30, 30, 30, 30, 30, 0, 30, 0, 30, 30, 30, 30, 30, 30, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[30] = new byte[] { 2, 5, 5, 5, 5, 2, 5, 5, 12, 5, 5, 4, 12, 11, 11, 11, 11, 11, 12, 2, 11, 2, 2, 2, 9, 9, 2, 2, 2, 2, 2, 2, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 9, 2, 9, 2, 9, 26, 8, 26, 8, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4}; - lineBreakProperties[31] = new byte[] { 9, 9, 9, 9, 9, 4, 9, 9, 2, 2, 2, 2, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 4, 4, 2, 2, 2, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 0, 2, 2, 5, 5, 4, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[32] = new byte[] { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 4, 4, 2, 2, 2, 2, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30}; - lineBreakProperties[33] = new byte[] { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 30, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0}; - lineBreakProperties[34] = new byte[] { 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0, 0, 0, 0, 0, 19, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21}; - lineBreakProperties[35] = new byte[] { 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[28] = new byte[] { 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0, 29, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[29] = new byte[] { 0, 31, 31, 0, 31, 0, 0, 31, 31, 0, 31, 0, 0, 31, 0, 0, 0, 0, 0, 0, 31, 31, 31, 31, 0, 31, 31, 31, 31, 31, 31, 31, 0, 31, 31, 31, 0, 31, 0, 31, 0, 0, 31, 31, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 31, 31, 31, 0, 0, 31, 31, 31, 31, 31, 0, 31, 0, 31, 31, 31, 31, 31, 31, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[30] = new byte[] { 2, 5, 5, 5, 5, 2, 5, 5, 13, 5, 5, 4, 13, 12, 12, 12, 12, 12, 13, 2, 12, 2, 2, 2, 9, 9, 2, 2, 2, 2, 2, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 9, 2, 9, 2, 9, 27, 8, 27, 8, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4}; + lineBreakProperties[31] = new byte[] { 9, 9, 9, 9, 9, 4, 9, 9, 2, 2, 2, 2, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 4, 4, 2, 2, 2, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 0, 2, 2, 5, 5, 4, 5, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[32] = new byte[] { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 4, 4, 2, 2, 2, 2, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31}; + lineBreakProperties[33] = new byte[] { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 31, 31, 31, 31, 31, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0}; + lineBreakProperties[34] = new byte[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22}; + lineBreakProperties[35] = new byte[] { 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21}; lineBreakProperties[36] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[37] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[38] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 9, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0}; lineBreakProperties[39] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[40] = new byte[] { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[44] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[45] = new byte[] { 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[40] = new byte[] { 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[45] = new byte[] { 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; lineBreakProperties[46] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[47] = new byte[] { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 4, 4, 24, 30, 4, 2, 4, 28, 30, 30, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[48] = new byte[] { 2, 2, 11, 11, 4, 4, 5, 2, 11, 11, 2, 9, 9, 9, 12, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[49] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[50] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 2, 0, 0, 0, 11, 11, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[51] = new byte[] { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 30, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[52] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[54] = new byte[] { 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0}; - lineBreakProperties[55] = new byte[] { 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 2, 2, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[56] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 4, 4, 4, 4, 4, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 2, 2, 2, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4}; - lineBreakProperties[59] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}; + lineBreakProperties[47] = new byte[] { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 4, 4, 25, 31, 4, 2, 4, 29, 31, 31, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[48] = new byte[] { 2, 2, 12, 12, 4, 4, 5, 2, 12, 12, 2, 9, 9, 9, 13, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[49] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[50] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 2, 0, 0, 0, 12, 12, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 31, 31, 31, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[51] = new byte[] { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 31, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[52] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 0, 0, 2, 2, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 9}; + lineBreakProperties[53] = new byte[] { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[54] = new byte[] { 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 4, 4, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0}; + lineBreakProperties[55] = new byte[] { 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 2, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[56] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 4, 4, 4, 4, 4, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 2, 2, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4}; + lineBreakProperties[57] = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 9, 2, 2, 2, 2, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[59] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9}; lineBreakProperties[62] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0}; lineBreakProperties[63] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 5, 2, 0}; - lineBreakProperties[64] = new byte[] { 4, 4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 36, 9, 9, 9, 9, 4, 12, 4, 4, 3, 1, 1, 2, 29, 29, 26, 29, 29, 29, 26, 29, 1, 1, 2, 2, 17, 17, 17, 4, 6, 6, 9, 9, 9, 9, 9, 12, 27, 27, 27, 27, 27, 27, 27, 27, 2, 29, 29, 1, 24, 24, 2, 2, 2, 2, 2, 2, 18, 26, 8, 24, 24, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 4, 4, 4, 4, 2, 4, 4, 4, 34, 2, 2, 2, 2, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 2, 2, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 1}; - lineBreakProperties[65] = new byte[] { 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28, 28, 28, 28, 28, 28, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[66] = new byte[] { 2, 2, 2, 27, 2, 1, 2, 2, 2, 27, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 28, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 1, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[67] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[68] = new byte[] { 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1, 2, 1, 28, 28, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[64] = new byte[] { 4, 4, 4, 4, 4, 4, 4, 13, 4, 4, 4, 37, 9, 9, 9, 9, 4, 13, 4, 4, 3, 1, 1, 2, 30, 30, 27, 30, 30, 30, 27, 30, 1, 1, 2, 2, 18, 18, 18, 4, 6, 6, 9, 9, 9, 9, 9, 13, 28, 28, 28, 28, 28, 28, 28, 28, 2, 30, 30, 1, 25, 25, 2, 2, 2, 2, 2, 2, 19, 27, 8, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 4, 4, 4, 4, 2, 4, 4, 4, 35, 2, 2, 2, 2, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 2, 2, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 1}; + lineBreakProperties[65] = new byte[] { 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 29, 29, 29, 29, 29, 29, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 29, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[66] = new byte[] { 2, 2, 2, 28, 2, 1, 2, 2, 2, 28, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[67] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[68] = new byte[] { 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1, 2, 1, 29, 29, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[69] = new byte[] { 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[70] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[71] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[70] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[71] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; lineBreakProperties[72] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; lineBreakProperties[73] = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2}; - lineBreakProperties[74] = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[75] = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; } - private static void init_1() { + private static void init1() { + lineBreakProperties[74] = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[75] = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[76] = new byte[] { 2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[77] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[78] = new byte[] { 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 0, 2, 2, 2, 29, 29, 29, 29, 0, 0, 2, 11, 11, 2, 2, 2, 2, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - lineBreakProperties[79] = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 26, 8, 2, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[83] = new byte[] { 2, 2, 2, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 26, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 2, 2}; - lineBreakProperties[86] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[88] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0}; - lineBreakProperties[89] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 4, 4, 4, 2, 11, 4}; + lineBreakProperties[77] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + lineBreakProperties[78] = new byte[] { 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 1, 2, 2, 2, 30, 30, 30, 30, 0, 0, 2, 12, 12, 2, 2, 2, 2, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + lineBreakProperties[79] = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 27, 8, 2, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[83] = new byte[] { 2, 2, 2, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 27, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 2, 2}; + lineBreakProperties[86] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[88] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[89] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 12, 4, 4, 4, 2, 12, 4}; lineBreakProperties[90] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; lineBreakProperties[91] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; - lineBreakProperties[92] = new byte[] { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 26, 4, 2, 2, 29, 29, 2, 2, 29, 29, 26, 8, 26, 8, 26, 8, 26, 8, 4, 4, 4, 4, 11, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[93] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[94] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; - lineBreakProperties[95] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0}; - lineBreakProperties[96] = new byte[] { 16, 8, 8, 16, 16, 24, 16, 16, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 16, 16, 26, 8, 26, 8, 26, 8, 26, 8, 24, 26, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 9, 9, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 16, 16, 16, 0, 24, 16, 24, 16, 24, 16, 24, 16, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; - lineBreakProperties[97] = new byte[] { 16, 16, 16, 24, 16, 24, 16, 24, 16, 16, 16, 16, 16, 16, 24, 16, 16, 16, 16, 16, 16, 24, 24, 0, 0, 9, 9, 24, 24, 24, 24, 16, 24, 24, 16, 24, 16, 24, 16, 24, 16, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 16, 24, 16, 24, 16, 16, 16, 16, 16, 16, 24, 16, 16, 16, 16, 16, 16, 24, 24, 16, 16, 16, 16, 24, 24, 24, 24, 16}; - lineBreakProperties[98] = new byte[] { 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; - lineBreakProperties[99] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24}; - lineBreakProperties[100] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; - lineBreakProperties[101] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0}; - lineBreakProperties[155] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[319] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[320] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; - lineBreakProperties[329] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[332] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 11, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 2, 2}; - lineBreakProperties[333] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[92] = new byte[] { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 27, 4, 2, 2, 30, 30, 2, 2, 30, 30, 27, 8, 27, 8, 27, 8, 27, 8, 4, 4, 4, 4, 12, 2, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[93] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[94] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}; + lineBreakProperties[95] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0}; + lineBreakProperties[96] = new byte[] { 17, 8, 8, 17, 17, 25, 17, 17, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 17, 17, 27, 8, 27, 8, 27, 8, 27, 8, 25, 27, 8, 8, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 9, 9, 9, 9, 9, 9, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 25, 25, 17, 17, 17, 0, 25, 17, 25, 17, 25, 17, 25, 17, 25, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 25, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}; + lineBreakProperties[97] = new byte[] { 17, 17, 17, 25, 17, 25, 17, 25, 17, 17, 17, 17, 17, 17, 25, 17, 17, 17, 17, 17, 17, 25, 25, 0, 0, 9, 9, 25, 25, 25, 25, 17, 25, 25, 17, 25, 17, 25, 17, 25, 17, 25, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 25, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 25, 17, 25, 17, 25, 17, 17, 17, 17, 17, 17, 25, 17, 17, 17, 17, 17, 17, 25, 25, 17, 17, 17, 17, 25, 25, 25, 25, 17}; + lineBreakProperties[98] = new byte[] { 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}; + lineBreakProperties[99] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25}; + lineBreakProperties[100] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 1, 1, 1, 1, 1, 1, 1, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}; + lineBreakProperties[101] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0}; + lineBreakProperties[155] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[320] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 25, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}; + lineBreakProperties[329] = new byte[] { 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4}; + lineBreakProperties[332] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 12, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 2, 2}; + lineBreakProperties[333] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 2, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0}; lineBreakProperties[335] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2}; - lineBreakProperties[336] = new byte[] { 2, 2, 9, 2, 2, 2, 9, 2, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 11, 11, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[337] = new byte[] { 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[338] = new byte[] { 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[340] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 2, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[344] = new byte[] { 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}; - lineBreakProperties[345] = new byte[] { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14}; - lineBreakProperties[346] = new byte[] { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}; - lineBreakProperties[347] = new byte[] { 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14}; - lineBreakProperties[348] = new byte[] { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}; - lineBreakProperties[349] = new byte[] { 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}; - lineBreakProperties[350] = new byte[] { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}; - lineBreakProperties[431] = new byte[] { 14, 14, 14, 14, 14, 14, 14, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - lineBreakProperties[432] = new byte[] { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31}; - lineBreakProperties[448] = new byte[] { 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35}; - lineBreakProperties[500] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; - lineBreakProperties[501] = new byte[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[336] = new byte[] { 2, 2, 9, 2, 2, 2, 9, 2, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 28, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[337] = new byte[] { 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0}; + lineBreakProperties[338] = new byte[] { 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0}; + lineBreakProperties[339] = new byte[] { 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 2, 2, 2, 2, 2, 2, 4, 4, 4, 2, 2, 2, 2, 0, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[340] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 2, 4, 4, 4, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0}; + lineBreakProperties[341] = new byte[] { 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 31, 31, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[343] = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 4, 9, 9, 0, 0, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0}; + lineBreakProperties[344] = new byte[] { 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; + lineBreakProperties[345] = new byte[] { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15}; + lineBreakProperties[346] = new byte[] { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; + lineBreakProperties[347] = new byte[] { 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15}; + lineBreakProperties[348] = new byte[] { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; + lineBreakProperties[349] = new byte[] { 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; + lineBreakProperties[350] = new byte[] { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; + lineBreakProperties[431] = new byte[] { 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 0}; + lineBreakProperties[432] = new byte[] { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}; + lineBreakProperties[448] = new byte[] { 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36}; lineBreakProperties[502] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; lineBreakProperties[503] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[506] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[507] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 2, 0, 0}; - lineBreakProperties[508] = new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 8, 8, 18, 18, 11, 11, 26, 8, 17, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 26, 8, 16, 16, 26, 8, 16, 16, 16, 16, 16, 16, 16, 8, 16, 8, 0, 24, 24, 11, 11, 16, 26, 8, 26, 8, 26, 8, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 28, 27, 16, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[509] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 34}; - lineBreakProperties[510] = new byte[] { 0, 11, 16, 16, 28, 27, 16, 16, 26, 8, 16, 16, 8, 16, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 26, 16, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 26, 16, 8, 16, 26, 8, 8, 26, 8, 8, 24, 2, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; - lineBreakProperties[511] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 24, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, 27, 28, 16, 16, 16, 28, 28, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 7, 1, 0, 0}; + lineBreakProperties[506] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 27, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[507] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 28, 2, 0, 0}; + lineBreakProperties[508] = new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 19, 8, 8, 19, 19, 12, 12, 27, 8, 18, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 27, 8, 17, 17, 27, 8, 17, 17, 17, 17, 17, 17, 17, 8, 17, 8, 0, 25, 25, 12, 12, 17, 27, 8, 27, 8, 27, 8, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 29, 28, 17, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[509] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 35}; + lineBreakProperties[510] = new byte[] { 0, 12, 17, 17, 29, 28, 17, 17, 27, 8, 17, 17, 8, 17, 8, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 25, 25, 17, 17, 17, 12, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 27, 17, 8, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 27, 17, 8, 17, 27, 8, 8, 27, 8, 8, 25, 2, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; + lineBreakProperties[511] = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 25, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, 28, 29, 17, 17, 17, 29, 29, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 7, 1, 0, 0}; } static { - init_0(); - init_1(); + init0(); + init1(); lineBreakProperties[3] = lineBreakProperties[2]; lineBreakProperties[4] = lineBreakProperties[2]; lineBreakProperties[8] = lineBreakProperties[2]; - lineBreakProperties[17] = lineBreakProperties[16]; lineBreakProperties[41] = lineBreakProperties[2]; lineBreakProperties[42] = lineBreakProperties[2]; lineBreakProperties[43] = lineBreakProperties[2]; - lineBreakProperties[53] = lineBreakProperties[16]; - lineBreakProperties[57] = lineBreakProperties[16]; + lineBreakProperties[44] = lineBreakProperties[2]; lineBreakProperties[58] = lineBreakProperties[2]; lineBreakProperties[60] = lineBreakProperties[2]; lineBreakProperties[61] = lineBreakProperties[2]; @@ -225,7 +233,7 @@ public final class LineBreakUtils { lineBreakProperties[82] = lineBreakProperties[2]; lineBreakProperties[84] = lineBreakProperties[2]; lineBreakProperties[85] = lineBreakProperties[2]; - lineBreakProperties[87] = lineBreakProperties[16]; + lineBreakProperties[87] = lineBreakProperties[17]; lineBreakProperties[102] = lineBreakProperties[94]; lineBreakProperties[103] = lineBreakProperties[94]; lineBreakProperties[104] = lineBreakProperties[94]; @@ -442,6 +450,7 @@ public final class LineBreakUtils { lineBreakProperties[316] = lineBreakProperties[94]; lineBreakProperties[317] = lineBreakProperties[94]; lineBreakProperties[318] = lineBreakProperties[94]; + lineBreakProperties[319] = lineBreakProperties[94]; lineBreakProperties[321] = lineBreakProperties[94]; lineBreakProperties[322] = lineBreakProperties[94]; lineBreakProperties[323] = lineBreakProperties[94]; @@ -453,10 +462,7 @@ public final class LineBreakUtils { lineBreakProperties[330] = lineBreakProperties[2]; lineBreakProperties[331] = lineBreakProperties[2]; lineBreakProperties[334] = lineBreakProperties[2]; - lineBreakProperties[339] = lineBreakProperties[16]; - lineBreakProperties[341] = lineBreakProperties[16]; - lineBreakProperties[342] = lineBreakProperties[16]; - lineBreakProperties[343] = lineBreakProperties[16]; + lineBreakProperties[342] = lineBreakProperties[17]; lineBreakProperties[351] = lineBreakProperties[344]; lineBreakProperties[352] = lineBreakProperties[345]; lineBreakProperties[353] = lineBreakProperties[346]; @@ -603,6 +609,8 @@ public final class LineBreakUtils { lineBreakProperties[497] = lineBreakProperties[448]; lineBreakProperties[498] = lineBreakProperties[94]; lineBreakProperties[499] = lineBreakProperties[94]; + lineBreakProperties[500] = lineBreakProperties[94]; + lineBreakProperties[501] = lineBreakProperties[94]; lineBreakProperties[504] = lineBreakProperties[2]; lineBreakProperties[505] = lineBreakProperties[2]; } @@ -626,68 +634,70 @@ public final class LineBreakUtils { /** Linebreak property constant */ public static final byte LINE_BREAK_PROPERTY_CM = 9; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_CR = 10; + public static final byte LINE_BREAK_PROPERTY_CP = 10; + /** Linebreak property constant */ + public static final byte LINE_BREAK_PROPERTY_CR = 11; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_EX = 11; + public static final byte LINE_BREAK_PROPERTY_EX = 12; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_GL = 12; + public static final byte LINE_BREAK_PROPERTY_GL = 13; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_H2 = 13; + public static final byte LINE_BREAK_PROPERTY_H2 = 14; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_H3 = 14; + public static final byte LINE_BREAK_PROPERTY_H3 = 15; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_HY = 15; + public static final byte LINE_BREAK_PROPERTY_HY = 16; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_ID = 16; + public static final byte LINE_BREAK_PROPERTY_ID = 17; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_IN = 17; + public static final byte LINE_BREAK_PROPERTY_IN = 18; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_IS = 18; + public static final byte LINE_BREAK_PROPERTY_IS = 19; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_JL = 19; + public static final byte LINE_BREAK_PROPERTY_JL = 20; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_JT = 20; + public static final byte LINE_BREAK_PROPERTY_JT = 21; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_JV = 21; + public static final byte LINE_BREAK_PROPERTY_JV = 22; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_LF = 22; + public static final byte LINE_BREAK_PROPERTY_LF = 23; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_NL = 23; + public static final byte LINE_BREAK_PROPERTY_NL = 24; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_NS = 24; + public static final byte LINE_BREAK_PROPERTY_NS = 25; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_NU = 25; + public static final byte LINE_BREAK_PROPERTY_NU = 26; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_OP = 26; + public static final byte LINE_BREAK_PROPERTY_OP = 27; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_PO = 27; + public static final byte LINE_BREAK_PROPERTY_PO = 28; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_PR = 28; + public static final byte LINE_BREAK_PROPERTY_PR = 29; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_QU = 29; + public static final byte LINE_BREAK_PROPERTY_QU = 30; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_SA = 30; + public static final byte LINE_BREAK_PROPERTY_SA = 31; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_SG = 31; + public static final byte LINE_BREAK_PROPERTY_SG = 32; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_SP = 32; + public static final byte LINE_BREAK_PROPERTY_SP = 33; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_SY = 33; + public static final byte LINE_BREAK_PROPERTY_SY = 34; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_WJ = 34; + public static final byte LINE_BREAK_PROPERTY_WJ = 35; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_XX = 35; + public static final byte LINE_BREAK_PROPERTY_XX = 36; /** Linebreak property constant */ - public static final byte LINE_BREAK_PROPERTY_ZW = 36; + public static final byte LINE_BREAK_PROPERTY_ZW = 37; - private static String lineBreakPropertyShortNames[] = {"AI", "AL", "B2", "BA", "BB", "BK", "CB", "CL", "CM", "CR", "EX", - "GL", "H2", "H3", "HY", "ID", "IN", "IS", "JL", "JT", "JV", "LF", "NL", "NS", "NU", "OP", "PO", "PR", "QU", "SA", "SG", "SP", - "SY", "WJ", "XX", "ZW"}; + private static String[] lineBreakPropertyShortNames = {"AI", "AL", "B2", "BA", "BB", "BK", "CB", "CL", "CM", + "CP", "CR", "EX", "GL", "H2", "H3", "HY", "ID", "IN", "IS", "JL", "JT", "JV", "LF", "NL", "NS", "NU", "OP", + "PO", "PR", "QU", "SA", "SG", "SP", "SY", "WJ", "XX", "ZW"}; - private static String lineBreakPropertyLongNames[] = {"Ambiguous","Alphabetic","Break_Both","Break_After","Break_Before", - "Mandatory_Break","Contingent_Break","Close_Punctuation","Combining_Mark","Carriage_Return","Exclamation", - "Glue","H2","H3","Hyphen","Ideographic","Inseparable","Infix_Numeric","JL","JT","JV","Line_Feed","Next_Line", - "Nonstarter","Numeric","Open_Punctuation","Postfix_Numeric","Prefix_Numeric","Quotation","Complex_Context", + private static String[] lineBreakPropertyLongNames = {"Ambiguous","Alphabetic","Break_Both","Break_After","Break_Before", + "Mandatory_Break","Contingent_Break","Close_Punctuation","Combining_Mark","Close_Parenthesis","Carriage_Return", + "Exclamation","Glue","H2","H3","Hyphen","Ideographic","Inseparable","Infix_Numeric","JL","JT","JV","Line_Feed", + "Next_Line","Nonstarter","Numeric","Open_Punctuation","Postfix_Numeric","Prefix_Numeric","Quotation","Complex_Context", "Surrogate","Space","Break_Symbols","Word_Joiner","Unknown","ZWSpace"}; /** diff --git a/src/java/org/apache/fop/tools/anttasks/FileCompare.java b/src/java/org/apache/fop/tools/anttasks/FileCompare.java index d9b64226a..83b0aa896 100644 --- a/src/java/org/apache/fop/tools/anttasks/FileCompare.java +++ b/src/java/org/apache/fop/tools/anttasks/FileCompare.java @@ -84,6 +84,7 @@ public class FileCompare { * @param f1 first file to compare * @param f2 second file to compare * @return true if files are same, false otherwise + * @throws IOException if not caught */ public static boolean compareFiles(File f1, File f2) throws IOException { return (compareFileSize(f1, f2) && compareBytes(f1, f2)); @@ -91,13 +92,15 @@ public class FileCompare { /** * Compare the contents of two files. - * @param true if files are same byte-by-byte, false otherwise + * @param file1 the first file to compare + * @param file2 the second file to compare + * @return true if files are same byte-by-byte, false otherwise */ private static boolean compareBytes(File file1, File file2) throws IOException { - BufferedInputStream file1Input = - new BufferedInputStream(new java.io.FileInputStream(file1)); - BufferedInputStream file2Input = - new BufferedInputStream(new java.io.FileInputStream(file2)); + BufferedInputStream file1Input + = new BufferedInputStream(new java.io.FileInputStream(file1)); + BufferedInputStream file2Input + = new BufferedInputStream(new java.io.FileInputStream(file2)); int charact1 = 0; int charact2 = 0; @@ -116,14 +119,12 @@ public class FileCompare { /** * Does a file size compare of two files - * @param true if files are same length, false otherwise + * @param oldFile the first file to compare + * @param newFile the second file to compare + * @return true if files are same length, false otherwise */ private static boolean compareFileSize(File oldFile, File newFile) { - if (oldFile.length() != newFile.length()) { - return false; - } else { - return true; - } + return oldFile.length() == newFile.length(); } // end: compareBytes private boolean filesExist(File oldFile, File newFile) { @@ -163,8 +164,8 @@ public class FileCompare { File oldFile; File newFile; try { - PrintWriter results = - new PrintWriter(new java.io.FileWriter("results.html"), true); + PrintWriter results + = new PrintWriter(new java.io.FileWriter("results.html"), true); this.writeHeader(results); for (int i = 0; i < filenameList.length; i++) { oldFile = new File(referenceDirectory + filenameList[i]); diff --git a/src/java/org/apache/fop/tools/anttasks/Fop.java b/src/java/org/apache/fop/tools/anttasks/Fop.java index cfb8c8ade..c0a1ba9f7 100644 --- a/src/java/org/apache/fop/tools/anttasks/Fop.java +++ b/src/java/org/apache/fop/tools/anttasks/Fop.java @@ -267,8 +267,7 @@ public class Fop extends Task { /** * Set whether exceptions are thrown. * default is false. - * - * @param force true if always generate. + * @param throwExceptions true if should be thrown */ public void setThrowexceptions(boolean throwExceptions) { this.throwExceptions = throwExceptions; @@ -308,6 +307,7 @@ public class Fop extends Task { /** * Returns the message type corresponding to Project.MSG_* * representing the current message level. + * @return message type * @see org.apache.tools.ant.Project */ public int getMessageType() { @@ -489,9 +489,6 @@ class FOPTaskStarter { return new File(file.getParentFile(), name); } - /** - * {@inheritDoc} - */ public void run() throws FOPException { //Set base directory if (task.getBasedir() != null) { @@ -556,13 +553,13 @@ class FOPTaskStarter { // OR output file doesn't exist OR // output file is older than input file if (task.getForce() || !outf.exists() - || (task.getXmlFile().lastModified() > outf.lastModified() || - task.getXsltFile().lastModified() > outf.lastModified())) { + || (task.getXmlFile().lastModified() > outf.lastModified() + || task.getXsltFile().lastModified() > outf.lastModified())) { render(task.getXmlFile(), task.getXsltFile(), outf, outputFormat); actioncount++; } else if (outf.exists() - && (task.getXmlFile().lastModified() <= outf.lastModified() || - task.getXsltFile().lastModified() <= outf.lastModified())) { + && (task.getXmlFile().lastModified() <= outf.lastModified() + || task.getXsltFile().lastModified() <= outf.lastModified())) { skippedcount++; } } @@ -642,7 +639,8 @@ class FOPTaskStarter { } } - private void renderInputHandler(InputHandler inputHandler, File outFile, String outputFormat) throws Exception { + private void renderInputHandler + (InputHandler inputHandler, File outFile, String outputFormat) throws Exception { OutputStream out = null; try { out = new java.io.FileOutputStream(outFile); @@ -693,10 +691,12 @@ class FOPTaskStarter { try { renderInputHandler(inputHandler, outFile, outputFormat); } catch (Exception ex) { - logger.error("Error rendering xml/xslt files: " + xmlFile + ", " + xsltFile, ex); + logger.error("Error rendering xml/xslt files: " + + xmlFile + ", " + xsltFile, ex); } if (task.getLogFiles()) { - task.log("xml: " + xmlFile + ", xslt: " + xsltFile + " -> " + outFile, Project.MSG_INFO); + task.log("xml: " + xmlFile + ", xslt: " + + xsltFile + " -> " + outFile, Project.MSG_INFO); } } } diff --git a/src/java/org/apache/fop/traits/BorderProps.java b/src/java/org/apache/fop/traits/BorderProps.java index 5bd4feec5..25ac86ced 100644 --- a/src/java/org/apache/fop/traits/BorderProps.java +++ b/src/java/org/apache/fop/traits/BorderProps.java @@ -42,13 +42,13 @@ public class BorderProps implements Serializable { public static final int COLLAPSE_OUTER = 2; /** Border style (one of EN_*) */ - public int style; // Enum for border style + public int style; // Enum for border style // CSOK: VisibilityModifier /** Border color */ - public Color color; + public Color color; // CSOK: VisibilityModifier /** Border width */ - public int width; + public int width; // CSOK: VisibilityModifier /** Border mode (one of SEPARATE, COLLAPSE_INNER and COLLAPSE_OUTER) */ - public int mode; + public int mode; // CSOK: VisibilityModifier /** * Constructs a new BorderProps instance. diff --git a/src/java/org/apache/fop/traits/MinOptMax.java b/src/java/org/apache/fop/traits/MinOptMax.java index 0f0422799..99fab1adf 100644 --- a/src/java/org/apache/fop/traits/MinOptMax.java +++ b/src/java/org/apache/fop/traits/MinOptMax.java @@ -56,7 +56,8 @@ public final class MinOptMax implements Serializable { * @return the corresponding instance * @throws IllegalArgumentException if <code>min > opt || max < opt</code>. */ - public static MinOptMax getInstance(int min, int opt, int max) { + public static MinOptMax getInstance(int min, int opt, int max) + throws IllegalArgumentException { if (min > opt) { throw new IllegalArgumentException("min (" + min + ") > opt (" + opt + ")"); } @@ -167,7 +168,8 @@ public final class MinOptMax implements Serializable { * @throws ArithmeticException if this instance has strictly less shrink or stretch * than the operand */ - public MinOptMax minus(MinOptMax operand) { + public MinOptMax minus(MinOptMax operand) + throws ArithmeticException { checkCompatibility(getShrink(), operand.getShrink(), "shrink"); checkCompatibility(getStretch(), operand.getStretch(), "stretch"); return new MinOptMax(min - operand.min, opt - operand.opt, max - operand.max); @@ -197,9 +199,11 @@ public final class MinOptMax implements Serializable { * @param minOperand the minimal value to be added. * @return an instance with the given value added to the minimal value. * @throws IllegalArgumentException if <code>min + minOperand > opt || max < opt</code>. - * @deprecated Do not use! It's only for backwards compatibility. */ - public MinOptMax plusMin(int minOperand) { + // [GA] remove deprecation - no alternative specified + // @deprecated Do not use! It's only for backwards compatibility. + public MinOptMax plusMin(int minOperand) + throws IllegalArgumentException { return getInstance(min + minOperand, opt, max); } @@ -209,9 +213,11 @@ public final class MinOptMax implements Serializable { * @param minOperand the minimal value to be subtracted. * @return an instance with the given value subtracted to the minimal value. * @throws IllegalArgumentException if <code>min - minOperand > opt || max < opt</code>. - * @deprecated Do not use! It's only for backwards compatibility. */ - public MinOptMax minusMin(int minOperand) { + // [GA] remove deprecation - no alternative specified + // @deprecated Do not use! It's only for backwards compatibility. + public MinOptMax minusMin(int minOperand) + throws IllegalArgumentException { return getInstance(min - minOperand, opt, max); } @@ -221,9 +227,11 @@ public final class MinOptMax implements Serializable { * @param maxOperand the maximal value to be added. * @return an instance with the given value added to the maximal value. * @throws IllegalArgumentException if <code>min > opt || max < opt + maxOperand</code>. - * @deprecated Do not use! It's only for backwards compatibility. */ - public MinOptMax plusMax(int maxOperand) { + // [GA] remove deprecation - no alternative specified + // @deprecated Do not use! It's only for backwards compatibility. + public MinOptMax plusMax(int maxOperand) + throws IllegalArgumentException { return getInstance(min, opt, max + maxOperand); } @@ -233,9 +241,11 @@ public final class MinOptMax implements Serializable { * @param maxOperand the maximal value to be subtracted. * @return an instance with the given value subtracted to the maximal value. * @throws IllegalArgumentException if <code>min > opt || max < opt - maxOperand</code>. - * @deprecated Do not use! It's only for backwards compatibility. */ - public MinOptMax minusMax(int maxOperand) { + // [GA] remove deprecation - no alternative specified + // @deprecated Do not use! It's only for backwards compatibility. + public MinOptMax minusMax(int maxOperand) + throws IllegalArgumentException { return getInstance(min, opt, max - maxOperand); } @@ -246,7 +256,8 @@ public final class MinOptMax implements Serializable { * @return the product of this <code>MinOptMax</code> and the given factor * @throws IllegalArgumentException if the factor is negative */ - public MinOptMax mult(int factor) { + public MinOptMax mult(int factor) + throws IllegalArgumentException { if (factor < 0) { throw new IllegalArgumentException("factor < 0; was: " + factor); } else if (factor == 1) { diff --git a/src/java/org/apache/fop/traits/SpaceVal.java b/src/java/org/apache/fop/traits/SpaceVal.java index cb709c73e..f9f5c4991 100644 --- a/src/java/org/apache/fop/traits/SpaceVal.java +++ b/src/java/org/apache/fop/traits/SpaceVal.java @@ -65,9 +65,9 @@ public class SpaceVal { /** * Constructor for SpaceVal objects based on the full set of properties. * @param space space to use - * @param bConditional Conditionality value - * @param bForcing Forcing value - * @param iPrecedence Precedence value + * @param conditional Conditionality value + * @param forcing Forcing value + * @param precedence Precedence value */ public SpaceVal(MinOptMax space, boolean conditional, boolean forcing, int precedence) { this.space = space; @@ -76,6 +76,12 @@ public class SpaceVal { this.precedence = precedence; } + /** + * @param wordSpacing property + * @param letterSpacing space value + * @param fs font + * @return space value + */ public static SpaceVal makeWordSpacing(Property wordSpacing, SpaceVal letterSpacing, Font fs) { if (wordSpacing.getEnum() == Constants.EN_NORMAL) { // give word spaces the possibility to shrink by a third, @@ -89,6 +95,10 @@ public class SpaceVal { } } + /** + * @param letterSpacing property + * @return space value + */ public static SpaceVal makeLetterSpacing(Property letterSpacing) { if (letterSpacing.getEnum() == Constants.EN_NORMAL) { // letter spaces are set to zero (or use different values?) diff --git a/src/java/org/apache/fop/traits/TraitEnum.java b/src/java/org/apache/fop/traits/TraitEnum.java index 18fdffaab..c473228cb 100644 --- a/src/java/org/apache/fop/traits/TraitEnum.java +++ b/src/java/org/apache/fop/traits/TraitEnum.java @@ -21,6 +21,8 @@ package org.apache.fop.traits; import java.io.Serializable; +import org.apache.fop.fo.Constants; + /** Base class for enumeration classes representing traits. */ public abstract class TraitEnum implements Serializable { diff --git a/src/java/org/apache/fop/util/AbstractPaintingState.java b/src/java/org/apache/fop/util/AbstractPaintingState.java index c0c3c7fc8..5944b546c 100644 --- a/src/java/org/apache/fop/util/AbstractPaintingState.java +++ b/src/java/org/apache/fop/util/AbstractPaintingState.java @@ -340,7 +340,7 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable { /** * Sets the current state data * - * @param currentData state data + * @param data the state data */ protected void setData(AbstractData data) { this.data = data; @@ -468,6 +468,7 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable { /** * Sets the current AffineTransform. + * @param baseTransform the transform */ public void setTransform(AffineTransform baseTransform) { this.transform = baseTransform; diff --git a/src/java/org/apache/fop/util/ColorExt.java b/src/java/org/apache/fop/util/ColorExt.java new file mode 100644 index 000000000..6f4e21382 --- /dev/null +++ b/src/java/org/apache/fop/util/ColorExt.java @@ -0,0 +1,250 @@ +/* + * 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; + +import java.awt.Color; +import java.awt.color.ColorSpace; +import java.util.Arrays; + +/** + * Color helper class. + * <p> + * This class extends java.awt.Color class keeping track of the original color + * property values specified by the fo user in a rgb-icc call. + */ +public final class ColorExt extends Color { + // + private static final long serialVersionUID = 1L; + + // Values of fop-rgb-icc arguments + private float rgbReplacementRed; + private float rgbReplacementGreen; + private float rgbReplacementBlue; + + private String iccProfileName; + private String iccProfileSrc; + private ColorSpace colorSpace; + + private float[] colorValues; + + /* + * Helper for createFromFoRgbIcc + */ + private ColorExt(ColorSpace colorSpace, float[] colorValues, float opacity) { + super(colorSpace, colorValues, opacity); + } + + /* + * Helper for createFromSvgIccColor + */ + private ColorExt(float red, float green, float blue, float opacity) { + super(red, green, blue, opacity); + } + + /** + * Create ColorExt object backup up FO's rgb-icc color function + * + * @param redReplacement + * Red part of RGB replacement color that will be used when ICC + * profile can not be loaded + * @param greenReplacement + * Green part of RGB replacement color that will be used when ICC + * profile can not be loaded + * @param blueReplacement + * Blue part of RGB replacement color that will be used when ICC + * profile can not be loaded + * @param profileName + * Name of ICC profile + * @param profileSrc + * Source of ICC profile + * @param colorSpace + * ICC ColorSpace for the ICC profile + * @param iccValues + * color values + * @return the requested color object + */ + public static ColorExt createFromFoRgbIcc(float redReplacement, + float greenReplacement, float blueReplacement, String profileName, + String profileSrc, ColorSpace colorSpace, float[] iccValues) { + ColorExt ce = new ColorExt(colorSpace, iccValues, 1.0f); + ce.rgbReplacementRed = redReplacement; + ce.rgbReplacementGreen = greenReplacement; + ce.rgbReplacementBlue = blueReplacement; + ce.iccProfileName = profileName; + ce.iccProfileSrc = profileSrc; + ce.colorSpace = colorSpace; + ce.colorValues = iccValues; + return ce; + } + + /** + * Create ColorExt object backing up SVG's icc-color function. + * + * @param red + * Red value resulting from the conversion from the user provided + * (icc) color values to the batik (rgb) color space + * @param green + * Green value resulting from the conversion from the user + * provided (icc) color values to the batik (rgb) color space + * @param blue + * Blue value resulting from the conversion from the user + * provided (icc) color values to the batik (rgb) color space + * @param opacity + * Opacity + * @param profileName + * ICC profile name + * @param profileHref + * the URI to the color profile + * @param profileCS + * ICC ColorSpace profile + * @param colorValues + * ICC color values + * @return the requested color object + */ + public static ColorExt createFromSvgIccColor // CSOK: ParameterNumber + (float red, float green, + float blue, float opacity, String profileName, String profileHref, + ColorSpace profileCS, float[] colorValues) { + //TODO this method is not referenced by FOP, can it be deleted? + ColorExt ce = new ColorExt(red, green, blue, opacity); + ce.rgbReplacementRed = -1; + ce.rgbReplacementGreen = -1; + ce.rgbReplacementBlue = -1; + ce.iccProfileName = profileName; + ce.iccProfileSrc = profileHref; + ce.colorSpace = profileCS; + ce.colorValues = colorValues; + return ce; + + } + + /** {@inheritDoc} */ + public int hashCode() { + //implementation from the superclass should be good enough for our purposes + return super.hashCode(); + } + + /** {@inheritDoc} */ + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ColorExt other = (ColorExt)obj; + //TODO maybe use super.getColorComponents() instead + if (!Arrays.equals(colorValues, other.colorValues)) { + return false; + } + if (iccProfileName == null) { + if (other.iccProfileName != null) { + return false; + } + } else if (!iccProfileName.equals(other.iccProfileName)) { + return false; + } + if (iccProfileSrc == null) { + if (other.iccProfileSrc != null) { + return false; + } + } else if (!iccProfileSrc.equals(other.iccProfileSrc)) { + return false; + } + if (Float.floatToIntBits(rgbReplacementBlue) + != Float.floatToIntBits(other.rgbReplacementBlue)) { + return false; + } + if (Float.floatToIntBits(rgbReplacementGreen) + != Float.floatToIntBits(other.rgbReplacementGreen)) { + return false; + } + if (Float.floatToIntBits(rgbReplacementRed) + != Float.floatToIntBits(other.rgbReplacementRed)) { + return false; + } + return true; + } + + /** + * Get ICC profile name + * + * @return ICC profile name + */ + public String getIccProfileName() { + return this.iccProfileName; + } + + /** + * Get ICC profile source + * + * @return ICC profile source + */ + public String getIccProfileSrc() { + return this.iccProfileSrc; + } + + /** + * @return the original ColorSpace + */ + public ColorSpace getOrigColorSpace() { + //TODO this method is probably unnecessary due to super.cs and getColorSpace() + return this.colorSpace; + } + + /** + * Returns the original color values. + * @return the original color values + */ + public float[] getOriginalColorComponents() { + //TODO this method is probably unnecessary due to super.fvalue and getColorComponents() + float[] copy = new float[this.colorValues.length]; + System.arraycopy(this.colorValues, 0, copy, 0, copy.length); + return copy; + } + + /** + * Create string representation of fop-rgb-icc function call to map this + * ColorExt settings + * @return the string representing the internal fop-rgb-icc() function call + */ + public String toFunctionCall() { + StringBuffer sb = new StringBuffer(40); + sb.append("fop-rgb-icc("); + sb.append(this.rgbReplacementRed + ","); + sb.append(this.rgbReplacementGreen + ","); + sb.append(this.rgbReplacementBlue + ","); + sb.append(this.iccProfileName + ","); + if (this.iccProfileSrc != null) { + sb.append("\"" + this.iccProfileSrc + "\""); + } + float[] colorComponents = this.getColorComponents(null); + for (int ix = 0; ix < colorComponents.length; ix++) { + sb.append(","); + sb.append(colorComponents[ix]); + } + sb.append(")"); + return sb.toString(); + } + +} diff --git a/src/java/org/apache/fop/util/ColorProfileUtil.java b/src/java/org/apache/fop/util/ColorProfileUtil.java index f234dde66..35b6660dc 100644 --- a/src/java/org/apache/fop/util/ColorProfileUtil.java +++ b/src/java/org/apache/fop/util/ColorProfileUtil.java @@ -27,7 +27,10 @@ import java.io.UnsupportedEncodingException; /** * Helper methods for handling color profiles. */ -public class ColorProfileUtil { +public final class ColorProfileUtil { + + private ColorProfileUtil() { + } /** * Returns the profile description of an ICC profile diff --git a/src/java/org/apache/fop/util/ColorUtil.java b/src/java/org/apache/fop/util/ColorUtil.java index 656d9ef98..8fe6c707f 100644 --- a/src/java/org/apache/fop/util/ColorUtil.java +++ b/src/java/org/apache/fop/util/ColorUtil.java @@ -27,8 +27,7 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.color.ColorExt; +import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.expr.PropertyException; @@ -329,7 +328,7 @@ public final class ColorUtil { String iccProfileSrc = null; if (isPseudoProfile(iccProfileName)) { if (CMYK_PSEUDO_PROFILE.equalsIgnoreCase(iccProfileName)) { - colorSpace = CMYKColorSpace.getInstance(); + colorSpace = DeviceCMYKColorSpace.getInstance(); } else { assert false : "Incomplete implementation"; } @@ -454,7 +453,7 @@ public final class ColorUtil { + "Arguments to cmyk() must be in the range [0%-100%] or [0.0-1.0]"); } float[] cmyk = new float[] {cyan, magenta, yellow, black}; - CMYKColorSpace cmykCs = CMYKColorSpace.getInstance(); + DeviceCMYKColorSpace cmykCs = DeviceCMYKColorSpace.getInstance(); float[] rgb = cmykCs.toRGB(cmyk); parsedColor = ColorExt.createFromFoRgbIcc(rgb[0], rgb[1], rgb[2], CMYK_PSEUDO_PROFILE, null, cmykCs, cmyk); @@ -521,7 +520,7 @@ public final class ColorUtil { /** * Initializes the colorMap with some predefined values. */ - private static void initializeColorMap() { + private static void initializeColorMap() { // CSOK: MethodLength colorMap = Collections.synchronizedMap(new java.util.HashMap()); colorMap.put("aliceblue", new Color(240, 248, 255)); @@ -705,12 +704,16 @@ public final class ColorUtil { } /** - * Creates an uncalibrary CMYK color with the given gray value. + * Creates an uncalibrated CMYK color with the given gray value. * @param black the gray component (0 - 1) * @return the CMYK color */ public static Color toCMYKGrayColor(float black) { - - return org.apache.xmlgraphics.java2d.color.ColorUtil.toCMYKGrayColor(black); + float[] cmyk = new float[] {0f, 0f, 0f, 1.0f - black}; + DeviceCMYKColorSpace cmykCs = DeviceCMYKColorSpace.getInstance(); + float[] rgb = cmykCs.toRGB(cmyk); + return ColorExt.createFromFoRgbIcc(rgb[0], rgb[1], rgb[2], + CMYK_PSEUDO_PROFILE, null, cmykCs, cmyk); } + } diff --git a/src/java/org/apache/fop/util/CommandLineLogger.java b/src/java/org/apache/fop/util/CommandLineLogger.java index 0da112e5c..a9e59158f 100644 --- a/src/java/org/apache/fop/util/CommandLineLogger.java +++ b/src/java/org/apache/fop/util/CommandLineLogger.java @@ -1,9 +1,10 @@ -/* 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 +/* + * 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 * diff --git a/src/java/org/apache/fop/util/ConversionUtils.java b/src/java/org/apache/fop/util/ConversionUtils.java index f445134fc..fcdb4cdbd 100644 --- a/src/java/org/apache/fop/util/ConversionUtils.java +++ b/src/java/org/apache/fop/util/ConversionUtils.java @@ -25,6 +25,9 @@ package org.apache.fop.util; */ public final class ConversionUtils { + private ConversionUtils() { + } + /** * Converts the given base <code>String</code> into * an array of <code>int</code>, splitting the base along the diff --git a/src/java/org/apache/fop/util/DataURIResolver.java b/src/java/org/apache/fop/util/DataURIResolver.java index 99a8318c8..19ca31b22 100644 --- a/src/java/org/apache/fop/util/DataURIResolver.java +++ b/src/java/org/apache/fop/util/DataURIResolver.java @@ -32,6 +32,10 @@ public class DataURIResolver implements URIResolver { private final URIResolver newResolver = new org.apache.xmlgraphics.util.uri.DataURIResolver(); /** + * @param href an href + * @param base a base + * @return a source + * @throws TransformerException if not caught * @deprecated * @see org.apache.xmlgraphics.util.uri.DataURIResolver#resolve(String, * String) diff --git a/src/java/org/apache/fop/util/DataURLUtil.java b/src/java/org/apache/fop/util/DataURLUtil.java index 8568df274..46ff8635b 100644 --- a/src/java/org/apache/fop/util/DataURLUtil.java +++ b/src/java/org/apache/fop/util/DataURLUtil.java @@ -24,23 +24,34 @@ import java.io.InputStream; import java.io.Writer; /** - * @deprecated + * @deprecated use org.apache.xmlgraphics.util.uri.DataURLUtil directly * @see org.apache.xmlgraphics.util.uri.DataURLUtil */ -public class DataURLUtil { +public final class DataURLUtil { + + private DataURLUtil() { + } /** + * @param in an input stream + * @param mediatype a MIME media type + * @return a data url as a string + * @throws IOException if not caught * @deprecated * @see org.apache.xmlgraphics.util.uri.DataURLUtil#createDataURL(InputStream, * String) */ public static String createDataURL(InputStream in, String mediatype) - throws IOException { + throws IOException { return org.apache.xmlgraphics.util.uri.DataURLUtil.createDataURL(in, mediatype); } /** + * @param in an input stream + * @param mediatype a MIME media type + * @param writer a writer + * @throws IOException if not caught * @deprecated * @see org.apache.xmlgraphics.util.uri.DataURLUtil#writeDataURL(InputStream, * String, Writer) diff --git a/src/java/org/apache/fop/util/DecimalFormatCache.java b/src/java/org/apache/fop/util/DecimalFormatCache.java index d8c3b7361..a6634f50b 100644 --- a/src/java/org/apache/fop/util/DecimalFormatCache.java +++ b/src/java/org/apache/fop/util/DecimalFormatCache.java @@ -28,7 +28,10 @@ import java.util.Locale; * is not thread-safe but since FOP needs to format a lot of numbers the same way, it shall * be cached in a {@link ThreadLocal}. */ -public class DecimalFormatCache { +public final class DecimalFormatCache { + + private DecimalFormatCache() { + } private static final String BASE_FORMAT = "0.################"; diff --git a/src/java/org/apache/fop/util/LogUtil.java b/src/java/org/apache/fop/util/LogUtil.java index 23f275644..664667a76 100644 --- a/src/java/org/apache/fop/util/LogUtil.java +++ b/src/java/org/apache/fop/util/LogUtil.java @@ -25,7 +25,10 @@ import org.apache.fop.apps.FOPException; /** * Convenience Logging utility methods used in FOP */ -public class LogUtil { +public final class LogUtil { + + private LogUtil() { + } /** * Convenience method that handles any error appropriately diff --git a/src/java/org/apache/fop/util/UnitConv.java b/src/java/org/apache/fop/util/UnitConv.java index cf599712f..b0c87ec18 100644 --- a/src/java/org/apache/fop/util/UnitConv.java +++ b/src/java/org/apache/fop/util/UnitConv.java @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id: $ */ +/* $Id$ */ package org.apache.fop.util; @@ -27,6 +27,9 @@ import java.awt.geom.AffineTransform; */ public final class UnitConv { + private UnitConv() { + } + /** * conversion factory from millimeters to inches. * @deprecated use org.apache.xmlgraphics.util.UnitConv.IN2MM instead. diff --git a/src/java/org/apache/fop/util/WriterOutputStream.java b/src/java/org/apache/fop/util/WriterOutputStream.java index e08109ab0..17ec5d658 100644 --- a/src/java/org/apache/fop/util/WriterOutputStream.java +++ b/src/java/org/apache/fop/util/WriterOutputStream.java @@ -24,7 +24,7 @@ import java.io.OutputStream; import java.io.Writer; /** - * @deprecated + * @deprecated use org.apache.xmlgraphics.util.WriterOutputStream instead * @see org.apache.xmlgraphics.util.WriterOutputStream */ public class WriterOutputStream extends OutputStream { @@ -32,9 +32,7 @@ public class WriterOutputStream extends OutputStream { private final org.apache.xmlgraphics.util.WriterOutputStream writerOutputStream; /** - * @deprecated - * @see org.apache.xmlgraphics.util.WriterOutputStream#WriterOutputStream(Writer) - * String) + * @param writer a writer */ public WriterOutputStream(Writer writer) { writerOutputStream = new org.apache.xmlgraphics.util.WriterOutputStream( @@ -42,52 +40,35 @@ public class WriterOutputStream extends OutputStream { } /** - * @deprecated - * @see org.apache.xmlgraphics.util.WriterOutputStream#WriterOutputStream(Writer, - * String) String) + * @param writer a writer + * @param encoding stream encoding */ public WriterOutputStream(Writer writer, String encoding) { writerOutputStream = new org.apache.xmlgraphics.util.WriterOutputStream( writer, encoding); } - /** - * @deprecated - * @see org.apache.xmlgraphics.util.WriterOutputStream#close() - */ + /** {@inheritDoc} */ public void close() throws IOException { writerOutputStream.close(); } - /** - * @deprecated - * @see org.apache.xmlgraphics.util.WriterOutputStream#flush() - */ + /** {@inheritDoc} */ public void flush() throws IOException { writerOutputStream.flush(); } - /** - * @deprecated - * @see org.apache.xmlgraphics.util.WriterOutputStream#write(byte[], int, - * int) - */ + /** {@inheritDoc} */ public void write(byte[] buf, int offset, int length) throws IOException { writerOutputStream.write(buf, offset, length); } - /** - * @deprecated - * @see org.apache.xmlgraphics.util.WriterOutputStream#write(byte[]) - */ + /** {@inheritDoc} */ public void write(byte[] buf) throws IOException { writerOutputStream.write(buf); } - /** - * @deprecated - * @see org.apache.xmlgraphics.util.WriterOutputStream#write(int) - */ + /** {@inheritDoc} */ public void write(int b) throws IOException { writerOutputStream.write(b); } diff --git a/src/java/org/apache/fop/util/XMLUtil.java b/src/java/org/apache/fop/util/XMLUtil.java index f7c013a2f..0a55ce573 100644 --- a/src/java/org/apache/fop/util/XMLUtil.java +++ b/src/java/org/apache/fop/util/XMLUtil.java @@ -30,7 +30,10 @@ import org.xml.sax.helpers.AttributesImpl; /** * A collection of utility method for XML handling. */ -public class XMLUtil implements XMLConstants { +public final class XMLUtil implements XMLConstants { + + private XMLUtil() { + } /** * Returns an attribute value as a boolean value. diff --git a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java b/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java index c08076316..b2706c5c2 100644 --- a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java +++ b/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java @@ -32,14 +32,17 @@ import java.awt.image.WritableRaster; /** * Utility method for dealing with bitmap images. */ -public class BitmapImageUtil { +public final class BitmapImageUtil { + + private BitmapImageUtil() { + } /** * Indicates whether an image is a monochrome (1 bit black and white) image. * @param img the image * @return true if it's a monochrome image */ - public static final boolean isMonochromeImage(RenderedImage img) { + public static boolean isMonochromeImage(RenderedImage img) { return (getColorIndexSize(img) == 2); } @@ -48,7 +51,7 @@ public class BitmapImageUtil { * @param img the image (must be 1 bit monochrome) * @return true if a zero bit indicates a black/dark pixel, false for a white/bright pixel */ - public static final boolean isZeroBlack(RenderedImage img) { + public static boolean isZeroBlack(RenderedImage img) { if (!isMonochromeImage(img)) { throw new IllegalArgumentException("Image is not a monochrome image!"); } @@ -65,7 +68,7 @@ public class BitmapImageUtil { * @param b the blue component * @return the gray value */ - public static final int convertToGray(int r, int g, int b) { + public static int convertToGray(int r, int g, int b) { return (r * 30 + g * 59 + b * 11) / 100; } @@ -74,7 +77,7 @@ public class BitmapImageUtil { * @param rgb the RGB value * @return the gray value */ - public static final int convertToGray(int rgb) { + public static int convertToGray(int rgb) { int r = (rgb & 0xFF0000) >> 16; int g = (rgb & 0xFF00) >> 8; int b = rgb & 0xFF; @@ -86,7 +89,7 @@ public class BitmapImageUtil { * @param img the image * @return the size of the color index or 0 if there's no color index */ - public static final int getColorIndexSize(RenderedImage img) { + public static int getColorIndexSize(RenderedImage img) { ColorModel cm = img.getColorModel(); if (cm instanceof IndexColorModel) { IndexColorModel icm = (IndexColorModel)cm; @@ -101,7 +104,7 @@ public class BitmapImageUtil { * @param img the image * @return true if it's a grayscale image */ - public static final boolean isGrayscaleImage(RenderedImage img) { + public static boolean isGrayscaleImage(RenderedImage img) { return (img.getColorModel().getColorSpace().getNumComponents() == 1); } @@ -111,7 +114,7 @@ public class BitmapImageUtil { * @param targetDimension the new target dimensions or null if no scaling is necessary * @return the sRGB image */ - public static final BufferedImage convertTosRGB(RenderedImage img, + public static BufferedImage convertTosRGB(RenderedImage img, Dimension targetDimension) { return convertAndScaleImage(img, targetDimension, BufferedImage.TYPE_INT_RGB); } @@ -122,7 +125,7 @@ public class BitmapImageUtil { * @param targetDimension the new target dimensions or null if no scaling is necessary * @return the grayscale image */ - public static final BufferedImage convertToGrayscale(RenderedImage img, + public static BufferedImage convertToGrayscale(RenderedImage img, Dimension targetDimension) { return convertAndScaleImage(img, targetDimension, BufferedImage.TYPE_BYTE_GRAY); } @@ -133,7 +136,7 @@ public class BitmapImageUtil { * @param targetDimension the new target dimensions or null if no scaling is necessary * @return the monochrome image */ - public static final BufferedImage convertToMonochrome(RenderedImage img, + public static BufferedImage convertToMonochrome(RenderedImage img, Dimension targetDimension) { return toBufferedImage(convertToMonochrome(img, targetDimension, 0.0f)); } @@ -146,7 +149,7 @@ public class BitmapImageUtil { * Valid values: a value between 0.0f (fastest) and 1.0f (best) * @return the monochrome image */ - public static final RenderedImage convertToMonochrome(RenderedImage img, + public static RenderedImage convertToMonochrome(RenderedImage img, Dimension targetDimension, float quality) { if (!isMonochromeImage(img)) { if (quality >= 0.5f) { @@ -234,6 +237,7 @@ public class BitmapImageUtil { } } + /** @return the bitmap converter */ public static MonochromeBitmapConverter createDefaultMonochromeBitmapConverter() { MonochromeBitmapConverter converter = null; try { diff --git a/src/java/org/apache/fop/util/bitmap/DitherUtil.java b/src/java/org/apache/fop/util/bitmap/DitherUtil.java index c61befc9c..2fa2e9402 100644 --- a/src/java/org/apache/fop/util/bitmap/DitherUtil.java +++ b/src/java/org/apache/fop/util/bitmap/DitherUtil.java @@ -24,7 +24,10 @@ import java.awt.Color; /** * Utility methods for dithering. */ -public class DitherUtil { +public final class DitherUtil { + + private DitherUtil() { + } /** Selects a 2x2 Bayer dither matrix (5 grayscales) */ public static final int DITHER_MATRIX_2X2 = 2; diff --git a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java b/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java index 8c26bd622..002b3f95c 100644 --- a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java +++ b/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java @@ -29,7 +29,7 @@ import org.apache.xmlgraphics.util.Service; /** * Formats messages based on a template and with a set of named parameters. This is similar to - * {@link java.util.MessageFormat} but uses named parameters and supports conditional sub-groups. + * {@link java.text.MessageFormat} but uses named parameters and supports conditional sub-groups. * <p> * Example: * </p> diff --git a/src/sandbox/org/apache/fop/render/mif/MIFElement.java b/src/sandbox/org/apache/fop/render/mif/MIFElement.java index 8c749366f..b0aa7d5f5 100644 --- a/src/sandbox/org/apache/fop/render/mif/MIFElement.java +++ b/src/sandbox/org/apache/fop/render/mif/MIFElement.java @@ -31,24 +31,32 @@ import java.util.List; * to an output stream including sub-elements or a single value. */ public class MIFElement { + /** name */ protected String name; + /** value string */ protected String valueStr = null; + /** value elements */ protected List valueElements = null; - + /** true if started */ protected boolean started = false; + /** true if finishing */ protected boolean finish = false; + /** true if finished */ protected boolean finished = false; /** + * @param name a name */ - public MIFElement(String n) { - name = n; + public MIFElement(String name) { + this.name = name; } + /** @param str a string value */ public void setValue(String str) { valueStr = str; } + /** @param el an MIF element */ public void addElement(MIFElement el) { if (valueElements == null) { valueElements = new java.util.ArrayList(); @@ -62,6 +70,10 @@ public class MIFElement { * This method can be called again to continue from the previous point. * An element that contains child elements will only be finished when * the finish method is called. + * @param os output stream + * @param indent indentation + * @return true if finished + * @throws IOException if not caught */ public boolean output(OutputStream os, int indent) throws IOException { if (finished) { @@ -105,6 +117,7 @@ public class MIFElement { return true; } + /** @param deep if true, also perform finish over value elements */ public void finish(boolean deep) { finish = true; if (deep && valueElements != null) { diff --git a/src/sandbox/org/apache/fop/render/mif/MIFFOEventHandlerMaker.java b/src/sandbox/org/apache/fop/render/mif/MIFFOEventHandlerMaker.java index 01357c18d..31ce03dc3 100644 --- a/src/sandbox/org/apache/fop/render/mif/MIFFOEventHandlerMaker.java +++ b/src/sandbox/org/apache/fop/render/mif/MIFFOEventHandlerMaker.java @@ -34,17 +34,17 @@ public class MIFFOEventHandlerMaker extends AbstractFOEventHandlerMaker { private static final String[] MIMES = new String[] {MimeConstants.MIME_MIF}; - /** @see org.apache.fop.render.AbstractFOEventHandlerMaker */ + /** {@inheritDoc} */ public FOEventHandler makeFOEventHandler(FOUserAgent ua, OutputStream out) { return new MIFHandler(ua, out); } - /** @see org.apache.fop.render.AbstractFOEventHandlerMaker#needsOutputStream() */ + /** {@inheritDoc} */ public boolean needsOutputStream() { return true; } - /** @see org.apache.fop.render.AbstractFOEventHandlerMaker#getSupportedMimeTypes() */ + /** {@inheritDoc} */ public String[] getSupportedMimeTypes() { return MIMES; } diff --git a/src/sandbox/org/apache/fop/render/mif/MIFFile.java b/src/sandbox/org/apache/fop/render/mif/MIFFile.java index 131db5c2b..d0fa27023 100644 --- a/src/sandbox/org/apache/fop/render/mif/MIFFile.java +++ b/src/sandbox/org/apache/fop/render/mif/MIFFile.java @@ -33,23 +33,39 @@ import java.util.List; */ public class MIFFile extends MIFElement { + /** colorCatalog */ protected MIFElement colorCatalog = null; + /** pgfCatalog */ protected PGFElement pgfCatalog = null; + /** fontCatalog */ protected MIFElement fontCatalog = null; + /** rulingCatalog */ protected RulingElement rulingCatalog = null; + /** tblCatalog */ protected MIFElement tblCatalog = null; + /** views */ protected MIFElement views = null; + /** variableFormats */ protected MIFElement variableFormats = null; + /** xRefFormats */ protected MIFElement xRefFormats = null; + /** document */ protected MIFElement document = null; + /** bookComponent */ protected MIFElement bookComponent = null; + /** initialAutoNums */ protected MIFElement initialAutoNums = null; + /** aFrames */ protected MIFElement aFrames = null; + /** tbls */ protected MIFElement tbls = null; + /** pages */ protected List pages = new java.util.ArrayList(); + /** textFlows */ protected List textFlows = null; + /** default constructor */ public MIFFile() { super(""); valueElements = new java.util.ArrayList(); @@ -104,6 +120,10 @@ public class MIFFile extends MIFElement { } + /** + * @param os output stream + * @throws IOException if not caught + */ public void output(OutputStream os) throws IOException { if (finished) { return; @@ -130,6 +150,7 @@ public class MIFFile extends MIFElement { } } + /** @param p a page element to add */ public void addPage(MIFElement p) { pages.add(p); addElement(p); diff --git a/src/sandbox/org/apache/fop/render/mif/MIFHandler.java b/src/sandbox/org/apache/fop/render/mif/MIFHandler.java index ca36ab174..0adf8bf5b 100644 --- a/src/sandbox/org/apache/fop/render/mif/MIFHandler.java +++ b/src/sandbox/org/apache/fop/render/mif/MIFHandler.java @@ -42,6 +42,8 @@ import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; import org.apache.fop.fo.flow.table.TableCell; import org.apache.fop.fo.flow.table.TableColumn; +import org.apache.fop.fo.flow.table.TableFooter; +import org.apache.fop.fo.flow.table.TableHeader; import org.apache.fop.fo.flow.table.TableRow; import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; @@ -85,9 +87,7 @@ public class MIFHandler extends FOEventHandler { FontSetup.setup(fontInfo, null, new DefaultFontResolver(ua)); } - /** - * @see org.apache.fop.fo.FOEventHandler#startDocument() - */ + /** {@inheritDoc} */ public void startDocument() throws SAXException { log.fatal("The MIF Handler is non-functional at this time. Please help resurrect it!"); mifFile = new MIFFile(); @@ -98,9 +98,7 @@ public class MIFHandler extends FOEventHandler { } } - /** - * @see org.apache.fop.fo.FOEventHandler#endDocument() - */ + /** {@inheritDoc} */ public void endDocument() throws SAXException { // finish all open elements mifFile.finish(true); @@ -112,19 +110,15 @@ public class MIFHandler extends FOEventHandler { } } - /** - * Start the page sequence. - * This creates the pages in the MIF document that will be used - * by the following flows and static areas. - * @see org.apache.fop.fo.FOEventHandler - */ + /** {@inheritDoc} */ public void startPageSequence(PageSequence pageSeq) { // get the layout master set // setup the pages for this sequence String name = pageSeq.getMasterReference(); SimplePageMaster spm = pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(name); if (spm == null) { - PageSequenceMaster psm = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(name); + PageSequenceMaster psm + = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(name); } else { // create simple master with regions MIFElement prop = new MIFElement("PageType"); @@ -160,284 +154,190 @@ public class MIFHandler extends FOEventHandler { } } - /** - * @see org.apache.fop.fo.FOEventHandler#endPageSequence(PageSequence) - */ + /** {@inheritDoc} */ public void endPageSequence(PageSequence pageSeq) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startFlow(Flow) - */ + /** {@inheritDoc} */ public void startFlow(Flow fl) { // start text flow in body region textFlow = new MIFElement("TextFlow"); } - /** - * @see org.apache.fop.fo.FOEventHandler#endFlow(Flow) - */ + /** {@inheritDoc} */ public void endFlow(Flow fl) { textFlow.finish(true); mifFile.addElement(textFlow); textFlow = null; } - /** - * @see org.apache.fop.fo.FOEventHandler#startBlock(Block) - */ + /** {@inheritDoc} */ public void startBlock(Block bl) { para = new MIFElement("Para"); // get font textFlow.addElement(para); } - /** - * @see org.apache.fop.fo.FOEventHandler#endBlock(Block) - */ + /** {@inheritDoc} */ public void endBlock(Block bl) { para.finish(true); para = null; } - /** - * - * @param inl Inline that is starting. - */ - public void startInline(Inline inl){ + /** {@inheritDoc} */ + public void startInline(Inline inl) { } - /** - * - * @param inl Inline that is ending. - */ - public void endInline(Inline inl){ + /** {@inheritDoc} */ + public void endInline(Inline inl) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startTable(Table) - */ + /** {@inheritDoc} */ public void startTable(Table tbl) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endTable(Table) - */ + /** {@inheritDoc} */ public void endTable(Table tbl) { } - /** - * - * @param tc TableColumn that is starting; - */ + /** {@inheritDoc} */ public void startColumn(TableColumn tc) { } - /** - * - * @param tc TableColumn that is ending; - */ + /** {@inheritDoc} */ public void endColumn(TableColumn tc) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startHeader(TableBody) - */ - public void startHeader(TableBody th) { + /** {@inheritDoc} */ + public void startHeader(TableHeader th) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endHeader(TableBody) - */ - public void endHeader(TableBody th) { + /** {@inheritDoc} */ + public void endHeader(TableHeader th) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startFooter(TableBody) - */ - public void startFooter(TableBody tf) { + /** {@inheritDoc} */ + public void startFooter(TableFooter tf) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endFooter(TableBody) - */ - public void endFooter(TableBody tf) { + /** {@inheritDoc} */ + public void endFooter(TableFooter tf) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startBody(TableBody) - */ + /** {@inheritDoc} */ public void startBody(TableBody tb) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endBody(TableBody) - */ + /** {@inheritDoc} */ public void endBody(TableBody tb) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startRow(TableRow) - */ + /** {@inheritDoc} */ public void startRow(TableRow tr) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endRow(TableRow) - */ + /** {@inheritDoc} */ public void endRow(TableRow tr) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startCell(TableCell) - */ + /** {@inheritDoc} */ public void startCell(TableCell tc) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endCell(TableCell) - */ + /** {@inheritDoc} */ public void endCell(TableCell tc) { } - // Lists - /** - * @see org.apache.fop.fo.FOEventHandler#startList(ListBlock) - */ + /** {@inheritDoc} */ public void startList(ListBlock lb) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endList(ListBlock) - */ + /** {@inheritDoc} */ public void endList(ListBlock lb) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startListItem(ListItem) - */ + /** {@inheritDoc} */ public void startListItem(ListItem li) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endListItem(ListItem) - */ + /** {@inheritDoc} */ public void endListItem(ListItem li) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startListLabel() - */ + /** {@inheritDoc} */ public void startListLabel() { } - /** - * @see org.apache.fop.fo.FOEventHandler#endListLabel() - */ + /** {@inheritDoc} */ public void endListLabel() { } - /** - * @see org.apache.fop.fo.FOEventHandler#startListBody() - */ + /** {@inheritDoc} */ public void startListBody() { } - /** - * @see org.apache.fop.fo.FOEventHandler#endListBody() - */ + /** {@inheritDoc} */ public void endListBody() { } - // Static Regions - /** - * @see org.apache.fop.fo.FOEventHandler#startStatic() - */ + /** {@inheritDoc} */ public void startStatic() { } - /** - * @see org.apache.fop.fo.FOEventHandler#endStatic() - */ + /** {@inheritDoc} */ public void endStatic() { } - /** - * @see org.apache.fop.fo.FOEventHandler#startMarkup() - */ + /** {@inheritDoc} */ public void startMarkup() { } - /** - * @see org.apache.fop.fo.FOEventHandler#endMarkup() - */ + /** {@inheritDoc} */ public void endMarkup() { } - /** - * @see org.apache.fop.fo.FOEventHandler#startLink(BasicLink basicLink) - */ + /** {@inheritDoc} */ public void startLink(BasicLink basicLink) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endLink() - */ + /** {@inheritDoc} */ public void endLink() { } - /** - * @see org.apache.fop.fo.FOEventHandler#image(ExternalGraphic) - */ + /** {@inheritDoc} */ public void image(ExternalGraphic eg) { } - /** - * @see org.apache.fop.fo.FOEventHandler#pageRef() - */ + /** {@inheritDoc} */ public void pageRef() { } - /** - * @see org.apache.fop.fo.FOEventHandler#foreignObject(InstreamForeignObject) - */ + /** {@inheritDoc} */ public void foreignObject(InstreamForeignObject ifo) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startFootnote(Footnote) - */ + /** {@inheritDoc} */ public void startFootnote(Footnote footnote) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endFootnote(Footnote) - */ + /** {@inheritDoc} */ public void endFootnote(Footnote footnote) { } - /** - * @see org.apache.fop.fo.FOEventHandler#startFootnoteBody(FootnoteBody) - */ + /** {@inheritDoc} */ public void startFootnoteBody(FootnoteBody body) { } - /** - * @see org.apache.fop.fo.FOEventHandler#endFootnoteBody(FootnoteBody) - */ + /** {@inheritDoc} */ public void endFootnoteBody(FootnoteBody body) { } - /** - * @see org.apache.fop.fo.FOEventHandler#leader(Leader) - */ + /** {@inheritDoc} */ public void leader(Leader l) { } - /** - * @see org.apache.fop.fo.FOEventHandler#characters(char[], int, int) - */ - public void characters(char data[], int start, int length) { + /** {@inheritDoc} */ + public void characters(char[] data, int start, int length) { if (para != null) { String str = new String(data, start, length); str = str.trim(); @@ -458,17 +358,11 @@ public class MIFHandler extends FOEventHandler { } } - /** - * - * @param pagenum PageNumber that is starting. - */ + /** {@inheritDoc} */ public void startPageNumber(PageNumber pagenum) { } - /** - * - * @param pagenum PageNumber that is ending. - */ + /** {@inheritDoc} */ public void endPageNumber(PageNumber pagenum) { } } diff --git a/src/sandbox/org/apache/fop/render/mif/PGFElement.java b/src/sandbox/org/apache/fop/render/mif/PGFElement.java index 6aa253ac2..958518fac 100644 --- a/src/sandbox/org/apache/fop/render/mif/PGFElement.java +++ b/src/sandbox/org/apache/fop/render/mif/PGFElement.java @@ -33,6 +33,10 @@ public class PGFElement extends RefElement { super("PgfCatalog"); } + /** + * @param key an object + * @return an MIF element + */ public MIFElement lookupElement(Object key) { if (key == null) { MIFElement pgf = new MIFElement("Pgf"); diff --git a/src/sandbox/org/apache/fop/render/mif/RefElement.java b/src/sandbox/org/apache/fop/render/mif/RefElement.java index c6b5d0ec5..b23dffa2b 100644 --- a/src/sandbox/org/apache/fop/render/mif/RefElement.java +++ b/src/sandbox/org/apache/fop/render/mif/RefElement.java @@ -31,12 +31,17 @@ package org.apache.fop.render.mif; public class RefElement extends MIFElement { /** + * @param name a name * @see org.apache.fop.render.mif.MIFElement#MIFElement(String) */ - public RefElement(String n) { - super(n); + public RefElement(String name) { + super(name); } + /** + * @param key a key + * @return an mif element + */ public MIFElement lookupElement(Object key) { return null; } diff --git a/src/sandbox/org/apache/fop/render/mif/RulingElement.java b/src/sandbox/org/apache/fop/render/mif/RulingElement.java index 2c2765bad..c811a01a4 100644 --- a/src/sandbox/org/apache/fop/render/mif/RulingElement.java +++ b/src/sandbox/org/apache/fop/render/mif/RulingElement.java @@ -19,12 +19,15 @@ package org.apache.fop.render.mif; +/** a ruling element */ public class RulingElement extends RefElement { + /** default constructor */ public RulingElement() { super("RulingCatalog"); } + /** {@inheritDoc} */ public MIFElement lookupElement(Object key) { if (key == null) { MIFElement rul = new MIFElement("Ruling"); diff --git a/src/sandbox/org/apache/fop/render/svg/SVGDataUrlImageHandler.java b/src/sandbox/org/apache/fop/render/svg/SVGDataUrlImageHandler.java index 4ff565331..fbe29e8d5 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGDataUrlImageHandler.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGDataUrlImageHandler.java @@ -33,11 +33,11 @@ import org.apache.xmlgraphics.image.loader.Image; import org.apache.xmlgraphics.image.loader.ImageFlavor; import org.apache.xmlgraphics.image.loader.impl.ImageRawStream; import org.apache.xmlgraphics.util.QName; +import org.apache.xmlgraphics.util.uri.DataURLUtil; import org.apache.fop.render.ImageHandler; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.intermediate.IFConstants; -import org.apache.fop.util.DataURLUtil; /** * Image handler implementation that embeds JPEG bitmaps as RFC 2397 data URLs in the target SVG diff --git a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java index c5a19818d..bcc3a6913 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java @@ -34,17 +34,14 @@ import org.w3c.dom.Document; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.apache.xmlgraphics.image.loader.ImageException; import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.ImageSessionContext; import org.apache.xmlgraphics.xmp.Metadata; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.ResourceEventProducer; +import org.apache.fop.apps.MimeConstants; import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.intermediate.AbstractIFPainter; @@ -64,9 +61,6 @@ import org.apache.fop.util.XMLUtil; */ public class SVGPainter extends AbstractIFPainter implements SVGConstants { - /** logging instance */ - private static Log log = LogFactory.getLog(SVGPainter.class); - private AbstractSVGDocumentHandler parent; /** The SAX content handler that receives the generated XML events. */ @@ -391,7 +385,10 @@ public class SVGPainter extends AbstractIFPainter implements SVGConstants { state.resetFontChanged(); } - /** {@inheritDoc} */ + /** + * @param extension an extension object + * @throws IFException if not caught + */ public void handleExtensionObject(Object extension) throws IFException { if (extension instanceof Metadata) { Metadata meta = (Metadata)extension; diff --git a/src/sandbox/org/apache/fop/render/svg/SVGRenderer.java b/src/sandbox/org/apache/fop/render/svg/SVGRenderer.java index d65555355..63f486c07 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGRenderer.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGRenderer.java @@ -67,16 +67,16 @@ public class SVGRenderer extends Java2DRenderer { /** Helper class for generating multiple files */ private MultiFileRenderingUtil multiFileUtil; - /** @see org.apache.fop.render.AbstractRenderer */ - public String getMimeType() { - return MIME_TYPE; + /** Default constructor. */ + public SVGRenderer() { } - /** Creates TIFF renderer. */ - public SVGRenderer() { + /** {@inheritDoc} */ + public String getMimeType() { + return MIME_TYPE; } - /** @see org.apache.fop.render.Renderer#startRenderer(java.io.OutputStream) */ + /** {@inheritDoc} */ public void startRenderer(OutputStream outputStream) throws IOException { this.firstOutputStream = outputStream; this.multiFileUtil = new MultiFileRenderingUtil(SVG_FILE_EXTENSION, @@ -84,9 +84,7 @@ public class SVGRenderer extends Java2DRenderer { super.startRenderer(this.firstOutputStream); } - /** - * @see org.apache.fop.render.java2d.Java2DRenderer#renderPage(org.apache.fop.area.PageViewport) - */ + /** {@inheritDoc} */ public void renderPage(PageViewport pageViewport) throws IOException { log.debug("Rendering page: " + pageViewport.getPageNumberString()); // Get a DOMImplementation @@ -122,7 +120,7 @@ public class SVGRenderer extends Java2DRenderer { } - /** @see org.apache.fop.render.Renderer#stopRenderer() */ + /** {@inheritDoc} */ public void stopRenderer() throws IOException { super.stopRenderer(); diff --git a/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java b/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java index 71810495b..f0da974e6 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGRendererMaker.java @@ -32,17 +32,17 @@ public class SVGRendererMaker extends AbstractRendererMaker { private static final String[] MIMES = new String[] {MimeConstants.MIME_SVG}; - /**@see org.apache.fop.render.AbstractRendererMaker */ + /** {@inheritDoc} */ public Renderer makeRenderer(FOUserAgent ua) { return new SVGRenderer(); } - /** @see org.apache.fop.render.AbstractRendererMaker#needsOutputStream() */ + /** {@inheritDoc} */ public boolean needsOutputStream() { return true; } - /** @see org.apache.fop.render.AbstractRendererMaker#getSupportedMimeTypes() */ + /** {@inheritDoc} */ public String[] getSupportedMimeTypes() { return MIMES; } diff --git a/src/sandbox/org/apache/fop/render/svg/SVGSVGHandler.java b/src/sandbox/org/apache/fop/render/svg/SVGSVGHandler.java index 702f081ac..c46c35b99 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGSVGHandler.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGSVGHandler.java @@ -32,9 +32,10 @@ import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGElement; import org.w3c.dom.svg.SVGSVGElement; +/** The svg:svg element handler. */ public class SVGSVGHandler implements XMLHandler, SVGRendererContextConstants { - /** @see org.apache.fop.render.XMLHandler */ + /** {@inheritDoc} */ public void handleXML(RendererContext context, org.w3c.dom.Document doc, String ns) throws Exception { if (getNamespace().equals(ns)) { @@ -67,12 +68,12 @@ public class SVGSVGHandler implements XMLHandler, SVGRendererContextConstants { } - /** @see org.apache.fop.render.XMLHandler#supportsRenderer(org.apache.fop.render.Renderer) */ + /** {@inheritDoc} */ public boolean supportsRenderer(Renderer renderer) { return (renderer instanceof SVGRenderer); } - /** @see org.apache.fop.render.XMLHandler#getNamespace() */ + /** {@inheritDoc} */ public String getNamespace() { return SVGRenderer.MIME_TYPE; } diff --git a/src/sandbox/org/apache/fop/render/svg/SVGUtil.java b/src/sandbox/org/apache/fop/render/svg/SVGUtil.java index 2953b0d5a..186789dac 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGUtil.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGUtil.java @@ -26,7 +26,10 @@ import org.apache.fop.render.intermediate.IFUtil; /** * This class provides utility methods for generating SVG. */ -public class SVGUtil { +public final class SVGUtil { + + private SVGUtil() { + } /** * Formats a length in millipoints as a point value. diff --git a/status.xml b/status.xml index 353b8059b..1f0916753 100644 --- a/status.xml +++ b/status.xml @@ -58,6 +58,21 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Renderers" dev="VH" type="remove"> + Removed old Renderer implementations for those output formats that have a version based on + the new DocumentHandler architecture available (AFP, PCL, PDF, PS). + </action> + <action context="Fonts" dev="AC" type="fix"> + Reinstated support for being able to specify a font cache filepath in the fop user configuration. + </action> + <action context="Fonts" dev="AC" type="add"> + Added convenience support for the flushing of the Fop font cache file from the command line. + </action> + <action context="Renderers" dev="JM" type="add" fixes-bug="44460" due-to="Andrejus Chaliapinas"> + Added support for PDF File Attachments (Embedded Files). + </action> + </release> + <release version="1.0" date="21 July 2010"> <action context="Renderers" dev="JM" type="fix"> AFP Output: Fixed positioning of Java2D-based images (when GOCA is enabled). </action> @@ -88,6 +103,8 @@ <action context="Renderers" dev="JM" type="add" fixes-bug="48567" due-to="Peter Hancock"> Initial support for CID-keyed double-byte fonts (Type 0) in AFP output. </action> + <action context="API" dev="SP" type="add">Added a command-line option '-catalog' to use a catalog resolver for the XML and XSLT files</action> + <action context="Layout" dev="SP" type="add">Implement internal character classes if the hyphenation pattern file does not contain them</action> <action context="Layout" dev="VH" type="fix" fixes-bug="46486"> Bugfix: having a special page-master for the last page caused loss of content when normal blocks were mixed with blocks spanning all columns. @@ -135,7 +152,7 @@ <action context="Renderers" dev="JM,VH" type="add" fixes-bug="46705" due-to="Jost Klopfstein"> Added basic accessibility and Tagged PDF support. </action> - <action context="Code" dev="JM" type="add"> + <action context="Renderers" dev="JM" type="add"> Added support for encoding CMYK bitmap images (IOCA FS45) and TIFF images as embedded objects. </action> <action context="Code" dev="AC" type="add"> @@ -544,6 +561,10 @@ Added support for addressing all glyphs available in a Type 1 font, not just the ones in the font's primary encoding. </action> + <action context="Code" dev="JM" type="add" importance="high"> + Added an event handling framework which allows to get better feedback from within FOP + with the ability to customize problem management. + </action> </release> <release version="0.95" date="05 August 2008"> <notes> diff --git a/test/java/org/apache/fop/GenericFOPTestCase.java b/test/java/org/apache/fop/GenericFOPTestCase.java index 26053cdad..5b51a34e1 100644 --- a/test/java/org/apache/fop/GenericFOPTestCase.java +++ b/test/java/org/apache/fop/GenericFOPTestCase.java @@ -31,12 +31,13 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.apache.fop.apps.Fop; +import org.xml.sax.InputSource; + import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; import org.apache.fop.util.DigestFilter; -import org.xml.sax.InputSource; /** * Framework for simple regression testing. @@ -76,8 +77,8 @@ public final class GenericFOPTestCase extends TestCase { public void testSimple() throws Exception { final String digestIn = "17bf13298796065f7775db8707133aeb"; final String digestOut = "e2761f51152f6663911e567901596707"; - final String fo = - "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>" + final String fo + = "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>" + " <fo:layout-master-set>" + " <fo:simple-page-master master-name='simple'" + " page-height='25cm' page-width='20cm'>" @@ -118,8 +119,8 @@ public final class GenericFOPTestCase extends TestCase { FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setCreationDate(new Date(10000)); MessageDigest outDigest = MessageDigest.getInstance("MD5"); - DigestOutputStream out = - new DigestOutputStream(new ByteArrayOutputStream(), outDigest); + DigestOutputStream out + = new DigestOutputStream(new ByteArrayOutputStream(), outDigest); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); InputSource source = new InputSource(new StringReader(fo)); DigestFilter filter = new DigestFilter("MD5"); diff --git a/test/java/org/apache/fop/StandardTestSuite.java b/test/java/org/apache/fop/StandardTestSuite.java index 281301789..caf75b4b4 100644 --- a/test/java/org/apache/fop/StandardTestSuite.java +++ b/test/java/org/apache/fop/StandardTestSuite.java @@ -23,7 +23,6 @@ import junit.framework.Test; import junit.framework.TestSuite; import org.apache.fop.fonts.DejaVuLGCSerifTest; -import org.apache.fop.fonts.TrueTypeAnsiTestCase; import org.apache.fop.image.loader.batik.ImageLoaderTestCase; import org.apache.fop.image.loader.batik.ImagePreloaderTestCase; import org.apache.fop.intermediate.IFMimickingTestCase; @@ -54,7 +53,6 @@ public class StandardTestSuite { suite.addTest(new TestSuite(PDFEncodingTestCase.class)); suite.addTest(new TestSuite(PDFCMapTestCase.class)); suite.addTest(new TestSuite(PDFsRGBSettingsTestCase.class)); - suite.addTest(new TestSuite(TrueTypeAnsiTestCase.class)); suite.addTest(new TestSuite(DejaVuLGCSerifTest.class)); suite.addTest(RichTextFormatTestSuite.suite()); suite.addTest(new TestSuite(ImageLoaderTestCase.class)); diff --git a/test/java/org/apache/fop/URIResolutionTestCase.java b/test/java/org/apache/fop/URIResolutionTestCase.java index fd4f879da..0a197722b 100644 --- a/test/java/org/apache/fop/URIResolutionTestCase.java +++ b/test/java/org/apache/fop/URIResolutionTestCase.java @@ -92,7 +92,7 @@ public class URIResolutionTestCase extends AbstractFOPTestCase { MyURIResolver resolver = new MyURIResolver(withStream); ua.setURIResolver(resolver); - ua.setBaseURL(foFile.getParentFile().toURL().toString()); + ua.setBaseURL(foFile.getParentFile().toURI().toURL().toString()); Document doc = createAreaTree(foFile, ua); @@ -119,7 +119,7 @@ public class URIResolutionTestCase extends AbstractFOPTestCase { FOUserAgent ua = fopFactory.newFOUserAgent(); MyURIResolver resolver = new MyURIResolver(false); ua.setURIResolver(resolver); - ua.setBaseURL(foFile.getParentFile().toURL().toString()); + ua.setBaseURL(foFile.getParentFile().toURI().toURL().toString()); ByteArrayOutputStream baout = new ByteArrayOutputStream(); diff --git a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java index 5c803317e..6ce833312 100644 --- a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java +++ b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java @@ -100,7 +100,7 @@ public abstract class BaseUserConfigTestCase extends BasePDFTestCase { /** * @return user config File */ - abstract protected String getUserConfigFilename(); + protected abstract String getUserConfigFilename(); /* * @see junit.framework.TestCase#getName() diff --git a/test/java/org/apache/fop/events/EventChecker.java b/test/java/org/apache/fop/events/EventChecker.java index 767c590ed..afef11d87 100644 --- a/test/java/org/apache/fop/events/EventChecker.java +++ b/test/java/org/apache/fop/events/EventChecker.java @@ -40,7 +40,7 @@ class EventChecker extends Assert implements EventListener { if (event.getEventID().equals(expectedEventID)) { eventReceived = true; } else { - fail("Unexpected event: id = " + event.getEventID() + ": "+ msg); + fail("Unexpected event: id = " + event.getEventID() + ": " + msg); } } diff --git a/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java b/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java deleted file mode 100644 index 3f98c93f4..000000000 --- a/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java +++ /dev/null @@ -1,107 +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.fonts; - -import java.io.File; -import java.io.OutputStream; -import java.io.StringReader; -import java.net.URL; -import java.util.List; - -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamSource; - -import junit.framework.TestCase; - -import org.apache.commons.io.output.NullOutputStream; - -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.Fop; -import org.apache.fop.apps.FopFactory; -import org.apache.fop.fonts.apps.TTFReader; -import org.apache.fop.render.pdf.PDFRenderer; - -/** - * Tests XML font metrics file generation and usage for WinAnsi mode. - */ -public class TrueTypeAnsiTestCase extends TestCase { - - /** - * Tests a TrueType font in WinAnsi mode. - * @throws Exception if an error occurs - */ - public void testTrueTypeAnsi() throws Exception { - String fontFamily = "Gladiator Bold"; - File ttfFile = new File("./test/resources/fonts/glb12.ttf"); - File workDir = new File("./build/test-results"); - if (!workDir.isDirectory()) { - assertTrue(workDir.mkdirs()); - } - File metricsFile = new File(workDir, ttfFile.getName() + ".xml"); - if (metricsFile.isFile()) { - assertTrue(metricsFile.delete()); - } - - String[] args = new String[] {"-enc", "ansi", - ttfFile.getCanonicalPath(), metricsFile.getCanonicalPath()}; - TTFReader.main(args); - assertTrue(metricsFile.isFile()); - - FopFactory fopFactory = FopFactory.newInstance(); - FOUserAgent ua = fopFactory.newFOUserAgent(); - PDFRenderer renderer = new PDFRenderer(); - renderer.setUserAgent(ua); - List fontList = new java.util.ArrayList(); - List triplets = new java.util.ArrayList(); - triplets.add(new FontTriplet(fontFamily, "normal", Font.WEIGHT_NORMAL)); - EmbedFontInfo font = new EmbedFontInfo( - metricsFile.toURI().toASCIIString(), - true, triplets, - ttfFile.toURI().toASCIIString(), null); - fontList.add(font); - renderer.addFontList(fontList); - - ua.setRendererOverride(renderer); - OutputStream out = new NullOutputStream(); - - Fop fop = fopFactory.newFop(null, ua, out); - - TransformerFactory tFactory = TransformerFactory.newInstance(); - Source src = new StreamSource(new StringReader( - "<root font-family='" + fontFamily + "'>Test!</root>")); - Result res = new SAXResult(fop.getDefaultHandler()); - Transformer transformer = tFactory.newTransformer( - getSourceForResource(this, "fonttest.xsl")); - transformer.transform(src, res); - } - - private static Source getSourceForResource(Object reference, String name) { - URL url = reference.getClass().getResource(name); - if (url == null) { - throw new NullPointerException("Resource not found: " + name); - } - return new StreamSource(url.toExternalForm()); - } - -} diff --git a/test/java/org/apache/fop/fonts/fonttest.xsl b/test/java/org/apache/fop/fonts/fonttest.xsl deleted file mode 100644 index 26c7d72a5..000000000 --- a/test/java/org/apache/fop/fonts/fonttest.xsl +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:fo="http://www.w3.org/1999/XSL/Format"> - - <xsl:output method="xml" indent="yes"/> - - <xsl:template match="root"> - <fo:root> - <fo:layout-master-set> - <fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm" - margin="2cm"> - <fo:region-body/> - </fo:simple-page-master> - </fo:layout-master-set> - <fo:page-sequence master-reference="A4"> - <fo:flow flow-name="xsl-region-body"> - <fo:block font-family="{@font-family}"> - <xsl:value-of select="."/> - </fo:block> - </fo:flow> - </fo:page-sequence> - </fo:root> - </xsl:template> -</xsl:stylesheet> diff --git a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java index bfe9018b1..5513a89ab 100644 --- a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java +++ b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java @@ -94,6 +94,6 @@ public abstract class FOTreeUnitTester extends TestCase { foReader.setErrorHandler(fop.getDefaultHandler()); foReader.setEntityResolver(fop.getDefaultHandler()); - foReader.parse(new File("test/fotree/unittests/" + filename).toURL().toExternalForm()); + foReader.parse(new File("test/fotree/unittests/" + filename).toURI().toURL().toExternalForm()); } } diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java index d938a852b..2c0cf8504 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java @@ -116,7 +116,7 @@ public class LayoutEngineTester { //Setup FOP for area tree rendering FOUserAgent ua = effFactory.newFOUserAgent(); - ua.setBaseURL(testFile.getParentFile().toURL().toString()); + ua.setBaseURL(testFile.getParentFile().toURI().toURL().toString()); ua.getEventBroadcaster().addEventListener( new ConsoleEventListenerForTests(testFile.getName(), EventSeverity.WARN)); diff --git a/test/java/org/apache/fop/memory/MemoryEater.java b/test/java/org/apache/fop/memory/MemoryEater.java index a665580ae..337027dc4 100644 --- a/test/java/org/apache/fop/memory/MemoryEater.java +++ b/test/java/org/apache/fop/memory/MemoryEater.java @@ -79,7 +79,7 @@ public class MemoryEater { OutputStream out = new NullOutputStream(); //write to /dev/nul try { FOUserAgent userAgent = fopFactory.newFOUserAgent(); - userAgent.setBaseURL(foFile.getParentFile().toURL().toExternalForm()); + userAgent.setBaseURL(foFile.getParentFile().toURI().toURL().toExternalForm()); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out); Result res = new SAXResult(fop.getDefaultHandler()); diff --git a/test/java/org/apache/fop/memory/Stats.java b/test/java/org/apache/fop/memory/Stats.java index 9e371251d..354952347 100644 --- a/test/java/org/apache/fop/memory/Stats.java +++ b/test/java/org/apache/fop/memory/Stats.java @@ -71,7 +71,7 @@ class Stats { public void dumpFinalStats() { long duration = System.currentTimeMillis() - startTime; System.out.println("Final statistics"); - System.out.println("Pages produced: " +totalPagesProduced); + System.out.println("Pages produced: " + totalPagesProduced); long ppm = 60000 * totalPagesProduced / duration; System.out.println("Average speed: " + ppm + "ppm"); } diff --git a/test/java/org/apache/fop/render/RendererFactoryTest.java b/test/java/org/apache/fop/render/RendererFactoryTest.java index 4a40ac7c1..6b8e8f5f3 100644 --- a/test/java/org/apache/fop/render/RendererFactoryTest.java +++ b/test/java/org/apache/fop/render/RendererFactoryTest.java @@ -33,7 +33,6 @@ import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFRenderer; import org.apache.fop.render.pdf.PDFDocumentHandler; -import org.apache.fop.render.pdf.PDFRenderer; import org.apache.fop.render.rtf.RTFHandler; /** @@ -73,29 +72,15 @@ public class RendererFactoryTest extends TestCase { RendererFactory factory = fopFactory.getRendererFactory(); FOUserAgent ua; Renderer renderer; - Renderer overrideRenderer; ua = fopFactory.newFOUserAgent(); renderer = factory.createRenderer(ua, MimeConstants.MIME_PDF); assertTrue(renderer instanceof IFRenderer); - factory.setRendererPreferred(true); //Test legacy setting - ua = fopFactory.newFOUserAgent(); - renderer = factory.createRenderer(ua, MimeConstants.MIME_PDF); - assertTrue(renderer instanceof PDFRenderer); - ua = fopFactory.newFOUserAgent(); renderer = factory.createRenderer(ua, MimeConstants.MIME_FOP_IF); assertTrue(renderer instanceof IFRenderer); - factory.setRendererPreferred(false); - ua = fopFactory.newFOUserAgent(); - overrideRenderer = new PDFRenderer(); - overrideRenderer.setUserAgent(ua); - ua.setRendererOverride(overrideRenderer); - renderer = factory.createRenderer(ua, null); - assertTrue(renderer == overrideRenderer); - ua = fopFactory.newFOUserAgent(); IFDocumentHandler overrideHandler; overrideHandler = new PDFDocumentHandler(); diff --git a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java index f5d2f84cf..bd5c8ade1 100644 --- a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java @@ -27,38 +27,38 @@ import org.apache.fop.pdf.CMapBuilder; /** Simple sanity test of the PDFCmap class */ public class PDFCMapTestCase extends TestCase { + private static final String EOL = "\n"; public void testPDFCMapFillInPDF() throws Exception { - final String EOL = "\n"; - final String expected = - "%!PS-Adobe-3.0 Resource-CMap" + EOL - +"%%DocumentNeededResources: ProcSet (CIDInit)" + EOL - +"%%IncludeResource: ProcSet (CIDInit)" + EOL - +"%%BeginResource: CMap (test)" + EOL - +"%%EndComments" + EOL - +"/CIDInit /ProcSet findresource begin" + EOL - +"12 dict begin" + EOL - +"begincmap" + EOL - +"/CIDSystemInfo 3 dict dup begin" + EOL - +" /Registry (Adobe) def" + EOL - +" /Ordering (Identity) def" + EOL - +" /Supplement 0 def" + EOL - +"end def" + EOL - +"/CMapVersion 1 def" + EOL - +"/CMapType 1 def" + EOL - +"/CMapName /test def" + EOL - +"1 begincodespacerange" + EOL - +"<0000> <FFFF>" + EOL - +"endcodespacerange" + EOL - +"1 begincidrange" + EOL - +"<0000> <FFFF> 0" + EOL - +"endcidrange" + EOL - +"endcmap" + EOL - +"CMapName currentdict /CMap defineresource pop" + EOL - +"end" + EOL - +"end" + EOL - +"%%EndResource" + EOL - +"%%EOF" + EOL + final String expected + = "%!PS-Adobe-3.0 Resource-CMap" + EOL + + "%%DocumentNeededResources: ProcSet (CIDInit)" + EOL + + "%%IncludeResource: ProcSet (CIDInit)" + EOL + + "%%BeginResource: CMap (test)" + EOL + + "%%EndComments" + EOL + + "/CIDInit /ProcSet findresource begin" + EOL + + "12 dict begin" + EOL + + "begincmap" + EOL + + "/CIDSystemInfo 3 dict dup begin" + EOL + + " /Registry (Adobe) def" + EOL + + " /Ordering (Identity) def" + EOL + + " /Supplement 0 def" + EOL + + "end def" + EOL + + "/CMapVersion 1 def" + EOL + + "/CMapType 1 def" + EOL + + "/CMapName /test def" + EOL + + "1 begincodespacerange" + EOL + + "<0000> <FFFF>" + EOL + + "endcodespacerange" + EOL + + "1 begincidrange" + EOL + + "<0000> <FFFF> 0" + EOL + + "endcidrange" + EOL + + "endcmap" + EOL + + "CMapName currentdict /CMap defineresource pop" + EOL + + "end" + EOL + + "end" + EOL + + "%%EndResource" + EOL + + "%%EOF" + EOL ; final StringWriter w = new StringWriter(); diff --git a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java index 7f0462a75..72c677a0c 100644 --- a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java +++ b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java @@ -43,52 +43,22 @@ import org.apache.fop.render.intermediate.IFContext; public class ImageHandlingTestCase extends AbstractPostScriptTestCase { /** - * Tests JPEG handling with the {@link PSRenderer}. + * Tests JPEG handling. * @throws Exception if an error occurs */ - public void testJPEGImageWithRendererLevel3() throws Exception { - innerTestJPEGImageWithRenderer(3); + public void testJPEGImageLevel3() throws Exception { + innerTestJPEGImage(3); } /** - * Tests JPEG handling with the {@link PSRenderer}. + * Tests JPEG handling. * @throws Exception if an error occurs */ - public void testJPEGImageWithRendererLevel2() throws Exception { - innerTestJPEGImageWithRenderer(2); + public void testJPEGImageLevel2() throws Exception { + innerTestJPEGImage(2); } - /** - * Tests JPEG handling with the {@link PSDocumentHandler}. - * @throws Exception if an error occurs - */ - public void testJPEGImageWithIFLevel3() throws Exception { - innerTestJPEGImageWithIF(3); - } - - /** - * Tests JPEG handling with the {@link PSDocumentHandler}. - * @throws Exception if an error occurs - */ - public void testJPEGImageWithIFLevel2() throws Exception { - innerTestJPEGImageWithIF(2); - } - - private void innerTestJPEGImageWithRenderer(int level) throws Exception { - FOUserAgent ua = fopFactory.newFOUserAgent(); - PSRenderer renderer = new PSRenderer(); - renderer.setUserAgent(ua); - PSRenderingUtil psUtil = renderer.getPSUtil(); - psUtil.setLanguageLevel(level); - psUtil.setOptimizeResources(true); - ua.setRendererOverride(renderer); - - // Prepare output file - File outputFile = renderFile(ua, "ps-jpeg-image.fo", "-rend-l" + psUtil.getLanguageLevel()); - verifyPostScriptFile(outputFile, psUtil.getLanguageLevel()); - } - - private void innerTestJPEGImageWithIF(int level) throws Exception { + private void innerTestJPEGImage(int level) throws Exception { FOUserAgent ua = fopFactory.newFOUserAgent(); PSDocumentHandler handler = new PSDocumentHandler(); handler.setContext(new IFContext(ua)); @@ -159,10 +129,6 @@ public class ImageHandlingTestCase extends AbstractPostScriptTestCase { } } - private void assertMatches(String text, String regex) { - assertTrue("Text didn't match '" + regex + "'", text.matches(regex)); - } - private void assertContains(String text, String searchString) { assertTrue("Text doesn't contain '" + searchString + "'", text.indexOf(searchString) >= 0); } diff --git a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java index e5b9a4d27..862ad5205 100644 --- a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java +++ b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java @@ -54,28 +54,10 @@ import org.apache.fop.render.intermediate.IFContext; public class ResourceOptimizationTestCase extends AbstractPostScriptTestCase { /** - * Tests resource optimization with the {@link PSRenderer}. + * Tests resource optimization. * @throws Exception if an error occurs */ - public void testResourceOptimizationWithRenderer() throws Exception { - FOUserAgent ua = fopFactory.newFOUserAgent(); - PSRenderer renderer = new PSRenderer(); - renderer.setUserAgent(ua); - // This is the important part: we're enabling resource optimization - renderer.getPSUtil().setOptimizeResources(true); - ua.setRendererOverride(renderer); - - // Prepare output file - File outputFile = renderFile(ua, "ps-resources.fo", - "-rend-l" + renderer.getPSUtil().getLanguageLevel()); - verifyPostScriptFile(outputFile); - } - - /** - * Tests resource optimization with the {@link PSDocumentHandler}. - * @throws Exception if an error occurs - */ - public void testResourceOptimizationWithIF() throws Exception { + public void testResourceOptimization() throws Exception { FOUserAgent ua = fopFactory.newFOUserAgent(); PSDocumentHandler handler = new PSDocumentHandler(); handler.setContext(new IFContext(ua)); diff --git a/test/java/org/apache/fop/threading/AvalonAdapter.java b/test/java/org/apache/fop/threading/AvalonAdapter.java new file mode 100644 index 000000000..bfe0a5010 --- /dev/null +++ b/test/java/org/apache/fop/threading/AvalonAdapter.java @@ -0,0 +1,58 @@ +/* + * 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.threading; + +import org.apache.avalon.framework.logger.Logger; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; + +/** + * Redirects events to an Avalon logger. + */ +class AvalonAdapter implements EventListener { + + private final Logger logger; + private String filename; + + public AvalonAdapter(Logger logger, String filename) { + this.logger = logger; + this.filename = filename; + } + + public void processEvent(Event event) { + String msg = EventFormatter.format(event); + EventSeverity severity = event.getSeverity(); + if (severity == EventSeverity.INFO) { + //logger.info(filename + ": " + msg); + } else if (severity == EventSeverity.WARN) { + //logger.warn(filename + ": " + msg); + } else if (severity == EventSeverity.ERROR) { + logger.error(filename + ": " + msg); + } else if (severity == EventSeverity.FATAL) { + logger.fatalError(filename + ": " + msg); + } else { + assert false; + } + } + +}
\ No newline at end of file diff --git a/test/java/org/apache/fop/threading/FOPTestbed.java b/test/java/org/apache/fop/threading/FOPTestbed.java index 737317bec..8424260a9 100644 --- a/test/java/org/apache/fop/threading/FOPTestbed.java +++ b/test/java/org/apache/fop/threading/FOPTestbed.java @@ -56,7 +56,7 @@ public class FOPTestbed extends AbstractLogEnabled private int threads; private File outputDir; private Configuration fopCfg; - private FOProcessor foprocessor; + private Processor foprocessor; private boolean writeToDevNull; private int counter = 0; @@ -74,7 +74,7 @@ public class FOPTestbed extends AbstractLogEnabled for (int i = 0; i < entries.length; i++) { this.taskList.add(new TaskDef(entries[i])); } - this.fopCfg = configuration.getChild("foprocessor"); + this.fopCfg = configuration.getChild("processor"); } /** {@inheritDoc} */ @@ -177,11 +177,11 @@ public class FOPTestbed extends AbstractLogEnabled * Creates a new FOProcessor. * @return the newly created instance */ - public FOProcessor createFOProcessor() { + public Processor createFOProcessor() { try { Class clazz = Class.forName(this.fopCfg.getAttribute("class", "org.apache.fop.threading.FOProcessorImpl")); - FOProcessor fop = (FOProcessor)clazz.newInstance(); + Processor fop = (Processor)clazz.newInstance(); ContainerUtil.enableLogging(fop, getLogger()); ContainerUtil.configure(fop, this.fopCfg); ContainerUtil.initialize(fop); @@ -206,13 +206,15 @@ public class FOPTestbed extends AbstractLogEnabled this.fo = cfg.getAttribute("fo", null); if (this.fo == null) { this.xml = cfg.getAttribute("xml"); - this.xslt = cfg.getAttribute("xslt"); - TransformerFactory factory = TransformerFactory.newInstance(); - Source xsltSource = new StreamSource(new File(xslt)); - try { - this.templates = factory.newTemplates(xsltSource); - } catch (TransformerConfigurationException tce) { - throw new ConfigurationException("Invalid XSLT", tce); + this.xslt = cfg.getAttribute("xslt", null); + if (this.xslt != null) { + TransformerFactory factory = TransformerFactory.newInstance(); + Source xsltSource = new StreamSource(new File(xslt)); + try { + this.templates = factory.newTemplates(xsltSource); + } catch (TransformerConfigurationException tce) { + throw new ConfigurationException("Invalid XSLT", tce); + } } } } @@ -249,9 +251,9 @@ public class FOPTestbed extends AbstractLogEnabled private TaskDef def; private int num; - private FOProcessor fop; + private Processor fop; - public Task(TaskDef def, int num, FOProcessor fop) { + public Task(TaskDef def, int num, Processor fop) { this.def = def; this.num = num; this.fop = fop; diff --git a/test/java/org/apache/fop/threading/FOProcessorImpl.java b/test/java/org/apache/fop/threading/FOProcessorImpl.java index 2b580bbd0..3702d87e7 100644 --- a/test/java/org/apache/fop/threading/FOProcessorImpl.java +++ b/test/java/org/apache/fop/threading/FOProcessorImpl.java @@ -43,16 +43,12 @@ import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; -import org.apache.fop.events.Event; -import org.apache.fop.events.EventFormatter; -import org.apache.fop.events.EventListener; -import org.apache.fop.events.model.EventSeverity; /** - * Default implementation of the FOProcessor interface using FOP. + * Default implementation of the {@link Processor} interface using FOP. */ public class FOProcessorImpl extends AbstractLogEnabled - implements FOProcessor, Configurable, Initializable { + implements Processor, Configurable, Initializable { private FopFactory fopFactory = FopFactory.newInstance(); private TransformerFactory factory = TransformerFactory.newInstance(); @@ -83,7 +79,8 @@ public class FOProcessorImpl extends AbstractLogEnabled try { URL url = new URL(src.getSystemId()); String filename = FilenameUtils.getName(url.getPath()); - foUserAgent.getEventBroadcaster().addEventListener(new AvalonAdapter(filename)); + foUserAgent.getEventBroadcaster().addEventListener( + new AvalonAdapter(getLogger(), filename)); } catch (MalformedURLException mfue) { throw new RuntimeException(mfue); } @@ -107,30 +104,4 @@ public class FOProcessorImpl extends AbstractLogEnabled public String getTargetFileExtension() { return this.fileExtension; } - - private class AvalonAdapter implements EventListener { - - private String filename; - - public AvalonAdapter(String filename) { - this.filename = filename; - } - - public void processEvent(Event event) { - String msg = EventFormatter.format(event); - EventSeverity severity = event.getSeverity(); - if (severity == EventSeverity.INFO) { - //getLogger().info(filename + ": " + msg); - } else if (severity == EventSeverity.WARN) { - //getLogger().warn(filename + ": " + msg); - } else if (severity == EventSeverity.ERROR) { - getLogger().error(filename + ": " + msg); - } else if (severity == EventSeverity.FATAL) { - getLogger().fatalError(filename + ": " + msg); - } else { - assert false; - } - } - - } }
\ No newline at end of file diff --git a/test/java/org/apache/fop/threading/IFProcessorImpl.java b/test/java/org/apache/fop/threading/IFProcessorImpl.java new file mode 100644 index 000000000..34873d76b --- /dev/null +++ b/test/java/org/apache/fop/threading/IFProcessorImpl.java @@ -0,0 +1,124 @@ +/* + * 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.threading; + +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamResult; + +import org.xml.sax.ContentHandler; + +import org.apache.avalon.framework.activity.Initializable; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.commons.io.FilenameUtils; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.render.intermediate.IFParser; +import org.apache.fop.render.intermediate.IFUtil; + +/** + * Implementation of the {@link Processor} interface that renders IF XML to a final output format. + */ +public class IFProcessorImpl extends AbstractLogEnabled + implements Processor, Configurable, Initializable { + + private FopFactory fopFactory = FopFactory.newInstance(); + private TransformerFactory factory = TransformerFactory.newInstance(); + private String userconfig; + private String mime; + private String fileExtension; + + /** {@inheritDoc} */ + public void configure(Configuration configuration) throws ConfigurationException { + this.userconfig = configuration.getChild("userconfig").getValue(null); + this.mime = configuration.getChild("mime").getValue(MimeConstants.MIME_PDF); + this.fileExtension = configuration.getChild("extension").getValue(".pdf"); + } + + /** {@inheritDoc} */ + public void initialize() throws Exception { + if (this.userconfig != null) { + getLogger().debug("Setting user config: " + userconfig); + fopFactory.setUserConfig(this.userconfig); + } + } + + /** {@inheritDoc} + * @throws IFException */ + public void process(Source src, Templates templates, OutputStream out) + throws org.apache.fop.apps.FOPException, java.io.IOException, IFException { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + foUserAgent.setBaseURL(src.getSystemId()); + try { + URL url = new URL(src.getSystemId()); + String filename = FilenameUtils.getName(url.getPath()); + foUserAgent.getEventBroadcaster().addEventListener( + new AvalonAdapter(getLogger(), filename)); + } catch (MalformedURLException mfue) { + throw new RuntimeException(mfue); + } + + //Setup target handler + IFDocumentHandler targetHandler = fopFactory.getRendererFactory().createDocumentHandler( + foUserAgent, mime); + + //Setup fonts + IFUtil.setupFonts(targetHandler); + targetHandler.setResult(new StreamResult(out)); + + try { + Transformer transformer; + if (templates == null) { + transformer = factory.newTransformer(); + } else { + transformer = templates.newTransformer(); + } + IFParser parser = new IFParser(); + ContentHandler contentHandler = parser.getContentHandler(targetHandler, foUserAgent); + Result res = new SAXResult(contentHandler); + transformer.transform(src, res); + } catch (TransformerException e) { + throw new FOPException(e); + } + } + + /** {@inheritDoc} */ + public String getTargetFileExtension() { + return this.fileExtension; + } + +}
\ No newline at end of file diff --git a/test/java/org/apache/fop/threading/FOProcessor.java b/test/java/org/apache/fop/threading/Processor.java index dd663da05..9c86fc382 100644 --- a/test/java/org/apache/fop/threading/FOProcessor.java +++ b/test/java/org/apache/fop/threading/Processor.java @@ -25,9 +25,9 @@ import javax.xml.transform.Source; import javax.xml.transform.Templates; /** - * Represents an FO processor. + * Represents a processor. */ -public interface FOProcessor { +public interface Processor { /** * Process a file. diff --git a/test/java/org/apache/fop/threading/sample.cfg.xml b/test/java/org/apache/fop/threading/sample.cfg.xml index 0be7dc539..a4de0d754 100644 --- a/test/java/org/apache/fop/threading/sample.cfg.xml +++ b/test/java/org/apache/fop/threading/sample.cfg.xml @@ -2,13 +2,13 @@ <config prompt="false"> <threads>2</threads> <output-dir>C:/Dev/FOP/temp/out</output-dir> - <foprocessor class="org.apache.fop.threading.FOProcessorImpl"> + <processor class="org.apache.fop.threading.FOProcessorImpl"> <!-- <userconfig>C:/Dev/FOP/temp/userconfig.xml</userconfig> --> <mime>application/pdf</mime> <extension>.pdf</extension> - </foprocessor> + </processor> <tasks repeat="2"> <task fo="C:/Dev/FOP/temp/helloworld.fo"/> <task xml="C:/Dev/FOP/temp/page-x-of-y.xml" xslt="C:/Dev/FOP/temp/page-x-of-y.xsl"/> diff --git a/test/java/org/apache/fop/traits/BorderPropsTestCase.java b/test/java/org/apache/fop/traits/BorderPropsTestCase.java index 3332d11f2..be7714ba2 100644 --- a/test/java/org/apache/fop/traits/BorderPropsTestCase.java +++ b/test/java/org/apache/fop/traits/BorderPropsTestCase.java @@ -23,10 +23,10 @@ import java.awt.Color; import junit.framework.TestCase; -import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.color.ColorExt; +import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace; import org.apache.fop.fo.Constants; +import org.apache.fop.util.ColorExt; import org.apache.fop.util.ColorUtil; /** @@ -50,7 +50,7 @@ public class BorderPropsTestCase extends TestCase { assertEquals(b1, b2); float[] cmyk = new float[] {1.0f, 1.0f, 0.5f, 1.0f}; - CMYKColorSpace cmykCs = CMYKColorSpace.getInstance(); + DeviceCMYKColorSpace cmykCs = DeviceCMYKColorSpace.getInstance(); float[] rgb = cmykCs.toRGB(cmyk); col = ColorExt.createFromFoRgbIcc(rgb[0], rgb[1], rgb[2], "#CMYK", null, cmykCs, cmyk); diff --git a/test/java/org/apache/fop/util/ColorUtilTestCase.java b/test/java/org/apache/fop/util/ColorUtilTestCase.java index 83163c888..aefd2a76a 100644 --- a/test/java/org/apache/fop/util/ColorUtilTestCase.java +++ b/test/java/org/apache/fop/util/ColorUtilTestCase.java @@ -24,8 +24,7 @@ import java.awt.color.ColorSpace; import junit.framework.TestCase; -import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.color.ColorExt; +import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FopFactory; @@ -157,7 +156,7 @@ public class ColorUtilTestCase extends TestCase { assertEquals(255, colActual.getRed()); assertEquals(255, colActual.getGreen()); assertEquals(0, colActual.getBlue()); - assertEquals(CMYKColorSpace.getInstance(), colActual.getColorSpace()); + assertEquals(DeviceCMYKColorSpace.getInstance(), colActual.getColorSpace()); float[] comps = colActual.getColorComponents(null); assertEquals(4, comps.length); assertEquals(0f, comps[0], 0); @@ -172,7 +171,7 @@ public class ColorUtilTestCase extends TestCase { assertEquals(248, colActual.getRed()); assertEquals(199, colActual.getGreen()); assertEquals(172, colActual.getBlue()); - assertEquals(CMYKColorSpace.getInstance(), colActual.getColorSpace()); + assertEquals(DeviceCMYKColorSpace.getInstance(), colActual.getColorSpace()); comps = colActual.getColorComponents(null); assertEquals(0.0274f, comps[0], 0.001); assertEquals(0.2196f, comps[1], 0.001); @@ -186,7 +185,7 @@ public class ColorUtilTestCase extends TestCase { assertEquals(255, colActual.getRed()); assertEquals(255, colActual.getGreen()); assertEquals(0, colActual.getBlue()); - assertEquals(CMYKColorSpace.getInstance(), colActual.getColorSpace()); + assertEquals(DeviceCMYKColorSpace.getInstance(), colActual.getColorSpace()); comps = colActual.getColorComponents(null); assertEquals(4, comps.length); assertEquals(0f, comps[0], 0); @@ -201,7 +200,7 @@ public class ColorUtilTestCase extends TestCase { assertEquals(127, colActual.getRed()); assertEquals(127, colActual.getGreen()); assertEquals(127, colActual.getBlue()); - assertEquals(CMYKColorSpace.getInstance(), colActual.getColorSpace()); + assertEquals(DeviceCMYKColorSpace.getInstance(), colActual.getColorSpace()); comps = colActual.getColorComponents(null); assertEquals(4, comps.length); assertEquals(0f, comps[0], 0); diff --git a/test/java/org/apache/fop/util/DigestFilter.java b/test/java/org/apache/fop/util/DigestFilter.java index 0384b42df..94e8d67d2 100644 --- a/test/java/org/apache/fop/util/DigestFilter.java +++ b/test/java/org/apache/fop/util/DigestFilter.java @@ -43,7 +43,7 @@ import org.xml.sax.helpers.XMLFilterImpl; public class DigestFilter extends XMLFilterImpl { private MessageDigest digest; - private byte value[]; + private byte[] value; private boolean isNamespaceAware; public DigestFilter(String algorithm) throws NoSuchAlgorithmException { @@ -133,7 +133,7 @@ public class DigestFilter extends XMLFilterImpl { */ public void setFeature(String feature, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { - if(feature.equals("http://xml.org/sax/features/namespaces")) { + if (feature.equals("http://xml.org/sax/features/namespaces")) { isNamespaceAware = value; } super.setFeature(feature, value); diff --git a/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java b/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java index 0d976219d..678e80e7d 100644 --- a/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java +++ b/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java @@ -122,7 +122,7 @@ public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer try { FOUserAgent userAgent = fopFactory.newFOUserAgent(); userAgent.setTargetResolution(context.getTargetResolution()); - userAgent.setBaseURL(src.getParentFile().toURL().toString()); + userAgent.setBaseURL(src.getParentFile().toURI().toURL().toString()); File tempOut = new File(context.getTargetDir(), src.getName() + "." + index + "." + getTargetExtension()); diff --git a/test/java/org/apache/fop/visual/BitmapProducerJava2D.java b/test/java/org/apache/fop/visual/BitmapProducerJava2D.java index bd78fd93f..997a75931 100644 --- a/test/java/org/apache/fop/visual/BitmapProducerJava2D.java +++ b/test/java/org/apache/fop/visual/BitmapProducerJava2D.java @@ -70,7 +70,7 @@ public class BitmapProducerJava2D extends AbstractBitmapProducer implements Conf try { FOUserAgent userAgent = fopFactory.newFOUserAgent(); userAgent.setTargetResolution(context.getTargetResolution()); - userAgent.setBaseURL(src.getParentFile().toURL().toString()); + userAgent.setBaseURL(src.getParentFile().toURI().toURL().toString()); File outputFile = new File(context.getTargetDir(), src.getName() + "." + index + ".java2d.png"); |