You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by de...@apache.org on 2005/08/01 03:04:14 UTC

svn commit: r226710 - in /xmlgraphics/batik/trunk: sources/org/apache/batik/apps/svgbrowser/ sources/org/apache/batik/gvt/text/ test-references/samples/tests/spec/text/ test-resources/org/apache/batik/test/

Author: deweese
Date: Sun Jul 31 18:03:59 2005
New Revision: 226710

URL: http://svn.apache.org/viewcvs?rev=226710&view=rev
Log:
1) Fixed misplaced glyph for mixed LTR and RTL text.
2) Fixed NPE when closing open window without entering anything.
3) New test for Bidi checking for misplaced glyph.

Added:
    xmlgraphics/batik/trunk/test-references/samples/tests/spec/text/textBiDi2.png   (with props)
Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/BidiAttributedCharacterIterator.java
    xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java?rev=226710&r1=226709&r2=226710&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java Sun Jul 31 18:03:59 2005
@@ -1042,6 +1042,7 @@
             }
             if (uriChooser.showDialog() == URIChooser.OK_OPTION) {
                 String s = uriChooser.getText();
+                if (s == null) return;
                 int i = s.indexOf("#");
                 String t = "";
                 if (i != -1) {

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/BidiAttributedCharacterIterator.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/BidiAttributedCharacterIterator.java?rev=226710&r1=226709&r2=226710&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/BidiAttributedCharacterIterator.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/BidiAttributedCharacterIterator.java Sun Jul 31 18:03:59 2005
@@ -42,7 +42,7 @@
     private FontRenderContext frc;
     private int chunkStart;
     private int [] newCharOrder;
-
+    private final static Float FLOAT_NAN = new Float(Float.NaN);
     private final static Map mirroredGlyphs = new HashMap(50);
 
 
@@ -162,16 +162,19 @@
 
         //  work out the new character order
         newCharOrder = doBidiReorder(charIndices, charLevels, 
-                                           numChars, maxBiDi);
+                                     numChars, maxBiDi);
 
         // construct the string in the new order
         StringBuffer reorderedString = new StringBuffer();
         char c;
+        int reorderedFirstChar = 0;
         for (int i = 0; i < numChars; i++) {
-            c = aci.setIndex(newCharOrder[i]);
+            int srcIdx = newCharOrder[i];
+            c = aci.setIndex(srcIdx);
+            if (srcIdx == 0) reorderedFirstChar = i;
 
             // check for mirrored char
-            int bidiLevel = tl.getCharacterLevel(newCharOrder[i]);
+            int bidiLevel = tl.getCharacterLevel(srcIdx);
             if ((bidiLevel & 0x01) != 0) {
                 // bidi level is odd so writing dir is right to left
                 // So get the mirror version of the char if there
@@ -221,14 +224,14 @@
         if (x != null && !x.isNaN()) {
             reorderedAS.addAttribute
                 (GVTAttributedCharacterIterator.TextAttribute.X,
-                 new Float(Float.NaN), newCharOrder[0], newCharOrder[0]+1);
+                 FLOAT_NAN, reorderedFirstChar, reorderedFirstChar+1);
             reorderedAS.addAttribute
                 (GVTAttributedCharacterIterator.TextAttribute.X, x, 0, 1);
         }
         if (y != null && !y.isNaN()) {
             reorderedAS.addAttribute
                 (GVTAttributedCharacterIterator.TextAttribute.Y,
-                 new Float(Float.NaN), newCharOrder[0], newCharOrder[0]+1);
+                 FLOAT_NAN, reorderedFirstChar, reorderedFirstChar+1);
             reorderedAS.addAttribute
                 (GVTAttributedCharacterIterator.TextAttribute.Y, y, 0, 1);
         }

Added: xmlgraphics/batik/trunk/test-references/samples/tests/spec/text/textBiDi2.png
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/test-references/samples/tests/spec/text/textBiDi2.png?rev=226710&view=auto
==============================================================================
Binary file - no diff available.

Propchange: xmlgraphics/batik/trunk/test-references/samples/tests/spec/text/textBiDi2.png
------------------------------------------------------------------------------
    svn:executable = *

Propchange: xmlgraphics/batik/trunk/test-references/samples/tests/spec/text/textBiDi2.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml?rev=226710&r1=226709&r2=226710&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml (original)
+++ xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml Sun Jul 31 18:03:59 2005
@@ -329,6 +329,7 @@
         <test id="samples/tests/spec/text/textAnchor2.svg" />
         <test id="samples/tests/spec/text/textAnchor3.svg" />
         <test id="samples/tests/spec/text/textBiDi.svg" />
+        <test id="samples/tests/spec/text/textBiDi2.svg" />
         <test id="samples/tests/spec/text/textDecoration.svg" />
         <test id="samples/tests/spec/text/textDecoration2.svg" />
         <test id="samples/tests/spec/text/textEffect.svg" />