Subject: Re: bug#39656: 27.0.60; ordering of fonts in fontset is ignored

From: Eli Zaretskii <[email-masked]>
Date: Wed, 19 Feb 2020 17:51:32 +0200

> Date: Wed, 19 Feb 2020 11:02:44 +0000
> From: Alan Third <[email-masked]>
> Cc: [email-masked]
> 
> > Evaluating the form below, every character is displayed with "SimHei"
> > if glyphs are defined in both "SImHei" and "MS Gothic".
> > For example, most of CJK Ideographs are displayed with "SimHei".
> > "MS Gothic" is not used between U+3400 and U+9FA5.
> > 
> > (let* ((ascii "SimHei")
> >        (primary "MS Gothic")
> >        (secondary ascii))
> >   (setq use-default-font-for-symbols nil)
> >   (set-frame-font ascii)
> >   (set-fontset-font nil '(#x80 . #x10FFFF) primary)
> >   (set-fontset-font nil '(#x80 . #x10FFFF) secondary nil 'append))
> 
> As I understand it the fontsets are used as fallbacks if the default
> font doesn’t contain the desired glyph. Since SimHei DOES contain the
> glyph and has been set as the default (set-frame-font) we would expect
> to see it displayed with SimHei.

Yes, that is true, AFAIU.  Commenting out this line:

  (set-frame-font ascii)

makes more characters use MS Gothic.  However, CJK Ideographs are
still not displayed with MS Gothic, but with SimHei (I don't have that
font on my system, so I used SimSun instead).  But I don't see a
problem here, because MS Gothic covers only a very small fraction of
CJK Ideographs.  So Emacs does TRT here, although I couldn't figure
out why it rejects MS Gothic for these characters.