Subject: bug#29630: 25.3; Unable to change fontset using :family face attribute

From: handa <[email-masked]>
Date: Wed, 27 Dec 2017 21:33:04 +0900

In article <[email-masked]>, Thomas Morgan <[email-masked]> 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
[email-masked]