changeset 91901:1469de45e945

(handle_composition_prop): Set it->c to the fist characte of the composed region. (fill_composite_glyph_string): Set base_face->font_info to s->font_info. Get a face for ascii from base_face->ascii_face. (BUILD_COMPOSITE_GLYPH_STRING): Call fill_composite_glyph_string with a face already decided. (x_produce_glyphs): Be sure to set it->ascent and it->descent to non-negative. (x_produce_glyphs): If the composition method is ..._WITH_GLYPH_STRING, call font_prepare_composition unconditionally.
author Kenichi Handa <handa@m17n.org>
date Sun, 17 Feb 2008 02:01:43 +0000
parents da78ada8c491
children 153651069fb2
files src/xdisp.c
diffstat 1 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Sun Feb 17 02:01:26 2008 +0000
+++ b/src/xdisp.c	Sun Feb 17 02:01:43 2008 +0000
@@ -4676,15 +4676,20 @@
 
   if (STRINGP (it->string))
     {
+      unsigned char *s;
+
       pos = IT_STRING_CHARPOS (*it);
       pos_byte = IT_STRING_BYTEPOS (*it);
       string = it->string;
+      s = SDATA (string) + pos_byte;
+      it->c = STRING_CHAR (s, 0);
     }
   else
     {
       pos = IT_CHARPOS (*it);
       pos_byte = IT_BYTEPOS (*it);
       string = Qnil;
+      it->c = FETCH_CHAR (pos_byte);
     }
 
   /* If there's a valid composition and point is not inside of the
@@ -4740,8 +4745,6 @@
 	      Lisp_Object lgstring = AREF (XHASH_TABLE (composition_hash_table)
 					   ->key_and_value,
 					   cmp->hash_index * 2);
-
-	      it->c = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, 0));
 	    }
 	  else
 #endif /* USE_FONT_BACKEND */
@@ -19309,7 +19312,7 @@
 		s->cmp->hash_index * 2);
 
       s->face = base_face;
-      s->font_info = s->cmp->font;
+      s->font_info = base_face->font_info;
       s->font = s->font_info->font;
       for (i = 0, s->nchars = 0; i < s->cmp->glyph_len; i++, s->nchars++)
 	{
@@ -19341,7 +19344,8 @@
 
 	  if (c != '\t')
 	    {
-	      int face_id = FACE_FOR_CHAR (s->f, base_face, c, -1, Qnil);
+	      int face_id = FACE_FOR_CHAR (s->f, base_face->ascii_face, c,
+					   -1, Qnil);
 
 	      face = get_char_face_and_encoding (s->f, c, face_id,
 						 s->char2b + i, 1, 1);
@@ -19879,7 +19883,6 @@
     int n;								    \
     									    \
     char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len);	    \
-    base_face = base_face->ascii_face;					    \
     									    \
     /* Make glyph_strings for each glyph sequence that is drawable by	    \
        the same face, and append them to HEAD/TAIL.  */			    \
@@ -21095,6 +21098,11 @@
 
 	  take_vertical_position_into_account (it);
 
+	  if (it->ascent < 0)
+	    it->ascent = 0;
+	  if (it->descent < 0)
+	    it->descent = 0;
+
 	  if (it->glyph_row)
 	    append_glyph (it);
 	}
@@ -21119,8 +21127,8 @@
 #ifdef USE_FONT_BACKEND
       if (cmp->method == COMPOSITION_WITH_GLYPH_STRING)
 	{
-	  if (! cmp->font || cmp->font != font)
-	    font_prepare_composition (cmp, it->f);
+	  PREPARE_FACE_FOR_DISPLAY (it->f, face);
+	  font_prepare_composition (cmp, it->f);
 	}
       else
 #endif	/* USE_FONT_BACKEND */
@@ -21399,11 +21407,7 @@
 
       it->pixel_width = cmp->pixel_width;
       it->ascent = it->phys_ascent = cmp->ascent;
-      if (it->ascent < 0)
-	it->ascent = it->phys_ascent = 0;
       it->descent = it->phys_descent = cmp->descent;
-      if (it->descent < 0)
-	it->descent = it->phys_descent = 0;
       if (face->box != FACE_NO_BOX)
 	{
 	  int thick = face->box_line_width;
@@ -21428,6 +21432,10 @@
 	it->ascent += overline_margin;
 
       take_vertical_position_into_account (it);
+      if (it->ascent < 0)
+	it->ascent = 0;
+      if (it->descent < 0)
+	it->descent = 0;
 
       if (it->glyph_row)
 	append_composite_glyph (it);