Open cont-lan opened 4 years ago
What do the logs say at the end about the location of the font file? It is always the same location?
@cont-lan Could you additionally upload:
after
and stix2math.lua
after running lualatex MWE
a second timels -l
output for the font file used for STIX2 Math (The path should be given at the end of the log or around line 44520 of stix2math.lua
.stix2math.lua
luaotfload-tool --list='familyname:Stix Two*' --fields=basename,fullpath
@u-fischer: I enclose the log file MWE.log.zip It mentions the .otf files, but I cannot find any mention of any of the cache files.
you are not using the stix math font in your MWE ;-(. Add an \int or so so that you can see in the log where the font is from. And add the files @zauguin asked for.
@u-fischer @zauguin We had a short local power outage :-( hence the delay.
Above I promised that I did not have any files from the fedora distibution. That turned out to be a lie, because the Fedora package stix-fonts
is in fact installed, and seems to insinuate itself into the lualatex processing. I suggest that we put this discussion on hold until I have understood more about why the Fedora package was installed, and how and why it mixes with the Texlive files.
@u-fischer @zauguin We had a short local power outage :-( hence the delay.
Above I promised that I did not have any files from the fedora distibution. That turned out to be a lie, because the Fedora package
stix-fonts
is in fact installed, and seems to insinuate itself into the lualatex processing. I suggest that we put this discussion on hold until I have understood more about why the Fedora package was installed, and how and why it mixes with the Texlive files.
I can't tell you why it is installed, but it is default behavior in luaotfload that in that case, the system font is preferred.
Even if you have these additional fonts installed, luotfload still shouldn't keep rewriting the cache. So it would be great if you could provide the information anyway.
@zauguin
@cont-lan Could you additionally upload:
* The diff you get between `after` and `stix2math.lua` after running `lualatex MWE` a second time
That was exactly the diff you got.
* `ls -l` output for the font file used for STIX2 Math (The path should be given at the end of the log or around line 44520 of `stix2math.lua`.
Here are the
ls -l
and the md5sum of both files.ls -l /usr/share/fonts/stix-fonts/STIX2Math.otf; md5sum /usr/share/fonts/stix-fonts/STIX2Math.otf -rw-r--r-- 1 root root 808220 2019-06-18 18:47 /usr/share/fonts/stix-fonts/STIX2Math.otf ec7220889178fdf32e3a2605c7b64209 /usr/share/fonts/stix-fonts/STIX2Math.otf ls -l /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Math.otf; md5sum /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Math.otf -rw-r--r-- 1 root root 808220 2019-05-03 00:48 /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Math.otf 2cdae3efd06ddad8e66bc743796bb3d3 /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Math.otf
The file mentioned in
stix2math.lua
is/usr/share/fonts...
. The md5sum show that they are obviously different, even if they have the same size.* complete copy of any version of `stix2math.lua`
* The output of `luaotfload-tool --list='familyname:Stix Two*' --fields=basename,fullpath`
luaotfload-tool --list='familyname:Stix Two*' --fields=basename,fullpath
stixtwomath STIX2Math.otf /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Math.otf stixtwotext STIX2Text-BoldItalic.otf /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Text-BoldItalic.otf stixtwotext STIX2Text-Regular.otf /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Text-Regular.otf stixtwotext STIX2Text-Italic.otf /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Text-Italic.otf stixtwotext STIX2Text-Bold.otf /opt/texlive/texmf-dist/fonts/opentype/public/stix2-otf/STIX2Text-Bold.otf stixtwotext STIX2Text-Regular.otf /usr/share/fonts/stix-fonts/STIX2Text-Regular.otf stixtwotext STIX2Text-BoldItalic.otf /usr/share/fonts/stix-fonts/STIX2Text-BoldItalic.otf stixtwotext STIX2Text-Bold.otf /usr/share/fonts/stix-fonts/STIX2Text-Bold.otf stixtwotext STIX2Text-Italic.otf /usr/share/fonts/stix-fonts/STIX2Text-Italic.otf stixtwomath STIX2Math.otf /usr/share/fonts/stix-fonts/STIX2Math.otf
The issue is that unicode-math tries to load the font both in regular and in bold. The regular font is loaded using the family lookup rules and therefore correctly selects the system font. For the bold font, the system detects that no bold version exists and therefore tries other ways of finding the font before falling back to the regular version. In this step, the rule "system font before texmf font" is not checked and the first found font is used, in this case the texmf one. Therefore the "bold" and the "regular" version are the same font, but oaded from different locations.
Given that both loctions have the same filename, the same cache file is used and both caches overwrite each other, triggering cache rewriting everytime the document is compiled. (The same issue probably caused #40) We can probably fix this by adding a lookup system similar to families for individual fonts.
@zauguin would it be possible/sensible to make the cache unique by location, e.g. by adding a hash of the path to the name?
@u-fischer Sensible? IMO yes. Possible? Not without patching the fontloader. The only cache we have which is not managed by the fontloader (the hb one for harf) already does this.
This issue started out as a question on TeX StackExchange (where my username is LeifLund):
https://tex.stackexchange.com/questions/560861/stix-two-math-keeps-rewriting-the-cache-with-lualatex
On the advice of Ulrike Fischer in comments I came here. The MWE I use has tiny changes compared to the one in StackExchange: MWE.tex.zip
The end of
ls -ltr
of the font cache:The file
before
is a copy ofstix2math.lua
. After runninglualatex MWE
we getwhere
after
is a new copy ofstix2math.lua
. The diff is diff.zipVersions of everything:
TeX 3.14159265 (TeX Live 2020)
I have made a separate installation of Texlive 2020, so no files come from the Fedora distribution.