From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.devel Subject: Re: `set-fontset-font' and ascii characters Date: Thu, 01 May 2003 19:48:37 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87u1cezhlu.fsf@ID-87814.user.dfncis.de> References: <87he8kutns.fsf@ID-87814.user.dfncis.de> <200305010810.RAA15007@etlken.m17n.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1051811820 24979 80.91.224.249 (1 May 2003 17:57:00 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 1 May 2003 17:57:00 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 01 19:56:54 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19BIIg-0006UH-00 for ; Thu, 01 May 2003 19:56:54 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19BISP-00008e-00 for ; Thu, 01 May 2003 20:06:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19BII4-0006iM-00 for emacs-devel@quimby.gnus.org; Thu, 01 May 2003 13:56:16 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19BIHG-0006Qp-00 for emacs-devel@gnu.org; Thu, 01 May 2003 13:55:26 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19BIGo-0005wf-00 for emacs-devel@gnu.org; Thu, 01 May 2003 13:54:59 -0400 Original-Received: from pop.gmx.de ([213.165.64.20] helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.10.13) id 19BIF7-0004jS-00 for emacs-devel@gnu.org; Thu, 01 May 2003 13:53:13 -0400 Original-Received: (qmail 18622 invoked by uid 65534); 1 May 2003 17:53:07 -0000 Original-Received: from dialin-145-254-193-235.arcor-ip.net (EHLO HERMES) (145.254.193.235) by mail.gmx.net (mp022-rz3) with SMTP; 01 May 2003 19:53:07 +0200 Original-To: Kenichi Handa In-Reply-To: <200305010810.RAA15007@etlken.m17n.org> (Kenichi Handa's message of "Thu, 1 May 2003 17:10:49 +0900 (JST)") X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6;Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13597 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13597 --=-=-= Kenichi Handa writes: > In article <87he8kutns.fsf@ID-87814.user.dfncis.de>, Oliver Scholz writes: >> Is there any special reason why `set-fontset-font' should raise an >> error, if CHARACTER specifies a single byte char? The patch below >> seems to work, but I may be missing something. > > Thank you for working on it. > > If we change the ASCII font in the fontset of the default > face, I think it should have the same effect as changing the > font of the default face (e.g. changing the font size > results in chaning the frame size). The reason I inhibitted > changing ASCII font in a fontset is that it seems difficult > to achieve that effect (or at least I didn't know how to do > that when I wrote the code). Does you change pay attetion > to that? [...] It doesn't, sorry. I didn't realize that this could be an issue, because I use an window manager which keeps frames full-size anyways. But I spent the afternoon browsing the sources for a solution that does. The two patches below seem to make it work (only slightly tested). Now, if an ASCII font was changed, Fset_fontset_font checks all frames whether FONTSET is their frame fontset and forces a resizing of all frames that have. This is done by the new function x_new_fontset_force, which is like x_new_fontset, except that it does its works even if new fontset = old fontset. (This is done by factoring out a new function x_set_fontset_internal out of x_set_fontset.) Oliver --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=fontset.diff *** fontset.c.~1.76.~ Thu Feb 20 15:13:04 2003 --- fontset.c Thu May 1 19:31:18 2003 *************** *** 36,41 **** --- 36,42 ---- #include "dispextern.h" #include "fontset.h" #include "window.h" + #include "xterm.h" #ifdef FONTSET_DEBUG #undef xassert *************** *** 993,998 **** --- 994,1001 ---- int from, to; int id; Lisp_Object family, registry; + int sbyte_change = 0; /* Flag indicating that CHARACTER specifies + the `ascii' charset. */ fontset = check_fontset_name (name); *************** *** 1008,1014 **** error ("Character range should be by non-generic characters."); if (!NILP (name) && (SINGLE_BYTE_CHAR_P (from) || SINGLE_BYTE_CHAR_P (to))) ! error ("Can't change font for a single byte character"); } else if (SYMBOLP (character)) { --- 1011,1017 ---- error ("Character range should be by non-generic characters."); if (!NILP (name) && (SINGLE_BYTE_CHAR_P (from) || SINGLE_BYTE_CHAR_P (to))) ! sbyte_change = 1; } else if (SYMBOLP (character)) { *************** *** 1027,1039 **** if (!char_valid_p (from, 1)) invalid_character (from); if (SINGLE_BYTE_CHAR_P (from)) ! error ("Can't change font for a single byte character"); if (from < to) { if (!char_valid_p (to, 1)) invalid_character (to); if (SINGLE_BYTE_CHAR_P (to)) ! error ("Can't change font for a single byte character"); } if (STRINGP (fontname)) --- 1030,1042 ---- if (!char_valid_p (from, 1)) invalid_character (from); if (SINGLE_BYTE_CHAR_P (from)) ! sbyte_change = 1; if (from < to) { if (!char_valid_p (to, 1)) invalid_character (to); if (SINGLE_BYTE_CHAR_P (to)) ! sbyte_change = 1; } if (STRINGP (fontname)) *************** *** 1068,1089 **** FONTSET_SET (fontset, from, elt); Foptimize_char_table (fontset); ! /* If there's a realized fontset REALIZED whose parent is FONTSET, ! clear all the elements of REALIZED and free all multibyte faces ! whose fontset is REALIZED. This way, the specified character(s) ! are surely redisplayed by a correct font. */ ! for (id = 0; id < ASIZE (Vfontset_table); id++) ! { ! realized = AREF (Vfontset_table, id); ! if (!NILP (realized) ! && !BASE_FONTSET_P (realized) ! && EQ (FONTSET_BASE (realized), fontset)) { ! FRAME_PTR f = XFRAME (FONTSET_FRAME (realized)); ! clear_fontset_elements (realized); ! free_realized_multibyte_face (f, id); } ! } return Qnil; } --- 1071,1119 ---- FONTSET_SET (fontset, from, elt); Foptimize_char_table (fontset); ! /* Make sure that Emacs displays all faces with the correct ! font. The ascii charset needs a special treatment.*/ ! if (sbyte_change) ! { ! Lisp_Object fr_list; ! FRAME_PTR frpt; ! ! /* Check all frames whether they have FONTSET as the fontset for ! the default face. If so, make sure that Emacs changes the ! size of the frame accordingly. */ ! for (fr_list = Vframe_list; ! CONSP (fr_list); ! fr_list = XCDR (fr_list)) { ! frpt = XFRAME (XCAR (fr_list)); ! if (FONTSET_ID (fontset) == FRAME_FONTSET (frpt)) ! { ! Lisp_Object fpvalue = get_frame_param (frpt, Qfont); ! x_new_fontset_force (frpt, SDATA (fpvalue)); ! } } ! /* Make sure that the next call to init_iterator will free all ! realized faces (stolen from ! `internal-set-lisp-face-attribute'). */ ! ++face_change_count; ! ++windows_or_buffers_changed; ! } else { ! /* If there's a realized fontset REALIZED whose parent is FONTSET, ! clear all the elements of REALIZED and free all multibyte faces ! whose fontset is REALIZED. This way, the specified character(s) ! are surely redisplayed by a correct font. */ ! for (id = 0; id < ASIZE (Vfontset_table); id++) ! { ! realized = AREF (Vfontset_table, id); ! if (!NILP (realized) ! && !BASE_FONTSET_P (realized) ! && EQ (FONTSET_BASE (realized), fontset)) ! { ! FRAME_PTR f = XFRAME (FONTSET_FRAME (realized)); ! clear_fontset_elements (realized); ! free_realized_multibyte_face (f, id); ! } ! }} return Qnil; } --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=xterm.diff *** xterm.c.~1.790.~ Wed Apr 9 18:44:46 2003 --- xterm.c Thu May 1 19:30:51 2003 *************** *** 7937,7943 **** char *fontsetname; { int fontset = fs_query_fontset (build_string (fontsetname), 0); - Lisp_Object result; if (fontset < 0) return Qnil; --- 7937,7942 ---- *************** *** 7947,7957 **** to do. */ return fontset_name (fontset); ! result = x_new_font (f, (SDATA (fontset_ascii (fontset)))); if (!STRINGP (result)) /* Can't load ASCII font. */ ! return Qnil; /* Since x_new_font doesn't update any fontset information, do it now. */ f->output_data.x->fontset = fontset; --- 7946,7986 ---- to do. */ return fontset_name (fontset); ! if (x_new_fontset_internal (f, fontset) == 0) ! return build_string (fontsetname); ! else return Qnil; ! } ! ! ! /* Like x_new_fontset, but don't check wheter the fontset is already ! set in the frame. */ ! ! Lisp_Object ! x_new_fontset_force (f, fontsetname) ! struct frame *f; ! char *fontsetname; ! { ! int fontset = fs_query_fontset (build_string (fontsetname), 0); ! ! if (fontset < 0) ! return Qnil; ! ! if (x_new_fontset_internal (f, fontset) == 0) ! return build_string (fontsetname); ! else return Qnil; ! } ! ! int ! x_new_fontset_internal (f, fontset) ! struct frame *f; ! int fontset; ! { ! Lisp_Object result ! = x_new_font (f, (SDATA (fontset_ascii (fontset)))); if (!STRINGP (result)) /* Can't load ASCII font. */ ! return 1; /* Since x_new_font doesn't update any fontset information, do it now. */ f->output_data.x->fontset = fontset; *************** *** 7961,7968 **** && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) xic_set_xfontset (f, SDATA (fontset_ascii (fontset))); #endif ! ! return build_string (fontsetname); } --- 7990,7996 ---- && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) xic_set_xfontset (f, SDATA (fontset_ascii (fontset))); #endif ! return 0; } --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit -- Oliver Scholz 12 Floréal an 211 de la Révolution Taunusstr. 25 Liberté, Egalité, Fraternité! 60329 Frankfurt a. M. http://www.jungdemokratenhessen.de Tel. (069) 97 40 99 42 http://www.jdjl.org --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel --=-=-=--