You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ga...@apache.org on 2012/02/26 03:29:29 UTC
svn commit: r1293736 [2/38] - in /xmlgraphics/fop/trunk: ./
src/codegen/java/org/apache/fop/tools/
src/codegen/unicode/java/org/apache/fop/complexscripts/
src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/
src/documentation/content/xdocs/trun...
Modified: xmlgraphics/fop/trunk/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/build.xml?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/build.xml (original)
+++ xmlgraphics/fop/trunk/build.xml Sun Feb 26 02:29:01 2012
@@ -85,12 +85,12 @@ list of possible build targets.
</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/xmlunit*"/>
+ <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/xmlunit*"/>
</patternset>
<fileset dir="${basedir}" id="dist.src">
<include name="src/**"/>
@@ -98,7 +98,7 @@ list of possible build targets.
<include name="hyph/hyphenation.dtd"/>
<include name="hyph/readme"/>
<patternset refid="dist.lib"/>
- <patternset refid="dist.src.lib.tools"/>
+ <patternset refid="dist.src.lib.tools"/>
<include name="lib/servlet*"/>
<include name="test/**"/>
<include name="examples/**"/>
@@ -153,6 +153,8 @@ list of possible build targets.
<property name="javac.fork" value="no"/>
<property name="junit.fork" value="yes"/>
<property name="junit.haltonfailure" value="off"/>
+ <property name="junit.printsummary" value="off"/>
+ <property name="junit.formatter.brief" value="on"/>
<property name="javadoc.packages" value="org.apache.fop.*"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="src.codegen.dir" value="${src.dir}/codegen"/>
@@ -214,7 +216,10 @@ list of possible build targets.
</presetdef>
<presetdef name="junit">
- <junit haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" maxmemory="256m"/>
+ <junit haltonfailure="${junit.haltonfailure}"
+ fork="${junit.fork}"
+ printsummary="${junit.printsummary}"
+ maxmemory="256m"/>
</presetdef>
<!-- =================================================================== -->
@@ -396,18 +401,18 @@ list of possible build targets.
<javac destdir="${build.codegen-classes.dir}">
<src path="${src.codegen.dir}/unicode/java"/>
</javac>
- <java classname="org.apache.fop.hyphenation.UnicodeClasses" resultproperty="classes.result" classpath="${build.codegen-classes.dir}">
+ <java classname="org.apache.fop.hyphenation.UnicodeClasses" resultproperty="classes.result" classpath="${build.codegen-classes.dir}">
<arg value="${src.dir}/java/org/apache/fop/hyphenation/classes.xml"/>
- </java>
- <condition property="classes.result.message" value="Generation of classes successful">
- <not>
- <isfailure code="${classes.result}"/>
- </not>
- </condition>
- <condition property="classes.result.message" value="Generation of classes failed">
- <isfailure code="${classes.result}"/>
- </condition>
- <echo message="${classes.result.message}"/>
+ </java>
+ <condition property="classes.result.message" value="Generation of classes successful">
+ <not>
+ <isfailure code="${classes.result}"/>
+ </not>
+ </condition>
+ <condition property="classes.result.message" value="Generation of classes failed">
+ <isfailure code="${classes.result}"/>
+ </condition>
+ <echo message="${classes.result.message}"/>
</target>
<!-- =================================================================== -->
<!-- compiles hyphenation patterns -->
@@ -418,20 +423,20 @@ list of possible build targets.
<pathelement location="${build.classes.dir}"/>
</path>
<mkdir dir="${build.classes.dir}/hyph"/>
- <java classname="org.apache.fop.hyphenation.SerializeHyphPattern" fork="true" resultproperty="hyph.result" classpathref="hyph-classpath">
- <arg value="${user.hyph.dir}"/>
- <arg value="${build.classes.dir}/hyph"/>
- <jvmarg value="-Xss${hyph.stacksize}"/>
- </java>
- <condition property="hyph.result.message" value="Hyphenation successful">
- <not>
- <isfailure code="${hyph.result}"/>
- </not>
- </condition>
- <condition property="hyph.result.message" value="Hyphenation failed">
- <isfailure code="${hyph.result}"/>
- </condition>
- <echo message="${hyph.result.message}"/>
+ <java classname="org.apache.fop.hyphenation.SerializeHyphPattern" fork="true" resultproperty="hyph.result" classpathref="hyph-classpath">
+ <arg value="${user.hyph.dir}"/>
+ <arg value="${build.classes.dir}/hyph"/>
+ <jvmarg value="-Xss${hyph.stacksize}"/>
+ </java>
+ <condition property="hyph.result.message" value="Hyphenation successful">
+ <not>
+ <isfailure code="${hyph.result}"/>
+ </not>
+ </condition>
+ <condition property="hyph.result.message" value="Hyphenation failed">
+ <isfailure code="${hyph.result}"/>
+ </condition>
+ <echo message="${hyph.result.message}"/>
</target>
<target name="uptodate-jar-hyphenation" depends="compile-hyphenation">
<uptodate property="jar.hyphenation.uptodate" targetfile="${build.dir}/fop-hyph.jar">
@@ -551,6 +556,7 @@ list of possible build targets.
<include name="org/apache/fop/accessibility/StructureTreeElement.class"/>
<include name="org/apache/fop/apps/Fop.class"/>
<include name="org/apache/fop/apps/FOPException.class"/>
+ <include name="org/apache/fop/complexscripts/fonts/*.class"/>
<include name="org/apache/fop/fo/Constants.class"/>
<include name="org/apache/fop/fo/FOTreeBuilder.class"/>
<include name="org/apache/fop/area/AreaTreeControl*"/>
@@ -662,10 +668,15 @@ list of possible build targets.
<!-- =================================================================== -->
<!-- Testing -->
<!-- =================================================================== -->
- <target name="junit-with-xmlunit" depends="init-avail" if="xmlunit.present">
+ <target name="junit-init" depends="init-avail" if="xmlunit.present">
+ <condition property="junit.formatter.brief.use">
+ <istrue value="${junit.formatter.brief}"/>
+ </condition>
+ </target>
+ <target name="junit-with-xmlunit" depends="junit-init" if="xmlunit.present">
<patternset id="test-sources"/>
</target>
- <target name="junit-without-xmlunit" depends="init-avail" unless="xmlunit.present">
+ <target name="junit-without-xmlunit" depends="junit-init" unless="xmlunit.present">
<patternset id="test-sources">
<exclude name="**/intermediate/*"/>
</patternset>
@@ -705,6 +716,7 @@ list of possible build targets.
<include name="META-INF/**"/>
<include name="**/*.xml"/>
<include name="**/*.fo"/>
+ <include name="**/BidiTestData*.ser"/>
<include name="**/*.afp"/>
<include name="**/*.xsl"/>
</fileset>
@@ -778,10 +790,10 @@ list of possible build targets.
<attribute name="classpath" default="standard-junit-classpath"/>
<sequential>
<echo message="Running @{title} tests..."/>
- <junit dir="${basedir}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure">
+ <junit dir="${basedir}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure" printsummary="${junit.printsummary}">
<sysproperty key="basedir" value="${basedir}/@{basedir}"/>
<sysproperty key="jawa.awt.headless" value="true"/>
- <formatter type="brief" usefile="false"/>
+ <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
<formatter type="plain" usefile="true"/>
<formatter type="xml" usefile="true"/>
<classpath>
@@ -798,7 +810,7 @@ list of possible build targets.
<junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" forkmode="once"
errorproperty="fop.junit.error" failureproperty="fop.junit.failure">
<sysproperty key="jawa.awt.headless" value="true"/>
- <formatter type="brief" usefile="false"/>
+ <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
<formatter type="plain" usefile="true"/>
<formatter type="xml" usefile="true"/>
<classpath>
@@ -865,7 +877,10 @@ list of possible build targets.
<target name="junit-render-pdf" depends="junit-compile">
<junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/>
</target>
- <target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder, junit-text-linebreak, junit-fotree, junit-render-pdf"/>
+ <target name="junit-complexscripts" depends="junit-compile">
+ <junit-run title="complexscripts" testsuite="org.apache.fop.complexscripts.ComplexScriptsTestSuite" outfile="TEST-complexscripts"/>
+ </target>
+ <target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder, junit-text-linebreak, junit-fotree, junit-render-pdf, junit-complexscripts"/>
<target name="junit" depends="junit-all" description="Runs all of FOP's JUnit tests"
if="junit.present">
<fail><condition><or><isset property="fop.junit.error"/><isset property="fop.junit.failure"/><not><isset property="hyphenation.present"/></not></or></condition>
@@ -1017,7 +1032,7 @@ NOTE:
<!-- =================================================================== -->
<property name="checkstyle.noframes.xslt" value="${basedir}/checkstyle-noframes.xsl" />
<condition property="checkstyle.avail">
- <and>
+ <and>
<available classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
<classpath>
<path refid="libs-tools-build-classpath"/>
@@ -1252,11 +1267,11 @@ NOTE:
<!-- Nightly builds -->
<!-- =================================================================== -->
<target name="junit-nightly-build" depends="junit-userconfig,junit-text-linebreak,junit-fotree">
- <fail>
- <condition>
- <or>
- <isset property="fop.junit.error"/>
- <isset property="fop.junit.failure"/>
+ <fail>
+ <condition>
+ <or>
+ <isset property="fop.junit.error"/>
+ <isset property="fop.junit.failure"/>
</or>
</condition>
NOTE:
@@ -1330,21 +1345,71 @@ NOTE:
</target>
<!-- =================================================================== -->
- <!-- Helper task to generate source files that have already been checked -->
+ <!-- Helper tasks to generate source files that have already been checked -->
<!-- into the repository. For these files, the version in the -->
<!-- repository is the official one and may have updates that will *not* -->
<!-- be generated by below. This target should never be part of the -->
<!-- normal build process. -->
<!-- =================================================================== -->
- <target name="codegen-unicode" >
+ <target name="codegen-unicode" depends="compile-java">
<mkdir dir="${build.codegen-classes.dir}"/>
<javac destdir="${build.codegen-classes.dir}">
<src path="${src.codegen.dir}/unicode/java"/>
+ <classpath>
+ <path refid="libs-build-classpath"/>
+ <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${build.codegen-classes.dir}"/>
+ </classpath>
</javac>
<java classname="org.apache.fop.text.linebreak.GenerateLineBreakUtils" classpath="${build.codegen-classes.dir}">
<arg line="-o ${src.dir}/java/org/apache/fop/text/linebreak/LineBreakUtils.java"/>
</java>
</target>
+ <target name="codegen-unicode-bidi" depends="compile-java">
+ <mkdir dir="${build.codegen-classes.dir}"/>
+ <javac destdir="${build.codegen-classes.dir}" includeAntRuntime="true">
+ <src path="${src.codegen.dir}/unicode/java"/>
+ <classpath>
+ <path refid="libs-build-classpath"/>
+ <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${build.codegen-classes.dir}"/>
+ </classpath>
+ </javac>
+ <java classname="org.apache.fop.complexscripts.bidi.GenerateBidiClass" classpath="${build.codegen-classes.dir}">
+ <arg line="-b http://www.unicode.org/Public/6.0.0/ucd/extracted/DerivedBidiClass.txt"/>
+ <arg line="-o ${src.dir}/java/org/apache/fop/complexscripts/bidi/BidiClass.java"/>
+ </java>
+ <delete>
+ <fileset dir="${test.dir}/java/org/apache/fop/complexscripts/bidi">
+ <include name="**/BidiTestData*.ser"/>
+ </fileset>
+ </delete>
+ <java classname="org.apache.fop.text.bidi.GenerateBidiTestData" classpath="${build.codegen-classes.dir}" fork="yes">
+ <arg line="-v"/>
+ <arg line="-i"/>
+ <arg line="-b http://www.unicode.org/Public/6.0.0/ucd/BidiTest.txt"/>
+ <arg line="-d http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt"/>
+ <arg line="-o ${test.dir}/java/org/apache/fop/complexscripts/bidi/BidiTestData.java"/>
+ </java>
+ </target>
+ <target name="resgen-complexscripts" depends="compile-java">
+ <mkdir dir="${build.unit.tests.dir}"/>
+ <javac destdir="${build.unit.tests.dir}" includeAntRuntime="true" memoryMaximumSize="1024m">
+ <src path="${test.dir}/java/org/apache/fop/complexscripts/"/>
+ <classpath>
+ <path refid="libs-build-classpath"/>
+ <pathelement location="${build.classes.dir}"/>
+ </classpath>
+ </javac>
+ <java classname="org.apache.fop.complexscripts.scripts.arabic.GenerateArabicTestData">
+ <classpath>
+ <path refid="libs-build-classpath"/>
+ <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${build.unit.tests.dir}"/>
+ </classpath>
+ <arg line="-c"/>
+ </java>
+ </target>
<!-- =================================================================== -->
<!-- Special target for Gump -->
<!-- =================================================================== -->
@@ -1361,7 +1426,7 @@ NOTE:
</fail>
<echo>All tests passed!</echo>
</target>
- <!-- =================================================================== -->
+<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
<target name="clean" description="Cleans the build directory">
@@ -1373,7 +1438,7 @@ NOTE:
<delete>
<fileset dir="${basedir}" includes="${name}-*.tar.gz"/>
<fileset dir="${basedir}" includes="${name}-*.zip"/>
- <fileset dir="${basedir}" includes="${name}-bundle.jar"/>
+ <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.">
@@ -1409,4 +1474,10 @@ NOTE:
</xmlcatalog>
</xmlvalidate>
</target>
+
+<!-- =================================================================== -->
+<!-- Local targets -->
+<!-- =================================================================== -->
+ <import file="build-local.targets.xml" optional="true"/>
+
</project>
Modified: xmlgraphics/fop/trunk/checkstyle-suppressions.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/checkstyle-suppressions.xml?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/checkstyle-suppressions.xml (original)
+++ xmlgraphics/fop/trunk/checkstyle-suppressions.xml Sun Feb 26 02:29:01 2012
@@ -2,6 +2,7 @@
<!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/complexscripts/fonts/GlyphPositioningTable.java" checks="FileLengthCheck"/>
+ <suppress files="org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java" checks="FileLengthCheck"/>
<suppress files="org/apache/fop/Version.java" lines="40-50" checks="LineLengthCheck"/>
</suppressions>
Modified: xmlgraphics/fop/trunk/findbugs-exclude.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/findbugs-exclude.xml?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/findbugs-exclude.xml (original)
+++ xmlgraphics/fop/trunk/findbugs-exclude.xml Sun Feb 26 02:29:01 2012
@@ -4821,4 +4821,389 @@
<Bug pattern="REC_CATCH_EXCEPTION"/>
</Match>
<!-- /Automatically generated list of exclusions on 18 February 2011 -->
+ <!-- complex script exclusions -->
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphDefinitionTable"/>
+ <Method name="getLookupTypeFromName"/>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable"/>
+ <Method name="getLookupTypeFromName"/>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable"/>
+ <Method name="getLookupTypeFromName"/>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable"/>
+ <Method name="getTableTypeFromName"/>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter"/>
+ <Method name="<init>"/>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter"/>
+ <Method name="convertWordCase"/>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.fonts.autodetect.FontInfoFinder"/>
+ <Method name="find"/>
+ <Bug pattern="DM_CONVERT_CASE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.bidi.InlineRun"/>
+ <Method name="<init>" params="org.apache.fop.area.inline.InlineArea, int[]" returns="void"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningState"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$DeviceTable"/>
+ <Method name="getDeltas"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$DeviceTable"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.scripts.ArabicScriptProcessor"/>
+ <Or>
+ <Method name="getPositioningFeatures"/>
+ <Method name="getSubstitutionFeatures"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.scripts.DefaultScriptProcessor"/>
+ <Or>
+ <Method name="getPositioningFeatures"/>
+ <Method name="getSubstitutionFeatures"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.GlyphSequence"/>
+ <Method name="getAssociations"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.GlyphSequence$CharAssociation"/>
+ <Method name="getSubIntervals"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionState"/>
+ <Method name="setAlternates"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$Ligature"/>
+ <Or>
+ <Method name="getComponents"/>
+ <Method name="getLigatures"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$Ligature"/>
+ <Method name="<init>" params="int, int[]" returns="void"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$LigatureSet"/>
+ <Method name="getLigatures"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$LigatureSet"/>
+ <Method name="<init>" params="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$Ligature[]" returns="void"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ChainedClassSequenceRule"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ChainedClassSequenceRule"/>
+ <Or>
+ <Method name="getBacktrackClasses"/>
+ <Method name="getLookaheadClasses"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ChainedCoverageSequenceRule"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ChainedCoverageSequenceRule"/>
+ <Or>
+ <Method name="getBacktrackCoverages"/>
+ <Method name="getLookaheadCoverages"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ChainedGlyphSequenceRule"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ChainedGlyphSequenceRule"/>
+ <Or>
+ <Method name="getBacktrackGlyphs"/>
+ <Method name="getLookaheadGlyphs"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ClassSequenceRule"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$ClassSequenceRule"/>
+ <Method name="getClasses"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$CoverageSequenceRule"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$CoverageSequenceRule"/>
+ <Method name="getCoverages"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$GlyphSequenceRule"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$GlyphSequenceRule"/>
+ <Method name="getGlyphs"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$Rule"/>
+ <Method name="getLookups"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$RuleSet"/>
+ <Method name="<init>"/>
+ <Bug pattern="EI_EXPOSE_REP2"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$RuleSet"/>
+ <Method name="getRules"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.scripts.IndicScriptProcessor"/>
+ <Or>
+ <Method name="getPositioningFeatures"/>
+ <Method name="getSubstitutionFeatures"/>
+ <Method name="getOptionalSubstitutionFeatures"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.area.inline.WordArea"/>
+ <Or>
+ <Method name="getBidiLevels"/>
+ <Method name="getGlyphPositionAdjustments"/>
+ </Or>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.fo.FOText"/>
+ <Method name="getBidiLevels"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.fonts.truetype.TTFDirTabEntry"/>
+ <Method name="getTag"/>
+ <Bug pattern="EI_EXPOSE_REP"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.area.inline.TextArea"/>
+ <Method name="makeLevels"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.area.inline.WordArea"/>
+ <Or>
+ <Method name="getBidiLevels"/>
+ <Method name="glyphPositionAdjustmentsAt"/>
+ </Or>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.bidi.UnicodeBidiAlgorithm"/>
+ <Method name="resolveLevels"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$ChainedContextualSubtableFormat1"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$ChainedContextualSubtableFormat2"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$ChainedContextualSubtableFormat3"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$ContextualSubtableFormat1"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$ContextualSubtableFormat2"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$ContextualSubtableFormat3"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphPositioningTable$CursiveSubtableFormat1"/>
+ <Method name="getExitEntryAnchors"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$AlternateSubtableFormat1"/>
+ <Method name="getAlternatesForCoverageIndex"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$ChainedContextualSubtableFormat1"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$ChainedContextualSubtableFormat2"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$ChainedContextualSubtableFormat3"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$ContextualSubtableFormat1"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$ContextualSubtableFormat2"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$ContextualSubtableFormat3"/>
+ <Method name="getLookups"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable$MultipleSubtableFormat1"/>
+ <Method name="getGlyphsForCoverageIndex"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.fonts.GlyphTable$LookupTable"/>
+ <Method name="getSubtables"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter"/>
+ <Or>
+ <Method name="formatNumberAsSequence"/>
+ <Method name="formatNumberAsSpecial"/>
+ </Or>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$ArabicNumeralsFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$EnglishNumberAsWordFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$FrenchNumberAsWordFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$GematriaNumeralsFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$IsopsephryNumeralsFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$KanaNumeralsFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$RomanNumeralsFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$SpanishNumberAsWordFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.complexscripts.util.NumberConverter$ThaiNumeralsFormatter"/>
+ <Method name="format"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.fo.FOText"/>
+ <Or>
+ <Method name="getBidiLevels"/>
+ <Method name="getMappingBidiLevels"/>
+ </Or>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.layoutmgr.inline.TextLayoutManager$TextAreaBuilder"/>
+ <Method name="getNonEmptyLevels"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
</FindBugsFilter>
Modified: xmlgraphics/fop/trunk/fop.cmd
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop.cmd?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop.cmd (original)
+++ xmlgraphics/fop/trunk/fop.cmd Sun Feb 26 02:29:01 2012
@@ -27,5 +27,5 @@ goto setupArgs
rem This label provides a place for the argument list loop to break out
:doneStart
-call %LOCAL_FOP_HOME%\fop.bat %FOP_CMD_LINE_ARGS%
+call "%LOCAL_FOP_HOME%\fop.bat" %FOP_CMD_LINE_ARGS%
Modified: xmlgraphics/fop/trunk/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java (original)
+++ xmlgraphics/fop/trunk/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java Sun Feb 26 02:29:01 2012
@@ -58,7 +58,7 @@ import org.apache.fop.events.model.Event
*/
public class EventProducerCollectorTask extends Task {
- private List filesets = new java.util.ArrayList();
+ private List<FileSet> filesets = new java.util.ArrayList<FileSet>();
private File destDir;
private File translationFile;
@@ -202,7 +202,7 @@ public class EventProducerCollectorTask
protected long processFileSets(EventProducerCollector collector)
throws IOException, EventConventionException, ClassNotFoundException {
long lastModified = 0;
- Iterator iter = filesets.iterator();
+ Iterator<FileSet> iter = filesets.iterator();
while (iter.hasNext()) {
FileSet fs = (FileSet)iter.next();
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
Added: xmlgraphics/fop/trunk/src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiClass.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiClass.java?rev=1293736&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiClass.java (added)
+++ xmlgraphics/fop/trunk/src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiClass.java Sun Feb 26 02:29:01 2012
@@ -0,0 +1,571 @@
+/*
+ * 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.complexscripts.bidi;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.fop.complexscripts.bidi.BidiConstants;
+import org.apache.fop.util.License;
+
+// CSOFF: LineLength
+// CSOFF: NoWhitespaceAfter
+
+/**
+ * <p>Utility for generating a Java class representing bidirectional
+ * class properties from the Unicode property files.</p>
+ *
+ * <p>This code is derived in part from GenerateLineBreakUtils.java.</p>
+ *
+ * @author Glenn Adams
+ */
+public final class GenerateBidiClass {
+
+ private GenerateBidiClass() {
+ }
+
+ private static byte[] bcL1 = new byte[256]; // ascii and basic latin blocks ( 0x0000 - 0x00FF )
+ private static byte[] bcR1 = new byte[368]; // hebrew and arabic blocks ( 0x0590 - 0x06FF )
+ private static int[] bcS1; // interval start indices
+ private static int[] bcE1; // interval end indices
+ private static byte[] bcC1; // interval bid classes
+
+ /**
+ * Generate a class managing bidi class properties for Unicode characters.
+ *
+ * @param bidiFileName name (as URL) of file containing bidi type data
+ * @param outFileName name of the output file
+ * @throws Exception
+ */
+ private static void convertBidiClassProperties(String bidiFileName, String outFileName) throws Exception {
+
+ readBidiClassProperties(bidiFileName);
+
+ // generate class
+ PrintWriter out = new PrintWriter(new FileWriter(outFileName));
+ License.writeJavaLicenseId(out);
+ out.println();
+ out.println("package org.apache.fop.complexscripts.bidi;");
+ out.println();
+ out.println("import java.util.Arrays;");
+ out.println("import org.apache.fop.complexscripts.bidi.BidiConstants;");
+ out.println();
+ out.println("// CSOFF: WhitespaceAfterCheck");
+ out.println("// CSOFF: LineLengthCheck");
+ out.println();
+ out.println("/*");
+ out.println(" * !!! THIS IS A GENERATED FILE !!!");
+ out.println(" * If updates to the source are needed, then:");
+ out.println(" * - apply the necessary modifications to");
+ out.println(" * 'src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiClass.java'");
+ out.println(" * - run 'ant codegen-unicode', which will generate a new BidiClass.java");
+ out.println(" * in 'src/java/org/apache/fop/complexscripts/bidi'");
+ out.println(" * - commit BOTH changed files");
+ out.println(" */");
+ out.println();
+ out.println("/** Bidirectional class utilities. */");
+ out.println("public final class BidiClass {");
+ out.println();
+ out.println("private BidiClass() {");
+ out.println("}");
+ out.println();
+ dumpData(out);
+ out.println ("/**");
+ out.println (" * Lookup bidi class for character expressed as unicode scalar value.");
+ out.println (" * @param ch a unicode scalar value");
+ out.println (" * @return bidi class");
+ out.println (" */");
+ out.println("public static int getBidiClass ( int ch ) {");
+ out.println(" if ( ch <= 0x00FF ) {");
+ out.println(" return bcL1 [ ch - 0x0000 ];");
+ out.println(" } else if ( ( ch >= 0x0590 ) && ( ch <= 0x06FF ) ) {");
+ out.println(" return bcR1 [ ch - 0x0590 ];");
+ out.println(" } else {");
+ out.println(" return getBidiClass ( ch, bcS1, bcE1, bcC1 );");
+ out.println(" }");
+ out.println("}");
+ out.println();
+ out.println("private static int getBidiClass ( int ch, int[] sa, int[] ea, byte[] ca ) {");
+ out.println(" int k = Arrays.binarySearch ( sa, ch );");
+ out.println(" if ( k >= 0 ) {");
+ out.println(" return ca [ k ];");
+ out.println(" } else {");
+ out.println(" k = - ( k + 1 );");
+ out.println(" if ( k == 0 ) {");
+ out.println(" return BidiConstants.L;");
+ out.println(" } else if ( ch <= ea [ k - 1 ] ) {");
+ out.println(" return ca [ k - 1 ];");
+ out.println(" } else {");
+ out.println(" return BidiConstants.L;");
+ out.println(" }");
+ out.println(" }");
+ out.println("}");
+ out.println();
+ out.println("}");
+ out.flush();
+ out.close();
+ }
+
+ /**
+ * Read bidi class property data.
+ *
+ * @param bidiFileName name (as URL) of bidi type data
+ */
+ private static void readBidiClassProperties(String bidiFileName) throws Exception {
+ // read property names
+ BufferedReader b = new BufferedReader(new InputStreamReader(new URL(bidiFileName).openStream()));
+ String line;
+ int lineNumber = 0;
+ TreeSet intervals = new TreeSet();
+ while ( ( line = b.readLine() ) != null ) {
+ lineNumber++;
+ if ( line.startsWith("#") ) {
+ continue;
+ } else if ( line.length() == 0 ) {
+ continue;
+ } else {
+ if ( line.indexOf ( "#" ) != -1 ) {
+ line = ( line.split ( "#" ) ) [ 0 ];
+ }
+ String[] fa = line.split ( ";" );
+ if ( fa.length == 2 ) {
+ int[] interval = parseInterval ( fa[0].trim() );
+ byte bidiClass = (byte) parseBidiClass ( fa[1].trim() );
+ if ( interval[1] == interval[0] ) { // singleton
+ int c = interval[0];
+ if ( c <= 0x00FF ) {
+ if ( bcL1 [ c - 0x0000 ] == 0 ) {
+ bcL1 [ c - 0x0000 ] = bidiClass;
+ } else {
+ throw new Exception ( "duplicate singleton entry: " + c );
+ }
+ } else if ( ( c >= 0x0590 ) && ( c <= 0x06FF ) ) {
+ if ( bcR1 [ c - 0x0590 ] == 0 ) {
+ bcR1 [ c - 0x0590 ] = bidiClass;
+ } else {
+ throw new Exception ( "duplicate singleton entry: " + c );
+ }
+ } else {
+ addInterval ( intervals, c, c, bidiClass );
+ }
+ } else { // non-singleton
+ int s = interval[0];
+ int e = interval[1]; // inclusive
+ if ( s <= 0x00FF ) {
+ for ( int i = s; i <= e; i++ ) {
+ if ( i <= 0x00FF ) {
+ if ( bcL1 [ i - 0x0000 ] == 0 ) {
+ bcL1 [ i - 0x0000 ] = bidiClass;
+ } else {
+ throw new Exception ( "duplicate singleton entry: " + i );
+ }
+ } else {
+ addInterval ( intervals, i, e, bidiClass );
+ break;
+ }
+ }
+ } else if ( ( s >= 0x0590 ) && ( s <= 0x06FF ) ) {
+ for ( int i = s; i <= e; i++ ) {
+ if ( i <= 0x06FF ) {
+ if ( bcR1 [ i - 0x0590 ] == 0 ) {
+ bcR1 [ i - 0x0590 ] = bidiClass;
+ } else {
+ throw new Exception ( "duplicate singleton entry: " + i );
+ }
+ } else {
+ addInterval ( intervals, i, e, bidiClass );
+ break;
+ }
+ }
+ } else {
+ addInterval ( intervals, s, e, bidiClass );
+ }
+ }
+ } else {
+ throw new Exception ( "bad syntax, line(" + lineNumber + "): " + line );
+ }
+ }
+ }
+ // compile interval search data
+ int ivIndex = 0, niv = intervals.size();
+ bcS1 = new int [ niv ];
+ bcE1 = new int [ niv ];
+ bcC1 = new byte [ niv ];
+ for ( Iterator it = intervals.iterator(); it.hasNext(); ivIndex++ ) {
+ Interval iv = (Interval) it.next();
+ bcS1[ivIndex] = iv.start;
+ bcE1[ivIndex] = iv.end;
+ bcC1[ivIndex] = (byte) iv.bidiClass;
+ }
+ // test data
+ test();
+ }
+
+ private static int[] parseInterval ( String interval ) throws Exception {
+ int s, e;
+ String[] fa = interval.split("\\.\\.");
+ if ( fa.length == 1 ) {
+ s = Integer.parseInt ( fa[0], 16 );
+ e = s;
+ } else if ( fa.length == 2 ) {
+ s = Integer.parseInt ( fa[0], 16 );
+ e = Integer.parseInt ( fa[1], 16 );
+ } else {
+ throw new Exception ( "bad interval syntax: " + interval );
+ }
+ if ( e < s ) {
+ throw new Exception ( "bad interval, start must be less than or equal to end: " + interval );
+ }
+ return new int[] {s, e};
+ }
+
+ private static int parseBidiClass ( String bidiClass ) {
+ int bc = 0;
+ if ( "L".equals ( bidiClass ) ) {
+ bc = BidiConstants.L;
+ } else if ( "LRE".equals ( bidiClass ) ) {
+ bc = BidiConstants.LRE;
+ } else if ( "LRO".equals ( bidiClass ) ) {
+ bc = BidiConstants.LRO;
+ } else if ( "R".equals ( bidiClass ) ) {
+ bc = BidiConstants.R;
+ } else if ( "AL".equals ( bidiClass ) ) {
+ bc = BidiConstants.AL;
+ } else if ( "RLE".equals ( bidiClass ) ) {
+ bc = BidiConstants.RLE;
+ } else if ( "RLO".equals ( bidiClass ) ) {
+ bc = BidiConstants.RLO;
+ } else if ( "PDF".equals ( bidiClass ) ) {
+ bc = BidiConstants.PDF;
+ } else if ( "EN".equals ( bidiClass ) ) {
+ bc = BidiConstants.EN;
+ } else if ( "ES".equals ( bidiClass ) ) {
+ bc = BidiConstants.ES;
+ } else if ( "ET".equals ( bidiClass ) ) {
+ bc = BidiConstants.ET;
+ } else if ( "AN".equals ( bidiClass ) ) {
+ bc = BidiConstants.AN;
+ } else if ( "CS".equals ( bidiClass ) ) {
+ bc = BidiConstants.CS;
+ } else if ( "NSM".equals ( bidiClass ) ) {
+ bc = BidiConstants.NSM;
+ } else if ( "BN".equals ( bidiClass ) ) {
+ bc = BidiConstants.BN;
+ } else if ( "B".equals ( bidiClass ) ) {
+ bc = BidiConstants.B;
+ } else if ( "S".equals ( bidiClass ) ) {
+ bc = BidiConstants.S;
+ } else if ( "WS".equals ( bidiClass ) ) {
+ bc = BidiConstants.WS;
+ } else if ( "ON".equals ( bidiClass ) ) {
+ bc = BidiConstants.ON;
+ } else {
+ throw new IllegalArgumentException ( "unknown bidi class: " + bidiClass );
+ }
+ return bc;
+ }
+
+ private static void addInterval ( SortedSet intervals, int start, int end, int bidiClass ) {
+ intervals.add ( new Interval ( start, end, bidiClass ) );
+ }
+
+ private static void dumpData ( PrintWriter out ) {
+ boolean first;
+ StringBuffer sb = new StringBuffer();
+
+ // bcL1
+ first = true;
+ sb.setLength(0);
+ out.println ( "private static byte[] bcL1 = {" );
+ for ( int i = 0; i < bcL1.length; i++ ) {
+ if ( ! first ) {
+ sb.append ( "," );
+ } else {
+ first = false;
+ }
+ sb.append ( bcL1[i] );
+ if ( sb.length() > 120 ) {
+ sb.append(',');
+ out.println(sb);
+ first = true;
+ sb.setLength(0);
+ }
+ }
+ if ( sb.length() > 0 ) {
+ out.println(sb);
+ }
+ out.println ( "};" );
+ out.println();
+
+ // bcR1
+ first = true;
+ sb.setLength(0);
+ out.println ( "private static byte[] bcR1 = {" );
+ for ( int i = 0; i < bcR1.length; i++ ) {
+ if ( ! first ) {
+ sb.append ( "," );
+ } else {
+ first = false;
+ }
+ sb.append ( bcR1[i] );
+ if ( sb.length() > 120 ) {
+ sb.append(',');
+ out.println(sb);
+ first = true;
+ sb.setLength(0);
+ }
+ }
+ if ( sb.length() > 0 ) {
+ out.println(sb);
+ }
+ out.println ( "};" );
+ out.println();
+
+ // bcS1
+ first = true;
+ sb.setLength(0);
+ out.println ( "private static int[] bcS1 = {" );
+ for ( int i = 0; i < bcS1.length; i++ ) {
+ if ( ! first ) {
+ sb.append ( "," );
+ } else {
+ first = false;
+ }
+ sb.append ( bcS1[i] );
+ if ( sb.length() > 120 ) {
+ sb.append(',');
+ out.println(sb);
+ first = true;
+ sb.setLength(0);
+ }
+ }
+ if ( sb.length() > 0 ) {
+ out.println(sb);
+ }
+ out.println ( "};" );
+ out.println();
+
+ // bcE1
+ first = true;
+ sb.setLength(0);
+ out.println ( "private static int[] bcE1 = {" );
+ for ( int i = 0; i < bcE1.length; i++ ) {
+ if ( ! first ) {
+ sb.append ( "," );
+ } else {
+ first = false;
+ }
+ sb.append ( bcE1[i] );
+ if ( sb.length() > 120 ) {
+ sb.append(',');
+ out.println(sb);
+ first = true;
+ sb.setLength(0);
+ }
+ }
+ if ( sb.length() > 0 ) {
+ out.println(sb);
+ }
+ out.println ( "};" );
+ out.println();
+
+ // bcC1
+ first = true;
+ sb.setLength(0);
+ out.println ( "private static byte[] bcC1 = {" );
+ for ( int i = 0; i < bcC1.length; i++ ) {
+ if ( ! first ) {
+ sb.append ( "," );
+ } else {
+ first = false;
+ }
+ sb.append ( bcC1[i] );
+ if ( sb.length() > 120 ) {
+ sb.append(',');
+ out.println(sb);
+ first = true;
+ sb.setLength(0);
+ }
+ }
+ if ( sb.length() > 0 ) {
+ out.println(sb);
+ }
+ out.println ( "};" );
+ out.println();
+ }
+
+ private static int getBidiClass ( int ch ) {
+ if ( ch <= 0x00FF ) {
+ return bcL1 [ ch - 0x0000 ];
+ } else if ( ( ch >= 0x0590 ) && ( ch <= 0x06FF ) ) {
+ return bcR1 [ ch - 0x0590 ];
+ } else {
+ return getBidiClass ( ch, bcS1, bcE1, bcC1 );
+ }
+ }
+
+ private static int getBidiClass ( int ch, int[] sa, int[] ea, byte[] ca ) {
+ int k = Arrays.binarySearch ( sa, ch );
+ if ( k >= 0 ) {
+ return ca [ k ];
+ } else {
+ k = - ( k + 1 );
+ if ( k == 0 ) {
+ return BidiConstants.L;
+ } else if ( ch <= ea [ k - 1 ] ) {
+ return ca [ k - 1 ];
+ } else {
+ return BidiConstants.L;
+ }
+ }
+ }
+
+ private static final int[] testData = // CSOK: ConstantName
+ {
+ 0x000000, BidiConstants.BN,
+ 0x000009, BidiConstants.S,
+ 0x00000A, BidiConstants.B,
+ 0x00000C, BidiConstants.WS,
+ 0x000020, BidiConstants.WS,
+ 0x000023, BidiConstants.ET,
+ 0x000028, BidiConstants.ON,
+ 0x00002B, BidiConstants.ES,
+ 0x00002C, BidiConstants.CS,
+ 0x000031, BidiConstants.EN,
+ 0x00003A, BidiConstants.CS,
+ 0x000041, BidiConstants.L,
+ 0x000300, BidiConstants.NSM,
+ 0x000374, BidiConstants.ON,
+ 0x0005BE, BidiConstants.R,
+ 0x000601, BidiConstants.AN,
+ 0x000608, BidiConstants.AL,
+ 0x000670, BidiConstants.NSM,
+ 0x000710, BidiConstants.AL,
+ 0x0007FA, BidiConstants.R,
+ 0x000970, BidiConstants.L,
+ 0x001392, BidiConstants.ON,
+ 0x002000, BidiConstants.WS,
+ 0x00200E, BidiConstants.L,
+ 0x00200F, BidiConstants.R,
+ 0x00202A, BidiConstants.LRE,
+ 0x00202B, BidiConstants.RLE,
+ 0x00202C, BidiConstants.PDF,
+ 0x00202D, BidiConstants.LRO,
+ 0x00202E, BidiConstants.RLO,
+ 0x0020E1, BidiConstants.NSM,
+ 0x002212, BidiConstants.ES,
+ 0x002070, BidiConstants.EN,
+ 0x003000, BidiConstants.WS,
+ 0x003009, BidiConstants.ON,
+ 0x00FBD4, BidiConstants.AL,
+ 0x00FE69, BidiConstants.ET,
+ 0x00FF0C, BidiConstants.CS,
+ 0x00FEFF, BidiConstants.BN,
+ 0x01034A, BidiConstants.L,
+ 0x010E60, BidiConstants.AN,
+ 0x01F100, BidiConstants.EN,
+ 0x0E0001, BidiConstants.BN,
+ 0x0E0100, BidiConstants.NSM,
+ 0x10FFFF, BidiConstants.BN
+ };
+
+ private static void test() throws Exception {
+ for ( int i = 0, n = testData.length / 2; i < n; i++ ) {
+ int ch = testData [ i * 2 + 0 ];
+ int tc = testData [ i * 2 + 1 ];
+ int bc = getBidiClass ( ch );
+ if ( bc != tc ) {
+ throw new Exception ( "test mapping failed for character (0x" + Integer.toHexString(ch) + "): expected " + tc + ", got " + bc );
+ }
+ }
+ }
+
+ /**
+ * Main entry point for generator.
+ * @param args array of command line arguments
+ */
+ public static void main(String[] args) {
+ String bidiFileName = "http://www.unicode.org/Public/UNIDATA/extracted/DerivedBidiClass.txt";
+ String outFileName = "BidiClass.java";
+ boolean ok = true;
+ for (int i = 0; i < args.length; i = i + 2) {
+ if (i + 1 == args.length) {
+ ok = false;
+ } else {
+ String opt = args[i];
+ if ("-b".equals(opt)) {
+ bidiFileName = args [i + 1];
+ } else if ("-o".equals(opt)) {
+ outFileName = args [i + 1];
+ } else {
+ ok = false;
+ }
+ }
+ }
+ if (!ok) {
+ System.out.println("Usage: GenerateBidiClass [-b <bidiFile>] [-o <outputFile>]");
+ System.out.println(" defaults:");
+ System.out.println(" <bidiFile>: " + bidiFileName);
+ System.out.println(" <outputFile>: " + outFileName);
+ } else {
+ try {
+ convertBidiClassProperties(bidiFileName, outFileName);
+ System.out.println("Generated " + outFileName + " from");
+ System.out.println(" <bidiFile>: " + bidiFileName);
+ } catch (Exception e) {
+ System.out.println("An unexpected error occured");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class Interval implements Comparable {
+ int start; // CSOK: VisibilityModifier
+ int end; // CSOK: VisibilityModifier
+ int bidiClass; // CSOK: VisibilityModifier
+ Interval ( int start, int end, int bidiClass ) {
+ this.start = start;
+ this.end = end;
+ this.bidiClass = bidiClass;
+ }
+ public int compareTo ( Object o ) {
+ Interval iv = (Interval) o;
+ if ( start < iv.start ) {
+ return -1;
+ } else if ( start > iv.start ) {
+ return 1;
+ } else if ( end < iv.end ) {
+ return -1;
+ } else if ( end > iv.end ) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org