texlive: fix texlive fonts for xetex#228196
Conversation
veprbl
left a comment
There was a problem hiding this comment.
Looks good. I don't see why it won't work on darwin.
|
After digging a bit more into it, I think that it should probably also work for darwin. TeXLive's binary distribution builds XeTeX with the font manager provided by Mac OS's native font framework (from It would be great if someone with access to a Mac (@xworld21?) could confirm. |
|
@apfelkuchen6 If you give me the steps, I have an aarch64-darwin system I can test on |
That would be great. |
LogsThe resulting PDF: |
|
Should we add a test for this? |
Bonus points if we have a generic |
xworld21
left a comment
There was a problem hiding this comment.
Cool! I tested this in a pure shell, and XeLaTeX works (Darwin x86-64). Great job. I find the hardcoded values in makeFontsConf slightly troubling, but if that's what Nixpkgs uses, then it's right to use it here as well.
However, always on Darwin, I am not able to use Lucida Grande. Probably because we are using fontconfig instead of the native solution, and we may have to improve on that. But this PR is only making things better, so let's start from here.
|
PS: nixpkgs/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl Lines 42 to 44 in 6b843da this is probably where /System/Library/Fonts, /Library/Fonts, ~/Library/Fonts should be added, guarded with an XSLT parameter so that they are used on Darwin only (list of folders taken from Homebrew's fontconfig).
|
This is neccessary for XeTeX to find the fonts distributed with TeXLive. The fontconfig file generated by makeFontsConf is almost identical to the one from the fontconfig package and /etc/fonts/fonts.conf on NixOS -- it only adds the specified font directories. In particular this means that all the actual configuration files in /etc/fonts/conf.d are still included and there also is a /usr/share/fonts font directory entry for use with non-NixOS linuxes, so it's unlikely that this breaks someone's setup.
This is for example useful for ncluding the texlive font directory in the `fonts.fonts` NixOS option.
a316160 to
f264447
Compare
I really like this idea, but not in this PR :). I have piggy-backed a simple test onto the similar luaotfload-test for now. |
|
@GrahamcOfBorg build tests.texlive |
Description of changes
XeTeX relies on the system's font managent tooling to locate fonts. This means that XeTeX was unable to find the fonts distributed with texlive as these weren't installed in paths searched by the system's font configuration.
This PR fixes this
for linuxby wrapping xetex such that theFONTCONFIG_FILEenvironment value is set to a suitable fontconfig file generated bymakeFontsConf. This file is almost identical to the one from the fontconfig package and/etc/fonts/fonts.confon NixOS -- it only adds the texlive font directories. In particular this means that all the actualconfiguration files in /
etc/fonts/conf.dare still included and there also is a/usr/share/fontsfont directory entry for use with non-NixOS linuxes, so it's unlikely that this breaks someone's setup.Darwin remains broken since XeTeX doesn't use fontconfig there.This also exposes texlive's font directory as a passthru-attribute, which makes adding texlive's fonts to the
fonts.fonts.nixos-option (or symlinking the directory to~/Library/fontson MacOS with home-manager) a lot easier.As the wrapper uses
--set-default, devShells can easily override the font directories to add more fonts. For example in the shellthe document
compiles with both
lualatexandxelatex. (It's a bit unfortunate that luaotfload hardcodes the fontconfig location to/etc/fonts/fonts.confand/usr/local/etc/fonts/fonts.conf, so a separate environment variable has to be used, but at least it works).Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)