(run_flt): Set font.font.family.
authorhanda <handa>
Fri, 9 Nov 2007 07:39:13 +0000 (07:39 +0000)
committerhanda <handa>
Fri, 9 Nov 2007 07:39:13 +0000 (07:39 +0000)
(compose_glyph_string): Fix handling of combining characters.

src/draw.c

index 101eb04..70f1e5e 100644 (file)
@@ -279,7 +279,7 @@ run_flt (MGlyphString *gstring, int from, int to, MRealizedFont *rfont,
   flt_gstr.used = gstring->used;
   flt_gstr.allocated = gstring->size;
   flt_gstr.r2l = 0;
-  font.font.family = Mnil;
+  font.font.family = mfont_get_prop (rfont->font, Mfamily);
   font.font.x_ppem = rfont->x_ppem;
   font.font.y_ppem = rfont->y_ppem;
   font.font.get_glyph_id = mfont__get_glyph_id;
@@ -533,16 +533,17 @@ compose_glyph_string (MFrame *frame, MText *mt, int from, int to,
 
          if (this->rface->layouter != Mnil)
            {
-             MGlyph *prev;
+             MGlyph *prev = MGLYPH (start - 1);
 
-             for (prev = MGLYPH (start - 1);
-                  (prev->type == GLYPH_CHAR
-                   && prev->category == GLYPH_CATEGORY_FORMATTER
-                   && (mfont__encode_char (NULL, (MFont *) this->rface->rfont,
-                                           NULL, prev->g.c)
-                       != MCHAR_INVALID_CODE));
-                  start--, prev--)
-               prev->rface->rfont = this->rface->rfont;
+             while (prev->type == GLYPH_CHAR
+                    && prev->category == GLYPH_CATEGORY_FORMATTER
+                    && (mfont__encode_char (NULL, (MFont *) this->rface->rfont,
+                                            NULL, prev->g.c)
+                        != MCHAR_INVALID_CODE))
+               {
+                 start--, prev--;
+                 prev->rface->rfont = this->rface->rfont;
+               }
 
              for (g++;
                   (g->type == GLYPH_CHAR
@@ -560,18 +561,17 @@ compose_glyph_string (MFrame *frame, MText *mt, int from, int to,
            }
          else
            {
-             while (this->type == GLYPH_CHAR
-                    && this->g.c >= 0x100
-                    && this->category == GLYPH_CATEGORY_MODIFIER
-                    && this->rface->rfont
-                    && this->rface->rfont->layouter == Mnil)
-               i++, this++;
+             g++;
+             while (g->type == GLYPH_CHAR
+                    && g->g.c >= 0x100
+                    && g->category == GLYPH_CATEGORY_MODIFIER
+                    && g->rface->rfont
+                    && g->rface->rfont->layouter == Mnil)
+               i++, g++;
              if (start + 1 < i)
                run_flt (gstring, start, i, this->rface->rfont, Mt);
              else
                mfont__get_metric (gstring, start, i);
-             if (this->type == GLYPH_ANCHOR)
-               break;
            }
          g = MGLYPH (i);
        }