From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.bugs Subject: bug#1127: Can't set default face to get the font I want Date: Tue, 14 Oct 2008 17:18:37 +0900 Message-ID: References: <87iqryl9jc.fsf@cyd.mit.edu> Reply-To: Kenichi Handa , 1127@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1223973035 2432 80.91.229.12 (14 Oct 2008 08:30:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Oct 2008 08:30:35 +0000 (UTC) Cc: 1127@emacsbugs.donarmstrong.com To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 14 10:31:31 2008 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 1KpfJN-0006rg-Ql for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Oct 2008 10:31:27 +0200 Original-Received: from localhost ([127.0.0.1]:53737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KpfIH-0002ee-Rt for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Oct 2008 04:30:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KpfID-0002dQ-Ft for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2008 04:30:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KpfIA-0002cx-Oo for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2008 04:30:12 -0400 Original-Received: from [199.232.76.173] (port=43774 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KpfIA-0002cs-L4 for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2008 04:30:10 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43409) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KpfI8-000788-Ld for bug-gnu-emacs@gnu.org; Tue, 14 Oct 2008 04:30:10 -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 m9E8TxeC022583; Tue, 14 Oct 2008 01:29:59 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m9E8P4vA021526; Tue, 14 Oct 2008 01:25:04 -0700 X-Loop: don@donarmstrong.com Resent-From: Kenichi Handa Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 14 Oct 2008 08:25:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1127 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1127-submit@emacsbugs.donarmstrong.com id=B1127.122397232620234 (code B ref 1127); Tue, 14 Oct 2008 08:25:03 +0000 Original-Received: (at 1127) by emacsbugs.donarmstrong.com; 14 Oct 2008 08:18:46 +0000 Original-Received: from mx1.aist.go.jp (mx1.aist.go.jp [150.29.246.133]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9E8IdFp020226 for <1127@emacsbugs.donarmstrong.com>; Tue, 14 Oct 2008 01:18:41 -0700 Original-Received: from rqsmtp1.aist.go.jp (rqsmtp1.aist.go.jp [150.29.254.115]) by mx1.aist.go.jp with ESMTP id m9E8IbKd007060; Tue, 14 Oct 2008 17:18:37 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp1.aist.go.jp by rqsmtp1.aist.go.jp with ESMTP id m9E8Ibxb025929; Tue, 14 Oct 2008 17:18:37 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp1.aist.go.jp with ESMTP id m9E8IbgN025973; Tue, 14 Oct 2008 17:18:37 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.69) (envelope-from ) id 1Kpf6z-00008A-As; Tue, 14 Oct 2008 17:18:37 +0900 In-reply-to: <87iqryl9jc.fsf@cyd.mit.edu> (message from Chong Yidong on Sun, 12 Oct 2008 00:30:47 -0400) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 14 Oct 2008 04:30:12 -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:21464 Archived-At: In article <87iqryl9jc.fsf@cyd.mit.edu>, Chong Yidong writes: > Hi Handa-san, > > % xrdb -remove > > % src/emacs -Q --eval '(customize-face (quote default))' > > > > I seem to be unable to select my beloved > > "-misc-fixed-medium-r-semicondensed--13-*-*-*-*-*-*-*". If I set > > family=fixed, foundry=misc, width=semicondensed, height=100, > > I get -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1; > > It appears that the "semicondensed" part is ignored. > This appears to be a problem in the font_score algorithm in font.c. The > font passed in as the argument has the `semicondensed' width property, > but the font found has `normal'. I can reproduce that problem, but I don't think it's a problem of font_score. For instance, (list-fonts (font-spec :family "fixed" :foundry "misc") nil nil (font-spec :width 'semicondensed)) correctly prefers semicondensed fonts. > I found the problem: in internal-set-lisp-face-attribute, we do the > following: > if (prop_index) > /* If a font-related attribute other than QCfont and QCfontset > is specified, and if the original QCfont attribute has a font > (font-spec or font-object), set the corresponding property in > the font to nil so that the font selector doesn't think that > the attribute is mandatory. */ > font_clear_prop (XVECTOR (lface)->contents, prop_index); > The FONT_AVGWIDTH_INDEX entry also needs to be cleared out at this time, > otherwise the font backend won't find the semicondensed font. I've > checked in a fix. It's reasonable to clear FONT_AVGWIDTH_INDEX of a font if :width is changed, but your change clears that unconditionally. I think we should install the attached change instead. Anyway, I don't think that fixes the current problem. The source of the problme I observed is this. When multiple font-related attributes of a face are customized, internal-set-lisp-face-attribute is called multiple times. For instance, when we customize family, foundry, and width (as you did), internal-set-lisp-face-attribute is called with attr :family and :width with these values in this sequence (note that my defualt font is now "dejavu sans mono"): (:family unspecified) (:width normal) (:family "dejavu sans mono") (:width semi-condensed) (:family "fixed") As "dejavu sans mono" doesn't have semi-condensed variation, the 4th call doesn't change the width, and then the 5th call changes the family to "fixed". Next, I tried this: At first customize family and foudnry only, then customize width to semi-condensed. But with the last customization of width, internal-set-lisp-face-attribute is called as this: (:family unspecified) (:width unspecified) (:width normal) (:family "dejavu sans mono") (:width semi-condensed) (:family "fixed") When the function is called to change width to semi-condensed, somehow the family was already set back to "dejavu sans mono", so, again, the font can't be changed to semi-condensed. At the moment, I don't know why internal-set-lisp-face-attribute is called in that way. --- Kenichi Handa handa@ni.aist.go.jp *** font.c.~1.87.~ 2008-10-14 13:55:27.000000000 +0900 --- font.c 2008-10-14 16:01:44.000000000 +0900 *************** *** 2996,3001 **** --- 2996,3002 ---- if (! FONTP (font)) return; if (NILP (AREF (font, prop)) + && prop != FONT_WIDTH_INDEX && prop != FONT_FAMILY_INDEX && prop != FONT_FOUNDRY_INDEX && prop != FONT_SIZE_INDEX) return; *************** *** 3018,3023 **** --- 3019,3026 ---- ASET (font, FONT_SPACING_INDEX, Qnil); ASET (font, FONT_AVGWIDTH_INDEX, Qnil); } + else if (prop == FONT_WIDTH_INDEX) + ASET (font, FONT_AVGWIDTH_INDEX, Qnil); attrs[LFACE_FONT_INDEX] = font; }