From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#29631: 25.3; Unable to use custom fontset as frame default font Date: Sun, 10 Dec 2017 19:28:04 +0200 Message-ID: <83d13mtrvf.fsf@gnu.org> References: <87shcjsi2w.fsf@ziiuu.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1512926951 5962 195.159.176.226 (10 Dec 2017 17:29:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 10 Dec 2017 17:29:11 +0000 (UTC) Cc: 29631@debbugs.gnu.org To: Thomas Morgan , Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 10 18:29:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eO5PV-0001KG-SQ for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Dec 2017 18:29:06 +0100 Original-Received: from localhost ([::1]:45404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eO5Pd-0008Rs-7A for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Dec 2017 12:29:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eO5PV-0008Mi-78 for bug-gnu-emacs@gnu.org; Sun, 10 Dec 2017 12:29:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eO5PS-0001fb-1l for bug-gnu-emacs@gnu.org; Sun, 10 Dec 2017 12:29:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46875) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eO5PR-0001fX-Ud for bug-gnu-emacs@gnu.org; Sun, 10 Dec 2017 12:29:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eO5PR-0001L6-OF for bug-gnu-emacs@gnu.org; Sun, 10 Dec 2017 12:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Dec 2017 17:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29631 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29631-submit@debbugs.gnu.org id=B29631.15129269115112 (code B ref 29631); Sun, 10 Dec 2017 17:29:01 +0000 Original-Received: (at 29631) by debbugs.gnu.org; 10 Dec 2017 17:28:31 +0000 Original-Received: from localhost ([127.0.0.1]:55555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eO5Ow-0001KO-NC for submit@debbugs.gnu.org; Sun, 10 Dec 2017 12:28:31 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eO5Ou-0001KB-E5 for 29631@debbugs.gnu.org; Sun, 10 Dec 2017 12:28:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eO5Om-00017F-31 for 29631@debbugs.gnu.org; Sun, 10 Dec 2017 12:28:23 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eO5Ok-00015V-5r; Sun, 10 Dec 2017 12:28:18 -0500 Original-Received: from [176.228.60.248] (port=2327 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eO5Oj-0000Ln-Ei; Sun, 10 Dec 2017 12:28:17 -0500 In-reply-to: <87shcjsi2w.fsf@ziiuu.com> (message from Thomas Morgan on Sat, 09 Dec 2017 16:32:39 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140905 Archived-At: > From: Thomas Morgan > Date: Sat, 09 Dec 2017 16:32:39 -0500 > > I started Emacs with `emacs -Q', entered the following expression > in *scratch*, and evaluated it with C-M-x: > > (progn > ;; Create a new fontset called fontset-liberation. > (create-fontset-from-fontset-spec > "-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation") > > ;; Set its primary font to Liberation Mono. > (set-fontset-font "fontset-liberation" 'unicode-bmp "Liberation Mono") > > ;; Add a fallback to Freemono for characters that Liberation Mono lacks. > (set-fontset-font "fontset-liberation" 'unicode-bmp "Freemono:size=40" > nil 'append) > > ;; Set the frame's default font to the new fontset. > > (set-face-font 'default "fontset-liberation") > > ;; Return font objects for "a", an ASCII character that Liberation Mono has, > ;; and "ȷ" (LATIN SMALL LETTER DOTLESS J), a character in Freemono but > ;; not in Liberation Mono. > (list (font-at 0 nil "a") (font-at 0 nil "ȷ"))) > > The result was this: > > (# > #) > > The font for ASCII character "a" was Liberation Mono as expected, but > I expected the second font to be Freemono and it was Liberation Serif. > > I checked which fontset is being used as default: > > (face-attribute 'default :fontset) > > It's fontset-auto1, not fontset-liberation: > > "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-fontset-auto1" > > I typed `M-x describe-fontset RET fontset-auto1 RET'. > > Fontset: -1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-fontset-auto1 > CHAR RANGE (CODE RANGE) > FONT NAME (REQUESTED and [OPENED]) > C-@ .. Ÿ (#x43 .. #x9F) > -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1 >   .. ɏ (#xA0 .. #x24F) > -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1 > [-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1] > [-1ASC-Liberation Serif-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1] > ɐ .. [#x3FFF7F] (#x250 .. #x3FFF7F) > -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1 > [\200] .. [\377] (#x3FFF80 .. #x3FFFFF) > -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1 > > ------ > [...] > > (Non-UTF8 characters are replaced with representations in brackets.) > > So fontset-auto1 includes Liberation Serif but not Freemono. > fontset-auto1 seems to be generated from fontset-liberation's primary > font without regard for its fallback fonts. > > To test whether changing the fallback font in fontset-auto1 has > an effect, I restarted Emacs with `emacs -Q' and evaluated the > following expression, which modifies fontset-auto1 instead of > fontset-liberation. > > (progn > ;; Create a new fontset called fontset-liberation. > (create-fontset-from-fontset-spec > "-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation") > > ;; Set the frame's default font to the new fontset. > (set-face-font 'default "fontset-liberation") > > ;; Set the frame's primary font to Liberation Mono. > (set-fontset-font "fontset-auto1" 'unicode-bmp "Liberation Mono") > > ;; Add a fallback to Freemono for characters that Liberation Mono lacks. > (set-fontset-font "fontset-auto1" 'unicode-bmp "Freemono:size=40" > nil 'append) > > ;; Return font objects for "a", an ASCII character that Liberation Mono has, > ;; and "ȷ" (LATIN SMALL LETTER DOTLESS J), a character in Freemono but > ;; not in Liberation Mono. > (list (font-at 0 nil "a") (font-at 0 nil "ȷ"))) > > This changed the font for the non-ASCII character to Freemono > and returned what I expected: > > (# > #) > > (Incidentally, evaluating the above progn without restarting Emacs > causes a core dump, but I have a smaller test case for that and I'll > make another report about it.) > > It looks as if fontset-auto1 is generated by fontset_from_font > in fontset.c, but I don't understand why the specified fontset > (fontset-liberation) is not used and I haven't been able to find > anything in the manual that clarifies this behavior. I'd like > to know how to use a custom fontset for a frame's default face > (and for other faces), but if that's not supported, this may be > a documentation bug. CC'ing Handa-san in the hope that he could provide some insights.