changeset 90646:18698239b6d8

(get_next_display_element): Set it->face_id for the first component of a composition. (x_produce_glyphs): Check if the font is changed or not for composition.
author Kenichi Handa <handa@m17n.org>
date Tue, 31 Oct 2006 05:07:21 +0000
parents 7eeafaaa9eab
children a156ddd24e02
files src/xdisp.c
diffstat 1 files changed, 23 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Mon Oct 30 08:54:41 2006 +0000
+++ b/src/xdisp.c	Tue Oct 31 05:07:21 2006 +0000
@@ -5899,20 +5899,21 @@
 	      goto get_next;
 	    }
 	}
-
-      /* Adjust face id for a multibyte character.  There are no
-         multibyte character in unibyte text.  */
-      if (it->multibyte_p
-	  && success_p
-	  && FRAME_WINDOW_P (it->f))
-	{
-	  struct face *face = FACE_FROM_ID (it->f, it->face_id);
-	  int pos = (it->s ? -1
-		     : STRINGP (it->string) ? IT_STRING_CHARPOS (*it)
-		     : IT_CHARPOS (*it));
+    }
+
+  /* Adjust face id for a multibyte character.  There are no multibyte
+     character in unibyte text.  */
+  if ((it->what == IT_CHARACTER || it->what == IT_COMPOSITION)
+      && it->multibyte_p
+      && success_p
+      && FRAME_WINDOW_P (it->f))
+    {
+      struct face *face = FACE_FROM_ID (it->f, it->face_id);
+      int pos = (it->s ? -1
+		 : STRINGP (it->string) ? IT_STRING_CHARPOS (*it)
+		 : IT_CHARPOS (*it));
 	  
-	  it->face_id = FACE_FOR_CHAR (it->f, face, it->c, pos, it->string);
-	}
+      it->face_id = FACE_FOR_CHAR (it->f, face, it->c, pos, it->string);
     }
 
   /* Is this character the last one of a run of characters with
@@ -20883,13 +20884,15 @@
       struct face *face = FACE_FROM_ID (it->f, it->face_id);
       int boff;			/* baseline offset */
       struct composition *cmp = composition_table[it->cmp_id];
+      int glyph_len = cmp->glyph_len;
+      XFontStruct *font = face->font;
 
       it->nglyphs = 1;
 
 #ifdef USE_FONT_BACKEND
       if (cmp->method == COMPOSITION_WITH_GLYPH_STRING)
 	{
-	  if (! cmp->font)
+	  if (! cmp->font || cmp->font != font)
 	    font_prepare_composition (cmp);
 	}
       else
@@ -20901,7 +20904,7 @@
 	 here we check only the font of the first glyph.  This leads
 	 to incorrect display, but it's very rare, and C-l (recenter)
 	 can correct the display anyway.  */
-      if (! cmp->font)
+      if (! cmp->font || cmp->font != font)
 	{
 	  /* Ascent and descent of the font of the first character
 	     of this composition (adjusted by baseline offset).
@@ -20913,11 +20916,9 @@
 	  int lbearing, rbearing;
 	  int i, width, ascent, descent;
 	  int left_padded = 0, right_padded = 0;
-	  int glyph_len = cmp->glyph_len;
 	  int face_id;
 	  int c;
 	  XChar2b char2b;
-	  XFontStruct *font;
 	  XCharStruct *pcm;
 	  int font_not_found_p;
 	  struct font_info *font_info;
@@ -20937,23 +20938,16 @@
 	  if (i > 0)
 	    left_padded = 1;
 
-	  /* Get the font of the first non-TAB component.  */
 	  pos = (STRINGP (it->string) ? IT_STRING_CHARPOS (*it)
 		 : IT_CHARPOS (*it));
-	  face_id = FACE_FOR_CHAR (it->f, face, c, pos, it->string);
-	  font = FACE_FROM_ID (it->f, face_id)->font;
 	  /* When no suitable font found, use the default font.  */
 	  font_not_found_p = font == NULL;
 	  if (font_not_found_p)
 	    {
-	      font = FACE_FROM_ID (it->f, it->face_id)->font;
-	      font_info
-		= FONT_INFO_FROM_FACE (it->f,
-				       FACE_FROM_ID (it->f, it->face_id));
-	    }
-	  else
-	    font_info
-	      = FONT_INFO_FROM_FACE (it->f, FACE_FROM_ID (it->f, face_id));
+	      face = face->ascii_face;
+	      font = face->font;
+	    }
+	  font_info = FONT_INFO_FROM_FACE (it->f, face);
 	  boff = font_info->baseline_offset;
 	  if (font_info->vertical_centering)
 	    boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
@@ -20966,7 +20960,7 @@
 	  pcm = NULL;
 	  if (! font_not_found_p)
 	    {
-	      get_char_face_and_encoding (it->f, c, face_id,
+	      get_char_face_and_encoding (it->f, c, it->face_id,
 					  &char2b, it->multibyte_p, 0);
 	      pcm = get_per_char_metric (font, font_info, &char2b,
 					 FONT_TYPE_FOR_MULTIBYTE (font, c));