luaotfload icon indicating copy to clipboard operation
luaotfload copied to clipboard

`luaotfload-tool --find` fails due to missing functionality in `luaonly` mode

Open wangweixuan opened this issue 1 year ago • 4 comments

Currently the command-line tool luaotfload-tool --find is not working:

...4/texmf-dist/tex/luatex/luaotfload/luaotfload-arabic.lua:19: attempt to index a nil value (global 'node')

It works if I comment out this line (introduced in 79e909f): https://github.com/latex3/luaotfload/blob/72561365e3de47c138418af7d11ab335683ff7f0/src/luaotfload-features.lua#L893

The required module relies on the node table. However,luaotfload-tool runs in luaonly mode. That mode has limited functionality (from LuaTeX manual):

[...] the tables that deal with typesetting, like tex, token, node and pdf, are off-limits during the execution of the startup file (they are nil’d).

wangweixuan avatar Mar 19 '24 16:03 wangweixuan

Resolved in dev with 12521e87463d78e2cbf0bd94a09381bf97ee29be.

zauguin avatar Apr 06 '24 09:04 zauguin

I applied this patch to the directory: kpsewhich luaotfload.sty and after luaotfload-tool --update --force, the tool is fixed:

$ luaotfload-tool --find="ScheherazadeNew"
luaotfload | resolve : Font "ScheherazadeNew" found!
luaotfload | resolve : Resolved file name "/usr/share/fonts/TTF/ScheherazadeNew-Regular.ttf"

However,

$ cat mwe.tex
\documentclass[mla8]{mla}
\usepackage{fontspec}
\setmainfont{FreeSerif}
\setmainfont[Script=Arabic]{ScheherazadeNew}

\begin{document}

\begin{paper}
        Testing
        تجربة
\end{paper}
\end{document}

and

$ lualatex mwe.tex
This is LuaHBTeX, Version 1.18.0 (TeX Live 2024/Arch Linux)
 restricted system commands enabled.
(./mwe.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-02-20>
 (/usr/share/texmf-dist/tex/latex/mlacls/mla.cls
Document Class: mla 2021/09/14 v1.0 MLA Paper Class
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size12.clo))
...
(/usr/share/texmf-dist/tex/latex/enumitem/enumitem.sty)
(/usr/share/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty)))

Package hyperref Warning: Option `pdfusetitle' has already been used,
(hyperref)                setting the option has no effect on input line 113.

)
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: File not found: "ScheherazadeNew.otf".

! Package fontspec Error: The font "ScheherazadeNew" cannot be found.

For immediate help type H <return>.
 ...

For some reason, luaotfload-tool works, but not lualatex.

Edit: this issue doesn't happen with article documentclass but it happens with mla.cls. I filed a package bug here.

avidseeker avatar Jul 09 '24 01:07 avidseeker

Note: this isn't related to Arabic. Same problem for other fonts: luaotfload-tool --find="Noto Color Emoji". And for some reason, it complains about the .otfversion of the file despite explicitly setting the extension to.ttf`:

\fontspec{NotoColorEmoji}[
	Extension=.ttf,
	Path=/usr/share/texmf-dist/fonts/truetype/google/noto-emoji/,
	RawFeature={mode=harf}]
\setmainfont{NotoColorEmoji}
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: File not found: "NotoColorEmoji.otf".

Curious.. I thought there is no need for luaotfload since I specified an absolute path as per the instructions of the manual for fontspec.

avidseeker avatar Jul 20 '24 05:07 avidseeker

This is completely unrelated to the problem described here. Please create a separate issue.

zauguin avatar Jul 20 '24 07:07 zauguin