From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Fontset problem Date: Thu, 26 Sep 2002 17:10:34 +0900 (JST) Sender: emacs-devel-admin@gnu.org Message-ID: <200209260810.RAA12662@etlken.m17n.org> References: <200209061301.WAA16358@etlken.m17n.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1033027976 14295 127.0.0.1 (26 Sep 2002 08:12:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 26 Sep 2002 08:12:56 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17uTlW-0003iJ-00 for ; Thu, 26 Sep 2002 10:12: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 17uUTA-0004PT-00 for ; Thu, 26 Sep 2002 10:58: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) id 17uTlc-00028D-00; Thu, 26 Sep 2002 04:13:00 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17uTjb-0001lk-00 for emacs-devel@gnu.org; Thu, 26 Sep 2002 04:10:55 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17uTjY-0001lI-00 for emacs-devel@gnu.org; Thu, 26 Sep 2002 04:10:54 -0400 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17uTjW-0001fh-00 for emacs-devel@gnu.org; Thu, 26 Sep 2002 04:10:51 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2]) by tsukuba.m17n.org (8.11.6/3.7W-20010518204228) with ESMTP id g8Q8AZF19901; Thu, 26 Sep 2002 17:10:35 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.3/3.7W-20010823150639) with ESMTP id g8Q8AYd08021; Thu, 26 Sep 2002 17:10:34 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id RAA12662; Thu, 26 Sep 2002 17:10:34 +0900 (JST) Original-To: schwab@suse.de In-reply-to: (message from Andreas Schwab on Fri, 06 Sep 2002 15:43:56 +0200) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.1.30 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:8174 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:8174 Sorry for the late response. In article , Andreas Schwab writes: > Kenichi Handa writes: > |> So, please try this: > |> > |> Emacs.Fontset-0: -*-courier-medium-r-normal--*-140-*-*-*-*-fontset-startup,\ > |> mule-unicode-2500-33ff:-*-fixed-*-*-*-*-*-*-*-*-*-*-iso10646-1,\ > |> mule-unicode-e000-ffff:-*-fixed-*-*-*-*-*-*-*-*-*-*-iso10646-1,\ > |> mule-unicode-0100-24ff:-*-fixed-*-*-*-*-*-*-*-*-*-*-iso10646-1 > That does not work either, now Emacs is using courier instead of fixed for > the mule-unicode charsets. Ah, I see. You actually have courier iso10646-1 fonts. Hmmm, currently, Emacs tries at first the family specified by face, and if you have that font, Emacs uses it. Perhaps, for finding a font or non-ASCII, non-Latin-1 chars, Emacs should prefer the family specified in the fontset to the family specified in the face. I've just installed this change. Please try it. At least it works for me with the above resource on the machine that has courier iso10646-1 fonts. Other people please check if it doesn't break your font/fontset setting. Font selection routine is one of very delicate parts. --- Ken'ichi HANDA handa@m17n.org 2002-09-26 Kenichi Handa * xfaces.c (try_font_list): New arg PREFER_FACE_FAMILY. If it is nonzero, try face's family at first. Otherwise try FAMILY at first. (choose_face_font): If C is a single byte char or latin-1, call try_font_list with PREFER_FACE_FAMILY 1. Index: xfaces.c =================================================================== RCS file: /cvs/emacs/src/xfaces.c,v retrieving revision 1.262 retrieving revision 1.263 diff -u -c -r1.262 -r1.263 cvs server: conflicting specifications of output style *** xfaces.c 13 Sep 2002 19:35:08 -0000 1.262 --- xfaces.c 26 Sep 2002 08:03:52 -0000 1.263 *************** *** 510,516 **** static int font_list P_ ((struct frame *, Lisp_Object, Lisp_Object, Lisp_Object, struct font_name **)); static int try_font_list P_ ((struct frame *, Lisp_Object *, ! Lisp_Object, Lisp_Object, struct font_name **)); static int try_alternative_families P_ ((struct frame *f, Lisp_Object, Lisp_Object, struct font_name **)); static int cmp_font_names P_ ((const void *, const void *)); --- 510,517 ---- static int font_list P_ ((struct frame *, Lisp_Object, Lisp_Object, Lisp_Object, struct font_name **)); static int try_font_list P_ ((struct frame *, Lisp_Object *, ! Lisp_Object, Lisp_Object, struct font_name **, ! int)); static int try_alternative_families P_ ((struct frame *f, Lisp_Object, Lisp_Object, struct font_name **)); static int cmp_font_names P_ ((const void *, const void *)); *************** *** 6324,6344 **** match. A value of nil means include fonts of any registry and encoding. Return in *FONTS a pointer to a vector of font_name structures for the fonts matched. Value is the number of fonts found. */ static int ! try_font_list (f, attrs, family, registry, fonts) struct frame *f; Lisp_Object *attrs; Lisp_Object family, registry; struct font_name **fonts; { int nfonts = 0; Lisp_Object face_family = attrs[LFACE_FAMILY_INDEX]; ! if (STRINGP (face_family)) ! nfonts = try_alternative_families (f, face_family, registry, fonts); #ifdef MAC_OS /* When realizing the default face and a font spec does not matched --- 6325,6352 ---- match. A value of nil means include fonts of any registry and encoding. + If PREFER_FACE_FAMILY is nonzero, perfer face's family to FAMILY. + Otherwise, prefer FAMILY. + Return in *FONTS a pointer to a vector of font_name structures for the fonts matched. Value is the number of fonts found. */ static int ! try_font_list (f, attrs, family, registry, fonts, prefer_face_family) struct frame *f; Lisp_Object *attrs; Lisp_Object family, registry; struct font_name **fonts; + int prefer_face_family; { int nfonts = 0; Lisp_Object face_family = attrs[LFACE_FAMILY_INDEX]; + Lisp_Object try_family; + + try_family = prefer_face_family ? face_family : family; ! if (STRINGP (try_family)) ! nfonts = try_alternative_families (f, try_family, registry, fonts); #ifdef MAC_OS /* When realizing the default face and a font spec does not matched *************** *** 6346,6357 **** default font. On the Mac, this is mac-roman, which does not work if the family is -etl-fixed, e.g. The following widens the choices and fixes that problem. */ ! if (nfonts == 0 && STRINGP (face_family) && STRINGP (registry) && xstricmp (SDATA (registry), "mac-roman") == 0) ! nfonts = try_alternative_families (f, face_family, Qnil, fonts); #endif ! if (nfonts == 0 && !NILP (family)) nfonts = try_alternative_families (f, family, registry, fonts); /* Try font family of the default face or "fixed". */ --- 6354,6368 ---- default font. On the Mac, this is mac-roman, which does not work if the family is -etl-fixed, e.g. The following widens the choices and fixes that problem. */ ! if (nfonts == 0 && STRINGP (try_family) && STRINGP (registry) && xstricmp (SDATA (registry), "mac-roman") == 0) ! nfonts = try_alternative_families (f, try_family, Qnil, fonts); #endif ! if (! prefer_face_family) ! family = face_family; ! ! if (nfonts == 0 && STRINGP (family)) nfonts = try_alternative_families (f, family, registry, fonts); /* Try font family of the default face or "fixed". */ *************** *** 6425,6431 **** /* Get a list of fonts matching that pattern and choose the best match for the specified face attributes from it. */ ! nfonts = try_font_list (f, attrs, XCAR (pattern), XCDR (pattern), &fonts); width_ratio = (SINGLE_BYTE_CHAR_P (c) ? 1 : CHARSET_WIDTH (CHAR_CHARSET (c))); --- 6436,6444 ---- /* Get a list of fonts matching that pattern and choose the best match for the specified face attributes from it. */ ! nfonts = try_font_list (f, attrs, XCAR (pattern), XCDR (pattern), &fonts, ! (SINGLE_BYTE_CHAR_P (c) ! || CHAR_CHARSET (c) == charset_latin_iso8859_1)); width_ratio = (SINGLE_BYTE_CHAR_P (c) ? 1 : CHARSET_WIDTH (CHAR_CHARSET (c)));