Subject: bug#65803: 29.1; Noto Sans Mono CJK JP has doubled-width on Windows

From: Shingo Tanaka <[email-masked]>
Date: Fri, 8 Sep 2023 07:26:18 +0900

> Please also tell what does (frame-char-width) return with each of the
> two fonts on Windows.

Here are the results including the one on Ubuntu.
Obviously, the 2nd one (Noto on Windows) returns a doubled-width size
which is unexpected.

;; On Windows - No issue
(progn
  (set-face-attribute 'default nil :font "ＭＳ ゴシック")
  (frame-char-width))
10
(string-pixel-width "A")
10
(string-pixel-width "あ")
20

;; On Windows - Wrong frame-char-width
(progn
  (set-face-attribute 'default nil :font "Noto Sans Mono CJK JP")
  (frame-char-width))
20
(string-pixel-width "A")
10
(string-pixel-width "あ")
20

;; On Ubuntu (w/Cairo) - No issue
(progn
  (set-face-attribute 'default nil :font "Noto Sans Mono CJK JP")
  (frame-char-width))
13
(string-pixel-width "A")
13
(string-pixel-width "あ")
26

> Is your Ubuntu build with Cairo, btw?

Yes, the Emacs on Ubuntu is the latest Snap version which is compiled
with Cairo, as I can double check it by seeing colored Emoji.

2023年9月8日(金) 15:25 Eli Zaretskii <[email-masked]>:
>
> > From: Shingo Tanaka <[email-masked]>
> > Date: Fri, 8 Sep 2023 08:19:29 +0900
> > Cc: [email-masked]
> >
> > I'm not an expert on fonts either, but the reason why I reported is because
> > I don't see this issue on Ubuntu as attached with exactly the same font
> > (NotoSansMonoCJKjp-VF.ttf).  So the difference looks like coming from OS
> > difference but not emacs version difference.
>
> Could be: the way Emacs handles fonts on Windows is very different
> from what we do on GNU/Linux.  For example, it seemed to me that the
> session using this font on Windows actually used the bold variant of
> the font, which might have something to do with the very partial
> support for font families on MS-Windows.
>
> Please also tell what does (frame-char-width) return with each of the
> two fonts on Windows.
>
> Is your Ubuntu build with Cairo, btw?