linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Documentation <linux-doc@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Federico Vaga <federico.vaga@vaga.pv.it>,
	Akira Yokosawa <akiyks@gmail.com>,
	Carlos Bilbao <carlos.bilbao@kernel.org>,
	Avadhut Naik <avadhut.naik@amd.com>, Alex Shi <alexs@kernel.org>,
	Yanteng Si <si.yanteng@linux.dev>,
	Dongliang Mu <dzm91@hust.edu.cn>,
	Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Stanislav Fomichev <sdf@google.com>,
	David Vernet <void@manifault.com>,
	Miguel Ojeda <ojeda@kernel.org>, James Seo <james@equiv.tech>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH RFC] Documentation: typography refresh
Date: Sun, 22 Jun 2025 14:13:19 +0200	[thread overview]
Message-ID: <20250622141311.389abf16@foz.lan> (raw)
In-Reply-To: <20250619042318.17325-2-bagasdotme@gmail.com>

Em Thu, 19 Jun 2025 11:23:19 +0700
Bagas Sanjaya <bagasdotme@gmail.com> escreveu:

> At present, kernel documentation uses system serif font for body text.
> Some people, however, objected to it and instead prefer that the
> typography choice must be legible, consistent, and accessible (after
> all, the audience ranges developers peeking into kernel internals to
> ordinary users that skimmed through Documentation/admin-guide/).
> 
> To tackle the problem, follow Wikimedia's typography refresh [1].
> For the font choices, instead of using web fonts as in previous
> attempt [2], use:
> 
>   * Linux Libertine, Georgia, Times for serif (used in h1 and h2
>     headings)
>   * system font for sans-serif and monospace
> 
> This allows for more readability and consistency without sacrificing
> page load times and bandwidth, as the font choices is most likely
> already available on many platforms.
> 
> The reason why serif fonts is used for headings in complement to sans
> serif in text body is to break up visual monotony of docs page by
> creating contrast between headings (as entry point to docs information)
> and text body, which is important considering that kernel docs are
> quite lengthy with many sections.
> 
> For body text (excluding sidebar), it is set to #252525 on top
> of #FFFFFF background as they have contrast ratio 15.3:1, which
> is rated as AAA according to WCAG 2.0 section 1.4.6. Having slightly
> off-black foreground text on white background can reduce eye strain
> and juxtaposition on dyslexic readers.
> 
> This refresh only applies to default Alabaster theme.
> 
> [1]: https://www.mediawiki.org/wiki/Typography_refresh
> [2]: https://lore.kernel.org/linux-doc/20231102123225.32768-1-bagasdotme@gmail.com/
> 
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>  Documentation/conf.py                      |  5 +-
>  Documentation/sphinx-static/typography.css | 62 ++++++++++++++++++++++
>  2 files changed, 66 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/sphinx-static/typography.css
> 
> diff --git a/Documentation/conf.py b/Documentation/conf.py
> index 12de52a2b17e78..f5713cd70cc17c 100644
> --- a/Documentation/conf.py
> +++ b/Documentation/conf.py
> @@ -310,9 +310,12 @@ if  html_theme == 'alabaster':
>          'sidebar_width': '15em',
>          'fixed_sidebar': 'true',
>          'font_size': 'inherit',
> -        'font_family': 'serif',
>      }
>  
> +    html_css_files  = [
> +        'typography.css',
> +    ]
> +
>  sys.stderr.write("Using %s theme\n" % html_theme)

I liked this part: having fonts inside a css. However the code is broken,
as there are already several parts of conf.py which alrease sets
html_css_files on different ways, depending on two make vars. From
make help:

	make DOCS_THEME={sphinx-theme} selects a different Sphinx theme.
	make DOCS_CSS={a .css file} adds a DOCS_CSS override file for html/epub output.

The code on conf.py in question is:

	if html_theme in ["sphinx_rtd_theme", "sphinx_rtd_dark_mode"]:
		...
	        html_css_files = [
	            "theme_overrides.css",
	        ]
		...
		if html_theme == "sphinx_rtd_theme":
	            # Add color-specific RTD normal mode
            html_css_files.append("theme_rtd_colors.css")
	...
	if "DOCS_CSS" in os.environ:
	    css = os.environ["DOCS_CSS"].split(" ")

	    for l in css:
	        html_css_files.append(l)

You can't just replace html_css_files without considering the above,
specially since one could be doing DOCS_CSS="some_other_typography.css".

IMO, the code should be instead:

	if html_theme == "alabaster":
	    if not html_css_files:
	        html_css_files  = [ "typography.css" ]

E.g. only use it if:
- the theme is the default one;
- the Kernel docs will be built without DOCS_CSS.

Thanks,
Mauro

  parent reply	other threads:[~2025-06-22 12:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  4:23 [PATCH RFC] Documentation: typography refresh Bagas Sanjaya
2025-06-19  7:12 ` Randy Dunlap
2025-06-22  7:19   ` Bagas Sanjaya
2025-06-22  8:58 ` Vegard Nossum
2025-06-23  3:41   ` Bagas Sanjaya
2025-06-24 22:59     ` Carlos Bilbao
2025-06-25  0:35       ` Bagas Sanjaya
     [not found]         ` <CAOc0haLSQVO9RexsMDRJ9zx=TPOi5yC6ADX4VLSbFvi1bhP_iw@mail.gmail.com>
2025-07-03 23:50           ` Jonathan Corbet
2025-07-06 16:14             ` Carlos Bilbao
2025-06-22 12:13 ` Mauro Carvalho Chehab [this message]
2025-06-25 18:46 ` Jonathan Corbet
2025-06-27  0:20   ` Bagas Sanjaya

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=20250622141311.389abf16@foz.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=akiyks@gmail.com \
    --cc=alexs@kernel.org \
    --cc=avadhut.naik@amd.com \
    --cc=bagasdotme@gmail.com \
    --cc=carlos.bilbao@kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dzm91@hust.edu.cn \
    --cc=federico.vaga@vaga.pv.it \
    --cc=gregkh@linuxfoundation.org \
    --cc=james@equiv.tech \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=sdf@google.com \
    --cc=si.yanteng@linux.dev \
    --cc=tglx@linutronix.de \
    --cc=void@manifault.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).