changeset 101774:d4f9e4244d5a

(encode_terminal_code): Fix handling of composition. (produce_composite_glyph): For static composition, get pixel_width from struct composition.
author Kenichi Handa <handa@m17n.org>
date Wed, 04 Feb 2009 01:35:16 +0000
parents ea382e59a9cc
children 250ce1fa6aed
files src/term.c
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/term.c	Wed Feb 04 01:31:37 2009 +0000
+++ b/src/term.c	Wed Feb 04 01:35:16 2009 +0000
@@ -627,7 +627,7 @@
 		int c = LGLYPH_CHAR (g);
 
 		if (! char_charset (c, charset_list, NULL))
-		  break;
+		  c = '?';
 		buf += CHAR_STRING (c, buf);
 		nchars++;
 	      }
@@ -636,17 +636,23 @@
 	      {
 		int c = COMPOSITION_GLYPH (cmp, i);
 
-		if (! char_charset (c, charset_list, NULL))
-		  break;
+		if (c == '\t')
+		  continue;
+		if (char_charset (c, charset_list, NULL))
+		  {
+		    if (CHAR_WIDTH (c) == 0
+			&& i > 0 && COMPOSITION_GLYPH (cmp, i - 1) == '\t')
+		      /* Should be left-padded */
+		      {
+			buf += CHAR_STRING (' ', buf);
+			nchars++;
+		      }
+		  }
+		else
+		  c = '?';
 		buf += CHAR_STRING (c, buf);
 		nchars++;
 	      }
-	  if (i == 0)
-	    {
-	      /* The first character of the composition is not encodable.  */
-	      *buf++ = '?';
-	      nchars++;
-	    }
 	}
       /* We must skip glyphs to be padded for a wide character.  */
       else if (! CHAR_GLYPH_PADDING_P (*src))
@@ -1811,8 +1817,7 @@
     {
       struct composition *cmp = composition_table[it->cmp_it.id];
 
-      c = COMPOSITION_GLYPH (cmp, 0);
-      it->pixel_width = CHAR_WIDTH (it->c);
+      it->pixel_width = cmp->width;
     }
   else
     {