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

texlive: fix texlive fonts for xetex
This commit is contained in:
Dmitry Kalinkin 2023-04-26 20:46:46 -04:00 committed by GitHub
commit af4cf4d6ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 9 deletions

View file

@ -11,11 +11,11 @@
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}
@ -26,7 +26,13 @@
}
''
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
'';

View file

@ -82,8 +82,12 @@ in (buildEnv {
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}"
@ -196,7 +200,11 @@ in (buildEnv {
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
@ -311,5 +319,3 @@ in (buildEnv {
''
;
}).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?

View file

@ -5,7 +5,7 @@
{ stdenv, lib, fetchurl, runCommand, writeText, buildEnv
, callPackage, ghostscript_headless, harfbuzz
, makeWrapper, python3, ruby, perl, gnused, gnugrep, coreutils
, libfaketime
, libfaketime, makeFontsConf
, useFixedHashes ? true
, recurseIntoAttrs
}:
@ -24,7 +24,7 @@ let
# 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;
};