[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250622141311.389abf16@foz.lan>
Date: Sun, 22 Jun 2025 14:13:19 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Bagas Sanjaya <bagasdotme@...il.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, Linux
Documentation <linux-doc@...r.kernel.org>, Jonathan Corbet
<corbet@....net>, Mauro Carvalho Chehab <mchehab@...nel.org>, Federico Vaga
<federico.vaga@...a.pv.it>, Akira Yokosawa <akiyks@...il.com>, Carlos
Bilbao <carlos.bilbao@...nel.org>, Avadhut Naik <avadhut.naik@....com>,
Alex Shi <alexs@...nel.org>, Yanteng Si <si.yanteng@...ux.dev>, Dongliang
Mu <dzm91@...t.edu.cn>, Thomas Gleixner <tglx@...utronix.de>, Greg
Kroah-Hartman <gregkh@...uxfoundation.org>, Stanislav Fomichev
<sdf@...gle.com>, David Vernet <void@...ifault.com>, Miguel Ojeda
<ojeda@...nel.org>, James Seo <james@...iv.tech>, Daniel Vetter
<daniel.vetter@...ll.ch>
Subject: Re: [PATCH RFC] Documentation: typography refresh
Em Thu, 19 Jun 2025 11:23:19 +0700
Bagas Sanjaya <bagasdotme@...il.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@...il.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
Powered by blists - more mailing lists