reutenauer / polyglossia

An alternative to Babel for XeLaTeX and LuaLaTeX
http://www.ctan.org/pkg/polyglossia
MIT License
190 stars 51 forks source link

Document fails to compile when polyglossia was loaded #480

Closed sayahna closed 3 years ago

sayahna commented 3 years ago

A minimum working example, test.tex, is available in the attached archive, polyglossia-mwe.zip. It is written in Malayalam, my native tongue. The font used is also attached.

When polyglossia is loaded, it creates an error during compilation with lualatex-dev 2021 pretest version. A snippet of the log is given below:

warning  (node filter): error: ...exmf-dist/tex/luatex/luaotfload/luaotfload-ha
rf-plug.lua:455: attempt to perform arithmetic on a nil value (field 'nextclust
er')
.
<argument> ...type:D \tex_kern:D \c_zero_dim \fi: \tex_par:D 
                                                  \hook_use:n {para/after}\@...

polyglossia-mwe.zip

Without the package, the document generates the correct output. With xelatex, the documents runs okay with and without polyglossia.

jspitz commented 3 years ago

Does it work if you pass the option luatexrenderer=none to polyglossia? If so, this is probably a harfbuzz renderer bug which should be reported at https://github.com/latex3/luaotfload/issues

sayahna commented 3 years ago

Sorry, the problem still persists even after passing the option that you had told. I am also tempted to believe that it has something to do with the Harfbuzz renderer, because the shaping of the glyphs has been completely jeopardised. You can make a comparison between the test-with-polyglossia.pdf and test-without-polyglossia.pdf, the later being the correct output.

It works with polyglossia when xelatex-dev is invoked, correct output is generated.

I shall post the bug at luaoffload project once the influence of polyglossia is ruled out.

sayahna commented 3 years ago

On 19-Mar-2021, at 2:10 PM, Jürgen Spitzmüller @.***> wrote:

Does it work if you pass the option luatexrenderer=none to polyglossia? If so, this is probably a harfbuzz renderer bug which should be reported at https://github.com/latex3/luaotfload/issues https://github.com/latex3/luaotfload/issues Sorry, the problem still persists even after passing the option that you had told. I am also tempted to believe that it has something to do with the Harfbuzz renderer, because the shaping of the glyphs has been completely jeopardised. You can make a comparison between the test-with-polyglossia.pdf and test-without-polyglossia.pdf, the later being the correct output.

It works with polyglossia when xelatex-dev is invoked.

I shall post the bug at luaoffload project once the influence of polyglossia is ruled out.

Warm regards

Radhakrishnan

jspitz commented 3 years ago

OK. I tested with stable lualatex in recent TL 2020, and the document compiles. Does it compile with lualatex (as opposed to lualatex-dev) in TL 21 pretest? In any case it seems something has changed in lualatex, and either it is a bug on the lualatex side or there is a change that requires adaptation on polyglossia side. Do they now use Harfbuzz renderer by default?

jspitz commented 3 years ago

I can reproduce with lualatex-dev on TL20 as well. Note that it is fixed if the renderer is set to something else in the \newfontfamily declaration:

\makeatletter
\@ifpackageloaded{polyglossia}
 {\setdefaultlanguage{malayalam}
  \newfontfamily\malayalamfont[Script=Malayalam,
    Ligatures=TeX]{RIT Rachana}[Renderer=Node]}% <---- HERE
 {\setmainfont[Script=Malayalam,Ligatures=TeX]{RIT Rachana}[Renderer=Harfbuzz]}
\makeatother
jspitz commented 3 years ago

The error message is reminiscent of https://github.com/latex3/luaotfload/issues/179

Since this has just been fixed some days ago, this might just be the bug.

sayahna commented 3 years ago

The output with Renderer=Node option, is wrong. The glyph shaping is not correct. My language needs Harfbuzz, without which the output is of no use.

sayahna commented 3 years ago

If the bug is fixed a few days ago, I presume that it has not been in the newest pretest releases. I have a pretest local installation, updated in the morning and tested test.tex. I do it everyday. Since it is failing for so many days, I thought of reporting here first.

jspitz commented 3 years ago

I just tested: https://github.com/latex3/luaotfload/commit/97a89d691db2a7ee0ead56eafa517f74d6a5dea2 fixes compilation of your document with lualatex-dev for me, so this is https://github.com/latex3/luaotfload/issues/179

sayahna commented 3 years ago

Okay, that is a good news. I will try and let you know. Thanks a lot for the help.

sayahna commented 3 years ago

Has not reached TL 2021 pretest yet. Will wait.

sayahna commented 3 years ago

I tested with the version in the dev branch. It works okay and the output is perfect. Many thanks for your quick help.

jspitz commented 3 years ago

Thanks for the very good report!