new file mode 100644
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
+<!-- This is a copy of the /etc/fonts/fonts.conf file to configure system font access -->
+<!-- Modified to include the texlive fonts -->
+<fontconfig>
+ <description>Fonts configuration file</description>
+
+<!-- Font directory list -->
+
+ <dir>/usr/share/fonts</dir>
+ <dir>/usr/local/share/fonts</dir>
+ <dir prefix="xdg">fonts</dir>
+
+ <!-- Custom directory with texlive fonts -->
+ <dir>/texlive/texmf-dist/fonts</dir>
+
+<!--
+ Accept deprecated 'mono' alias, replacing it with 'monospace'
+-->
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>mono</string>
+ </test>
+ <edit name="family" mode="assign" binding="same">
+ <string>monospace</string>
+ </edit>
+ </match>
+
+<!--
+ Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
+-->
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>sans serif</string>
+ </test>
+ <edit name="family" mode="assign" binding="same">
+ <string>sans-serif</string>
+ </edit>
+ </match>
+
+<!--
+ Accept deprecated 'sans' alias, replacing it with 'sans-serif'
+-->
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>sans</string>
+ </test>
+ <edit name="family" mode="assign" binding="same">
+ <string>sans-serif</string>
+ </edit>
+ </match>
+<!--
+ Accept alternate 'system ui' spelling, replacing it with 'system-ui'
+-->
+ <match target="pattern">
+ <test qual="any" name="family">
+ <string>system ui</string>
+ </test>
+ <edit name="family" mode="assign" binding="same">
+ <string>system-ui</string>
+ </edit>
+ </match>
+
+<!--
+ Ignore dpkg temporary files created in fonts directories
+-->
+ <selectfont>
+ <rejectfont>
+ <glob>*.dpkg-tmp</glob>
+ </rejectfont>
+ </selectfont>
+ <selectfont>
+ <rejectfont>
+ <glob>*.dpkg-new</glob>
+ </rejectfont>
+ </selectfont>
+
+<!--
+ Load local system customization file
+-->
+ <include ignore_missing="yes">conf.d</include>
+
+<!-- Font cache directory list -->
+
+ <cachedir>/var/cache/fontconfig</cachedir>
+ <cachedir prefix="xdg">fontconfig</cachedir>
+ <!-- the following element will be removed in the future -->
+ <cachedir>~/.fontconfig</cachedir>
+
+ <config>
+<!--
+ Rescan configuration every 30 seconds when FcFontSetList is called
+ -->
+ <rescan>
+ <int>30</int>
+ </rescan>
+ </config>
+
+</fontconfig>
+
@@ -71,12 +71,18 @@ if [ -e /srv/autobuilder/valkyrie.yocto.io/ ]; then
zcat < install-tl-unx.tar.gz | tar xf -
cd install-tl-*/
./install-tl --scheme=small --texdir=${textooldir} --no-interaction
- PATH=$PATH:${textooldir}/bin/x86_64-linux tlmgr install titlesec varwidth tabulary needspace upquote framed capt-of wrapfig fncychap gnu-freefont ctex latexmk
+ PATH=$PATH:${textooldir}/bin/x86_64-linux tlmgr install titlesec varwidth tabulary needspace upquote framed capt-of wrapfig fncychap gnu-freefont ctex latexmk nimbus15
popd
fi
PATH=$PATH:${textooldir}/bin/x86_64-linux
fi
+# Provide our own fonts.conf path to make fonts installed with tlmgr available
+# system-wide. It will pick up the fonts.conf file in this directory.
+# This is then used by rsvg-convert to pick up the Nimbus font when converting
+# files.
+export FONTCONFIG_PATH="$scriptdir/docsfontconfig"
+
# Getting the old docbook built docs from an archive. Not rebuilding them.
docbookarchive_localpath=${sharedir}/cluster-downloads-cache/`basename ${docbookarchive_url}`
if [ ! -e ${docbookarchive_localpath} ]; then
rsvg-convert, which we use to convert SVG images to PDFs/PNGs, would always print out the following error: Fontconfig error: Cannot load default config file: No such file: (null) As a result some SVGs are oddly rendered because it doesn't find the correct fonts. This can be easily fixed by setting and exporting the FONTCONFIG_PATH variable which must point to a directory containing a fonts.conf file. Since we build on multiple distros, we may not always find this file in /etc/fonts (installed there by default on many distros). Additionally, we can also install custom fonts using tlmgr and use them thanks to that file. Add a custom fonts.conf that adds /texlive/texmf-dist/fonts to the list of directories to look for fonts. This files is just based on the original fonts.conf. Also add the nimbus15 package to the list of tlmgr installed packages so that we make sure we always use the same font for rendering images (assuming the SVG files use the "Nimbus Sans L" font). Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- Test build: https://autobuilder.yoctoproject.org/valkyrie/#/builders/34/builds/143 Note: Nimbus is the recommended font for docs images. --- scripts/docsfontconfig/fonts.conf | 100 ++++++++++++++++++++++++++++++++++++++ scripts/run-docs-build | 8 ++- 2 files changed, 107 insertions(+), 1 deletion(-) --- base-commit: abae49b0f62f6f2083dbb057a3b8ab947e14e1c5 change-id: 20250220-doc-fontsconfig-4f54a9a12ad5 Best regards,