Revert "lib/gdi/font.cpp: try to fix wrong reordering of some characters"
authorghost <andreas.monzner@multimedia-labs.de>
Sat, 8 May 2010 16:42:25 +0000 (18:42 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Sat, 8 May 2010 16:42:25 +0000 (18:42 +0200)
its not working okay.. we need a better fix

This reverts commit 414208c929faa0fc56f9c21c0df572dc0b13d3fe.

lib/gdi/font.cpp

index 1d3c34d..2fd9fb6 100644 (file)
@@ -597,7 +597,8 @@ int eTextPara::renderString(const char *string, int rflags)
                // now do the usual logical->visual reordering
        int size=uc_shape.size();
 #ifdef HAVE_FRIBIDI
                // now do the usual logical->visual reordering
        int size=uc_shape.size();
 #ifdef HAVE_FRIBIDI
-       bool mustRealign=false;
+       FriBidiCharType dir=FRIBIDI_TYPE_ON;
+       int lines=1;
        int pos=0, spos=0;
        uc_visual.resize(size);
        // gaaanz lahm, aber anders geht das leider nicht, sorry.
        int pos=0, spos=0;
        uc_visual.resize(size);
        // gaaanz lahm, aber anders geht das leider nicht, sorry.
@@ -624,25 +625,23 @@ int eTextPara::renderString(const char *string, int rflags)
                default:
                        break;
                }
                default:
                        break;
                }
-               if (line_end || pos+incr >= size)
-               {
+               if (line_end || pos+incr >= size) {
                        int len = pos - spos;
                        if (len)
                        int len = pos - spos;
                        if (len)
-                       {
-                               FriBidiCharType dir=FRIBIDI_TYPE_ON;
                                fribidi_log2vis(array+spos, len, &dir, target+spos, 0, 0, 0);
                                fribidi_log2vis(array+spos, len, &dir, target+spos, 0, 0, 0);
-                               if (!mustRealign && dir&FRIBIDI_MASK_RTL)
-                                       mustRealign = true;
-                       }
                        target[pos] = array[pos];
                        if (incr > 1)
                                target[pos+1] = array[pos+1];
                        spos = pos+incr;
                        target[pos] = array[pos];
                        if (incr > 1)
                                target[pos+1] = array[pos+1];
                        spos = pos+incr;
+                       ++lines;
                        line_open = false;
                }
                pos += incr;
        }
 
                        line_open = false;
                }
                pos += incr;
        }
 
+       if (lines < 2)
+               fribidi_log2vis(array, size, &dir, target, 0, 0, 0);
+
        uc_visual.assign(target, target+size);
 #else
        uc_visual=uc_shape;
        uc_visual.assign(target, target+size);
 #else
        uc_visual=uc_shape;
@@ -741,7 +740,7 @@ nprint:     isprintable=0;
        bboxValid=false;
        calc_bbox();
 #ifdef HAVE_FRIBIDI
        bboxValid=false;
        calc_bbox();
 #ifdef HAVE_FRIBIDI
-       if (mustRealign)
+       if (dir & FRIBIDI_MASK_RTL)
                realign(dirRight);
 #endif
        return 0;
                realign(dirRight);
 #endif
        return 0;