[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xfree-i18n
Subject:    XTerm-158 fix patch (Re: [I18n]xterm-158, XIM and UTF-8)
From:       Tomohiro KUBOTA <tkubota () riken ! go ! jp>
Date:       2001-09-14 15:58:58
[Download RAW message or body]

Hi,

At 10 Sep 2001 19:59:30 +0100,
Juliusz Chroboczek <jec@dcs.ed.ac.uk> wrote:

> 1. The return value of XCreateFontSet is not checked.  Tomohiro, could
> you please fix that?  It would be reasonable to either abort XTerm in
> that case, or to print a warning and continue in Root style, or
> perhaps to switch to the fixed fontset and try again.  Please make
> sure that you avoid looping if you chose the latter fix.

Here is a patch.  When XCreateFontSet() fails, it tries with
XCreateFontSet() again with DEFXIMFONT, i.e., "*".  When it
also fails, it gives up to use XIM.

Another fix is inside PreeditPosition(), where the very position
where segfault occurs.  I inserted a check whether XIM lives or not.

---------
diff -ruN xterm-158/charproc.c xterm-158-1/charproc.c
--- xterm-158/charproc.c	Sun Sep  9 10:22:34 2001
+++ xterm-158-1/charproc.c	Sat Sep 15 00:27:53 2001
@@ -2729,6 +2729,7 @@
     XPoint spot;
     XVaNestedList list;
 
+    if (!screen->xic) return;
     spot.x = CurCursorX(screen, screen->cur_row, screen->cur_col);
     spot.y = CursorY(screen, screen->cur_row) + screen->fs_ascent;
     list = XVaCreateNestedList(0,
@@ -5005,6 +5006,21 @@
 					 &missing_charset_list,
 					 &missing_charset_count,
 					 &def_string);
+	if (term->screen.fs == NULL) {
+	    fprintf(stderr,"Preparation of font set "
+		    "\"%s\" for XIM failed.\n", term->misc.f_x);
+	    term->screen.fs = XCreateFontSet(XtDisplay(term),
+					     DEFXIMFONT,
+					     &missing_charset_list,
+					     &missing_charset_count,
+					     &def_string);
+	}
+	if (term->screen.fs == NULL) {
+	    fprintf(stderr,"Preparation of default font set "
+		    "\"%s\" for XIM failed.\n", DEFXIMFONT);
+	    XCloseIM(xim);
+	    return;
+	}
 	extents = XExtentsOfFontSet(term->screen.fs);
 	j = XFontsOfFontSet(term->screen.fs, &fonts, &font_name_list);
 	for (i = 0, term->screen.fs_ascent = 0; i < j; i++) {
---------

Tomohiro KUBOTA <kubota@debian.org>
http://www.debian.or.jp/~kubota/
"Introduction to I18N"  http://www.debian.org/doc/manuals/intro-i18n/
_______________________________________________
I18n mailing list
I18n@XFree86.Org
http://XFree86.Org/mailman/listinfo/i18n

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic