All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiandong Qiu <qiujiandong1998@gmail.com>
To: Weijie Yuan <wy@wyuan.org>
Cc: Alexs Shi <alexs@kernel.org>, Yanteng Si <si.yanteng@linux.dev>,
	 Dongliang Mu <dzm91@hust.edu.cn>,
	Jonathan Corbet <corbet@lwn.net>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/2] docs/zh_CN: update translations for process/changes.rst and sphinx.rst
Date: Mon, 6 Jul 2026 21:21:25 +0800	[thread overview]
Message-ID: <akuoP6z-GMfbKucI@archlinux> (raw)
In-Reply-To: <akp9kzW3bG_pYLW8@wyuan.org>

Hi Weijie,

I've been looking into the font rendering issue and have found
the root cause and a solution.

In the lore archive, the CSS defines `font-family: monospace`.
This instructs the browser to use the system's default monospace font.
On many Linux distributions, this default is Noto Sans Mono. The problem
is that Noto Sans Mono is a Latin-only font, so it lacks glyphs for Chinese
characters. When the browser encounters Chinese text, it falls back to
other fonts, causing inconsistent and often misaligned display.

The fix is to configure the system to prefer a monospace font that supports
both Latin and Chinese characters well, with a 2:1 width ratio for optimal
alignment. This can be done by adding a fontconfig rule to set the preferred
font for the monospace family.

Here's a commit that demonstrates exactly this configuration:

https://github.com/qiujiandong/dotfiles/commit/be193b3ec36a826b611d97920ff6afa76994aa7c

It creates an XML configuration file (e.g., ~/.config/fontconfig/fonts.conf)
with the following content:

```xml
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Maple Mono NF CN</family>
    </prefer>
  </alias>
</fontconfig>
```

After adding this configuration, run `fc-cache -vf` to refresh the font cache.
Make sure the preferred font (in this example, Maple Mono NF CN) is installed.

After applying this change, the lore archive pages in the browser will use the
configured monospace font, displaying both English and Chinese text correctly.
This approach is generic and can be adapted to use any other suitable monospace
font that fits your preference.

Hope this helps!

Best regards,
Jiandong

      reply	other threads:[~2026-07-06 13:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-21 13:12 [PATCH v2 0/2] docs/zh_CN: update translations for process/changes.rst and sphinx.rst Jiandong Qiu
2026-06-21 13:12 ` [PATCH v2 1/2] docs/zh_CN: add process/changes.rst translation Jiandong Qiu
2026-07-05  8:23   ` Dongliang Mu
2026-07-05 15:48     ` Jiandong Qiu
2026-06-21 13:12 ` [PATCH v2 2/2] docs/zh_CN: update sphinx.rst translation Jiandong Qiu
2026-07-05  6:24 ` [PATCH v2 0/2] docs/zh_CN: update translations for process/changes.rst and sphinx.rst Weijie Yuan
2026-07-05 15:20   ` Jiandong Qiu
2026-07-05 15:51     ` Weijie Yuan
2026-07-06 13:21       ` Jiandong Qiu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=akuoP6z-GMfbKucI@archlinux \
    --to=qiujiandong1998@gmail.com \
    --cc=alexs@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dzm91@hust.edu.cn \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=si.yanteng@linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=wy@wyuan.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.