? doc/reference/vte-overrides.txt
? gnome-pty-helper/.in
Index: src/vtedraw.h
===================================================================
RCS file: /cvs/gnome/vte/src/vtedraw.h,v
retrieving revision 1.9
diff -u -p -r1.9 vtedraw.h
--- src/vtedraw.h	20 Apr 2004 05:16:56 -0000	1.9
+++ src/vtedraw.h	14 Feb 2005 19:34:52 -0000
@@ -33,7 +33,14 @@ G_BEGIN_DECLS
 #define VTE_DRAW_SINGLE_WIDE_CHARACTERS	"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
 					"abcdefgjijklmnopqrstuvwxyz" \
 					"0123456789./+@"
-#define VTE_DRAW_DOUBLE_WIDE_CHARACTERS	0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94
+/* Some Korean fonts don't have CJK ideographs at all. Add 5 Hangul syllables
+   for them */
+#define VTE_DRAW_DOUBLE_WIDE_CHARACTERS 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94,\
+					0xac00, 0xac01, 0xac04, 0xac08, 0xac10
+/* For Pango, we have to use CJK Ideographs alone. Otherwise, 'width'
+   returned by pango_layout would be screwed up for Chinese and Japanese 
+   fonts without Hangul */
+#define VTE_DRAW_DOUBLE_WIDE_IDEOGRAPHS 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94
 #define VTE_DRAW_OPAQUE 0xff
 #define VTE_DRAW_MAX_LENGTH 88
 
Index: src/vteglyph.c
===================================================================
RCS file: /cvs/gnome/vte/src/vteglyph.c,v
retrieving revision 1.14
diff -u -p -r1.14 vteglyph.c
--- src/vteglyph.c	20 Apr 2004 05:16:56 -0000	1.14
+++ src/vteglyph.c	14 Feb 2005 19:34:52 -0000
@@ -148,7 +148,7 @@ _vte_glyph_cache_set_font_description(Gt
 	GList *iter;
 	FcPattern *pattern;
 	GArray *patterns;
-	FT_Face face;
+	FT_Face face, prev_face;
 	gunichar double_wide_characters[] = {VTE_DRAW_DOUBLE_WIDE_CHARACTERS};
 
 	g_return_if_fail(cache != NULL);
@@ -349,7 +349,8 @@ _vte_glyph_cache_set_font_description(Gt
 		cache->height = 1;
 		cache->ascent = 1;
 	}
-	width = 0;
+	width = count = 0;
+	prev_face = NULL;
 	for (i = 0; i < G_N_ELEMENTS(double_wide_characters); i++) {
 		face = _vte_glyph_cache_face_for_char(cache,
 						      double_wide_characters[i]);
@@ -364,12 +365,18 @@ _vte_glyph_cache_set_font_description(Gt
 						cache->ft_render_flags);
 		}
 		if (error == 0) {
+			if (count && prev_face != face) {
+				count = width = 0;
+			}
 			width += face->glyph->metrics.horiAdvance;
 			count++;
+			prev_face = face;
 		}
 	}
 	if (count > 0) {
 		if (cache->width == width / 64 / count) {
+			/* add 1 to round up when dividing by 2 */
+			cache->width++;
 			cache->width /= 2;
 		}
 	}
