* bug#29630: 25.3; Unable to change fontset using :family face attribute
@ 2017-12-09 21:26 Thomas Morgan
2017-12-10 17:24 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Morgan @ 2017-12-09 21:26 UTC (permalink / raw
To: 29630
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))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#29630: 25.3; Unable to change fontset using :family face attribute
2017-12-09 21:26 bug#29630: 25.3; Unable to change fontset using :family face attribute Thomas Morgan
@ 2017-12-10 17:24 ` Eli Zaretskii
2017-12-21 15:19 ` handa
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2017-12-10 17:24 UTC (permalink / raw
To: Thomas Morgan, Kenichi Handa; +Cc: 29630
> From: Thomas Morgan <tlm@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#29630: 25.3; Unable to change fontset using :family face attribute
2017-12-10 17:24 ` Eli Zaretskii
@ 2017-12-21 15:19 ` handa
2017-12-24 5:25 ` Thomas Morgan
0 siblings, 1 reply; 5+ messages in thread
From: handa @ 2017-12-21 15:19 UTC (permalink / raw
To: Eli Zaretskii; +Cc: 29630, tlm
> > From: Thomas Morgan <tlm@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@gnu.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#29630: 25.3; Unable to change fontset using :family face attribute
2017-12-21 15:19 ` handa
@ 2017-12-24 5:25 ` Thomas Morgan
2017-12-27 12:33 ` handa
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Morgan @ 2017-12-24 5:25 UTC (permalink / raw
To: handa; +Cc: 29630
handa <handa@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">)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#29630: 25.3; Unable to change fontset using :family face attribute
2017-12-24 5:25 ` Thomas Morgan
@ 2017-12-27 12:33 ` handa
0 siblings, 0 replies; 5+ messages in thread
From: handa @ 2017-12-27 12:33 UTC (permalink / raw
To: Thomas Morgan; +Cc: 29630
In article <87zi68elz1.fsf@ziiuu.com>, Thomas Morgan <tlm@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@gnu.org
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-12-27 12:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-09 21:26 bug#29630: 25.3; Unable to change fontset using :family face attribute Thomas Morgan
2017-12-10 17:24 ` Eli Zaretskii
2017-12-21 15:19 ` handa
2017-12-24 5:25 ` Thomas Morgan
2017-12-27 12:33 ` handa
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.