--- qt-copy/src/kernel/qtextengine_p.h.orig	2003-12-20 19:48:02.000000000 -0500
+++ qt-copy/src/kernel/qtextengine_p.h	2004-01-13 05:42:44.000000000 -0500
@@ -202,6 +202,28 @@
     unsigned short justification   :4;  // Justification class
     unsigned short clusterStart    :1;  // First glyph of representation of cluster
     unsigned short mark            :1;  // needs to be positioned around base char
+    /*
+       The following attribute is redundant.  ZWSP, ZWJ, ZWNJ, and
+       ZWNBSP are four characters in Unicode that are zero-width.
+       None of these should be shown on the scree, so they do not
+       have any glyph to set zeroWidth to 1 for them.  Even if
+       you want to show them on screen (for editing purposes,
+       etc), the OpenType recommends that they should have zero
+       width in font.  That's the way all fonts are, and right
+       now I see that QT handles this nice.
+
+       The attribute is currently only set in arabic_shape and
+       never used anywhere.
+
+       So for binary compatiblity, I do not remove this member,
+       but remove the only reference to it in qscriptengine.cpp
+       that has caused a bug in Arabic support.  The bug is very
+       simple, ZWNJ and friends are shown in Arabic text!  They
+       should not.  So I have put the old "goto skip;" line back
+       there and commented out zeroWidth code.
+
+       -- Behdad Esfahbod <kde@behdad.org>  2004 Januray 13
+    */
     unsigned short zeroWidth       :1;  // ZWJ, ZWNJ etc, with no width
     unsigned short reserved        :1;
     unsigned short combiningClass  :8;
--- qt-copy/src/kernel/qscriptengine.cpp.orig	2004-01-13 05:42:22.000000000 -0500
+++ qt-copy/src/kernel/qscriptengine.cpp	2004-01-13 05:42:44.000000000 -0500
@@ -227,7 +227,7 @@
 static void heuristicSetGlyphAttributes( const QString &string, int from, int len,
 					 QTextEngine *engine, QScriptItem *si )
 {
-    // ### zeroWidth and justification are missing here!!!!!
+    // ### justification are missing here!!!!!
 
     if ( si->num_glyphs != len )
 	qWarning("QScriptEngine::heuristicSetGlyphAttributes: char length and num glyphs disagree" );
@@ -262,8 +262,8 @@
 	    if ( cmb == 0 ) {
 		// Fix 0 combining classes
 		if ( uc[pos].row() == 0x0e ) {
+	            unsigned char col = uc[pos].cell();
 		    // thai or lao
-		    unsigned char col = uc[pos].cell();
 		    if ( col == 0x31 ||
 			 col == 0x34 ||
 			 col == 0x35 ||
@@ -297,6 +297,21 @@
 	    advances[pos] = 0;
 	    si->hasPositioning = TRUE;
 	}
+
+	/* This piece of code is redundant -- Behdad Esfahbod
+	 * See comments in qtextengine_p.h about zeroWidth */
+	/* remove ZWSP, ZWNJ, ZWJ, ZWNBSP */
+	/*
+	unsigned char row = uc[pos].row();
+	unsigned char col = uc[pos].cell();
+	if ( row == 0x20 && ( col >= 0x0b && col <= 0x0d ) ||
+	     row == 0xFE && col == 0xFF  )  {
+	    glyphAttributes[pos].zeroWidth = TRUE;
+	} else {
+	    glyphAttributes[pos].zeroWidth = FALSE;
+	}
+	*/
+
 	pos++;
     }
 }
@@ -383,15 +398,6 @@
    previous and left with next in the above rules ;-)
 */
 
-/*
-  Two small helper functions for arabic shaping. They get the next shape causing character on either
-  side of the char in question. Implements rule R1.
-
-  leftChar() returns true if the char to the left is a left join-causing char
-  rightChar() returns true if the char to the right is a right join-causing char
-*/
-
-
 enum Shape {
     XIsolated,
     XFinal,
@@ -808,9 +814,16 @@
 	if ( r != 0x06 ) {
 	    if ( r == 0x20 ) {
 		uchar c = ch->cell();
-		if (c == 0x0c || c == 0x0d)
-		    // remove ZWJ and ZWNJ
-		    zeroWidth = TRUE;
+
+		// remove ZWSP, ZWJ, and ZWNJ
+		if (c == 0x0b || c == 0x0c || c == 0x0d) {
+		    /* These characters should really get
+		     * removed,  means no glyph at all, so
+		     * zeroWidth is irrelevant.
+		     * -- Behdad Esfahbod <kde@behdad.org> */
+		    goto skip;
+		    // zeroWidth = TRUE;
+		}
 	    }
 	    if ( reverse )
 		*data = mirroredChar( *ch );

