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: `set-fontset-font' and ascii characters Date: Sun, 27 Apr 2003 12:22:15 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87he8kutns.fsf@ID-87814.user.dfncis.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1051439291 8579 80.91.224.249 (27 Apr 2003 10:28:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 27 Apr 2003 10:28:11 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Apr 27 12:28:07 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 199jOB-0002E9-00 for ; Sun, 27 Apr 2003 12:28:07 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 199jVo-0004ue-00 for ; Sun, 27 Apr 2003 12:36:00 +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 199jNb-00079l-00 for emacs-devel@quimby.gnus.org; Sun, 27 Apr 2003 06:27:31 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 199jN0-00070V-00 for emacs-devel@gnu.org; Sun, 27 Apr 2003 06:26:54 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 199jMn-0006Rq-00 for emacs-devel@gnu.org; Sun, 27 Apr 2003 06:26:44 -0400 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 199jMk-0006Fq-00 for emacs-devel@gnu.org; Sun, 27 Apr 2003 06:26:38 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 199jLg-00026P-00 for ; Sun, 27 Apr 2003 12:25:32 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 199jLf-00026G-00 for ; Sun, 27 Apr 2003 12:25:31 +0200 Original-Lines: 127 Original-X-Complaints-To: usenet@main.gmane.org 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) Cancel-Lock: sha1:K9DLOfcU3IbOYZxAF1baP7f7pP0= 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:13490 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13490 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. Oliver *** fontset.c.~1.73.~ Fri Jan 17 09:10:00 2003 --- fontset.c Sun Apr 27 12:05:48 2003 *************** *** 992,997 **** --- 992,999 ---- 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); *************** *** 1007,1013 **** 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)) { --- 1009,1015 ---- 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)) { *************** *** 1026,1038 **** 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)) --- 1028,1040 ---- 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)) *************** *** 1067,1088 **** 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; } --- 1069,1100 ---- FONTSET_SET (fontset, from, elt); Foptimize_char_table (fontset); ! if (sbyte_change) ! { ! /* The ascii charset needs a special treatment in order to make ! sure that it is redisplayed in the correct font. The ! following (stolen from `internal-set-lisp-face-attribute') ! makes sure that the next call to init_iterator will free all ! realized faces. */ ! ++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; } -- 8 Floréal an 211 de la Révolution Liberté, Egalité, Fraternité!