Index: src/vtepango.c
===================================================================
RCS file: /cvs/gnome/vte/src/vtepango.c,v
retrieving revision 1.16
diff -u -p -r1.16 vtepango.c
--- src/vtepango.c	20 Apr 2004 05:16:56 -0000	1.16
+++ src/vtepango.c	14 Feb 2005 19:34:52 -0000
@@ -268,7 +268,7 @@ _vte_pango_set_text_font(struct _vte_dra
 	PangoLayout *layout;
 	PangoLayoutIter *iter;
 	PangoRectangle ink, logical;
-	gunichar full_codepoints[] = {VTE_DRAW_DOUBLE_WIDE_CHARACTERS};
+	gunichar full_codepoints[] = {VTE_DRAW_DOUBLE_WIDE_IDEOGRAPHS};
 	GString *full_string;
 	gint full_width;
 	int i;
@@ -319,6 +319,8 @@ _vte_pango_set_text_font(struct _vte_dra
 
 	/* If they're the same, then we have a screwy font. */
 	if (full_width == draw->width) {
+		/* add 1 to round up when dividing by 2 */
+		draw->width++;
 		draw->width /= 2;
 	}
 
Index: src/vtepangox.c
===================================================================
RCS file: /cvs/gnome/vte/src/vtepangox.c,v
retrieving revision 1.14
diff -u -p -r1.14 vtepangox.c
--- src/vtepangox.c	20 Apr 2004 05:16:56 -0000	1.14
+++ src/vtepangox.c	14 Feb 2005 19:34:52 -0000
@@ -279,7 +279,7 @@ _vte_pango_x_set_text_font(struct _vte_d
 	PangoLayout *layout;
 	PangoLayoutIter *iter;
 	PangoRectangle ink, logical;
-	gunichar full_codepoints[] = {VTE_DRAW_DOUBLE_WIDE_CHARACTERS};
+	gunichar full_codepoints[] = {VTE_DRAW_DOUBLE_WIDE_IDEOGRAPHS};
 	GString *full_string;
 	gint full_width;
 	int i;
@@ -329,6 +329,8 @@ _vte_pango_x_set_text_font(struct _vte_d
 
 	/* If they're the same, then we have a screwy font. */
 	if (full_width == draw->width) {
+                /* add 1 to round up when dividing by 2 */
+		draw->width++;
 		draw->width /= 2;
 	}
 
Index: src/vtexft.c
===================================================================
RCS file: /cvs/gnome/vte/src/vtexft.c,v
retrieving revision 1.19
diff -u -p -r1.19 vtexft.c
--- src/vtexft.c	20 Apr 2004 05:16:56 -0000	1.19
+++ src/vtexft.c	14 Feb 2005 19:34:52 -0000
@@ -535,7 +535,7 @@ _vte_xft_set_text_font(struct _vte_draw 
 		       VteTerminalAntiAlias antialias)
 {
 	GString *string;
-	XftFont *font;
+	XftFont *font, *prev_font;
 	XGlyphInfo extents;
 	struct _vte_xft_data *data;
 	gunichar wide_chars[] = {VTE_DRAW_DOUBLE_WIDE_CHARACTERS};
@@ -579,20 +579,34 @@ _vte_xft_set_text_font(struct _vte_draw 
 	/* Estimate a typical cell width by looking at double-width
 	 * characters, and if it's the same as the single width, assume the
 	 * single-width stuff is broken. */
-	n = 0;
+	n = width = 0;
+	prev_font = NULL;
 	for (i = 0; i < G_N_ELEMENTS(wide_chars); i++) {
 		c = wide_chars[i];
 		font = _vte_xft_font_for_char(data->font, c);
 		if ((font != NULL) &&
 		    (_vte_xft_char_exists(data->font, font, c))) {
+			if (n && prev_font != font) { /* font change */
+			    n = width = 0; 
+			}
 			memset(&extents, 0, sizeof(extents));
 			_vte_xft_text_extents(data->font, font, c, &extents);
 			n++;
 			width += extents.xOff;
+			prev_font = font;
 		}
 	}
+#ifdef VTE_DEBUG
+	if (_vte_debug_on(VTE_DEBUG_MISC)) {
+		fprintf(stderr, "VteXft font : single width=%d,"
+		        "double width=%d, # of doubld width chars=%d\n", 
+			draw->width, howmany(width,n), n);
+	}
+#endif
 	if (n > 0) {
 		if (howmany(width, n) == draw->width) {
+		        /* add 1 to round up when dividing by 2 */
+			draw->width++;
 			draw->width /= 2;
 		}
 	}
