GNU bug report logs - #65803
29.1; Noto Sans Mono CJK JP has doubled-width on Windows

Previous Next

Package: emacs;

Reported by: Shingo Tanaka <shingo.fg8 <at> gmail.com>

Date: Thu, 7 Sep 2023 13:39:02 UTC

Severity: normal

Found in version 29.1

Full log


Message #41 received at 65803 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 65803 <at> debbugs.gnu.org, shingo.fg8 <at> gmail.com
Subject: Re: bug#65803: 29.1; Noto Sans Mono CJK JP has doubled-width on
 Windows
Date: Sat, 09 Sep 2023 15:17:42 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: Shingo Tanaka <shingo.fg8 <at> gmail.com>,  65803 <at> debbugs.gnu.org
> Date: Fri, 08 Sep 2023 21:42:37 +0800
> 
> For a nominally monospace font, the ft*font backends infer the average
> from the width of the space glyph, instead of giving undue credence to
> its reported ``average width''.  CJK fonts customarily contain tens of
> thousands of glyphs, of which only a small subset represent ASCII
> ``monospace'' characters relevant to Emacs, but the `tmAveCharWidth'
> field, which is derived from the font's OS/2 table:
> 
>   https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html
> 
> represents the average width of all the glyphs within the font, and is
> ergo naturally biased towards the large number of CJK glyphs
> incorporated within the font.  The W32 backend should either infer the
> average width itself, or ground it upon on the width of the space glyph.
> Refer to this code in ftfont_open:
> 
>       font->min_width = font->average_width = font->space_width = 0;
>       for (i = 32, n = 0; i < 127; i++)
> 	if (FT_Load_Char (ft_face, i, FT_LOAD_DEFAULT) == 0)
> 	  {
> 	    int this_width = ft_face->glyph->metrics.horiAdvance >> 6;
> 
> 	    if (this_width > 0
> 		&& (! font->min_width || font->min_width > this_width))
> 	      font->min_width = this_width;
> 	    if (i == 32)
> 	      font->space_width = this_width;
> 	    font->average_width += this_width;
> 	    n++;
> 	  }
>       if (n > 0)
> 	font->average_width /= n;

Thanks, but the above snippet in ftfont.c is only done for
proportional fonts, not for fixed-pitch fonts.  Is the font in
question, Noto Sans Mono CJK JP, a proportional font?  That is, does
it not set the fixed-pitch attribute?




This bug report was last modified 1 year and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.