Subject: Re: bug#33019: 26.1; can not set fontset as frame font by set-frame-font

From: Eli Zaretskii <[email-masked]>
Date: Mon, 21 Feb 2022 17:24:25 +0200

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Mon, 21 Feb 2022 15:57:10 +0100
> 
> > Evaluating the form below, five U+4E00s are inserted with same glyphs.
> > C-u C-x = on each character shows the same information.
> >
> >>              display: by this font (glyph code)
> >>    uniscribe:-outline-Noto Sans CJK JP
> >> Regular-normal-normal-normal-sans-17-*-*-*-p-*-iso8859-1 (#x2667)
> >
> > (let ((prefix "-outline-Noto Serif CJK JP-normal-normal-normal-serif-*-*-*-*-p-*-"))
> >   (set-frame-font "Noto Mono")
> >   (set-fontset-font "fontset-default" '(#x4E00 . #x9FFF)
> >                     "Noto Sans CJK JP Regular")
> >   (insert "\x4E00"
> >           (propertize "\x4E00" 'face '(:family "Noto Serif CJK JP"))
> >           (propertize "\x4E00" 'face '(:font "Noto Serif CJK JP"))
> >           (propertize "\x4E00" 'face (list :font (concat prefix "iso10646-1")))
> >           (propertize "\x4E00" 'face (list :font (concat prefix "jisx0208-sjis")))
> >           ))
> 
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
> 
> Trying this in Emacs 29, I get a different font on the second char:

The OP uses MS-Windows.

This bug report is complicated by 2 factors:

  . specifying a font for a face actually affects directly only the
    ASCII characters; non-ASCII will not necessarily use that font if
    the default fontset says otherwise, or if Emacs thinks that this
    font cannot support those non-ASCII characters;
  . specifying :family in a face doesn't work very well on Windows,
    because the Windows API for enumerating fonts that belong to a
    family only finds 4 font variants: regular, bold, italic, and
    bold-italic; it doesn't find any other variants -- this could
    cause some font families to be rejected