Subject: bug#73363: 30.0.91; CJK Font Rendering Behavior Changed

From: Eli Zaretskii <[email-masked]>
Date: Fri, 20 Sep 2024 16:50:22 +0300

> From: Robert Pluim <[email-masked]>
> Cc: Po Lu <[email-masked]>,  [email-masked],
>   [email-masked]
> Date: Fri, 20 Sep 2024 14:24:11 +0200
> 
> >>>>> On Fri, 20 Sep 2024 20:08:10 +0800, Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email-masked]> said:
>     >> Some of our font backends (sfntfont, at least, and perhaps macfont in
>     >> this case) will return different registries from that which was
>     >> specified in the font spec when enumerating font entities, in order to
>     >> enable font specs requesting an ASCII charset also to match fonts with
>     >> Unicode as the charset.  If cached, these font entities will be
>     >> repeatedly rejected in font_find_for_lface after being opened, with
>     >> obvious consequences for performance.
> 
>     Po Lu> I forgot to mention that sometimes no charset can be derived before the
>     Po Lu> font object is opened, and in these situations it is best not to cache
>     Po Lu> these font objects at all, if a registry should be specified in the
>     Po Lu> spec, for similar reasons.
> 
> These are the fonts which are being rejected on macOS for me. And yet
> PingFang SC seems to work ok.
> 
> strangeness detected: spec:’#<font-spec nil nil nil nil gb2312.1980-0 nil nil nil nil nil nil nil nil>’ font:’#<font-object -*-PingFang SC-regular-normal-normal-*-12-*-*-*-p-0-iso10646-1>’

Po Lu, why does it make sense to reject iso10646-1 in these cases?  I
could perhaps understand why reject gb2312.1980-0 when we request
something like jisx0208*-*, but iso10646-1 is supposed to support all
the characters, so I don't understand the rationale for rejecting
that.  And the same for unicode-bmp and unicode-sip, I think (although
those are rarely used).

And what if the requested registry is ascii-0?  That one should match
any registry, IMO.  If not, why not?

More generally, what were the examples where you saw problems in
accepting registries different from the requested one?  Also, if those
problems are specific to certain platforms, how about making this test
only on those platforms?  Font selection machinery in Emacs is
delicate enough to try to "do no harm" first and foremost.