Merge pull request #228196 from apfelkuchen6/texlive-xetex-fonts

texlive: fix texlive fonts for xetex

Changed files
+21 -9
pkgs
test
texlive
tools
typesetting
tex
+8 -2
pkgs/test/texlive/default.nix
···
diff -u "''${nixpkgsTlpdbNix}" "''${tlpdbNix}" | tee "$out/tlpdb.nix.patch"
'';
-
luaotfload-fonts = runCommand "texlive-test-lualatex" {
+
opentype-fonts = runCommand "texlive-test-opentype" {
nativeBuildInputs = [
(with texlive; combine { inherit scheme-medium libertinus-fonts; })
];
-
input = builtins.toFile "lualatex-testfile.tex" ''
+
input = builtins.toFile "opentype-testfile.tex" ''
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Serif}
···
}
''
export HOME="$(mktemp -d)"
+
# We use the same testfile to test two completely different
+
# font discovery mechanisms, both of which were once broken:
+
# - lualatex uses its own luaotfload script (#220228)
+
# - xelatex uses fontconfig (#228196)
+
# both of the following two commands need to succeed.
lualatex -halt-on-error "$input"
+
xelatex -halt-on-error "$input"
echo success > $out
'';
+11 -5
pkgs/tools/typesetting/tex/texlive/combine.nix
···
nativeBuildInputs = [ makeWrapper libfaketime perl bin.texlinks ];
buildInputs = pkgList.extraInputs;
-
# This is set primarily to help find-tarballs.nix to do its job
-
passthru.packages = pkgList.all;
+
passthru = {
+
# This is set primarily to help find-tarballs.nix to do its job
+
packages = pkgList.all;
+
# useful for inclusion in the `fonts.fonts` nixos option or for use in devshells
+
fonts = "${texmfroot}/texmf-dist/fonts";
+
};
postBuild = ''
TEXMFROOT="${texmfroot}"
···
makeWrapper "$target" "$link" \
--prefix PATH : "${gnused}/bin:${gnugrep}/bin:${coreutils}/bin:$out/bin:${perl}/bin" \
--prefix PERL5LIB : "$PERL5LIB" \
-
--set-default TEXMFCNF "$TEXMFCNF"
+
--set-default TEXMFCNF "$TEXMFCNF" \
+
--set-default FONTCONFIG_FILE "${
+
# neccessary for XeTeX to find the fonts distributed with texlive
+
makeFontsConf { fontDirectories = [ "${texmfroot}/texmf-dist/fonts" ]; }
+
}"
# avoid using non-nix shebang in $target by calling interpreter
if [[ "$(head -c 2 "$target")" = "#!" ]]; then
···
''
;
}).overrideAttrs (_: { allowSubstitutes = true; })
-
# TODO: make TeX fonts visible by fontconfig: it should be enough to install an appropriate file
-
# similarly, deal with xe(la)tex font visibility?
+2 -2
pkgs/tools/typesetting/tex/texlive/default.nix
···
{ stdenv, lib, fetchurl, runCommand, writeText, buildEnv
, callPackage, ghostscript_headless, harfbuzz
, makeWrapper, python3, ruby, perl, gnused, gnugrep, coreutils
-
, libfaketime
+
, libfaketime, makeFontsConf
, useFixedHashes ? true
, recurseIntoAttrs
}:
···
# function for creating a working environment from a set of TL packages
combine = import ./combine.nix {
inherit bin combinePkgs buildEnv lib makeWrapper writeText
-
stdenv python3 ruby perl gnused gnugrep coreutils libfaketime;
+
stdenv python3 ruby perl gnused gnugrep coreutils libfaketime makeFontsConf;
ghostscript = ghostscript_headless;
};