From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#2667: Still seeing inconsistent fonts Date: Wed, 20 May 2009 15:43:00 -0400 Message-ID: References: <87zldo8dnb.fsf@cyd.mit.edu> Reply-To: Stefan Monnier , 2667@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1242849144 7626 80.91.229.12 (20 May 2009 19:52:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 May 2009 19:52:24 +0000 (UTC) Cc: cyd@stupidchicken.com, 2667@emacsbugs.donarmstrong.com To: Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 20 21:52:17 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M6rpk-0000Df-EK for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 May 2009 21:52:12 +0200 Original-Received: from localhost ([127.0.0.1]:44885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M6rpj-00044R-I8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 May 2009 15:52:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M6rpe-000446-MM for bug-gnu-emacs@gnu.org; Wed, 20 May 2009 15:52:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M6rpa-00043m-CI for bug-gnu-emacs@gnu.org; Wed, 20 May 2009 15:52:06 -0400 Original-Received: from [199.232.76.173] (port=58889 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M6rpa-00043j-4k for bug-gnu-emacs@gnu.org; Wed, 20 May 2009 15:52:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:42431) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M6rpZ-0001kF-F7 for bug-gnu-emacs@gnu.org; Wed, 20 May 2009 15:52:01 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4KJpv32022439; Wed, 20 May 2009 12:51:57 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n4KJo6f0021219; Wed, 20 May 2009 12:50:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 20 May 2009 19:50:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 2667 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 2667-submit@emacsbugs.donarmstrong.com id=B2667.124284858719451 (code B ref 2667); Wed, 20 May 2009 19:50:06 +0000 Original-Received: (at 2667) by emacsbugs.donarmstrong.com; 20 May 2009 19:43:07 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from pruche.dit.umontreal.ca (pruche.dit.umontreal.ca [132.204.246.22]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4KJh1aX019439 for <2667@emacsbugs.donarmstrong.com>; Wed, 20 May 2009 12:43:03 -0700 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n4KJh2LY000630; Wed, 20 May 2009 15:43:02 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 29BFB3A183; Wed, 20 May 2009 15:43:00 -0400 (EDT) In-Reply-To: (Kenichi Handa's message of "Mon, 11 May 2009 21:21:45 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.93 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3279=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Wed, 20 May 2009 15:52:06 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:28052 Archived-At: > =E2=88=80 belongs to `symbol' script, but the xfont backend didn't > support :script font property. That is because I was afraid > that it made the font listing extremely slow (we must open > all iso10646-1 fonts to check if it supports the requested > characters). Actually my trial implementation of :script > property supports took more than 1 minute to display HELLO > file. 1 minute would be a problem, indeed. > But, if we can use this heuristic: > X fonts that have the same property values except for > size related properties supports the same set of > characters on all display. For example, all these fonts=20 > -adobe-courier-medium-r-normal--8-80-75-75-m-50-iso10646-1 > -adobe-courier-medium-r-normal--10-100-75-75-m-60-iso10646-1 > -adobe-courier-medium-r-normal--11-80-100-100-m-60-iso10646-1 > -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso10646-1 > -adobe-courier-medium-r-normal--14-100-100-100-m-90-iso10646-1 > -adobe-courier-medium-r-normal--14-140-75-75-m-90-iso10646-1 > -adobe-courier-medium-r-normal--17-120-100-100-m-100-iso10646-1 > -adobe-courier-medium-r-normal--18-180-75-75-m-110-iso10646-1 > -adobe-courier-medium-r-normal--20-140-100-100-m-110-iso10646-1 > -adobe-courier-medium-r-normal--24-240-75-75-m-150-iso10646-1 > -adobe-courier-medium-r-normal--25-180-100-100-m-150-iso10646-1 > -adobe-courier-medium-r-normal--34-240-100-100-m-200-iso10646-1 > suports the same set of characters. That assumption is obviously not guaranteed to hold, and I don't think it really holds in practice, but it looks like an acceptable tradeoff, since the cases where it doesn't hold shouldn't be too frequent. > we can list fonts in a realistic time. Attached is the > patch to try it. Could you please test it? As the change > is not simple, I have not yet installed it. I tried it on my smallest machine, and it seems fast enough: C-h h takes approximately the same amount of time with it than it did under Emacs-22.3 (around 3s to 4s). [ And this even though the Emacs-22.3 I used was built with -O2 and such, whereas my Emacs-CVS is built with -O1, USE_LISP_UNION_TYPE, ENABLE_CHECKING, and a few additional runtime tests. ] The machines I used to test it were all running Debian testing, with a fairly standard set of fonts. I don't know how it would behave for people with many more fonts installed (most of which would presumably be scalable and hence wouldn't be affected by the heuristic). > -static Lisp_Object xfont_list_pattern P_ ((Lisp_Object, Display *, char = *)); > +static int xfont_chars_supported P_ ((Lisp_Object, XFontStruct *, > + struct charset *, struct charset *)); Please just use ANSI-style declarations rather than K&R in new code. > + /* Two special cases to avoid opening rather big fonts. */ > + if (AREF (props, 2), Qja) > + return Fcons (intern ("kana"), Fcons (intern ("han"), Qnil)); > + if (AREF (props, 2), Qko) > + return Fcons (intern ("hangul"), Qnil); You need EQ (..) around those two tests. > + if (NILP (val)) > + script =3D Qnil; > + else > + script =3D XCDR (val); Aka: script =3D CDR (val); > + if (! repertory && NILP (xfont_scripts_cache)) > + { > + Lisp_Object args[2]; > + > + args[0] =3D QCtest; > + args[1] =3D Qequal; > + xfont_scripts_cache =3D Fmake_hash_table (2, args); > + } [...] > @@ -996,6 +1173,8 @@ > void > syms_of_xfont () > { > + staticpro (&xfont_scripts_cache); > + xfont_scripts_cache =3D Qnil; > xfont_driver.type =3D Qx; > register_font_driver (&xfont_driver, NULL); > } Why not just: @@ -996,6 +1173,8 @@ void syms_of_xfont () { + staticpro (&xfont_scripts_cache); + { + Lisp_Object args[2]; + args[0] =3D QCtest; + args[1] =3D Qequal; + xfont_scripts_cache =3D Fmake_hash_table (2, args); + } xfont_driver.type =3D Qx; register_font_driver (&xfont_driver, NULL); } Stefan