[Patch] libzvt totally broken for fontset, hence CJK.



I don't know since when this happened but libzvt is broken for
fontset. It cannot load fontset by name(zvt_term_set_font_name). 
When a pre-load fontset is passed to it (zvt_term_set_fonts),
it cannot display any double byte characters.

The problems exist both in current gnome release and cvs.

The attached patch does the minimum, let zvt displays double byte
characters when a pre-loaded font is passed to it. The spacing is
still wrong(double width cell are considered as single spacing cell),
but at least it display.

-- 
Best regard
hashao
--- zvtterm.c.orig	Sun Aug 19 22:25:22 2001
+++ zvtterm.c	Sun Aug 19 22:42:12 2001
@@ -3169,10 +3169,22 @@
   /* this is limited to 65535 characters! */
   case ZVT_FONT_FONTSET: {
     wchar_t *expandwc = zp->text_expand;
+    char* tempchar;	/* Add to _zvtprivate? less malloca. */
+    int ret;
     XFontSet fontset = (XFontSet) font_private->xfont;
 
-    for (i=0;i<len;i++) {
-      expandwc[i] = VT_ASCII(line->data[i+col]);
+    tempchar = g_malloc(len*sizeof(char)+1);
+
+    for(i=0;i<len;i++){
+        tempchar[i] = VT_ASCII(line->data[i+col]);
+    }
+    tempchar[i+1] = '\0';
+
+    ret = mbstowcs(expandwc, tempchar, len);
+    free(tempchar);
+    /* Invalid mbs, we might want to convert 1by1, fail more gracely. */
+    if(ret == -1){
+	return;
     }
 
     /* render wide characters, with fill if we can */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]