1 #!/bin/sh 1 #!/bin/sh 2 # SPDX-License-Identifier: GPL-2.0-only 2 # SPDX-License-Identifier: GPL-2.0-only 3 # Copyright (C) Akira Yokosawa, 2024 3 # Copyright (C) Akira Yokosawa, 2024 4 # 4 # 5 # For "make pdfdocs", reports of build errors 5 # For "make pdfdocs", reports of build errors of translations.pdf started 6 # arriving early 2024 [1, 2]. It turned out t 6 # arriving early 2024 [1, 2]. It turned out that Fedora and openSUSE 7 # tumbleweed have started deploying variable-f 7 # tumbleweed have started deploying variable-font [3] format of "Noto CJK" 8 # fonts [4, 5]. For PDF, a LaTeX package name 8 # fonts [4, 5]. For PDF, a LaTeX package named xeCJK is used for CJK 9 # (Chinese, Japanese, Korean) pages. xeCJK re 9 # (Chinese, Japanese, Korean) pages. xeCJK requires XeLaTeX/XeTeX, which 10 # does not (and likely never will) understand 10 # does not (and likely never will) understand variable fonts for historical 11 # reasons. 11 # reasons. 12 # 12 # 13 # The build error happens even when both of va 13 # The build error happens even when both of variable- and non-variable-format 14 # fonts are found on the build system. To mak 14 # fonts are found on the build system. To make matters worse, Fedora enlists 15 # variable "Noto CJK" fonts in the requirement 15 # variable "Noto CJK" fonts in the requirements of langpacks-ja, -ko, -zh_CN, 16 # -zh_TW, etc. Hence developers who have inte 16 # -zh_TW, etc. Hence developers who have interest in CJK pages are more 17 # likely to encounter the build errors. 17 # likely to encounter the build errors. 18 # 18 # 19 # This script is invoked from the error path o 19 # This script is invoked from the error path of "make pdfdocs" and emits 20 # suggestions if variable-font files of "Noto 20 # suggestions if variable-font files of "Noto CJK" fonts are in the list of 21 # fonts accessible from XeTeX. 21 # fonts accessible from XeTeX. 22 # 22 # 23 # References: 23 # References: 24 # [1]: https://lore.kernel.org/r/8734tqsrt7.fs 24 # [1]: https://lore.kernel.org/r/8734tqsrt7.fsf@meer.lwn.net/ 25 # [2]: https://lore.kernel.org/r/1708585803.60 25 # [2]: https://lore.kernel.org/r/1708585803.600323099@f111.i.mail.ru/ 26 # [3]: https://en.wikipedia.org/wiki/Variable_ 26 # [3]: https://en.wikipedia.org/wiki/Variable_font 27 # [4]: https://fedoraproject.org/wiki/Changes/ 27 # [4]: https://fedoraproject.org/wiki/Changes/Noto_CJK_Variable_Fonts 28 # [5]: https://build.opensuse.org/request/show 28 # [5]: https://build.opensuse.org/request/show/1157217 29 # 29 # 30 #============================================= 30 #=========================================================================== 31 # Workarounds for building translations.pdf 31 # Workarounds for building translations.pdf 32 #============================================= 32 #=========================================================================== 33 # 33 # 34 # * Denylist "variable font" Noto CJK fonts. 34 # * Denylist "variable font" Noto CJK fonts. 35 # - Create $HOME/deny-vf/fontconfig/fonts.co 35 # - Create $HOME/deny-vf/fontconfig/fonts.conf from template below, with 36 # tweaks if necessary. Remove leading "# 36 # tweaks if necessary. Remove leading "# ". 37 # - Path of fontconfig/fonts.conf can be ove 37 # - Path of fontconfig/fonts.conf can be overridden by setting an env 38 # variable FONTS_CONF_DENY_VF. 38 # variable FONTS_CONF_DENY_VF. 39 # 39 # 40 # * Template: 40 # * Template: 41 # -------------------------------------------- 41 # ----------------------------------------------------------------- 42 # <?xml version="1.0"?> 42 # <?xml version="1.0"?> 43 # <!DOCTYPE fontconfig SYSTEM "urn:fontconfig: 43 # <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 44 # <fontconfig> 44 # <fontconfig> 45 # <!-- 45 # <!-- 46 # Ignore variable-font glob (not to break xe 46 # Ignore variable-font glob (not to break xetex) 47 # --> 47 # --> 48 # <selectfont> 48 # <selectfont> 49 # <rejectfont> 49 # <rejectfont> 50 # <!-- 50 # <!-- 51 # for Fedora 51 # for Fedora 52 # --> 52 # --> 53 # <glob>/usr/share/fonts/google-no 53 # <glob>/usr/share/fonts/google-noto-*-cjk-vf-fonts</glob> 54 # <!-- 54 # <!-- 55 # for openSUSE tumbleweed 55 # for openSUSE tumbleweed 56 # --> 56 # --> 57 # <glob>/usr/share/fonts/truetype/ 57 # <glob>/usr/share/fonts/truetype/Noto*CJK*-VF.otf</glob> 58 # </rejectfont> 58 # </rejectfont> 59 # </selectfont> 59 # </selectfont> 60 # </fontconfig> 60 # </fontconfig> 61 # -------------------------------------------- 61 # ----------------------------------------------------------------- 62 # 62 # 63 # The denylisting is activated for "make p 63 # The denylisting is activated for "make pdfdocs". 64 # 64 # 65 # * For skipping CJK pages in PDF 65 # * For skipping CJK pages in PDF 66 # - Uninstall texlive-xecjk. 66 # - Uninstall texlive-xecjk. 67 # Denylisting is not needed in this case. 67 # Denylisting is not needed in this case. 68 # 68 # 69 # * For printing CJK pages in PDF 69 # * For printing CJK pages in PDF 70 # - Need non-variable "Noto CJK" fonts. 70 # - Need non-variable "Noto CJK" fonts. 71 # * Fedora 71 # * Fedora 72 # - google-noto-sans-cjk-fonts 72 # - google-noto-sans-cjk-fonts 73 # - google-noto-serif-cjk-fonts 73 # - google-noto-serif-cjk-fonts 74 # * openSUSE tumbleweed 74 # * openSUSE tumbleweed 75 # - Non-variable "Noto CJK" fonts are no 75 # - Non-variable "Noto CJK" fonts are not available as distro packages 76 # as of April, 2024. Fetch a set of f 76 # as of April, 2024. Fetch a set of font files from upstream Noto 77 # CJK Font released at: 77 # CJK Font released at: 78 # https://github.com/notofonts/noto- 78 # https://github.com/notofonts/noto-cjk/tree/main/Sans#super-otc 79 # and at: 79 # and at: 80 # https://github.com/notofonts/noto- 80 # https://github.com/notofonts/noto-cjk/tree/main/Serif#super-otc 81 # , then uncompress and deploy them. 81 # , then uncompress and deploy them. 82 # - Remember to update fontconfig cache 82 # - Remember to update fontconfig cache by running fc-cache. 83 # 83 # 84 # !!! Caution !!! 84 # !!! Caution !!! 85 # Uninstalling "variable font" packages ca 85 # Uninstalling "variable font" packages can be dangerous. 86 # They might be depended upon by other pac 86 # They might be depended upon by other packages important for your work. 87 # Denylisting should be less invasive, as 87 # Denylisting should be less invasive, as it is effective only while 88 # XeLaTeX runs in "make pdfdocs". 88 # XeLaTeX runs in "make pdfdocs". 89 89 90 # Default per-user fontconfig path (overridden 90 # Default per-user fontconfig path (overridden by env variable) 91 : ${FONTS_CONF_DENY_VF:=$HOME/deny-vf} 91 : ${FONTS_CONF_DENY_VF:=$HOME/deny-vf} 92 92 93 export XDG_CONFIG_HOME=${FONTS_CONF_DENY_VF} 93 export XDG_CONFIG_HOME=${FONTS_CONF_DENY_VF} 94 94 95 notocjkvffonts=`fc-list : file family variable 95 notocjkvffonts=`fc-list : file family variable | \ 96 grep 'variable=True' | \ 96 grep 'variable=True' | \ 97 grep -E -e 'Noto (Sans|Sans Mo 97 grep -E -e 'Noto (Sans|Sans Mono|Serif) CJK' | \ 98 sed -e 's/^/ /' -e 's/: Not 98 sed -e 's/^/ /' -e 's/: Noto S.*$//' | sort | uniq` 99 99 100 if [ "x$notocjkvffonts" != "x" ] ; then 100 if [ "x$notocjkvffonts" != "x" ] ; then 101 echo '================================ 101 echo '=============================================================================' 102 echo 'XeTeX is confused by "variable f 102 echo 'XeTeX is confused by "variable font" files listed below:' 103 echo "$notocjkvffonts" 103 echo "$notocjkvffonts" 104 echo 104 echo 105 echo 'For CJK pages in PDF, they need 105 echo 'For CJK pages in PDF, they need to be hidden from XeTeX by denylisting.' 106 echo 'Or, CJK pages can be skipped by 106 echo 'Or, CJK pages can be skipped by uninstalling texlive-xecjk.' 107 echo 107 echo 108 echo 'For more info on denylisting, ot 108 echo 'For more info on denylisting, other options, and variable font, see header' 109 echo 'comments of scripts/check-variab 109 echo 'comments of scripts/check-variable-fonts.sh.' 110 echo '================================ 110 echo '=============================================================================' 111 fi 111 fi 112 112 113 # As this script is invoked from Makefile's er 113 # As this script is invoked from Makefile's error path, always error exit 114 # regardless of whether any variable font is d 114 # regardless of whether any variable font is discovered or not. 115 exit 1 115 exit 1
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.