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: Sat, 03 May 2003 01:16:29 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87isstx7le.fsf@ID-87814.user.dfncis.de> References: <87he8kutns.fsf@ID-87814.user.dfncis.de> <200305010810.RAA15007@etlken.m17n.org> <87u1cezhlu.fsf@ID-87814.user.dfncis.de> <200305012353.IAA15973@etlken.m17n.org> <200305020105.KAA16075@etlken.m17n.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1051922592 7876 80.91.224.249 (3 May 2003 00:43:12 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 3 May 2003 00:43:12 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat May 03 02:43:11 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 19Bl7P-00022u-00 for ; Sat, 03 May 2003 02:43:11 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19Bl9B-0001j7-00 for ; Sat, 03 May 2003 02:45:02 +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 19Bl7z-0005Rd-03 for emacs-devel@quimby.gnus.org; Fri, 02 May 2003 20:43:47 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19Bl6N-000470-00 for emacs-devel@gnu.org; Fri, 02 May 2003 20:42:07 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19Bl6I-000459-00 for emacs-devel@gnu.org; Fri, 02 May 2003 20:42:03 -0400 Original-Received: from pop.gmx.net ([213.165.65.60] helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.10.13) id 19Bl5q-0003pA-00 for emacs-devel@gnu.org; Fri, 02 May 2003 20:41:34 -0400 Original-Received: (qmail 32092 invoked by uid 65534); 3 May 2003 00:41:31 -0000 Original-Received: from dialin-145-254-191-254.arcor-ip.net (EHLO HERMES) (145.254.191.254) by mail.gmx.net (mp009-rz3) with SMTP; 03 May 2003 02:41:31 +0200 Original-To: Kenichi Handa In-Reply-To: <200305020105.KAA16075@etlken.m17n.org> (Kenichi Handa's message of "Fri, 2 May 2003 10:05:14 +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:13638 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13638 --=-=-= Kenichi Handa writes: > In article , Oliver Scholz writes: >> I guess so. Basically that is how I discovered x_new_fontset. I >> started with Finternal_set_lisp_face_attribute and read the code until >> I found the exact spot where the frame is resized. And now you tell >> me that all this was pointless, because I could have used >> Finternal_set_lisp_face in the first place? *moan* :-) > > I should have got that idea from the start, sorry. :-( I was just kidding. It was a good opportunity to read and understand yet another part of the C code. And I had fun doing it. So my time was well applied. >> Allright, if you say that it is cleaner or easier to maintain this >> way, then I'll look at it tomorrow. > > Thank you very much. That way, I think, fontset.c can be > modularized much more, which results in the easier > maintenance. O.k. Here's the new patch. It seems that free_realized_multibyte_face is not used anymore. But it is defined in xfaces.c, so I didn't touch it. Oliver --=-=-= Content-Type: text/x-patch Content-Disposition: attachment *** fontset.c.~1.76.~ Thu Feb 20 15:13:04 2003 --- fontset.c Sat May 3 01:09:28 2003 *************** *** 939,958 **** return Qnil; } - - /* Clear all elements of FONTSET for multibyte characters. */ - - static void - clear_fontset_elements (fontset) - Lisp_Object fontset; - { - int i; - - for (i = CHAR_TABLE_SINGLE_BYTE_SLOTS; i < CHAR_TABLE_ORDINARY_SLOTS; i++) - XCHAR_TABLE (fontset)->contents[i] = Qnil; - } - - /* Check validity of NAME as a fontset name and return the corresponding fontset. If not valid, signal an error. If NAME is nil, return Vdefault_fontset. */ --- 939,944 ---- *************** *** 973,978 **** --- 959,967 ---- return FONTSET_FROM_ID (id); } + extern Lisp_Object QCfont; + extern Lisp_Object Vface_new_frame_defaults; + DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 4, 0, doc: /* Modify fontset NAME to use FONTNAME for CHARACTER. *************** *** 993,999 **** --- 982,991 ---- int from, to; int id; Lisp_Object family, registry; + Lisp_Object lf_fnt, lfaces, fontset_name; + + fontset_name = Fquery_fontset (name, Qnil); fontset = check_fontset_name (name); if (CONSP (character)) *************** *** 1006,1014 **** to = XINT (XCDR (character)); if (!char_valid_p (from, 0) || !char_valid_p (to, 0)) 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)) { --- 998,1003 ---- *************** *** 1026,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)) --- 1015,1024 ---- *************** *** 1068,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; --- 1053,1082 ---- FONTSET_SET (fontset, from, elt); Foptimize_char_table (fontset); ! /* If the fontset is already used in a face, then we need to update ! the display accordingly. ! ! This is done by calling Finternal_set_lisp_face. To find the ! faces which we need to update this way, we loop through all the ! faces declared in Vface_new_frame_alist and check each face ! whether FONTSET_NAME is specified as its fontset. Each element in ! Vface_new_frame_alist a cons cell with the symbol for the face as ! its car and an LFACE (a Lisp vector containing the face ! specification) as its cdr. */ ! ! for (lfaces = Vface_new_frame_defaults; ! CONSP (lfaces); ! lfaces = XCDR (lfaces)) ! { ! /* Set lf_fnt to the font or fontset specified for the current ! LFACE. */ ! lf_fnt = AREF (XCDR (XCAR (lfaces)), LFACE_FONT_INDEX); ! /* We call Fquery_fontset, so we are not puzzled by alias names, ! which may be used in LFACE. */ ! if (STRINGP (lf_fnt) && ! !NILP (Fequal (fontset_name, Fquery_fontset (lf_fnt, Qnil)))) ! Finternal_set_lisp_face_attribute ! ((XCAR (XCAR (lfaces))), QCfont, fontset_name, 0); } return Qnil; --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit -- Oliver Scholz 14 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 --=-=-=--