Re: [PATCH] emacs: fix author field width with double-width chars

Subject: Re: [PATCH] emacs: fix author field width with double-width chars

Date: Thu, 03 Jul 2025 07:04:05 -0300

To: 赵一开

Cc: notmuch@notmuchmail.org

From: David Bremner


赵一开 <yikai@z1k.dev> writes:

>
> You've come across the most common issue that every new CJK user
> struggles with :)
>
> The issue in your screenshot is that the CJK font together with the
> ASCII font is not monospaced.
> You should try using Noto CJK Mono as the default font in emacs (apply
> to both CJK characters and ASCII characters), with e.g.
> (set-face-attribute 'default nil :family "Noto Sans Mono CJK KR").
> Sorry I wasn't specific enough for this earlier.
>

Thanks for your patience. I tried this (in emacs -Q) and I agree it is
better, but it still seems not quite right to me (screenshots at end).

I attach a second screenshot in whitespace mode.

> Since CJK characters are wider than ASCII characters and defined as
> "double-width" in unicode, although CJK chars themselves are always
> monospaced, they should be exactly 2x the width of the ASCII chars to
> make the whole buffer properly aligned. However, sometimes CJK chars
> and ASCII chars are provided by different fonts, so the user is
> responsible to make sure of that. The easy way is to use one single
> monospaced font for all chars (e.g. "Noto Sans Mono CJK" mentioned
> above), or alternatively there are certain known compatible font
> pairs, for example, IIRC "Fira Code" and "Source Code Pro" works well
> with "Noto Sans CJK".
>

FWIW my initial screenshots used Fira Code.

emacs-gtk2.pngws-mode.png
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: