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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 10 Sep 2023 12:30:02 +0300

> Cc: [email-masked], [email-masked]
> Date: Sun, 10 Sep 2023 11:50:26 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> > From: Po Lu <[email-masked]>
> > Cc: [email-masked],  [email-masked]
> > Date: Sun, 10 Sep 2023 16:31:57 +0800
> > 
> > Eli Zaretskii <[email-masked]> writes:
> > 
> > > I don't see the fact of the font being fixed-pitch or proportional
> > > mentioned in the output of describe-font.  Am I missing something?
> > 
> > Strange.  Here, I see:
> > 
> > full name: Source Code Pro:pixelsize=13:foundry=ADBO:weight=regular:slant=normal:width=normal:spacing=100:scalable=true
> > 
> > where `spacing=100' indicates the font is monospace.
> 
> That's specific to Fontconfig, I think.  On Windows I see:
> 
>        full name: Courier New-10.0

Anyway, I tried to write the code to compute the font average width,
and found that it's impossible to do reliably on MS-Windows: all the
font-related functions that return glyph metrics require a "device
context" argument, which cannot be provided as long as we don't have
at least one w32 frame.  So invocations like

  emacs -fn "Arial Unicode MS"

will not work, and that means invoking Emacs with variable-pitch fonts
as the default will not be able to take advantage of this improvement,
which basically makes all this change useless.

Maybe it's possible to pull this trick anyway, but it will take
someone who knows the Windows GUI programming better than myself,
perhaps by reading the font data directly (like the Windows port of
Freetype does?).

Sorry.  I guess the conclusion is, unfortunately, that fonts like Noto
Sans Mono CJK JP cannot be used on Windows as the default font, only
as font for the CJK scripts (configured via the fontset).