Index: fop.bat =================================================================== --- fop.bat (revision 898924) +++ fop.bat (working copy) @@ -67,6 +67,7 @@ set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-logging-1.0.4.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_imageio.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\fop-hyph.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\icu4j-4_2_1.jar set LOCALCLASSPATH=%LOCALCLASSPATH%;%FOP_HYPHENATION_PATH% set JAVAOPTS=-Denv.windir=%WINDIR% Index: lib/icu4j-4_2_1.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: lib\icu4j-4_2_1.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: lib/license.html =================================================================== --- lib/license.html (revision 0) +++ lib/license.html (revision 0) @@ -0,0 +1,51 @@ + + + + +ICU License - ICU 1.8.1 and later + + + +

ICU License - ICU 1.8.1 and later

+ +

COPYRIGHT AND PERMISSION NOTICE

+ +

+Copyright (c) 1995-2009 International Business Machines Corporation and others +

+

+All rights reserved. +

+

+Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies +of the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. +

+

+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL +THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, +OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. +

+

+Except as contained in this notice, the name of a copyright holder shall not be +used in advertising or otherwise to promote the sale, use or other dealings in +this Software without prior written authorization of the copyright holder. +

+ +
+

+All trademarks and registered trademarks mentioned herein are the property of their respective owners. +

+ + Index: src/java/org/apache/fop/render/pcl/PCLPainter.java =================================================================== --- src/java/org/apache/fop/render/pcl/PCLPainter.java (revision 898924) +++ src/java/org/apache/fop/render/pcl/PCLPainter.java (working copy) @@ -32,6 +32,9 @@ import java.util.Map; import java.util.Stack; +import com.ibm.icu.text.ArabicShaping; +import com.ibm.icu.text.ArabicShapingException; +import com.ibm.icu.text.Bidi; import org.w3c.dom.Document; import org.apache.commons.logging.Log; @@ -475,7 +478,18 @@ Java2DPainter painter = new Java2DPainter(g2d, getContext(), parent.getFontInfo(), state); try { - painter.drawText(x, y, letterSpacing, wordSpacing, dx, text); + String textTemp = text; + ArabicShaping arabicShaping = new ArabicShaping(ArabicShaping.LETTERS_SHAPE | ArabicShaping.LAMALEF_AUTO); + try { + textTemp = arabicShaping.shape(textTemp); + } catch (ArabicShapingException ex) { + throw new IFException("Arabic Shaping Exception", ex); + } + Bidi bidi = new Bidi(); + bidi.setPara(textTemp, (byte)Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT, null); + textTemp = bidi.writeReordered(Bidi.KEEP_BASE_COMBINING); + + painter.drawText(x, y, letterSpacing, wordSpacing, dx, textTemp); } catch (IFException e) { //This should never happen with the Java2DPainter throw new RuntimeException("Unexpected error while painting text", e); Index: src/java/org/apache/fop/render/pdf/PDFPainter.java =================================================================== --- src/java/org/apache/fop/render/pdf/PDFPainter.java (revision 898924) +++ src/java/org/apache/fop/render/pdf/PDFPainter.java (working copy) @@ -27,6 +27,9 @@ import java.awt.geom.AffineTransform; import java.io.IOException; +import com.ibm.icu.text.ArabicShaping; +import com.ibm.icu.text.ArabicShapingException; +import com.ibm.icu.text.Bidi; import org.w3c.dom.Document; import org.apache.fop.fonts.Font; @@ -295,6 +298,16 @@ public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String text) throws IFException { + ArabicShaping arabicShaping = new ArabicShaping(ArabicShaping.LETTERS_SHAPE | ArabicShaping.LAMALEF_AUTO); + try { + text = arabicShaping.shape(text); + } catch (ArabicShapingException ex) { + throw new IFException("Arabic Shaping Exception", ex); + } + Bidi bidi = new Bidi(); + bidi.setPara(text, (byte)Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT, null); + text = bidi.writeReordered(Bidi.KEEP_BASE_COMBINING); + if (accessEnabled) { String ptr = getContext().getStructurePointer(); MarkedContentInfo mci = logicalStructureHandler.addTextContentItem(ptr);