(analyse_bidi_level): Adjust a type (FriBidiParType).
[m17n/m17n-lib.git] / src / draw.c
index 0e58c15..bc302b1 100644 (file)
@@ -109,7 +109,7 @@ analyse_bidi_level (MGlyphString *gstring)
   MGlyph *g;
   int i;
 #ifdef HAVE_FRIBIDI
-  FriBidiCharType base = bidi_sensitive ? FRIBIDI_TYPE_RTL : FRIBIDI_TYPE_LTR;
+  FriBidiParType base = bidi_sensitive ? FRIBIDI_TYPE_RTL : FRIBIDI_TYPE_LTR;
   FriBidiChar *logical = alloca (sizeof (FriBidiChar) * len);
   FriBidiLevel *levels;
   FriBidiStrIndex *indices;
@@ -225,9 +225,10 @@ visual_order (MGlyphString *gstring)
   for (i = 1; i < gstring->used - 1; i++)
     {
       MGlyph *g = gstring->glyphs + i;
+      int level = g->bidi_level;
 
       for (j = i; g->g.from == gstring->glyphs[j + 1].g.from; j++);
-      if (j > i)
+      if ((level % 2) && j > i)
        {
          memcpy (glyphs + i, gstring->glyphs + i,
                  sizeof (MGlyph) * (j - i + 1));
@@ -483,6 +484,8 @@ compose_glyph_string (MFrame *frame, MText *mt, int from, int to,
                    break;
                  }
            }
+         if (this_script == Minherited || this_script == Mcommon)
+           this_script = (MSymbol) mchar_get_prop (c, Mblock);
        }
 
       pos = g->g.from;
@@ -546,7 +549,6 @@ compose_glyph_string (MFrame *frame, MText *mt, int from, int to,
 
              for (g++;
                   (g->type == GLYPH_CHAR
-                   && g->g.from != gstring->control.cursor_pos
                    && g->rface->layouter == this->rface->layouter
                    && (g->rface->rfont == this->rface->rfont
                        || (g->category == GLYPH_CATEGORY_FORMATTER