* [PATCH] docs: Detect variable fonts and suggest removing them @ 2024-03-23 12:02 Akira Yokosawa 2024-03-23 14:55 ` Randy Dunlap ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Akira Yokosawa @ 2024-03-23 12:02 UTC (permalink / raw) To: Jonathan Corbet Cc: linux-doc, Akira Yokosawa, Иван Иванович xelatex doesn't understand variable font format. Recent deployment of variable Noto CJK fonts in Fedora and openSUSE tumbleweed breaks builds of translations.pdf. To help developers work around the build error, add a script for checking existence of variable form of those fonts and emitting suggestions. Invoke it in the error path of "make pdfdocs" so that it is activated only when PDF build actually fails. Signed-off-by: Akira Yokosawa <akiyks@gmail.com> Reported-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/8734tqsrt7.fsf@meer.lwn.net/ Reported-by: "Иван Иванович" <relect@bk.ru> Link: https://lore.kernel.org/linux-doc/1708585803.600323099@f111.i.mail.ru/ --- This is not in line with Jon's suggestion of tweaking sphinx-pre-install and/or kerneldoc-preamble.sty [1]. [1]: https://lore.kernel.org/r/87o7ccpcob.fsf@meer.lwn.net/ It would be ideal if kerneldoc-preamble.sty can be taught about the way to detect the existence of variable fonts and to skip CJK contents. However, it seems that it would add overly complex code for choosing fonts by file names with meticulous options to select CJK variant (SC, TC, KR, or JP) to use. Furthermore, as location and names of font files can be different among distro packages, keeping portability of the preamble is impossible in practice. As for sphinx-pre-install, even if variable "Noto CJK" fonts are found, they don't matter for non-CJK PDFs. Emitting warning every time would be noisy. Therefore, as a minimal approach, to help developers find a way forward, giving suggestions after the fact sounds like a reasonable approach to me, at least for the time being. Jon, you said in [1]: >> What does >> >> fc-list | grep NotoSansCJK-VF.ttc >> >> say? > > No output at all, even though I had google-noto-sans-cjk-vf-fonts > installed. So I'm wondering if scripts/check-variable-font.sh in this patch emits useful suggestions. Could you give it a try? - Install google-noto-sans-cjk-vf-fonts - Install google-noto-serif-cjk-vf-fonts - What does "sh scripts/check-variable-font.sh" say? - Run "make cleandocs; make SPHINXDIRS=translations pdfdocs". Do you see the suggestion after the build error? - Uninstall above 2 font packages. - What does "sh scripts/check-variable-font.sh" say now? - Run "make cleandocs; make SPHINXDIRS=translations pdfdocs" again. Does it complete successfully? Thanks, Akira --- Cc: linux-doc@vger.kernel.org --- Documentation/Makefile | 2 +- MAINTAINERS | 1 + scripts/check-variable-fonts.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 scripts/check-variable-fonts.sh diff --git a/Documentation/Makefile b/Documentation/Makefile index b68f8c816897..e7ff288bfd15 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -154,7 +154,7 @@ else # HAVE_PDFLATEX pdfdocs: latexdocs @$(srctree)/scripts/sphinx-pre-install --version-check $(foreach var,$(SPHINXDIRS), \ - $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit; \ + $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || sh $(srctree)/scripts/check-variable-fonts.sh || exit; \ mkdir -p $(BUILDDIR)/$(var)/pdf; \ mv $(subst .tex,.pdf,$(wildcard $(BUILDDIR)/$(var)/latex/*.tex)) $(BUILDDIR)/$(var)/pdf/; \ ) diff --git a/MAINTAINERS b/MAINTAINERS index 741d9142b343..3858416a2d67 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6346,6 +6346,7 @@ S: Maintained P: Documentation/doc-guide/maintainer-profile.rst T: git git://git.lwn.net/linux.git docs-next F: Documentation/ +F: scripts/check-variable-font.sh F: scripts/documentation-file-ref-check F: scripts/kernel-doc F: scripts/sphinx-pre-install diff --git a/scripts/check-variable-fonts.sh b/scripts/check-variable-fonts.sh new file mode 100755 index 000000000000..775800edb9fc --- /dev/null +++ b/scripts/check-variable-fonts.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# For "make pdfdocs", recent trend of deploying variable type of +# "Noto Sans CJK" and "Noto Serif CJK" fonts breaks xelatex, which does +# not understand variable fonts. +# +# It is hard to distinguish variable fonts from static ones in the preamble +# of LaTeX source code. Instead, this script is invoked in the error path +# of "make pdfdocs" and emit suggestions if such font files are found. +# +# Assumption: +# File names are not changed from those of upstream Noto CJK fonts: +# https://github.com/notofonts/noto-cjk/ + +vffonts=`fc-list -b | grep -i noto | grep -i cjk | grep -F -i -e "-vf" | \ + sort | uniq | sed -e 's/\tfile:/ file:/' | sed -e 's/(s)$//'` + +if [ "x$vffonts" != "x" ] ; then + echo "=====================================================================" + echo "Detected variable form of Noto CJK fonts incompatible with xelatex:" + echo "$vffonts" + echo "If you need CJK contents in PDF, remove them and install static ones." + echo "Otherwise, get rid of texlive-xecjk." + echo "=====================================================================" +fi + +# As this script is invoked from Makefile's error path, always error exit +# even if no variable font is detected. +exit 1 base-commit: b8cfda5c9065cd619a97c17da081cbfab3b1e756 -- 2.34.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] docs: Detect variable fonts and suggest removing them 2024-03-23 12:02 [PATCH] docs: Detect variable fonts and suggest removing them Akira Yokosawa @ 2024-03-23 14:55 ` Randy Dunlap 2024-03-24 0:05 ` Akira Yokosawa 2024-03-29 14:35 ` Jonathan Corbet 2024-04-06 2:04 ` [PATCH v2] docs: Detect variable fonts and suggest denylisting them Akira Yokosawa 2 siblings, 1 reply; 10+ messages in thread From: Randy Dunlap @ 2024-03-23 14:55 UTC (permalink / raw) To: Akira Yokosawa, Jonathan Corbet Cc: linux-doc, Иван Иванович Hi Akira, On 3/23/24 05:02, Akira Yokosawa wrote: > xelatex doesn't understand variable font format. Recent deployment > of variable Noto CJK fonts in Fedora and openSUSE tumbleweed breaks > builds of translations.pdf. > > To help developers work around the build error, add a script for > checking existence of variable form of those fonts and emitting > suggestions. Invoke it in the error path of "make pdfdocs" so that it > is activated only when PDF build actually fails. > > Signed-off-by: Akira Yokosawa <akiyks@gmail.com> > Reported-by: Jonathan Corbet <corbet@lwn.net> > Link: https://lore.kernel.org/r/8734tqsrt7.fsf@meer.lwn.net/ > Reported-by: "Иван Иванович" <relect@bk.ru> > Link: https://lore.kernel.org/linux-doc/1708585803.600323099@f111.i.mail.ru/ > --- [snip] > --- > Cc: linux-doc@vger.kernel.org > --- > Documentation/Makefile | 2 +- > MAINTAINERS | 1 + > scripts/check-variable-fonts.sh | 30 ++++++++++++++++++++++++++++++ > 3 files changed, 32 insertions(+), 1 deletion(-) > create mode 100755 scripts/check-variable-fonts.sh > I don't have much to say about the patch except that it seems like a good idea... However, some of the terminology could be improved IMO. E.g., "variable type" or "variable font" should be something like variable-width font or proportionally-spaced font. "static ones" should be something like fixed-space fonts or monospaced fonts. Unless I just completely don't understand the uses of "variable" and "static" here. > diff --git a/scripts/check-variable-fonts.sh b/scripts/check-variable-fonts.sh > new file mode 100755 > index 000000000000..775800edb9fc > --- /dev/null > +++ b/scripts/check-variable-fonts.sh > @@ -0,0 +1,30 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > +# > +# For "make pdfdocs", recent trend of deploying variable type of > +# "Noto Sans CJK" and "Noto Serif CJK" fonts breaks xelatex, which does > +# not understand variable fonts. > +# > +# It is hard to distinguish variable fonts from static ones in the preamble > +# of LaTeX source code. Instead, this script is invoked in the error path > +# of "make pdfdocs" and emit suggestions if such font files are found. > +# > +# Assumption: > +# File names are not changed from those of upstream Noto CJK fonts: > +# https://github.com/notofonts/noto-cjk/ > + > +vffonts=`fc-list -b | grep -i noto | grep -i cjk | grep -F -i -e "-vf" | \ > + sort | uniq | sed -e 's/\tfile:/ file:/' | sed -e 's/(s)$//'` > + > +if [ "x$vffonts" != "x" ] ; then > + echo "=====================================================================" > + echo "Detected variable form of Noto CJK fonts incompatible with xelatex:" > + echo "$vffonts" > + echo "If you need CJK contents in PDF, remove them and install static ones." > + echo "Otherwise, get rid of texlive-xecjk." > + echo "=====================================================================" > +fi > + > +# As this script is invoked from Makefile's error path, always error exit > +# even if no variable font is detected. > +exit 1 > > base-commit: b8cfda5c9065cd619a97c17da081cbfab3b1e756 Thanks. -- #Randy ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] docs: Detect variable fonts and suggest removing them 2024-03-23 14:55 ` Randy Dunlap @ 2024-03-24 0:05 ` Akira Yokosawa 2024-03-24 0:34 ` Randy Dunlap 0 siblings, 1 reply; 10+ messages in thread From: Akira Yokosawa @ 2024-03-24 0:05 UTC (permalink / raw) To: Randy Dunlap, Jonathan Corbet Cc: linux-doc, Иван Иванович, Akira Yokosawa On Sat, 23 Mar 2024 07:55:52 -0700, Randy Dunlap wrote: > Hi Akira, Thank you for your comments, Randy. > > On 3/23/24 05:02, Akira Yokosawa wrote: >> xelatex doesn't understand variable font format. Recent deployment >> of variable Noto CJK fonts in Fedora and openSUSE tumbleweed breaks >> builds of translations.pdf. >> >> To help developers work around the build error, add a script for >> checking existence of variable form of those fonts and emitting >> suggestions. Invoke it in the error path of "make pdfdocs" so that it >> is activated only when PDF build actually fails. >> >> Signed-off-by: Akira Yokosawa <akiyks@gmail.com> >> Reported-by: Jonathan Corbet <corbet@lwn.net> >> Link: https://lore.kernel.org/r/8734tqsrt7.fsf@meer.lwn.net/ >> Reported-by: "Иван Иванович" <relect@bk.ru> >> Link: https://lore.kernel.org/linux-doc/1708585803.600323099@f111.i.mail.ru/ >> --- > > [snip] > >> --- >> Cc: linux-doc@vger.kernel.org >> --- >> Documentation/Makefile | 2 +- >> MAINTAINERS | 1 + >> scripts/check-variable-fonts.sh | 30 ++++++++++++++++++++++++++++++ >> 3 files changed, 32 insertions(+), 1 deletion(-) >> create mode 100755 scripts/check-variable-fonts.sh >> > > I don't have much to say about the patch except that it seems like a good idea... > > However, some of the terminology could be improved IMO. > E.g., "variable type" or "variable font" should be something like > variable-width font or proportionally-spaced font. Good point. I need to be more careful in using terms rarely found in kernel development. In this case, "variable font" means "font file which employs the OpenType font variations technology". There is a Wikipedia page at: https://en.wikipedia.org/wiki/Variable_font > > "static ones" should be something like fixed-space fonts or monospaced fonts. > > Unless I just completely don't understand the uses of "variable" and "static" here. "static" here means "non-variable". I'll expand the changelog a bit in v2 with your comments in mind. Thanks, Akira ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] docs: Detect variable fonts and suggest removing them 2024-03-24 0:05 ` Akira Yokosawa @ 2024-03-24 0:34 ` Randy Dunlap 0 siblings, 0 replies; 10+ messages in thread From: Randy Dunlap @ 2024-03-24 0:34 UTC (permalink / raw) To: Akira Yokosawa, Jonathan Corbet Cc: linux-doc, Иван Иванович >>> --- >>> Cc: linux-doc@vger.kernel.org >>> --- >>> Documentation/Makefile | 2 +- >>> MAINTAINERS | 1 + >>> scripts/check-variable-fonts.sh | 30 ++++++++++++++++++++++++++++++ >>> 3 files changed, 32 insertions(+), 1 deletion(-) >>> create mode 100755 scripts/check-variable-fonts.sh >>> >> >> I don't have much to say about the patch except that it seems like a good idea... >> >> However, some of the terminology could be improved IMO. >> E.g., "variable type" or "variable font" should be something like >> variable-width font or proportionally-spaced font. > > Good point. > > I need to be more careful in using terms rarely found in kernel development. > > In this case, "variable font" means "font file which employs the OpenType > font variations technology". > > There is a Wikipedia page at: https://en.wikipedia.org/wiki/Variable_font > Ah, I see. Thank you. >> >> "static ones" should be something like fixed-space fonts or monospaced fonts. >> >> Unless I just completely don't understand the uses of "variable" and "static" here. > > "static" here means "non-variable". > > I'll expand the changelog a bit in v2 with your comments in mind. > > Thanks, Akira -- #Randy ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] docs: Detect variable fonts and suggest removing them 2024-03-23 12:02 [PATCH] docs: Detect variable fonts and suggest removing them Akira Yokosawa 2024-03-23 14:55 ` Randy Dunlap @ 2024-03-29 14:35 ` Jonathan Corbet 2024-03-29 15:00 ` Akira Yokosawa 2024-04-06 2:04 ` [PATCH v2] docs: Detect variable fonts and suggest denylisting them Akira Yokosawa 2 siblings, 1 reply; 10+ messages in thread From: Jonathan Corbet @ 2024-03-29 14:35 UTC (permalink / raw) To: Akira Yokosawa Cc: linux-doc, Akira Yokosawa, Иван Иванович Akira Yokosawa <akiyks@gmail.com> writes: > xelatex doesn't understand variable font format. Recent deployment > of variable Noto CJK fonts in Fedora and openSUSE tumbleweed breaks > builds of translations.pdf. > > To help developers work around the build error, add a script for > checking existence of variable form of those fonts and emitting > suggestions. Invoke it in the error path of "make pdfdocs" so that it > is activated only when PDF build actually fails. [Back after three weeks far from home...] The problem with this is: removing those fonts breaks other things. I ended up putting them back onto my system after, as I recall, Emacs stopped displaying non-ASCII text correctly (or at all). So we may be giving advice that some users come to regret having followed. As a result, I'm really not sure what the best thing to do here is. jon ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] docs: Detect variable fonts and suggest removing them 2024-03-29 14:35 ` Jonathan Corbet @ 2024-03-29 15:00 ` Akira Yokosawa 0 siblings, 0 replies; 10+ messages in thread From: Akira Yokosawa @ 2024-03-29 15:00 UTC (permalink / raw) To: Jonathan Corbet Cc: linux-doc, Иван Иванович, Akira Yokosawa On Fri, 29 Mar 2024 08:35:54 -0600, Jonathan Corbet wrote: ... > > The problem with this is: removing those fonts breaks other things. I > ended up putting them back onto my system after, as I recall, Emacs > stopped displaying non-ASCII text correctly (or at all). That's something I was worrying about. > So we may be > giving advice that some users come to regret having followed. > > As a result, I'm really not sure what the best thing to do here is. I've been experimenting a per-user fontconfig trick for denylisting those "variable fonts" for "make pdfdocs" only. Looks like there is hoping. Let me submit a v2 with that trick listed as the safest option in a week or so. Thanks, Akira > > jon ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] docs: Detect variable fonts and suggest denylisting them 2024-03-23 12:02 [PATCH] docs: Detect variable fonts and suggest removing them Akira Yokosawa 2024-03-23 14:55 ` Randy Dunlap 2024-03-29 14:35 ` Jonathan Corbet @ 2024-04-06 2:04 ` Akira Yokosawa 2024-04-10 20:52 ` Jonathan Corbet 2 siblings, 1 reply; 10+ messages in thread From: Akira Yokosawa @ 2024-04-06 2:04 UTC (permalink / raw) To: Jonathan Corbet Cc: linux-doc, Akira Yokosawa, Иван Иванович, Randy Dunlap Fedora and openSUSE has started deploying "variable font" [1] format Noto CJK fonts [2, 3]. "CJK" here stands for "Chinese, Japanese, and Korean". Unfortunately, XeTeX/XeLaTeX doesn't understand those fonts for historical reasons and builds of translations.pdf end up in errors if such fonts are present on the build host. To help developers work around the issue, add a script to check the presence of "variable font" Noto CJK fonts and to emit suggestions. The script is invoked in the error path of "make pdfdocs" so that the suggestions are made only when a PDF build actually fails. The first suggestion is to denylist those "variable font" files by activating a per-user and command-local fontconfig setting. For further info and backgrounds, please refer to the header comment of scripts/check-variable-font.sh newly added in this commit. Link: [1] https://en.wikipedia.org/wiki/Variable_font Link: [2] https://fedoraproject.org/wiki/Changes/Noto_CJK_Variable_Fonts Link: [3] https://build.opensuse.org/request/show/1157217 Reported-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/8734tqsrt7.fsf@meer.lwn.net/ Reported-by: "Иван Иванович" <relect@bk.ru> Link: https://lore.kernel.org/linux-doc/1708585803.600323099@f111.i.mail.ru/ Cc: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Akira Yokosawa <akiyks@gmail.com> --- Changes in v2: - Stop suggesting removal of variable-font packages. (Jon) - Rewrite changelog and add a couple of links for reference. (Randy) - Suggest denylisting "variable font" files for XeLaTeX in "make pdfdocs" as a less invasive option. - Simplify message from check-variable-font.sh and expand the header comments of the script. - Add template of fonts.conf for denylisting in the header comments. - Add rules for activating the XeLaTeX only fonts.conf in Documentation/Makefile. v1: https://lore.kernel.org/r/20240323120204.155678-1-akiyks@gmail.com/ Jon, how does the suggestion of denylisting sound to you? For the denylisting to work, $HOME/deny-vf/fontconfig/fonts.conf needs to be created manually. It would be possible to automate this step, but fonts.conf might need adjustments in case "variable font" files to be denied reside somewhere else. Thanks, Akira --- Documentation/Makefile | 7 +- Documentation/sphinx/kerneldoc-preamble.sty | 9 +- MAINTAINERS | 1 + scripts/check-variable-fonts.sh | 117 ++++++++++++++++++++ 4 files changed, 129 insertions(+), 5 deletions(-) create mode 100755 scripts/check-variable-fonts.sh diff --git a/Documentation/Makefile b/Documentation/Makefile index b68f8c816897..a961692baa12 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -28,6 +28,10 @@ BUILDDIR = $(obj)/output PDFLATEX = xelatex LATEXOPTS = -interaction=batchmode -no-shell-escape +# For denylisting "variable font" files +# Can be overridden by setting as an env variable +FONTS_CONF_DENY_VF ?= $(HOME)/deny-vf + ifeq ($(findstring 1, $(KBUILD_VERBOSE)),) SPHINXOPTS += "-q" endif @@ -151,10 +155,11 @@ pdfdocs: else # HAVE_PDFLATEX +pdfdocs: DENY_VF = XDG_CONFIG_HOME=$(FONTS_CONF_DENY_VF) pdfdocs: latexdocs @$(srctree)/scripts/sphinx-pre-install --version-check $(foreach var,$(SPHINXDIRS), \ - $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit; \ + $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" $(DENY_VF) -C $(BUILDDIR)/$(var)/latex || sh $(srctree)/scripts/check-variable-fonts.sh || exit; \ mkdir -p $(BUILDDIR)/$(var)/pdf; \ mv $(subst .tex,.pdf,$(wildcard $(BUILDDIR)/$(var)/latex/*.tex)) $(BUILDDIR)/$(var)/pdf/; \ ) diff --git a/Documentation/sphinx/kerneldoc-preamble.sty b/Documentation/sphinx/kerneldoc-preamble.sty index 3092df051c95..d479cfa73658 100644 --- a/Documentation/sphinx/kerneldoc-preamble.sty +++ b/Documentation/sphinx/kerneldoc-preamble.sty @@ -215,11 +215,12 @@ due to the lack of suitable font families and/or the texlive-xecjk package. - If you want them, please install ``Noto Sans CJK'' font families - along with the texlive-xecjk package by following instructions from + If you want them, please install non-variable ``Noto Sans CJK'' + font families along with the texlive-xecjk package by following + instructions from \sphinxcode{./scripts/sphinx-pre-install}. - Having optional ``Noto Serif CJK'' font families will improve - the looks of those translations. + Having optional non-variable ``Noto Serif CJK'' font families will + improve the looks of those translations. \end{sphinxadmonition}} \newcommand{\kerneldocEndSC}{} \newcommand{\kerneldocBeginTC}[1]{} diff --git a/MAINTAINERS b/MAINTAINERS index aa3b947fb080..3a4768c2f712 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6406,6 +6406,7 @@ S: Maintained P: Documentation/doc-guide/maintainer-profile.rst T: git git://git.lwn.net/linux.git docs-next F: Documentation/ +F: scripts/check-variable-font.sh F: scripts/documentation-file-ref-check F: scripts/kernel-doc F: scripts/sphinx-pre-install diff --git a/scripts/check-variable-fonts.sh b/scripts/check-variable-fonts.sh new file mode 100755 index 000000000000..12765e54e4f3 --- /dev/null +++ b/scripts/check-variable-fonts.sh @@ -0,0 +1,117 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) Akira Yokosawa, 2024 +# +# For "make pdfdocs", reports of build errors of translations.pdf started +# arriving early 2024 [1, 2]. It turned out that Fedora and openSUSE +# tumbleweed have started deploying variable-font [3] format of "Noto CJK" +# fonts [4, 5]. For PDF, a LaTeX package named xeCJK is used for CJK +# (Chinese, Japanese, Korean) pages. xeCJK requires XeLaTeX/XeTeX, which +# does not (and likely never will) understand variable fonts for historical +# reasons. +# +# The build error happens even when both of variable- and non-variable-format +# fonts are found on the build system. To make matters worse, Fedora enlists +# variable "Noto CJK" fonts in the requirements of langpacks-ja, -ko, -zh_CN, +# -zh_TW, etc. Hence developers who have interest in CJK pages are more +# likely to encounter the build errors. +# +# This script is invoked from the error path of "make pdfdocs" and emits +# suggestions if variable-font files of "Noto CJK" fonts are in the list of +# fonts accessible from XeTeX. +# +# Assumption: +# File names are not modified from those of upstream Noto CJK fonts: +# https://github.com/notofonts/noto-cjk/ +# +# References: +# [1]: https://lore.kernel.org/r/8734tqsrt7.fsf@meer.lwn.net/ +# [2]: https://lore.kernel.org/r/1708585803.600323099@f111.i.mail.ru/ +# [3]: https://en.wikipedia.org/wiki/Variable_font +# [4]: https://fedoraproject.org/wiki/Changes/Noto_CJK_Variable_Fonts +# [5]: https://build.opensuse.org/request/show/1157217 +# +#=========================================================================== +# Workarounds for building translations.pdf +#=========================================================================== +# +# * Denylist "variable font" Noto CJK fonts. +# - Create $HOME/deny-vf/fontconfig/fonts.conf from template below, with +# tweaks if necessary. Remove leading "# ". +# - Path of fontconfig/fonts.conf can be overridden by setting an env +# variable FONTS_CONF_DENY_VF. +# +# * Template: +# ----------------------------------------------------------------- +# <?xml version="1.0"?> +# <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> +# <fontconfig> +# <!-- +# Ignore variable-font glob (not to break xetex) +# --> +# <selectfont> +# <rejectfont> +# <!-- +# for Fedora +# --> +# <glob>/usr/share/fonts/google-noto-*-cjk-vf-fonts</glob> +# <!-- +# for openSUSE tumbleweed +# --> +# <glob>/usr/share/fonts/truetype/Noto*CJK*-VF.otf</glob> +# </rejectfont> +# </selectfont> +# </fontconfig> +# ----------------------------------------------------------------- +# +# The denylisting is activated for "make pdfdocs". +# +# * For skipping CJK pages in PDF +# - Uninstall texlive-xecjk. +# Denylisting is not needed in this case. +# +# * For printing CJK pages in PDF +# - Need non-variable "Noto CJK" fonts. +# * Fedora +# - google-noto-sans-cjk-fonts +# - google-noto-serif-cjk-fonts +# * openSUSE tumbleweed +# - Non-variable "Noto CJK" fonts are not available as distro packages +# as of April, 2024. Fetch a set of font files from upstream Noto +# CJK Font released at: +# https://github.com/notofonts/noto-cjk/tree/main/Sans#super-otc +# and at: +# https://github.com/notofonts/noto-cjk/tree/main/Serif#super-otc +# , then uncompress and deploy them. +# - Remember to update fontconfig cache by running fc-cache. +# +# !!! Caution !!! +# Uninstalling "variable font" packages can be dangerous. +# They might be depended upon by other packages important for your work. +# Denylisting should be less invasive, as it is effective only while +# XeLaTeX runs in "make pdfdocs". + +# Default per-user fontconfig path (overridden by env variable) +: ${FONTS_CONF_DENY_VF:=$HOME/deny-vf} + +export XDG_CONFIG_HOME=${FONTS_CONF_DENY_VF} + +vffonts=`fc-list -b | grep -iE 'file: .*noto.*cjk.*-vf' | \ + sed -e 's/\tfile:/ file:/' -e 's/(s)$//' | sort | uniq` + +if [ "x$vffonts" != "x" ] ; then + echo '=============================================================================' + echo 'XeTeX is confused by "variable font" files listed below:' + echo "$vffonts" + echo + echo 'For CJK pages in PDF, they need to be hidden from XeTeX by denylisting.' + echo 'Or, CJK pages can be skipped by uninstalling texlive-xecjk.' + echo + echo 'For more info on denylisting, other options, and variable font, see header' + echo 'comments of scripts/check-variable-fonts.sh.' + echo '=============================================================================' +fi + +# As this script is invoked from Makefile's error path, always error exit +# regardless of whether any variable font is discovered or not. +exit 1 base-commit: 9e192b39a5992d8b730383d57416964b44ea1041 -- 2.34.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2] docs: Detect variable fonts and suggest denylisting them 2024-04-06 2:04 ` [PATCH v2] docs: Detect variable fonts and suggest denylisting them Akira Yokosawa @ 2024-04-10 20:52 ` Jonathan Corbet 2024-04-10 22:57 ` Akira Yokosawa 0 siblings, 1 reply; 10+ messages in thread From: Jonathan Corbet @ 2024-04-10 20:52 UTC (permalink / raw) To: Akira Yokosawa Cc: linux-doc, Akira Yokosawa, Иван Иванович, Randy Dunlap Akira Yokosawa <akiyks@gmail.com> writes: > Fedora and openSUSE has started deploying "variable font" [1] format > Noto CJK fonts [2, 3]. "CJK" here stands for "Chinese, Japanese, > and Korean". > > Unfortunately, XeTeX/XeLaTeX doesn't understand those fonts for > historical reasons and builds of translations.pdf end up in errors > if such fonts are present on the build host. > > To help developers work around the issue, add a script to check the > presence of "variable font" Noto CJK fonts and to emit suggestions. > The script is invoked in the error path of "make pdfdocs" so that the > suggestions are made only when a PDF build actually fails. > > The first suggestion is to denylist those "variable font" files by > activating a per-user and command-local fontconfig setting. > > For further info and backgrounds, please refer to the header comment > of scripts/check-variable-font.sh newly added in this commit. > > Link: [1] https://en.wikipedia.org/wiki/Variable_font > Link: [2] https://fedoraproject.org/wiki/Changes/Noto_CJK_Variable_Fonts > Link: [3] https://build.opensuse.org/request/show/1157217 > Reported-by: Jonathan Corbet <corbet@lwn.net> > Link: https://lore.kernel.org/r/8734tqsrt7.fsf@meer.lwn.net/ > Reported-by: "Иван Иванович" <relect@bk.ru> > Link: https://lore.kernel.org/linux-doc/1708585803.600323099@f111.i.mail.ru/ > Cc: Randy Dunlap <rdunlap@infradead.org> > Signed-off-by: Akira Yokosawa <akiyks@gmail.com> > --- > Changes in v2: > > - Stop suggesting removal of variable-font packages. (Jon) > - Rewrite changelog and add a couple of links for reference. (Randy) > - Suggest denylisting "variable font" files for XeLaTeX in "make pdfdocs" > as a less invasive option. > - Simplify message from check-variable-font.sh and expand the header > comments of the script. > - Add template of fonts.conf for denylisting in the header comments. > - Add rules for activating the XeLaTeX only fonts.conf in > Documentation/Makefile. Thanks for working on this. I've verified that the message comes up at the right time (though before waiting a half-hour for things to fail would be better :) and that following the advice in the script makes the build work. I *did* have to do a "make cleandocs" after adding the fonts.conf file, though, before the build would succeed. So I've applied this, for now at least, but I do wonder: might it be better to stash this fonts.conf file in-tree somewhere and just pull it in automatically? Would that create problems for anybody if we were to do so? That might be a bit nicer than failing and making people set up the workaround on their own. Meanwhile, it occurred to me that it would be good to let the Fedora folks know that this breaks, so I've filed a bug there; we'll see if they have any thoughts on the matter as well. Thanks, jon ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] docs: Detect variable fonts and suggest denylisting them 2024-04-10 20:52 ` Jonathan Corbet @ 2024-04-10 22:57 ` Akira Yokosawa 2024-04-10 23:36 ` Jonathan Corbet 0 siblings, 1 reply; 10+ messages in thread From: Akira Yokosawa @ 2024-04-10 22:57 UTC (permalink / raw) To: Jonathan Corbet Cc: linux-doc, Иван Иванович, Randy Dunlap, Akira Yokosawa On Wed, 10 Apr 2024 14:52:37 -0600, Jonathan Corbet wrote: [...] > Meanwhile, it occurred to me that it would be good to let the Fedora > folks know that this breaks, so I've filed a bug there; we'll see if > they have any thoughts on the matter as well. Actually, I opened: https://bugzilla.redhat.com/show_bug.cgi?id=2271559 "google-noto-sans-cjk-vf-fonts is not compatible with XeTeX" the other day as a bug in google-noto-sans-cjk-vf-fonts. In response, Peng Wu (one of font package maintainers) opened: https://bugzilla.redhat.com/show_bug.cgi?id=2272153 "xelatex doesn't support font face from named instance of variable fonts" as a bug in texlive-base. In #2271559, I was asked to help report this issue to upstream XeTeX, which is in my to-do list. It sounds like there should be a way for XeTeX to identify variable fonts and ignore them. Thanks, Akira ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] docs: Detect variable fonts and suggest denylisting them 2024-04-10 22:57 ` Akira Yokosawa @ 2024-04-10 23:36 ` Jonathan Corbet 0 siblings, 0 replies; 10+ messages in thread From: Jonathan Corbet @ 2024-04-10 23:36 UTC (permalink / raw) To: Akira Yokosawa Cc: linux-doc, Иван Иванович, Randy Dunlap, Akira Yokosawa Akira Yokosawa <akiyks@gmail.com> writes: > On Wed, 10 Apr 2024 14:52:37 -0600, Jonathan Corbet wrote: > [...] >> Meanwhile, it occurred to me that it would be good to let the Fedora >> folks know that this breaks, so I've filed a bug there; we'll see if >> they have any thoughts on the matter as well. > > Actually, I opened: > > https://bugzilla.redhat.com/show_bug.cgi?id=2271559 > "google-noto-sans-cjk-vf-fonts is not compatible with XeTeX" > > the other day as a bug in google-noto-sans-cjk-vf-fonts. Ah...I filed mine under texlive, no wonder I didn't find yours first :) > In response, Peng Wu (one of font package maintainers) opened: > > https://bugzilla.redhat.com/show_bug.cgi?id=2272153 > "xelatex doesn't support font face from named instance of variable fonts" > > as a bug in texlive-base. I'm not sure why I didn't find that one, though...I did look. > In #2271559, I was asked to help report this issue to upstream XeTeX, > which is in my to-do list. > > It sounds like there should be a way for XeTeX to identify variable fonts > and ignore them. It seems like it should certainly be possible. We may end up carrying the workaround for a long time, though, before any fix filters through to users. Thanks, jon ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-04-10 23:36 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-03-23 12:02 [PATCH] docs: Detect variable fonts and suggest removing them Akira Yokosawa 2024-03-23 14:55 ` Randy Dunlap 2024-03-24 0:05 ` Akira Yokosawa 2024-03-24 0:34 ` Randy Dunlap 2024-03-29 14:35 ` Jonathan Corbet 2024-03-29 15:00 ` Akira Yokosawa 2024-04-06 2:04 ` [PATCH v2] docs: Detect variable fonts and suggest denylisting them Akira Yokosawa 2024-04-10 20:52 ` Jonathan Corbet 2024-04-10 22:57 ` Akira Yokosawa 2024-04-10 23:36 ` Jonathan Corbet
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.