Package: emacs;
Reported by: Thomas Morgan <tlm <at> ziiuu.com>
Date: Sat, 9 Dec 2017 21:41:01 UTC
Severity: normal
Found in version 25.3
To reply to this bug, email your comments to 29630 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#29630
; Package emacs
.
(Sat, 09 Dec 2017 21:41:02 GMT) Full text and rfc822 format available.Thomas Morgan <tlm <at> ziiuu.com>
:bug-gnu-emacs <at> gnu.org
.
(Sat, 09 Dec 2017 21:41:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Thomas Morgan <tlm <at> ziiuu.com> To: bug-gnu-emacs <at> gnu.org Subject: 25.3; Unable to change fontset using :family face attribute Date: Sat, 09 Dec 2017 16:26:48 -0500
I started Emacs with `emacs -Q' and created a new fontset by entering the following expression in *scratch* and evaluating it with C-M-x. (create-fontset-from-fontset-spec "-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation") I wanted to use this as the default font for the frame so I checked the Emacs Lisp manual. Section 37.12.1, Face Attributes, explains the :family attribute: Font family or fontset (a string). See (emacs)Fonts, for more information about font families. The function `font-family-list' (see below) returns a list of available family names. See (elisp)Fontsets, for information about fontsets. According to this, a string representing a fontset can be used as the value of the :family attribute. I tried using the fontset alias "fontset-liberation" by evaluating the following expression in *scratch* as above. (progn (set-face-attribute 'default nil :family "fontset-liberation") (font-at 0 nil "a")) This changed the frame's font to something other than Liberation Mono and returned: #<font-object "-CYRE-Podkova-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1"> I expected it to be Liberation Mono. I thought perhaps the problem was that I used the fontset alias rather than the fontset name, so I tried the fontset name instead: (progn (set-face-attribute 'default nil :family "-*-liberation mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation") (font-at 0 nil "a")) This signaled an error: "Invalid face foundry". I checked the manual again and read the sections linked to from the quote above: (emacs)Fonts and (elisp)Fontsets. They don't seem to explain how to specify a fontset with the :family face attribute. The documentation for the :font attribute doesn't say that it can be a fontset. But (elisp)Font and Color Parameters says the `font' frame parameter can be the name of a fontset and the frame parameter is "equivalent to the `font' attribute of the `default' face". So one can infer that the :font attribute of a face can be a fontset name. I tested this: (progn (set-face-attribute 'default nil :font "-*-liberation mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation") (font-at 0 nil "a")) This changes the font to Liberation Mono as expected: #<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"> I also tried equivalent expressions with set-face-font and using the fontset alias, all of which succeeded. The font is correct but the fontset is actually fontset-auto1, not fontset-liberation. I'll make another report about that. I think the documentation for the :family attribute should be changed to explain how to refer to a fontset if it's possible to do that. If it's not possible to specify a fontset with the :family attribute, the text about fontsets should be removed. Here is information from report-emacs-bug: In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-11-05 built on localhost Windowing system distributor 'The X.Org Foundation', version 11.0.11905000 Configured using: 'configure --disable-dependency-tracking --prefix=/nix/store/7px74nmmy9wnl594jsk0lcgz1ygsbwfj-emacs-25.3 --with-modules --with-x-toolkit=gtk3 --with-xft' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES Important settings: value of $LC_ALL: en_US.utf8 value of $LC_COLLATE: C value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set "-*-liberation mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation" Mark set #<font-object "-CYRE-Podkova-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1"> Mark set Entering debugger... Back to top level Mark set #<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"> Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu cl-loaddefs pcase cl-lib debug time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 100076 5220) (symbols 48 21018 0) (miscs 40 3069 127) (strings 32 18822 4645) (string-bytes 1 764635) (vectors 16 15076) (vector-slots 8 511125 5409) (floats 8 167 42) (intervals 56 249 0) (buffers 976 18))
bug-gnu-emacs <at> gnu.org
:bug#29630
; Package emacs
.
(Sun, 10 Dec 2017 17:25:02 GMT) Full text and rfc822 format available.Message #8 received at 29630 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Thomas Morgan <tlm <at> ziiuu.com>, Kenichi Handa <handa <at> gnu.org> Cc: 29630 <at> debbugs.gnu.org Subject: Re: bug#29630: 25.3; Unable to change fontset using :family face attribute Date: Sun, 10 Dec 2017 19:24:26 +0200
> From: Thomas Morgan <tlm <at> ziiuu.com> > Date: Sat, 09 Dec 2017 16:26:48 -0500 > > The documentation for the :font attribute doesn't say that it can > be a fontset. But (elisp)Font and Color Parameters says the `font' > frame parameter can be the name of a fontset and the frame parameter > is "equivalent to the `font' attribute of the `default' face". So > one can infer that the :font attribute of a face can be a fontset > name. I tested this: > > (progn > (set-face-attribute 'default nil :font > "-*-liberation mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation") > (font-at 0 nil "a")) > > This changes the font to Liberation Mono as expected: > > #<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"> > > I also tried equivalent expressions with set-face-font and > using the fontset alias, all of which succeeded. > > The font is correct but the fontset is actually fontset-auto1, > not fontset-liberation. I'll make another report about that. > > I think the documentation for the :family attribute should be > changed to explain how to refer to a fontset if it's possible > to do that. If it's not possible to specify a fontset with the > :family attribute, the text about fontsets should be removed. Thanks, I've updated the documentation to match what the code does. I'm CC'ing Handa-san, who might know more about this, and maybe explain how to fix the code to accept fontsets as value of :family. Currently, it doesn't seem to work, and I don't know enough about this to figure out whether it ever did or was supposed to. This whole area of Emacs is awfully under-documented.
bug-gnu-emacs <at> gnu.org
:bug#29630
; Package emacs
.
(Thu, 21 Dec 2017 15:21:02 GMT) Full text and rfc822 format available.Message #11 received at 29630 <at> debbugs.gnu.org (full text, mbox):
From: handa <handa <at> gnu.org> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 29630 <at> debbugs.gnu.org, tlm <at> ziiuu.com Subject: Re: bug#29630: 25.3; Unable to change fontset using :family face attribute Date: Fri, 22 Dec 2017 00:19:16 +0900
> > From: Thomas Morgan <tlm <at> ziiuu.com> > > Date: Sat, 09 Dec 2017 16:26:48 -0500 > > > > The documentation for the :font attribute doesn't say that it can > > be a fontset. But (elisp)Font and Color Parameters says the `font' > > frame parameter can be the name of a fontset and the frame parameter > > is "equivalent to the `font' attribute of the `default' face". So > > one can infer that the :font attribute of a face can be a fontset > > name. I tested this: > > > > (progn > > (set-face-attribute 'default nil :font > > "-*-liberation mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation") > > (font-at 0 nil "a")) > > > > This changes the font to Liberation Mono as expected: > > > > #<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"> > > > > I also tried equivalent expressions with set-face-font and > > using the fontset alias, all of which succeeded. > > > > The font is correct but the fontset is actually fontset-auto1, > > not fontset-liberation. Here, fontset works as just a provider of font-related properties (family, weight, size, etc), and then, based on the selected font, a new fontset is automatically created. This roundabout behavior was not to break (Emacs-internal) backward compatibility by introducing the concept of fontset. At least, calling set-fontset-font for the fontset of the current frame should work... and worked as far as I rememnber... but I've just found that this does not work with the latest Emacs?!? (set-fontset-font nil 'unicode-bmp "dejavu sans mono") (set-fontset-font nil 'unicode-bmp "Freemono" nil 'append) I'm now checking what is wrong. --- K. Handa handa <at> gnu.org
bug-gnu-emacs <at> gnu.org
:bug#29630
; Package emacs
.
(Sun, 24 Dec 2017 05:26:01 GMT) Full text and rfc822 format available.Message #14 received at 29630 <at> debbugs.gnu.org (full text, mbox):
From: Thomas Morgan <tlm <at> ziiuu.com> To: handa <handa <at> gnu.org> Cc: 29630 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org> Subject: Re: bug#29630: 25.3; Unable to change fontset using :family face attribute Date: Sat, 23 Dec 2017 21:25:22 -0800
handa <handa <at> gnu.org> writes: > Here, fontset works as just a provider of font-related properties > (family, weight, size, etc), and then, based on the selected font, a new > fontset is automatically created. This roundabout behavior was not to > break (Emacs-internal) backward compatibility by introducing the concept > of fontset. Thank you, Handa-san. (elisp)Face Attributes says this: `:font' [...] If you specify a string, the contents of the string should be a font name (*note (emacs)Fonts::); if the font name is an XLFD containing wildcards, Emacs chooses the first font matching those wildcards. [...] Would it make sense to add the following after the quoted sentence? You may also specify a fontset name as a string. For reasons of backward compatibility, in the case of the `default' face this may automatically generate a new fontset based on the family, weight, size, and other font-related properties of the specified fontset. It would probably also be helpful to document the :fontset attribute in the manual, if that's the proper way to specify a fontset for the the frame's default face. > At least, calling set-fontset-font for the fontset of the current frame > should work... and worked as far as I rememnber... but I've just found > that this does not work with the latest Emacs?!? > > (set-fontset-font nil 'unicode-bmp "dejavu sans mono") > (set-fontset-font nil 'unicode-bmp "Freemono" nil 'append) > > I'm now checking what is wrong. This seems to work for me with Emacs 25.3.1. To test it I started Emacs with `emacs -Q' and evaluated this in *scratch*: (progn (set-fontset-font nil 'unicode-bmp "DejaVu Sans Mono") (set-fontset-font nil 'unicode-bmp "FreeMono" nil 'append) (list (font-at 0 nil "G") (font-at 0 nil "⅁"))) (The second character is TURNED SANS-SERIF CAPITAL G, which is covered by FreeMono but not by DejaVu Sans Mono.) As expected, this was displayed in the echo area: (#<font-object "-PfEd-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"> #<font-object "-GNU -FreeMono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1">)
bug-gnu-emacs <at> gnu.org
:bug#29630
; Package emacs
.
(Wed, 27 Dec 2017 12:34:01 GMT) Full text and rfc822 format available.Message #17 received at 29630 <at> debbugs.gnu.org (full text, mbox):
From: handa <handa <at> gnu.org> To: Thomas Morgan <tlm <at> ziiuu.com> Cc: 29630 <at> debbugs.gnu.org, eliz <at> gnu.org Subject: Re: bug#29630: 25.3; Unable to change fontset using :family face attribute Date: Wed, 27 Dec 2017 21:33:04 +0900
In article <87zi68elz1.fsf <at> ziiuu.com>, Thomas Morgan <tlm <at> ziiuu.com> writes: > `:font' > [...] If you specify a string, the contents of the string should > be a font name (*note (emacs)Fonts::); if the font name is an XLFD > containing wildcards, Emacs chooses the first font matching those > wildcards. [...] > Would it make sense to add the following after the quoted sentence? > You may also specify a fontset name as a string. For reasons of > backward compatibility, in the case of the `default' face this may > automatically generate a new fontset based on the family, weight, > size, and other font-related properties of the specified fontset. The generation of a new fontset happens every time you change a font of the default face; not only when you specify a fontset for :font. So, here, as an explanation of :font, I think what we have to say is that specifying a fontset name is the same as specifying a font that the fontset defines for ASCII. For instance, Even if yoy create a fontset as this name: (create-fontset-from-fontset-spec "-*-dejavu sans mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-dejavu") when you do: (set-fontset-font "fontset-dejavu" 'unicode-bmp (font-spec :family "Freemono")) giving "fontset-dejavu" to :font is the same as giving (font-spec :family "Freemono"). > It would probably also be helpful to document the :fontset attribute > in the manual, if that's the proper way to specify a fontset for the > the frame's default face. I don't remember how :fontset attribute works here, sorry. :-( I tried: (set-face-attribute 'default nil :fontset "fontset-dejavu") but it seems that it has no effect?!? On the other hand, (modify-frame-parameters nil '((font . "fontset-dejavu"))) works. > > At least, calling set-fontset-font for the fontset of the current frame > > should work... and worked as far as I rememnber... but I've just found > > that this does not work with the latest Emacs?!? > > > > (set-fontset-font nil 'unicode-bmp "dejavu sans mono") > > (set-fontset-font nil 'unicode-bmp "Freemono" nil 'append) > > > > I'm now checking what is wrong. That was my misunderstanding, sorry. I have two versions of freemono fonts, ttf and otf, and Emacs (or fontconfig) found otf version, but I was expecting ttf version that has more glyphs. --- K. Handa handa <at> gnu.org
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.